From 9f4a1cf5f91f85c49d3e609f19c9e833a08ca8ee Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 22 三月 2024 08:29:48 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/components/configSettings.jsx | 108 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 94 insertions(+), 14 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index 3bb598e..e158718 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,20 @@
const { curSprite, configForm: form } = props;
useEffect(() => {
- }, []);
+ form.resetFields();
+ 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]);
const formValuesChange = (changeList) => {
if (curSprite && changeList && changeList.length > 0) {
@@ -27,11 +40,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 +52,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;
@@ -66,16 +103,23 @@
if (curSprite && curSprite?.data?.type) {
switch (curSprite.data.type) {
case Utils.SENSOR_TYPE.SHELF:
- curSprite.data.shelfNo = values.shelfNo;
+ 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);
@@ -114,7 +158,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>
@@ -132,7 +176,7 @@
label={intl.formatMessage({ id: 'map.settings.shelf.row', defaultMessage: '鎺�' })}
rules={[
{
- required: true,
+ required: false,
},
]}
>
@@ -147,7 +191,27 @@
label={intl.formatMessage({ id: 'map.settings.shelf.bay', defaultMessage: '鍒�' })}
rules={[
{
- required: true,
+ 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,
},
]}
>
@@ -158,15 +222,15 @@
/>
</Form.Item>
<Form.Item
- name='shelfNo'
- label={intl.formatMessage({ id: 'map.settings.shelf.no', defaultMessage: '璐ф灦鍙�' })}
+ name='horizontal'
+ label={intl.formatMessage({ id: 'map.settings.point.horizontal', defaultMessage: '妯悜' })}
rules={[
{
- required: true,
+ required: false,
},
]}
>
- <Input
+ <InputNumber
style={{
width: '50%',
}}
@@ -176,6 +240,22 @@
)}
<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,
--
Gitblit v1.9.1