From ca767633a3e8414661138720a68cc41a435a4afe Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 三月 2024 13:42:32 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/locales/en-US/map.ts | 4 ++++
zy-asrs-flow/src/pages/map/index.jsx | 15 +++------------
zy-asrs-flow/src/pages/map/utils.js | 26 +++++++++++++++++++++++++-
3 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/zy-asrs-flow/src/locales/en-US/map.ts b/zy-asrs-flow/src/locales/en-US/map.ts
index 0d081f4..47bc65e 100644
--- a/zy-asrs-flow/src/locales/en-US/map.ts
+++ b/zy-asrs-flow/src/locales/en-US/map.ts
@@ -9,6 +9,10 @@
'': '',
'': '',
'': '',
+ 'map.sensor.type.shelf': 'Shelf',
+ 'map.sensor.type.agv': 'Agv',
+ '': '',
+ '': '',
'': '',
'': '',
'': '',
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index a747e3b..cb16db0 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -64,6 +64,7 @@
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);
@@ -212,28 +213,18 @@
<Header className={styles.header}>
<Row style={{ height: '100%' }}>
<Col className={styles.headerCol} span={12} style={{}}>
-
<Select
className='map-header-select'
variant='filled'
- defaultValue="agv"
style={{
width: 160,
}}
size={'large'}
+ options={sensorTypeSelectOptions}
+ defaultValue={sensorTypeSelectOptions?.[0]?.value}
onChange={(value, option) => {
console.log(value, option);
}}
- options={[
- {
- value: 'agv',
- label: 'agv',
- },
- {
- value: 'crn',
- label: 'crn',
- },
- ]}
/>
<AutoComplete
className='map-header-select'
diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index a1ca052..61a231a 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -21,8 +21,8 @@
})
export const SENSOR_TYPE = Object.freeze({
- AGV: "AGV",
SHELF: "SHELF",
+ AGV: "AGV",
})
export const getRealPosition = (x, y, mapContainer) => {
@@ -248,4 +248,28 @@
} else {
return '';
}
+}
+
+export const sensorTypeSelectOptions = (intl) => {
+ let options = [];
+ Object.entries(SENSOR_TYPE).forEach(([key, value]) => {
+ switch (key) {
+ case SENSOR_TYPE.SHELF:
+ options.push({
+ value: value,
+ label: intl.formatMessage({ id: 'map.sensor.type.shelf', defaultMessage: '璐ф灦' })
+ })
+ break;
+ case SENSOR_TYPE.AGV:
+ options.push({
+ value: value,
+ label: intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: '鏃犱汉灏忚溅' })
+ })
+ break;
+ default:
+ break;
+ }
+
+ })
+ return options;
}
\ No newline at end of file
--
Gitblit v1.9.1