From 7920b91c683f21b1dc9c341e35f3120d8f1114ae Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 25 三月 2024 10:51:49 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/batch/index.jsx  |  210 -------------------------
 zy-asrs-flow/src/pages/map/batch/modify.jsx |  230 ++++++++++++++++++++++++++++
 zy-asrs-flow/src/pages/map/index.jsx        |    2 
 3 files changed, 237 insertions(+), 205 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/batch/index.jsx b/zy-asrs-flow/src/pages/map/batch/index.jsx
index 9b154bd..b49ae89 100644
--- a/zy-asrs-flow/src/pages/map/batch/index.jsx
+++ b/zy-asrs-flow/src/pages/map/batch/index.jsx
@@ -1,54 +1,22 @@
 import React, { useState, useRef, useEffect } from 'react';
-import { Drawer, Space, Button, Card, Select, InputNumber, Input, Result, Form } from 'antd';
-import {
-    ProCard,
-    ProForm,
-    ProFormCheckbox,
-    ProFormDatePicker,
-    ProFormDateRangePicker,
-    ProFormSelect,
-    ProFormText,
-    ProFormTextArea,
-    StepsForm,
-} from '@ant-design/pro-components';
+import { Drawer, Space, Button, Card} from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
 import { createStyles } from 'antd-style';
 import * as Utils from '../utils'
 import ShowJson from '../drawer/showJson';
+import BatchModify from './modify';
 
 const useStyles = createStyles(({ token, css }) => {
     return {
     }
 })
 
-const waitTime = (time = 100) => {
-    return new Promise((resolve) => {
-        setTimeout(() => {
-            resolve(true);
-        }, time);
-    });
-};
-
 const BatchDrawer = (props) => {
     const intl = useIntl();
     const { styles } = useStyles();
-    const { batchSprites } = props;
-    const [form] = Form.useForm();
-    const [currentStep, setCurrentStep] = useState(0);
-
-    const resetForm = () => {
-        form.resetFields();
-        setCurrentStep(0);
-    };
 
     useEffect(() => {
-        console.log(batchSprites);
-        resetForm();
     }, [props]);
-
-    useEffect(() => {
-        console.log(currentStep);
-    }, [currentStep]);
 
     const handleCancel = () => {
         props.onCancel();
@@ -84,176 +52,10 @@
                         height: '100%'
                     }}
                 >
