From 9d0acfb65c80c4948c305ca01338f894b87346a0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 09:44:37 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx |  194 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 171 insertions(+), 23 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx b/zy-asrs-flow/src/pages/map/components/mapCopySettings.jsx
index c279d2e..61e2dd2 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, Switch, Slider, Select, Drawer, Space, Button, InputNumber, Segmented } from 'antd';
+import { Col, Form, Input, Row, Switch, Slider, message, Drawer, Space, Button, InputNumber, Segmented } from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
 import { createStyles } from 'antd-style';
 import * as Utils from '../utils'
@@ -15,8 +15,10 @@
     const { curSprite } = props;
     const [form] = Form.useForm();
     const [autoIncrement, setAutoIncrement] = useState(false);
+    const [autoIncrementError, setAutoIncrementError] = useState(null);
 
     useEffect(() => {
+        setAutoIncrement(false);
         form.resetFields();
         if (curSprite && props) {
             form.setFieldsValue({
@@ -24,6 +26,31 @@
             });
         }
     }, [form, props]);
+
+    useEffect(() => {
+        if (autoIncrement === true && curSprite) {
+            switch (curSprite.data?.type) {
+                case Utils.SENSOR_TYPE.SHELF:
+                    if (!curSprite.data?.row || !curSprite.data?.bay) {
+                        setAutoIncrementError(intl.formatMessage({ id: 'map.settings.sub.copy.warn.config.shelf', defaultMessage: '璇峰厛璁剧疆璐ф灦鍙傛暟锛�' }));
+                    } else {
+                        setAutoIncrementError(null);
+                    }
+                    break;
+                case Utils.SENSOR_TYPE.POINT:
+                    if (!curSprite.data?.vertical || !curSprite.data?.horizontal) {
+                        setAutoIncrementError(intl.formatMessage({ id: 'map.settings.sub.copy.warn.config.point', defaultMessage: '璇峰厛璁剧疆瀹氫綅鐐瑰弬鏁帮紒' }));
+                    } else {
+                        setAutoIncrementError(null);
+                    }
+                    break;
+                default:
+                    break;
+            }
+        } else {
+            setAutoIncrementError(null);
+        }
+    }, [autoIncrement])
 
     const handleCancel = () => {
         props.onClose();
@@ -34,20 +61,12 @@
     }
 
     const handleFinish = (values) => {
-        console.log({
-            ...values
-            , ...props.values
-            , autoIncrement: autoIncrement
-        }); return
         props.submit({
             ...values
             , ...props.values
             , autoIncrement: autoIncrement
+            , type: curSprite?.data?.type
         })
-    }
-
-    const formValuesChange = (value) => {
-        console.log(value);
     }
 
     return (
@@ -73,12 +92,10 @@
             >
                 <Form
                     form={form}
-                    onFieldsChange={formValuesChange}
                     initialValues={{
                         copyGap: 0,
                         autoIncrement: false,
-                        incrementValue: 'row',
-                        incrementMode: 'Ascending',
+                        incrementMode: 'ascending',
                     }}
                     onFinish={handleFinish}
                     autoComplete="off"
@@ -129,26 +146,105 @@
                         {/* switch auto increment  */}
                         <Col span={24}>
                             <Form.Item
-                                label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.auto-increment', defaultMessage: '鑷闀�' })}
+                                label={intl.formatMessage({ id: 'map.settings.sub.copy.auto-increment', defaultMessage: '鑷闀�' })}
                                 labelCol={{ span: 8 }}
+                                help={autoIncrementError}
+                                validateStatus={autoIncrementError ? "error" : null}
                             >
                                 <Switch value={autoIncrement} onChange={setAutoIncrement} />
                             </Form.Item>
                         </Col>
 
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.SHUTTLE && (
+                            <>
+                                <Col span={24}>
+                                    <Form.Item
+                                        name='incrementValue'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment-value', defaultMessage: '鑷闀垮��' })}
+                                        labelCol={{ span: 8 }}
+                                        initialValue='no'
+                                    >
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.no', defaultMessage: '缂栧彿' }),
+                                                    value: 'no'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
+                                            }}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                                <Col span={24}>
+                                    <Form.Item
+                                        name='incrementMode'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment.mode', defaultMessage: '澧為暱鏂瑰紡' })}
+                                        labelCol={{ span: 8 }}
+                                    >
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.ascend', defaultMessage: '鍗囧簭' }),
+                                                    value: 'ascending'
+                                                },
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.descend', defaultMessage: '闄嶅簭' }),
+                                                    value: 'descending'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
+                                            }}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                            </>
+                        )}
+
                         {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
                             <>
                                 <Col span={24}>
                                     <Form.Item
-                                        name='id'
-                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.id', defaultMessage: '搴忓彿' })}
+                                        name='incrementValue'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment-value', defaultMessage: '鑷闀垮��' })}
+                                        labelCol={{ span: 8 }}
+                                        initialValue='no'
+                                    >
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.no', defaultMessage: '缂栧彿' }),
+                                                    value: 'no'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
+                                            }}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                                <Col span={24}>
+                                    <Form.Item
+                                        name='incrementMode'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment.mode', defaultMessage: '澧為暱鏂瑰紡' })}
                                         labelCol={{ span: 8 }}
                                     >
-                                        <InputNumber
-                                            style={{
-                                                width: '60%',
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.ascend', defaultMessage: '鍗囧簭' }),
+                                                    value: 'ascending'
+                                                },
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.descend', defaultMessage: '闄嶅簭' }),
+                                                    value: 'descending'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
                                             }}
-                                            min={0}
                                         />
                                     </Form.Item>
                                 </Col>
@@ -160,8 +256,9 @@
                                 <Col span={24}>
                                     <Form.Item
                                         name='incrementValue'
-                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.shelf.increment-value', defaultMessage: '鑷闀垮��' })}
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment-value', defaultMessage: '鑷闀垮��' })}
                                         labelCol={{ span: 8 }}
+                                        initialValue='row'
                                     >
                                         <Segmented
                                             block
@@ -191,11 +288,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) => {
@@ -206,6 +303,57 @@
                             </>
                         )}
 
+                        {autoIncrement && curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && (
+                            <>
+                                <Col span={24}>
+                                    <Form.Item
+                                        name='incrementValue'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment-value', defaultMessage: '鑷闀垮��' })}
+                                        labelCol={{ span: 8 }}
+                                        initialValue='vertical'
+                                    >
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.point.vertical', defaultMessage: '绾靛悜' }),
+                                                    value: 'vertical'
+                                                },
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.point.horizontal', defaultMessage: '妯悜' }),
+                                                    value: 'horizontal'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
+                                            }}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                                <Col span={24}>
+                                    <Form.Item
+                                        name='incrementMode'
+                                        label={intl.formatMessage({ id: 'map.settings.sub.copy.increment.mode', defaultMessage: '澧為暱鏂瑰紡' })}
+                                        labelCol={{ span: 8 }}
+                                    >
+                                        <Segmented
+                                            block
+                                            options={[
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.ascend', defaultMessage: '鍗囧簭' }),
+                                                    value: 'ascending'
+                                                },
+                                                {
+                                                    label: intl.formatMessage({ id: 'map.settings.sub.copy.descend', defaultMessage: '闄嶅簭' }),
+                                                    value: 'descending'
+                                                },
+                                            ]}
+                                            onChange={(value) => {
+                                            }}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                            </>
+                        )}
                     </Row>
                 </Form>
             </Drawer>

--
Gitblit v1.9.1