From 1e465fcab874dd5bf60fdff4151a3742b5a755b0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 17 十月 2024 14:21:12 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/header/MapSearch.jsx |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/zy-acs-flow/src/map/header/MapSearch.jsx b/zy-acs-flow/src/map/header/MapSearch.jsx
index cb867d1..57058a5 100644
--- a/zy-acs-flow/src/map/header/MapSearch.jsx
+++ b/zy-acs-flow/src/map/header/MapSearch.jsx
@@ -36,8 +36,8 @@
         setMode,
         dataFetched,
         curZone,
+        curSprite,
         setCurSprite,
-        setSpriteSettings,
     } = props;
 
     const theme = useTheme();
@@ -65,6 +65,12 @@
     }, [curDeviceType, dataFetched, curZone]);
 
     useEffect(() => {
+        if (!curSprite) {
+            resetSearch();
+        }
+    }, [curSprite]);
+
+    useEffect(() => {
         if (!Tool.getMapContainer()) return;
         if (inputValue !== '' && deviceList.length > 0) {
             setFilterDeviceList(
@@ -89,11 +95,11 @@
             case MAP_MODE.MOVABLE_MODE:
                 setMode(MAP_MODE.SETTINGS_MODE);
                 setTimeout(() => {
-                    setSpriteSettings(selectSprite);
+                    setCurSprite(selectSprite);
                 }, 200);
                 break;
             case MAP_MODE.SETTINGS_MODE:
-                setSpriteSettings(selectSprite);
+                setCurSprite(selectSprite);
                 break;
             default:
                 break;
@@ -138,10 +144,10 @@
                 size="small"
                 options={filterDeviceList}
                 getOptionLabel={(option) => option.value}
-                renderOption={(props, option) => {
-                    const { key, ...otherProps } = props;
+                renderOption={(optionProps, option) => {
+                    const { key, ...otherProps } = optionProps;
                     return (
-                        <li key={Number(key)} {...otherProps}>
+                        <li key={option.uuid} {...otherProps}>
                             <Stack direction="row" justifyContent="space-between" width="100%">
                                 <Typography variant="body1" fontWeight="bold">
                                     {option.label}

--
Gitblit v1.9.1