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/configSettings.jsx |  225 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 204 insertions(+), 21 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index 07a5a7b..6b45b0b 100644
--- a/zy-asrs-flow/src/pages/map/components/configSettings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
@@ -1,5 +1,5 @@
 import React, { useState, useRef, useEffect } from 'react';
-import { Col, Form, Input, Row, Checkbox, Slider, Select, Drawer, Space, Button, InputNumber, Card } from 'antd';
+import { message, Form, Input, Row, Checkbox, Slider, Select, Drawer, Space, Button, InputNumber, Card } from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
 import { createStyles } from 'antd-style';
 import * as Utils from '../utils'
@@ -15,7 +15,14 @@
     const { curSprite, configForm: form } = props;
 
     useEffect(() => {
-    }, []);
+        form.resetFields();
+        if (curSprite) {
+            form.setFieldsValue({
+                shelfType: Utils.SHELF_TYPE.STORE,
+                ...curSprite.data
+            })
+        }
+    }, [props, form]);
 
     const formValuesChange = (changeList) => {
         if (curSprite && changeList && changeList.length > 0) {
@@ -27,11 +34,11 @@
                             const bay = form.getFieldValue('bay')
                             if (value && bay) {
                                 form.setFieldsValue({
-                                    shelfNo: Utils.pureNumStr(value) + '-' + Utils.pureNumStr(bay)
+                                    no: Utils.pureNumStr(value) + '-' + Utils.pureNumStr(bay)
                                 });
                             } else {
                                 form.setFieldsValue({
-                                    shelfNo: ''
+                                    no: ''
                                 });
                             }
                             break;
@@ -39,11 +46,35 @@
                             const row = form.getFieldValue('row')
                             if (value && row) {
                                 form.setFieldsValue({
-                                    shelfNo: Utils.pureNumStr(row) + '-' + Utils.pureNumStr(value)
+                                    no: Utils.pureNumStr(row) + '-' + Utils.pureNumStr(value)
                                 });
                             } else {
                                 form.setFieldsValue({
-                                    shelfNo: ''
+                                    no: ''
+                                });
+                            }
+                            break;
+                        case 'vertical':
+                            const horizontal = form.getFieldValue('horizontal')
+                            if (value && horizontal) {
+                                form.setFieldsValue({
+                                    no: Utils.pureNumStr(value) + '-' + Utils.pureNumStr(horizontal)
+                                });
+                            } else {
+                                form.setFieldsValue({
+                                    no: ''
+                                });
+                            }
+                            break;
+                        case 'horizontal':
+                            const vertical = form.getFieldValue('vertical')
+                            if (value && vertical) {
+                                form.setFieldsValue({
+                                    no: Utils.pureNumStr(vertical) + '-' + Utils.pureNumStr(value)
+                                });
+                            } else {
+                                form.setFieldsValue({
+                                    no: ''
                                 });
                             }
                             break;
@@ -60,8 +91,17 @@
     const onFinishFailed = (errorInfo) => {
     };
 
-    const handleFinish = async (values) => {
-        props.onSubmit({ ...values });
+    const handleFinish = (values) => {
+        // execute where the form was finished
+        const confirmSettings = () => {
+            if (curSprite && curSprite?.data?.type) {
+                curSprite.data = { ...curSprite.data, ...values };
+                Utils.showSheflType(curSprite);
+            }
+            message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '鎿嶄綔鎴愬姛' }));
+        }
+
+        props.onSubmit({ ...values }, confirmSettings);
     }
 
     return (
@@ -83,12 +123,13 @@
                 disabled={false}
                 layout='horizontal'
                 labelCol={{
-                    span: 4,
+                    span: 5,
                 }}
                 wrapperCol={{
-                    span: 14,
+                    span: 19,
                 }}
             >
+                <br />
 
                 <Form.Item
                     label={intl.formatMessage({ id: 'map.settings.type', defaultMessage: '绫诲瀷' })}
@@ -96,7 +137,7 @@
                     <span>{curSprite?.data?.type}</span>
                 </Form.Item>
                 <Form.Item
-                    label={intl.formatMessage({ id: 'map.settings.uuid', defaultMessage: '缂栧彿' })}
+                    label={intl.formatMessage({ id: 'map.settings.uuid', defaultMessage: '鍥惧彿' })}
                 >
                     <span>{curSprite?.data?.uuid}</span>
                 </Form.Item>
@@ -107,30 +148,156 @@
                     </>
                 )}
 
