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 |   43 ++++++++++++++++++++++++++++++-------------
 1 files changed, 30 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 c51b37c..20cf43f 100644
--- a/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
@@ -1,5 +1,5 @@
 import React, { useState, useRef, useEffect } from 'react';
-import { Col, Form, Input, Row, Checkbox, Slider, Select, Drawer, Space, Button, InputNumber, Segmented } from 'antd';
+import { Col, Form, Input, Row, Switch, Slider, Select, Drawer, Space, Button, InputNumber, Segmented } from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
 import { createStyles } from 'antd-style';
 import * as Utils from '../utils'
@@ -14,13 +14,14 @@
     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({
                 ...props.values,
-                copyGap: 0
             });
         }
     }, [form, props]);
@@ -34,11 +35,12 @@
     }
 
     const handleFinish = (values) => {
-        props.submit({ ...values, ...props.values })
-    }
-
-    const formValuesChange = () => {
-
+        props.submit({
+            ...values
+            , ...props.values
+            , autoIncrement: autoIncrement
+            , type: curSprite?.data?.type
+        })
     }
 
     return (
@@ -64,8 +66,11 @@
             >
                 <Form
                     form={form}
-                    onFieldsChange={formValuesChange}
                     initialValues={{
+                        copyGap: 0,
+                        autoIncrement: false,
+                        incrementValue: 'row',
+                        incrementMode: 'Ascending',
                     }}
                     onFinish={handleFinish}
                     autoComplete="off"
@@ -113,7 +118,17 @@
                             </Form.Item>
                         </Col>
 
-                        {curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
+                        {/* switch auto increment  */}
+                        <Col span={24}>
+                            <Form.Item
+                                label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.auto-increment', defaultMessage: '鑷闀�' })}
+                                labelCol={{ span: 8 }}
+                            >
+                                <Switch value={autoIncrement} onChange={setAutoIncrement} />
+                            </Form.Item>
+                        </Col>
+
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
                             <>
                                 <Col span={24}>
                                     <Form.Item
@@ -132,11 +147,12 @@
                             </>
                         )}
 
-                        {curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
                             <>
                                 <Col span={24}>
                                     <Form.Item
-                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.auto-increment-value', defaultMessage: '鑷闀垮��' })}
+                                        name='incrementValue'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.increment-value', defaultMessage: '鑷闀垮��' })}
                                         labelCol={{ span: 8 }}
                                     >
                                         <Segmented
@@ -158,6 +174,7 @@
                                 </Col>
                                 <Col span={24}>
                                     <Form.Item
+                                        name='incrementMode'
                                         label={intl.formatMessage({ id: 'map.settings.sub.copy.increment.mode', defaultMessage: '澧為暱鏂瑰紡' })}
                                         labelCol={{ span: 8 }}
                                     >
@@ -166,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