From a48bf56c321ef769224182b5a85d59b4beb88d01 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 25 三月 2024 15:14:37 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx         |    1 +
 zy-asrs-flow/src/pages/map/header/search.jsx |   18 ++++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index 175c0bb..6fe61e4 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -87,16 +87,22 @@
     const [filterSensorList, setFilterSensorList] = React.useState([]);
     const [curSensorLabel, setCurSensorLabel] = React.useState(null);
 
-    // first select
-    React.useEffect(() => {
-        if (!Utils.getMapContainer()) { return; }
+    const resetSearch = () => {
         let sensorListAll = getAllSensorList(curSensorType);
         setSensorList(sensorListAll);
         setFilterSensorList(sensorListAll);
         setCurSensorLabel(null);
-    }, [curSensorType])
+    }
 
-    // second select
+    // first select and switch floor
+    React.useEffect(() => {
+        if (!Utils.getMapContainer()) { return }
+        setTimeout(() => {
+            resetSearch();
+        }, 200)
+    }, [curSensorType, props.curFloor])
+
+    // second select condition
     React.useEffect(() => {
         if (!Utils.getMapContainer()) { return; }
         if ((curSensorLabel !== null || curSensorLabel != undefined)
@@ -120,7 +126,7 @@
                 // avoid model modify which will clear spriteBySettings
                 setTimeout(() => {
                     setSpriteBySettings(selectSensor);
-                }, 300)
+                }, 200)
                 break;
             case ModelEnum.SETTINGS_MODEL:
                 setSpriteBySettings(selectSensor);
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 8ed7dd8..7158df3 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -295,6 +295,7 @@
                                     model={model}
                                     setModel={setModel}
                                     ModelEnum={MapModel}
+                                    curFloor={curFloor}
                                     curSprite={curSprite}
                                     setCurSPrite={setCurSPrite}
                                     setSpriteBySettings={setSpriteBySettings}

--
Gitblit v1.9.1