From 790a8230d49ebc927e864a96afbd5607b9656e09 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 16 十月 2024 09:30:29 +0800
Subject: [PATCH] #

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

diff --git a/zy-acs-flow/src/map/header/MapSearch.jsx b/zy-acs-flow/src/map/header/MapSearch.jsx
index 3a866e5..0a80200 100644
--- a/zy-acs-flow/src/map/header/MapSearch.jsx
+++ b/zy-acs-flow/src/map/header/MapSearch.jsx
@@ -1,4 +1,3 @@
-// MapSearch.js
 import React, { useState, useEffect } from 'react';
 import {
     Select,
@@ -19,10 +18,10 @@
 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' },
-        // 娣诲姞鍏朵粬璁惧绫诲瀷
+        // ... other devices
     ];
 
     return deviceTypes.map(({ key, id }) => ({
@@ -35,8 +34,11 @@
     const {
         mode,
         setMode,
+        dataFetched,
         curZone,
+        curSprite,
         setCurSprite,
+        spriteSettings,
         setSpriteSettings,
     } = props;
 
@@ -59,11 +61,15 @@
     };
 
     useEffect(() => {
-        if (!Tool.getMapContainer()) return;
-        setTimeout(() => {
+        if (dataFetched) {
             resetSearch();
-        }, 200);
-    }, [curDeviceType, curZone]);
+        }
+    }, [curDeviceType, dataFetched, curZone]);
+
+    useEffect(() => {
+        console.log(1);
+
+    }, [curSprite, spriteSettings]);
 
     useEffect(() => {
         if (!Tool.getMapContainer()) return;
@@ -139,10 +145,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}
@@ -195,6 +201,7 @@
                 onInputChange={(event, newInputValue) => {
                     setInputValue(newInputValue);
                 }}
+                disableClearable
             />
         </Stack>
     );

--
Gitblit v1.9.1