From 3157658523c787ec2a995252579829cd60f63261 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 三月 2024 14:27:38 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx         |   37 +-----------------
 zy-asrs-flow/src/pages/map/header/search.jsx |   68 ++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 35 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
new file mode 100644
index 0000000..3d2a7df
--- /dev/null
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -0,0 +1,68 @@
+import React, { useState, useRef, useEffect } from 'react';
+import { Layout, Button, Flex, Row, Col, FloatButton, Select, Spin, AutoComplete } from 'antd';
+import { FormattedMessage, useIntl, useModel } from '@umijs/max';
+import {
+    CloseOutlined
+} from '@ant-design/icons';
+import * as Utils from '../utils'
+
+const MapSearch = (props) => {
+    const intl = useIntl();
+
+    const sensorTypeSelectOptions = Utils.sensorTypeSelectOptions(intl);
+
+    const [curSensorType, setCurSensorType] = React.useState(sensorTypeSelectOptions?.[0]?.value);
+
+    useEffect(() => {
+    }, [props]);
+
+    React.useEffect(() => {
+        switch (curSensorType) {
+            case Utils.SENSOR_TYPE.SHELF:
+                break;
+            case Utils.SENSOR_TYPE.AGV:
+                break;
+            default:
+                break;
+        }
+    }, [curSensorType])
+
+    return (
+        <>
+            <Select
+                className='map-header-select'
+                variant='filled'
+                style={{
+                    width: 160,
+                }}
+                size={'large'}
+                options={sensorTypeSelectOptions}
+                value={curSensorType}
+                onChange={setCurSensorType}
+            />
+            <AutoComplete
+                className='map-header-select'
+                variant='filled'
+                style={{
+                    width: 360,
+                }}
+                size={'large'}
+                placeholder={intl.formatMessage({ id: 'common.search.placeholder', defaultMessage: '璇疯緭鍏ユ悳绱㈠唴瀹�' })}
+                allowClear={{
+                    clearIcon: <CloseOutlined />
+                }}
+                onSearch={() => { }}
+                options={[
+                    {
+                        value: 'text 1',
+                    },
+                    {
+                        value: 'text 2',
+                    },
+                ]}
+            />
+        </>
+    )
+}
+
+export default MapSearch;
\ No newline at end of file
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index a037c7a..727a660 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -16,6 +16,7 @@
 import Settings from './components/settings'
 import * as Utils from './utils'
 import Player from './player';
+import MapSearch from './header/search';
 import MapDrawer from './drawer';
 
 const useStyles = createStyles(({ token }) => {
@@ -64,7 +65,6 @@
     const { styles } = useStyles();
     const mapRef = React.useRef();
     const contentRef = React.useRef();
-    const sensorTypeSelectOptions = Utils.sensorTypeSelectOptions(intl);
 
     const [model, setModel] = React.useState(() => MapModel.OBSERVER_MODEL);
     const [deviceVisible, setDeviceVisible] = React.useState(false);
@@ -213,42 +213,9 @@
                 <Header className={styles.header}>
                     <Row style={{ height: '100%' }}>
                         <Col className={styles.headerCol} span={12} style={{}}>
-                            <Select
-                                className='map-header-select'
-                                variant='filled'
-                                style={{
-                                    width: 160,
-                                }}
-                                size={'large'}
-                                options={sensorTypeSelectOptions}
-                                defaultValue={sensorTypeSelectOptions?.[0]?.value}
-                                onChange={(value, option) => {
-                                    console.log(value, option);
-                                }}
-                            />
-                            <AutoComplete
-                                className='map-header-select'
-                                variant='filled'
-                                style={{
-                                    width: 360,
-                                }}
-                                size={'large'}
-                                placeholder={intl.formatMessage({ id: 'common.search.placeholder', defaultMessage: '璇疯緭鍏ユ悳绱㈠唴瀹�' })}
-                                allowClear={{
-                                    clearIcon: <CloseOutlined />
-                                }}
+                            <MapSearch
 
-                                onSearch={() => { }}
-                                options={[
-                                    {
-                                        value: 'text 1',
-                                    },
-                                    {
-                                        value: 'text 2',
-                                    },
-                                ]}
                             />
-
                         </Col>
                         {/* 3C40C6 */}
                         <Col span={12} style={{ backgroundColor: '#4a69bd' }}>

--
Gitblit v1.9.1