From 83c548d3dba59aaed9b52b5d413c6912a87d2efc Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 16 六月 2024 15:50:14 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/components/configSettings.jsx | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 206 insertions(+), 23 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index e853278..01697ee 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,15 +15,72 @@
const { curSprite, configForm: form } = props;
useEffect(() => {
- }, []);
+ form.resetFields();
+ if (curSprite) {
+ form.setFieldsValue({
+
+ // shelf
+ row: curSprite?.data?.row,
+ bay: curSprite?.data?.bay,
+ no: curSprite?.data?.no,
+ })
+ }
+ }, [props, form]);
const formValuesChange = (changeList) => {
if (curSprite && changeList && changeList.length > 0) {
changeList.forEach(change => {
const { name: nameList, value } = change;
nameList.forEach(name => {
- console.log(name, value);
switch (name) {
+ case 'row':
+ const bay = form.getFieldValue('bay')
+ if (value && bay) {
+ form.setFieldsValue({
+ no: Utils.pureNumStr(value) + '-' + Utils.pureNumStr(bay)
+ });
+ } else {
+ form.setFieldsValue({
+ no: ''
+ });
+ }
+ break;
+ case 'bay':
+ const row = form.getFieldValue('row')
+ if (value && row) {
+ form.setFieldsValue({
+ no: Utils.pureNumStr(row) + '-' + Utils.pureNumStr(value)
+ });
+ } else {
+ form.setFieldsValue({
+ 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;
default:
break;
}
@@ -37,8 +94,32 @@
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) {
+ 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;
+ }
+ }
+ message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '鎿嶄綔鎴愬姛' }));
+ }
+
+ props.onSubmit({ ...values }, confirmSettings);
}
return (
@@ -54,31 +135,133 @@
style={{
maxWidth: 600,
}}
- size='default' // small | default | large
- variant='filled' // outlined | borderless | filled
- labelWrap // label 鎹㈣
+ size='defalargeult'
+ variant='filled'
+ labelWrap
disabled={false}
layout='horizontal'
+ labelCol={{
+ span: 4,
+ }}
+ wrapperCol={{
+ span: 20,
+ }}
>
+ <br />
- <Row gutter={[24, 16]}>
+ <Form.Item
+ label={intl.formatMessage({ id: 'map.settings.type', defaultMessage: '绫诲瀷' })}
+ >
+ <span>{curSprite?.data?.type}</span>
+ </Form.Item>
+ <Form.Item
+ label={intl.formatMessage({ id: 'map.settings.uuid', defaultMessage: '鍦板浘鍙�' })}
+ >
+ <span>{curSprite?.data?.uuid}</span>
+ </Form.Item>
- <Col span={24}>
- <Row gutter={24}>
- <Col span={18}>
- <Form.Item
- label={intl.formatMessage({ id: 'map.settings.type', defaultMessage: '绫诲瀷' })}
- labelCol={{ span: 4 }}
- >
- <span>{curSprite?.data?.type}</span>
- </Form.Item>
- </Col>
- </Row>
- </Col>
+ {curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
+ <>
+ </>
+ )}
- </Row>
- </Form>
+ {curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && (
+ <>
+ <Form.Item
+ name='row'
+ label={intl.formatMessage({ id: 'map.settings.shelf.row', defaultMessage: '鎺�' })}
+ rules={[
+ {
+ required: false,
+ },
+ ]}
+ >
+ <InputNumber
+ style={{
+ width: '50%',
+ }}
+ />
+ </Form.Item>
+ <Form.Item
+ name='bay'
+ label={intl.formatMessage({ id: 'map.settings.shelf.bay', defaultMessage: '鍒�' })}
+ rules={[
+ {
+ required: false,
+ },
+ ]}
+ >
+ <InputNumber
+ style={{
+ width: '50%',
+ }}
+ />
+ </Form.Item>
+ </>
+ )}
+
+ {curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && (
+ <>
+ <Form.Item
+ name='vertical'
+ label={intl.formatMessage({ id: 'map.settings.point.vertical', defaultMessage: '绾靛悜' })}
+ rules={[
+ {
+ required: false,
+ },
+ ]}
+ >
+ <InputNumber
+ style={{
+ width: '50%',
+ }}
+ />
+ </Form.Item>
+ <Form.Item
+ name='horizontal'
+ label={intl.formatMessage({ id: 'map.settings.point.horizontal', defaultMessage: '妯悜' })}
+ rules={[
+ {
+ required: false,
+ },
+ ]}
+ >
+ <InputNumber
+ style={{
+ width: '50%',
+ }}
+ />
+ </Form.Item>
+ </>
+ )}
+
+ <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" htmlType="submit">
+ <FormattedMessage id='common.submit' defaultMessage='淇濆瓨' />
+ </Button>
+ </Form.Item>
+ </Form >
</>
)
}
--
Gitblit v1.9.1