From d0fb2d77c9070d7a55551f13d9cbd83d61a819e0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 13 三月 2024 16:09:50 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx b/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
index 1820264..20cf43f 100644
--- a/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
@@ -14,8 +14,10 @@
     const { styles } = useStyles();
     const { curSprite } = props;
     const [form] = Form.useForm();
+    const [autoIncrement, setAutoIncrement] = useState(false);
 
     useEffect(() => {
+        setAutoIncrement(false);
         form.resetFields();
         if (curSprite && props) {
             form.setFieldsValue({
@@ -33,12 +35,12 @@
     }
 
     const handleFinish = (values) => {
-        console.log(values); return
-        props.submit({ ...values, ...props.values })
-    }
-
-    const formValuesChange = (value) => {
-        console.log(value);
+        props.submit({
+            ...values
+            , ...props.values
+            , autoIncrement: autoIncrement
+            , type: curSprite?.data?.type
+        })
     }
 
     return (
@@ -64,7 +66,6 @@
             >
                 <Form
                     form={form}
-                    onFieldsChange={formValuesChange}
                     initialValues={{
                         copyGap: 0,
                         autoIncrement: false,
@@ -117,17 +118,17 @@
                             </Form.Item>
                         </Col>
 
+                        {/* switch auto increment  */}
                         <Col span={24}>
                             <Form.Item
-                                name='autoIncrement'
                                 label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.auto-increment', defaultMessage: '鑷闀�' })}
                                 labelCol={{ span: 8 }}
                             >
-                                <Switch />
+                                <Switch value={autoIncrement} onChange={setAutoIncrement} />
                             </Form.Item>
                         </Col>
 
-                        {form.getFieldValue('autoIncrement') === true && curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
                             <>
                                 <Col span={24}>
                                     <Form.Item
@@ -146,7 +147,7 @@
                             </>
                         )}
 
-                        {form.getFieldValue('autoIncrement') === true && curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
                             <>
                                 <Col span={24}>
                                     <Form.Item
@@ -182,11 +183,11 @@
                                             options={[
                                                 {
                                                     label: intl.formatMessage({ id: 'map.settings.sub.copy.ascend', defaultMessage: '鍗囧簭' }),
-                                                    value: 'Ascending'
+                                                    value: 'ascending'
                                                 },
                                                 {
                                                     label: intl.formatMessage({ id: 'map.settings.sub.copy.descend', defaultMessage: '闄嶅簭' }),
-                                                    value: 'Descending'
+                                                    value: 'descending'
                                                 },
                                             ]}
                                             onChange={(value) => {

--
Gitblit v1.9.1