From 54d940c0bfabe90700d0bcc9e72dc93bc8bafaad Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 11 十月 2024 10:54:26 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/settings/ConfigSettings.jsx | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/zy-acs-flow/src/map/settings/ConfigSettings.jsx b/zy-acs-flow/src/map/settings/ConfigSettings.jsx
index 54bec87..15b695c 100644
--- a/zy-acs-flow/src/map/settings/ConfigSettings.jsx
+++ b/zy-acs-flow/src/map/settings/ConfigSettings.jsx
@@ -46,16 +46,25 @@
}
}, [sprite, reset]);
+ const deviceType = sprite?.data?.type;
+
const rowValue = watch('row');
const bayValue = watch('bay');
useEffect(() => {
- if (rowValue != null && bayValue != null && rowValue !== '' && bayValue !== '') {
- setValue('no', `${rowValue}-${bayValue}`);
- } else {
- setValue('no', '');
+ if (deviceType === DEVICE_TYPE.SHELF) {
+ if (rowValue != null && bayValue != null && rowValue !== '' && bayValue !== '') {
+ setValue('no', `${rowValue}-${bayValue}`);
+ } else {
+ setValue('no', '');
+ }
}
- }, [rowValue, bayValue, setValue]);
+ }, [
+ setValue,
+ deviceType,
+ rowValue,
+ bayValue,
+ ]);
const onFormSubmit = (data) => {
if (sprite && sprite.data) {
@@ -74,7 +83,7 @@
<>
<Box component="form" onSubmit={handleSubmit(onFormSubmit)} noValidate sx={{ mt: 0 }}>
<Grid container spacing={1.4}>
- {sprite?.data?.type === DEVICE_TYPE.SHELF && (
+ {deviceType === DEVICE_TYPE.SHELF && (
<>
<Grid item xs={6}>
<Controller
@@ -113,20 +122,21 @@
</>
)}
- {sprite?.data?.type === DEVICE_TYPE.CHARGE && (
+ {deviceType === DEVICE_TYPE.CHARGE && (
<>
</>
)}
- {sprite?.data?.type === DEVICE_TYPE.STATION && (
+ {deviceType === DEVICE_TYPE.STATION && (
<>
</>
)}
- {sprite?.data?.type === DEVICE_TYPE.POINT && (
+ {deviceType === DEVICE_TYPE.POINT && (
<>
</>
)}
+
<Grid item xs={12}>
<Divider />
</Grid>
--
Gitblit v1.9.1