From b6e25f0072b04b45e406381c2cb3216eedf12dc4 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期一, 25 三月 2024 08:35:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack

---
 zy-asrs-flow/src/pages/map/drawer/agv/index.jsx          |    2 
 zy-asrs-flow/src/pages/map/drawer/point/index.jsx        |    2 
 zy-asrs-flow/src/pages/map/batch/index.jsx               |  224 +++++++++++++++++++++++++++++++
 zy-asrs-flow/src/locales/en-US/map.ts                    |   11 +
 zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx        |    2 
 zy-asrs-flow/src/pages/map/components/configSettings.jsx |  161 +++++++++++++++++-----
 zy-asrs-flow/src/pages/map/drawer/showJson.jsx           |    6 
 7 files changed, 356 insertions(+), 52 deletions(-)

diff --git a/zy-asrs-flow/src/locales/en-US/map.ts b/zy-asrs-flow/src/locales/en-US/map.ts
index 8e3c29d..569eda2 100644
--- a/zy-asrs-flow/src/locales/en-US/map.ts
+++ b/zy-asrs-flow/src/locales/en-US/map.ts
@@ -47,8 +47,19 @@
     '': '',
     'map.settings.no': 'No.',
     'map.settings.shelf.no': 'Shelf No',
+    'map.settings.shelf.location': 'Location',
     'map.settings.shelf.row': 'Row',
     'map.settings.shelf.bay': 'Bay',
+    'map.settings.shelf.type': 'Type',
+    'map.settings.shelf.space': 'Space',
+    'map.settings.shelf.top': 'Top',
+    'map.settings.shelf.right': 'Right',
+    'map.settings.shelf.bottom': 'Bottom',
+    'map.settings.shelf.left': 'Left',
+    'map.settings.shelf.value': 'Map Value',
+    'map.settings.shelf.store': 'Store',
+    'map.settings.shelf.track': 'Track',
+    'map.settings.shelf.diable': 'Diable',
     '': '',
     '': '',
     '': '',
diff --git a/zy-asrs-flow/src/pages/map/batch/index.jsx b/zy-asrs-flow/src/pages/map/batch/index.jsx
index c85ade5..31771f8 100644
--- a/zy-asrs-flow/src/pages/map/batch/index.jsx
+++ b/zy-asrs-flow/src/pages/map/batch/index.jsx
@@ -1,22 +1,54 @@
 import React, { useState, useRef, useEffect } from 'react';
-import { Drawer, Space, Button } from 'antd';
+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 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();
@@ -32,7 +64,7 @@
                 mask={false}
                 width={600}
                 style={{
-                    opacity: .8
+                    opacity: 1
                 }}
                 extra={
                     <Space>
@@ -42,8 +74,190 @@
                     </Space>
                 }
             >
-                {batchSprites?.length}
-            </Drawer>
+                <Card
+                    className='drawer-card'
+                    hoverable
+                    bordered={false}
+                    type='inner'
+                    style={{
+                        height: '100%'
+                    }}
+                >
+                    <StepsForm
+                        form={form}
+                        current={currentStep}
+                        onCurrentChange={setCurrentStep}
+                        onFinish={async () => {
+                            await waitTime(1000);
+                            message.success('鎻愪氦鎴愬姛');
+                        }}
+                        formProps={{
+                            validateMessages: {
+                                required: '姝ら」涓哄繀濉」',
+                            },
+                            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="閫夋嫨璐ф灦"
+                            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="璁剧疆鍙傛暟"
+                            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="缁撴灉"
+                            submitter={false}
+                        >
+                            <Result
+                                status="success"
+                                title="Successfully Purchased Cloud Server ECS!"
+                                subTitle="Order number: 2017182818828182881 Cloud server configuration takes 1-5 minutes, please wait."
+                                extra={[
+                                    <Button type="primary" key="console">
+                                        Go Console
+                                    </Button>,
+                                ]}
+                            />
+                        </StepsForm.StepForm>
+                    </StepsForm >
+                </Card >
+            </Drawer >
         </>
     )
 }
diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index e158718..9bd8aaa 100644
--- a/zy-asrs-flow/src/pages/map/components/configSettings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
@@ -19,13 +19,6 @@
         if (curSprite) {
             form.setFieldsValue({
                 ...curSprite.data
-                // no: curSprite.data?.no,
-                // // shelf
-                // row: curSprite.data?.row,
-                // bay: curSprite.data?.bay,
-                // // point
-                // vertical: curSprite.data?.vertical,
-                // horizontal: curSprite.data?.horizontal,
             })
         }
     }, [props, form]);
