From ca767633a3e8414661138720a68cc41a435a4afe Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 三月 2024 13:42:32 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/components/configSettings.jsx | 46 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index 7a6a67a..6cf6cc5 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,17 @@
const { curSprite, configForm: form } = props;
useEffect(() => {
- }, []);
+ form.resetFields();
+ if (curSprite) {
+ form.setFieldsValue({
+
+ // shelf
+ row: curSprite?.data?.row,
+ bay: curSprite?.data?.bay,
+ shelfNo: curSprite?.data?.shelfNo,
+ })
+ }
+ }, [props, form]);
const formValuesChange = (changeList) => {
if (curSprite && changeList && changeList.length > 0) {
@@ -60,8 +70,26 @@
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.shelfNo = values.shelfNo;
+ curSprite.data.row = values.row;
+ curSprite.data.bay = values.bay;
+ break;
+ case Utils.SENSOR_TYPE.AGV:
+ break;
+ default:
+ break;
+ }
+ }
+ message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '鎿嶄綔鎴愬姛' }));
+ }
+
+ props.onSubmit({ ...values }, confirmSettings);
}
return (
@@ -90,7 +118,7 @@
}}
>
<br />
-
+
<Form.Item
label={intl.formatMessage({ id: 'map.settings.type', defaultMessage: '绫诲瀷' })}
>
@@ -115,7 +143,7 @@
label={intl.formatMessage({ id: 'map.settings.shelf.row', defaultMessage: '鎺�' })}
rules={[
{
- required: true,
+ required: false,
},
]}
>
@@ -130,7 +158,7 @@
label={intl.formatMessage({ id: 'map.settings.shelf.bay', defaultMessage: '鍒�' })}
rules={[
{
- required: true,
+ required: false,
},
]}
>
@@ -145,7 +173,7 @@
label={intl.formatMessage({ id: 'map.settings.shelf.no', defaultMessage: '璐ф灦鍙�' })}
rules={[
{
- required: true,
+ required: false,
},
]}
>
@@ -163,7 +191,7 @@
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