From 2c43cc857247cd2bb0d4a88de5b950899abf4b7e Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 15 十月 2024 16:26:49 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/header/MapSearch.jsx |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/zy-acs-flow/src/map/header/MapSearch.jsx b/zy-acs-flow/src/map/header/MapSearch.jsx
index a4fd56f..de910c1 100644
--- a/zy-acs-flow/src/map/header/MapSearch.jsx
+++ b/zy-acs-flow/src/map/header/MapSearch.jsx
@@ -19,8 +19,8 @@
 const deviceTypeSelectOptionsFn = (translate) => {
     const deviceTypes = [
         { key: DEVICE_TYPE.SHELF, id: 'page.map.devices.shelf' },
-        { key: DEVICE_TYPE.STATION, id: 'page.map.devices.station' },
         { key: DEVICE_TYPE.AGV, id: 'page.map.devices.agv' },
+        { key: DEVICE_TYPE.STATION, id: 'page.map.devices.station' },
         { key: DEVICE_TYPE.POINT, id: 'page.map.devices.point' },
         // 娣诲姞鍏朵粬璁惧绫诲瀷
     ];
@@ -35,6 +35,7 @@
     const {
         mode,
         setMode,
+        dataFetched,
         curZone,
         setCurSprite,
         setSpriteSettings,
@@ -59,11 +60,10 @@
     };
 
     useEffect(() => {
-        if (!Tool.getMapContainer()) return;
-        setTimeout(() => {
+        if (dataFetched) {
             resetSearch();
-        }, 200);
-    }, [curDeviceType, curZone]);
+        }
+    }, [curDeviceType, dataFetched, curZone]);
 
     useEffect(() => {
         if (!Tool.getMapContainer()) return;
@@ -139,18 +139,21 @@
                 size="small"
                 options={filterDeviceList}
                 getOptionLabel={(option) => option.value}
-                renderOption={(props, option) => (
-                    <li {...props}>
-                        <Stack direction="row" justifyContent="space-between" width="100%">
-                            <Typography variant="body1" fontWeight="bold">
-                                {option.label}
-                            </Typography>
-                            <Typography variant="body2" color="text.secondary">
-                                {option.uuid}
-                            </Typography>
-                        </Stack>
-                    </li>
-                )}
+                renderOption={(props, option) => {
+                    const { key, ...otherProps } = props;
+                    return (
+                        <li key={Number(key)} {...otherProps}>
+                            <Stack direction="row" justifyContent="space-between" width="100%">
+                                <Typography variant="body1" fontWeight="bold">
+                                    {option.label}
+                                </Typography>
+                                <Typography variant="body2" color="text.secondary">
+                                    {option.uuid}
+                                </Typography>
+                            </Stack>
+                        </li>
+                    )
+                }}
                 renderInput={(params) => (
                     <TextField
                         {...params}
@@ -192,6 +195,7 @@
                 onInputChange={(event, newInputValue) => {
                     setInputValue(newInputValue);
                 }}
+                disableClearable
             />
         </Stack>
     );

--
Gitblit v1.9.1