Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack
| | |
| | | '': '', |
| | | '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', |
| | | '': '', |
| | | '': '', |
| | | '': '', |
| | |
| | | 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(); |
| | |
| | | mask={false} |
| | | width={600} |
| | | style={{ |
| | | opacity: .8 |
| | | opacity: 1 |
| | | }} |
| | | extra={ |
| | | <Space> |
| | |
| | | </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 > |
| | | </> |
| | | ) |
| | | } |
| | |
| | | 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]); |
| | |
| | | // 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: '操作成功' })); |
| | | } |
| | |
| | | disabled={false} |
| | | layout='horizontal' |
| | | labelCol={{ |
| | | span: 4, |
| | | span: 5, |
| | | }} |
| | | wrapperCol={{ |
| | | span: 20, |
| | | span: 19, |
| | | }} |
| | | > |
| | | <br /> |
| | |
| | | {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%', |
| | | }} |
| | |
| | | const contentList = { |
| | | json: ( |
| | | <ShowJson |
| | | curSprite={props.curSprite} |
| | | data={props.curSprite.data} |
| | | /> |
| | | ), |
| | | }; |
| | |
| | | const contentList = { |
| | | json: ( |
| | | <ShowJson |
| | | curSprite={props.curSprite} |
| | | data={props.curSprite.data} |
| | | /> |
| | | ), |
| | | }; |
| | |
| | | const contentList = { |
| | | json: ( |
| | | <ShowJson |
| | | curSprite={props.curSprite} |
| | | data={props.curSprite.data} |
| | | /> |
| | | ), |
| | | }; |
| | |
| | | |
| | | 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} |