+                {curSprite?.data?.type === Utils.SENSOR_TYPE.SHUTTLE && (
+                    <>
+
+                    </>
+                )}
+
                 {curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
                     <>
                         <Form.Item
-                            name='shelfNo'
-                            label={intl.formatMessage({ id: 'map.settings.shelf.no', defaultMessage: '璐ф灦鍙�' })}
+                            label={intl.formatMessage({ id: 'map.settings.shelf.location', defaultMessage: '搴撲綅' })}
+                        >
+                            <Space.Compact>
+                                <Form.Item
+                                    name='row'
+                                    noStyle
+                                    rules={[
+                                        {
+                                            required: false,
+                                        },
+                                    ]}
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.row' defaultMessage='鎺�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                                <Form.Item
+                                    name='bay'
+                                    noStyle
+                                    rules={[
+                                        {
+                                            required: false,
+                                        },
+                                    ]}
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.bay' defaultMessage='鍒�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                            </Space.Compact>
+                        </Form.Item>
+                        <Form.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: Utils.SHELF_TYPE.STORE
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.settings.shelf.track', defaultMessage: '杞ㄩ亾' }),
+                                        value: Utils.SHELF_TYPE.TRACK
+                                    },
+                                    {
+                                        label: intl.formatMessage({ id: 'map.settings.shelf.diable', defaultMessage: '绂佺敤' }),
+                                        value: Utils.SHELF_TYPE.DISABLE
+                                    },
+                                ]}
+                            />
+                        </Form.Item>
+                        <Form.Item
+                            label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })}
+                        >
+                            <Space.Compact>
+                                <Form.Item
+                                    name='top'
+                                    noStyle
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.top' defaultMessage='涓�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                                <Form.Item
+                                    name='bottom'
+                                    noStyle
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.bottom' defaultMessage='涓�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                            </Space.Compact>
+                        </Form.Item>
+                        <Form.Item
+                            label={' '}
+                        >
+                            <Space.Compact>
+                                <Form.Item
+                                    name='left'
+                                    noStyle
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.left' defaultMessage='宸�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                                <Form.Item
+                                    name='right'
+                                    noStyle
+                                >
+                                    <InputNumber
+                                        addonBefore={<Space.Compact><FormattedMessage id='map.settings.shelf.right' defaultMessage='鍙�' /></Space.Compact>}
+                                        style={{
+                                            width: '50%',
+                                        }}
+                                    />
+                                </Form.Item>
+                            </Space.Compact>
+                        </Form.Item>
+                        <Form.Item
+                            name='value'
+                            label={intl.formatMessage({ id: 'map.settings.shelf.value', defaultMessage: '鍦板浘鍊�' })}
+                        >
                             <Input
                                 style={{
                                     width: '50%',
                                 }}
-                                disabled
                             />
                         </Form.Item>
+                    </>
+                )}
+
+                {curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && (
+                    <>
                         <Form.Item
-                            name='row'
-                            label={intl.formatMessage({ id: 'map.settings.shelf.row', defaultMessage: '鎺�' })}
+                            name='vertical'
+                            label={intl.formatMessage({ id: 'map.settings.point.vertical', defaultMessage: '绾靛悜' })}
                             rules={[
                                 {
-                                    required: true,
+                                    required: false,
                                 },
                             ]}
                         >
@@ -141,11 +308,11 @@
                             />
                         </Form.Item>
                         <Form.Item
-                            name='bay'
-                            label={intl.formatMessage({ id: 'map.settings.shelf.bay', defaultMessage: '鍒�' })}
+                            name='horizontal'
+                            label={intl.formatMessage({ id: 'map.settings.point.horizontal', defaultMessage: '妯悜' })}
                             rules={[
                                 {
-                                    required: true,
+                                    required: false,
                                 },
                             ]}
                         >
@@ -159,11 +326,27 @@
                 )}
 
                 <Form.Item
+                    name='no'
+                    label={intl.formatMessage({ id: 'map.settings.no', defaultMessage: '缂栧彿' })}
+                    rules={[
+                        {
+                            required: false,
+                        },
+                    ]}
+                >
+                    <Input
+                        style={{
+                            width: '50%',
+                        }}
+                    />
+                </Form.Item>
+
+                <Form.Item
                     wrapperCol={{
                         offset: 4,
                         span: 16,
                     }}>
-                    <Button type="primary" onClick={handleFinish}>
+                    <Button type="primary" htmlType="submit">
                         <FormattedMessage id='common.submit' defaultMessage='淇濆瓨' />
                     </Button>
                 </Form.Item>

--
Gitblit v1.9.1