@@ -101,23 +94,7 @@
         // execute where the form was finished
         const confirmSettings = () => {
             if (curSprite && curSprite?.data?.type) {
-                switch (curSprite.data.type) {
-                    case Utils.SENSOR_TYPE.SHELF:
-                        curSprite.data.no = values.no; // *
-                        curSprite.data.row = values.row;
-                        curSprite.data.bay = values.bay;
-                        break;
-                    case Utils.SENSOR_TYPE.POINT:
-                        curSprite.data.no = values.no; // *
-                        curSprite.data.horizontal = values.horizontal;
-                        curSprite.data.vertical = values.vertical;
-                        break;
-                    case Utils.SENSOR_TYPE.AGV:
-                        curSprite.data.no = values.no; // *
-                        break;
-                    default:
-                        break;
-                }
+                curSprite.data = { ...curSprite.data, ...values }
             }
             message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '鎿嶄綔鎴愬姛' }));
         }
@@ -144,10 +121,10 @@
                 disabled={false}
                 layout='horizontal'
                 labelCol={{
-                    span: 4,
+                    span: 5,
                 }}
                 wrapperCol={{
-                    span: 20,
+                    span: 19,
                 }}
             >
                 <br />
@@ -172,30 +149,132 @@
                 {curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
                     <>
                         <Form.Item
-                            name='row'
-                            label={intl.formatMessage({ id: 'map.settings.shelf.row', 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: false,
+                                    required: true,
                                 },
                             ]}
                         >
-                            <InputNumber
-                                style={{
-                                    width: '50%',
-                                }}
+                            <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}
                             />
                         </Form.Item>
                         <Form.Item
-                            name='bay'
-                            label={intl.formatMessage({ id: 'map.settings.shelf.bay', defaultMessage: '鍒�' })}
-                            rules={[
-                                {
-                                    required: false,
-                                },
-                            ]}
+                            label={intl.formatMessage({ id: 'map.settings.shelf.space', defaultMessage: '闂磋窛' })}
                         >
-                            <InputNumber
+                            <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%',
                                 }}
diff --git a/zy-asrs-flow/src/pages/map/drawer/agv/index.jsx b/zy-asrs-flow/src/pages/map/drawer/agv/index.jsx
index 6899ae9..8041760 100644
--- a/zy-asrs-flow/src/pages/map/drawer/agv/index.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/agv/index.jsx
@@ -18,7 +18,7 @@
     const contentList = {
         json: (
             <ShowJson
-                curSprite={props.curSprite}
+                data={props.curSprite.data}
             />
         ),
     };
diff --git a/zy-asrs-flow/src/pages/map/drawer/point/index.jsx b/zy-asrs-flow/src/pages/map/drawer/point/index.jsx
index 5fd6e94..43e3a12 100644
--- a/zy-asrs-flow/src/pages/map/drawer/point/index.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/point/index.jsx
@@ -18,7 +18,7 @@
     const contentList = {
         json: (
             <ShowJson
-                curSprite={props.curSprite}
+                data={props.curSprite.data}
             />
         ),
     };
diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx b/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
index faef89f..894333f 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
@@ -18,7 +18,7 @@
     const contentList = {
         json: (
             <ShowJson
-                curSprite={props.curSprite}
+                data={props.curSprite.data}
             />
         ),
     };
diff --git a/zy-asrs-flow/src/pages/map/drawer/showJson.jsx b/zy-asrs-flow/src/pages/map/drawer/showJson.jsx
index c545c33..c103412 100644
--- a/zy-asrs-flow/src/pages/map/drawer/showJson.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/showJson.jsx
@@ -36,13 +36,13 @@
 
 const ShowJSON = (props) => {
     const { styles } = useStyles();
-    const { curSprite } = props;
+    const { data } = props;
 
-    const formattedJSON = JSON.stringify(curSprite.data, null, 2);
+    const formattedJSON = JSON.stringify(data, null, props.jsonType ?? 2);
 
     return (
         <>
-            <div className={styles.jsonBox}>
+            <div className={styles.jsonBox} style={{ height: props.height }}>
                 <textarea
                     readOnly
                     className={styles.jsonContent}

--
Gitblit v1.9.1