From 663efde2dead24239eec8d13d48883c8687006f7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 三月 2024 15:50:04 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx         |   11 ++++++++++-
 zy-asrs-flow/src/pages/map/header/search.jsx |   11 ++++-------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index 6d1a280..58c7045 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -5,7 +5,6 @@
     CloseOutlined
 } from '@ant-design/icons';
 import * as Utils from '../utils'
-import { values } from 'lodash';
 
 const renderTitle = (title, uuid) => (
     <>
@@ -29,6 +28,7 @@
 
 const MapSearch = (props) => {
     const intl = useIntl();
+    const { curSprite : curSensor, setCurSPrite: setCurSensor } = props;
 
     const sensorTypeSelectOptions = Utils.sensorTypeSelectOptions(intl);
 
@@ -36,7 +36,6 @@
     const [sensorList, setSensorList] = React.useState([]);
     const [curSensorUuid, setCurSensorUuid] = React.useState(null);
     const [curSensorLabel, setCurSensorLabel] = React.useState(null);
-    const [curSensor, setCurSensor] = React.useState(null);
 
     useEffect(() => {
         setSensorList([]);
@@ -72,12 +71,9 @@
     }, [curSensorType])
 
     React.useEffect(() => {
+        console.log(curSensorUuid);
         setCurSensor(Utils.findSpriteByUuid(curSensorUuid));
     }, [curSensorUuid])
-
-    React.useEffect(() => {
-        console.log(curSensor);
-    }, [curSensor])
 
     return (
         <>
@@ -119,11 +115,12 @@
                 onChange={(value) => {
                     setCurSensorLabel(value);
                     if (!value) {
+                        console.log(1);
                         setCurSensorUuid(null);
                         setCurSensorLabel(null);
                         setCurSensor(null);
                     } else {
-                        
+
                     }
                 }}
             />
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 727a660..c9dc708 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -66,6 +66,7 @@
     const mapRef = React.useRef();
     const contentRef = React.useRef();
 
+    const [curSprite, setCurSPrite] = React.useState(null);
     const [model, setModel] = React.useState(() => MapModel.OBSERVER_MODEL);
     const [deviceVisible, setDeviceVisible] = React.useState(false);
     const [settingsVisible, setSettingsVisible] = React.useState(false);
@@ -207,6 +208,10 @@
         // setSpriteBySettings(null);
     }
 
+    React.useEffect(() => {
+        console.log(curSprite);
+    }, curSprite);
+
     return (
         <>
             <Layout className={styles.layout}>
@@ -214,8 +219,12 @@
                     <Row style={{ height: '100%' }}>
                         <Col className={styles.headerCol} span={12} style={{}}>
                             <MapSearch
-
+                                curSprite={curSprite}
+                                setCurSPrite={setCurSPrite}
                             />
+                            <span>
+                                {curSprite?.data?.uuid}
+                            </span>
                         </Col>
                         {/* 3C40C6 */}
                         <Col span={12} style={{ backgroundColor: '#4a69bd' }}>

--
Gitblit v1.9.1