From c9e8eab9835c6f72f84552f694582d9a27f6328c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 11 十月 2024 16:50:31 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/settings/CopyDrawer.jsx | 42 +++++++++++++++++++++++++++---------------
zy-acs-flow/src/i18n/en.js | 4 ++++
zy-acs-flow/src/i18n/zh.js | 4 ++++
3 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js
index 808c772..abbbd94 100644
--- a/zy-acs-flow/src/i18n/en.js
+++ b/zy-acs-flow/src/i18n/en.js
@@ -656,6 +656,10 @@
ascend: 'Ascend',
descend: 'Descend',
},
+ valid: {
+ common: 'Please set the config parameters first',
+ shelf: 'Please set the row and bay in the config parameters first',
+ },
},
more: {
title: 'More',
diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js
index 11093ca..7b893b2 100644
--- a/zy-acs-flow/src/i18n/zh.js
+++ b/zy-acs-flow/src/i18n/zh.js
@@ -654,6 +654,10 @@
ascend: '鍗囧簭',
descend: '闄嶅簭',
},
+ valid: {
+ common: '璇峰厛璁剧疆绯荤粺鍙傛暟',
+ shelf: '璇峰厛鍦ㄧ郴缁熷弬鏁颁腑璁剧疆鎺掑拰鍒�',
+ },
},
more: {
title: '鏇村',
diff --git a/zy-acs-flow/src/map/settings/CopyDrawer.jsx b/zy-acs-flow/src/map/settings/CopyDrawer.jsx
index 6aa9880..2229124 100644
--- a/zy-acs-flow/src/map/settings/CopyDrawer.jsx
+++ b/zy-acs-flow/src/map/settings/CopyDrawer.jsx
@@ -46,6 +46,26 @@
],
};
+
+const validateIncrement = (value, deviceType, sprite, translate) => {
+ if (!value) {
+ return true;
+ }
+ switch (deviceType) {
+ case DEVICE_TYPE.SHELF:
+ if (!sprite?.data?.row || !sprite?.data?.bay) {
+ return translate('page.map.settings.map.copy.valid.shelf');
+ }
+ break;
+ default:
+ if (!sprite?.data?.no) {
+ return translate('page.map.settings.map.copy.valid.common');
+ }
+ break;
+ }
+ return true;
+};
+
const getDefaultFormValues = (value = {}) => ({
copyDirect: value.copyDirect || '',
copyCount: value.copyCount || '',
@@ -88,18 +108,6 @@
const handleClose = () => {
onCancel();
}
-
- const validateIncrement = (value) => {
- if (!value) {
- return true;
- }
- if (deviceType === DEVICE_TYPE.SHELF) {
- if (!sprite?.data?.row || !sprite?.data?.bay) {
- return 'Row or Bay value is required for SHELF device type.';
- }
- }
- return true;
- };
const onFormSubmit = (data) => {
console.log(data);
@@ -192,7 +200,7 @@
<Controller
name="autoIncrement"
control={control}
- rules={{ validate: validateIncrement }}
+ rules={{ validate: (value) => validateIncrement(value, deviceType, sprite, translate) }}
render={({ field }) => (
<FormControlLabel
control={
@@ -228,7 +236,9 @@
value={field.value}
exclusive
onChange={(event, value) => {
- field.onChange(value);
+ if (value !== null) {
+ field.onChange(value);
+ }
}}
fullWidth
>
@@ -261,7 +271,9 @@
value={field.value}
exclusive
onChange={(event, value) => {
- field.onChange(value);
+ if (value !== null) {
+ field.onChange(value);
+ }
}}
fullWidth
>
--
Gitblit v1.9.1