-                    <StepsForm
-                        form={form}
-                        current={currentStep}
-                        onCurrentChange={setCurrentStep}
-                        onFinish={async () => {
-                            await waitTime(1000);
-                            message.success('鎻愪氦鎴愬姛');
-                        }}
-                        formProps={{
-                            variant: 'filled',
-                            layout: 'horizontal',
-                            labelCol: {
-                                span: 4,
-                            },
-                            wrapperCol: {
-                                span: 20,
-                            },
-                            labelWrap: true
-                        }}
-                        submitter={{
-                            render: (props, dom) => {
-                                return props.step === 2 ? [] : dom;
-                            },
-                        }}
-                    >
-                        {/************************* first ****************************/}
-                        <StepsForm.StepForm
-                            name="base"
-                            title={intl.formatMessage({ id: 'map.settings.batch.select.shelf', defaultMessage: '閫夋嫨璐ф灦' })}
-                            onFinish={() => {
-                                return true;
-                            }}
-                        >
-                            <ProForm.Item
-                            >
-                                <ShowJson
-                                    data={
-                                        batchSprites?.filter(item => {
-                                            return item.data?.type === Utils.SENSOR_TYPE.SHELF
-                                        }).map(item => {
-                                            return item.data?.no;
-                                        })
-                                    }
-                                    height='500px'
-                                    jsonType={0}
-                                />
-                            </ProForm.Item>
-                        </StepsForm.StepForm>
-                        {/************************* second ****************************/}
-                        <StepsForm.StepForm
-                            name="checkbox"
-                            title={intl.formatMessage({ id: 'map.settings.batch.set.params', defaultMessage: '璁剧疆鍙傛暟' })}
-                            onFinish={(values) => {
-                                console.log(values);
-                                return true;
-                            }}
-                        >
-                            <ProForm.Item
-                                name='shelfType'
-                                label={intl.formatMessage({ id: 'map.settings.shelf.type', defaultMessage: '绫诲瀷' })}
-                                rules={[
-                                    {
-                                        required: true,
-                                    },
-                                ]}
-                            >
-                                <Select
-                                    style={{ width: 120 }}
-                                    options={[
-                                        {
-                                            label: intl.formatMessage({ id: 'map.settings.shelf.store', defaultMessage: '搴撲綅' }),
-                                            value: 0
-                                        },
-                                        {
-                                            label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '杞ㄩ亾' }),
-                                            value: 3
-                                        },
-                                        {
-                                            label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '绂佺敤' }),
-                                            value: 1
-                                        },
-                                    ]}
-                                    defaultValue={0}
-                                />
-                            </ProForm.Item>
-                            <ProForm.Item
-                                label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })}
-                            >
-                                <Space.Compact>
-                                    <ProForm.Item
-                                        name='top'
-                                        noStyle
-                                    >
-                                        <InputNumber
-                                            addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.top' defaultMessage='涓�' /></Space.Compact>}
-                                            style={{
-                                                width: '50%',
-                                            }}
-                                        />
-                                    </ProForm.Item>
-                                    <ProForm.Item
-                                        name='bottom'
-                                        noStyle
-                                    >
-                                        <InputNumber
-                                            addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.bottom' defaultMessage='涓�' /></Space.Compact>}
-                                            style={{
-                                                width: '50%',
-                                            }}
-                                        />
-                                    </ProForm.Item>
-                                </Space.Compact>
-                            </ProForm.Item>
-                            <ProForm.Item
-                                label={' '}
-                            >
-                                <Space.Compact>
-                                    <ProForm.Item
-                                        name='left'
-                                        noStyle
-                                    >
-                                        <InputNumber
-                                            addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.left' defaultMessage='宸�' /></Space.Compact>}
-                                            style={{
-                                                width: '50%',
-                                            }}
-                                        />
-                                    </ProForm.Item>
-                                    <ProForm.Item
-                                        name='right'
-                                        noStyle
-                                    >
-                                        <InputNumber
-                                            addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.right' defaultMessage='鍙�' /></Space.Compact>}
-                                            style={{
-                                                width: '50%',
-                                            }}
-                                        />
-                                    </ProForm.Item>
-                                </Space.Compact>
-                            </ProForm.Item>
-                            <ProForm.Item
-                                name='value'
-                                label={intl.formatMessage({ id: 'map.settings.shelf.value', defaultMessage: '鍦板浘鍊�' })}
-                            >
-                                <Input
-                                    style={{
-                                        width: '50%',
-                                    }}
-                                />
-                            </ProForm.Item>
-                        </StepsForm.StepForm>
-                        {/************************* third ****************************/}
-                        <StepsForm.StepForm
-                            name="time"
-                            title={intl.formatMessage({ id: 'map.settings.batch.result', defaultMessage: '缁撴灉' })}
-                            submitter={false}
-                        >
-                            <Result
-                                status="success"
-                                title={intl.formatMessage({ id: 'map.settings.batch.result.title', defaultMessage: '鎵归噺璁剧疆鎴愬姛' })}
-                                subTitle=""
-                                extra={[
-                                    <Button type="primary" key="console" onClick={handleCancel}>
-                                        <FormattedMessage id='common.confirm' defaultMessage='纭畾' />
-                                    </Button>,
-                                ]}
-                            />
-                        </StepsForm.StepForm>
-                    </StepsForm >
+                    <BatchModify
+                        batchSprites={props.batchSprites}
+                        handleCancel={handleCancel}
+                    />
                 </Card >
             </Drawer >
         </>
