From 491afee13734c9acc672802cd6d80ead53337c3e Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 三月 2024 19:25:54 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/header/search.jsx | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index 81261c7..0e829a9 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -57,6 +57,15 @@
const [curSensorLabel, setCurSensorLabel] = React.useState(null);
useEffect(() => {
+ const intervalID = setInterval(() => {
+ if (!curSensorLabel) {
+ let sensorListAll = updateSensorList();
+ setSensorList(sensorListAll);
+ setFilterSensorList(sensorListAll);
+ }
+ }, 1000)
+
+ return () => clearInterval(intervalID);
}, [props]);
// first select
@@ -64,15 +73,7 @@
if (!Utils.getMapContainer()) {
return
}
- let sensorListAll = [];
- Utils.getMapContainer().children.forEach(child => {
- if (child?.data?.type === curSensorType && child?.data?.no) {
- sensorListAll.push({
- value: child.data.no,
- label: renderTitle(child.data.no, child.data.uuid)
- })
- }
- });
+ let sensorListAll = updateSensorList();
setSensorList(sensorListAll);
setFilterSensorList(sensorListAll);
setCurSensorLabel(null);
@@ -88,6 +89,19 @@
}
}, [curSensorLabel])
+ function updateSensorList() {
+ let sensorListAll = [];
+ Utils.getMapContainer().children.forEach(child => {
+ if (child?.data?.type === curSensorType && child?.data?.no) {
+ sensorListAll.push({
+ value: child.data.no,
+ label: renderTitle(child.data.no, child.data.uuid)
+ })
+ }
+ });
+ return sensorListAll;
+ }
+
return (
<>
<Select
--
Gitblit v1.9.1