diff --git a/zy-asrs-flow/src/pages/map/batch/modify.jsx b/zy-asrs-flow/src/pages/map/batch/modify.jsx
new file mode 100644
index 0000000..6c0872e
--- /dev/null
+++ b/zy-asrs-flow/src/pages/map/batch/modify.jsx
@@ -0,0 +1,230 @@
+import React, { useState, useRef, useEffect } from 'react';
+import { Drawer, Space, Button, Card, Select, InputNumber, Input, Result, Form } from 'antd';
+import {
+    ProCard,
+    ProForm,
+    ProFormCheckbox,
+    ProFormDatePicker,
+    ProFormDateRangePicker,
+    ProFormSelect,
+    ProFormText,
+    ProFormTextArea,
+    StepsForm,
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl, useModel } from '@umijs/max';
+import { createStyles } from 'antd-style';
+import * as Utils from '../utils'
+import ShowJson from '../drawer/showJson';
+
+const waitTime = (time = 100) => {
+    return new Promise((resolve) => {
+        setTimeout(() => {
+            resolve(true);
+        }, time);
+    });
+};
+
+const useStyles = createStyles(({ token, css }) => {
+    return {
+    }
+})
+
+const BatchModify = (props) => {
+    const intl = useIntl();
+    const { styles } = useStyles();
+    const { batchSprites } = props;
+
+    const [form] = Form.useForm();
+    const [currentStep, setCurrentStep] = useState(0);
+
+    const resetForm = () => {
+        form.resetFields();
+        setCurrentStep(0);
+    };
+
+    useEffect(() => {
+        console.log(batchSprites);
+        resetForm();
+    }, [props]);
+
+    useEffect(() => {
+        console.log(currentStep);
+    }, [currentStep]);
+
+    return (
+        <>
+            <StepsForm
+                form={form}
+                current={currentStep}
+                onCurrentChange={setCurrentStep}
+                onFinish={async () => {
+                    await waitTime(1000);
+                    message.success('鎻愪氦鎴愬姛');
+                }}
+                formProps={{
+                    variant: 'filled',
+                    layout: 'horizontal',
+                    labelCol: {
+                        span: 4,
+                    },
+                    wrapperCol: {
+                        span: 20,
+                    },
+                    labelWrap: true
+                }}
+                submitter={{
+                    render: (props, dom) => {
+                        return props.step === 2 ? [] : dom;
+                    },
+                }}
+            >
+                {/************************* first ****************************/}
+                <StepsForm.StepForm
+                    name="base"
+                    title={intl.formatMessage({ id: 'map.settings.batch.select.shelf', defaultMessage: '閫夋嫨璐ф灦' })}
+                    onFinish={() => {
+                        return true;
+                    }}
+                >
+                    <ProForm.Item
+                    >
+                        <ShowJson
+                            data={
+                                batchSprites?.filter(item => {
+                                    return item.data?.type === Utils.SENSOR_TYPE.SHELF
+                                }).map(item => {
+                                    return item.data?.no;
+                                })
+                            }
+                            height='500px'
+                            jsonType={0}
+                        />
+                    </ProForm.Item>
+                </StepsForm.StepForm>
+                {/************************* second ****************************/}
+                <StepsForm.StepForm
+                    name="checkbox"
+                    title={intl.formatMessage({ id: 'map.settings.batch.set.params', defaultMessage: '璁剧疆鍙傛暟' })}
+                    onFinish={(values) => {
+                        console.log(values);
+                        return true;
+                    }}
+                >
+                    <ProForm.Item
+                        name='shelfType'
+                        label={intl.formatMessage({ id: 'map.settings.shelf.type', defaultMessage: '绫诲瀷' })}
+                        rules={[
+                            {
+                                required: true,
+                            },
+                        ]}
+                    >
+                        <Select
+                            style={{ width: 120 }}
+                            options={[
+                                {
+                                    label: intl.formatMessage({ id: 'map.settings.shelf.store', defaultMessage: '搴撲綅' }),
+                                    value: 0
+                                },
+                                {
+                                    label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '杞ㄩ亾' }),
+                                    value: 3
+                                },
+                                {
+                                    label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '绂佺敤' }),
+                                    value: 1
+                                },
+                            ]}
+                            defaultValue={0}
+                        />
+                    </ProForm.Item>
+                    <ProForm.Item
+                        label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })}
+                    >
+                        <Space.Compact>
+                            <ProForm.Item
+                                name='top'
+                                noStyle
+                            >
+                                <InputNumber
+                                    addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.top' defaultMessage='涓�' /></Space.Compact>}
+                                    style={{
+                                        width: '50%',
+                                    }}
+                                />
+                            </ProForm.Item>
+                            <ProForm.Item
+                                name='bottom'
+                                noStyle
+                            >
+                                <InputNumber
+                                    addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.bottom' defaultMessage='涓�' /></Space.Compact>}
+                                    style={{
+                                        width: '50%',
+                                    }}
+                                />
+                            </ProForm.Item>
+                        </Space.Compact>
+                    </ProForm.Item>
+                    <ProForm.Item
+                        label={' '}
+                    >
+                        <Space.Compact>
+                            <ProForm.Item
+                                name='left'
+                                noStyle
+                            >
+                                <InputNumber
+                                    addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.left' defaultMessage='宸�' /></Space.Compact>}
+                                    style={{
+                                        width: '50%',
+                                    }}
+                                />
+                            </ProForm.Item>
+                            <ProForm.Item
+                                name='right'
+                                noStyle
+                            >
+                                <InputNumber
+                                    addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.right' defaultMessage='鍙�' /></Space.Compact>}
+                                    style={{
+                                        width: '50%',
+                                    }}
+                                />
+                            </ProForm.Item>
+                        </Space.Compact>
+                    </ProForm.Item>
+                    <ProForm.Item
+                        name='value'
+                        label={intl.formatMessage({ id: 'map.settings.shelf.value', defaultMessage: '鍦板浘鍊�' })}
+                    >
+                        <Input
+                            style={{
+                                width: '50%',
+                            }}
+                        />
+                    </ProForm.Item>
+                </StepsForm.StepForm>
+                {/************************* third ****************************/}
+                <StepsForm.StepForm
+                    name="time"
+                    title={intl.formatMessage({ id: 'map.settings.batch.result', defaultMessage: '缁撴灉' })}
+                    submitter={false}
+                >
+                    <Result
+                        status="success"
+                        title={intl.formatMessage({ id: 'map.settings.batch.result.title', defaultMessage: '鎵归噺璁剧疆鎴愬姛' })}
+                        subTitle=""
+                        extra={[
+                            <Button type="primary" key="console" onClick={props.handleCancel}>
+                                <FormattedMessage id='common.confirm' defaultMessage='纭畾' />
+                            </Button>,
+                        ]}
+                    />
+                </StepsForm.StepForm>
+            </StepsForm >
+        </>
+    )
+}
+
+export default BatchModify;
\ No newline at end of file
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index cc7aee8..891d9e2 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -434,7 +434,7 @@
                 batchSprites={batchSprites}
                 refCurr={mapRef.current}
                 onCancel={() => {
-                    setBatchSprites(null);
+                    setBatchSprites([]);
                     setBatchDrawerVisible(false);
                 }}
             />

--
Gitblit v1.9.1