| | |
| | | </> |
| | | ); |
| | | |
| | | const sensorTypeSelectOptionsFn = (intl) => { |
| | | let options = []; |
| | | Object.entries(Utils.SENSOR_TYPE).forEach(([key, value]) => { |
| | | switch (key) { |
| | | case Utils.SENSOR_TYPE.SHELF: |
| | | options.push({ |
| | | value: value, |
| | | label: |
| | | ( |
| | | <> |
| | | <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.shelf', defaultMessage: '货架' })}</span> |
| | | </> |
| | | ) |
| | | }) |
| | | break; |
| | | case Utils.SENSOR_TYPE.AGV: |
| | | options.push({ |
| | | value: value, |
| | | label: |
| | | ( |
| | | <> |
| | | <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: '无人小车' })}</span> |
| | | </> |
| | | ) |
| | | }) |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | }) |
| | | return options; |
| | | } |
| | | |
| | | const MapSearch = (props) => { |
| | | const intl = useIntl(); |
| | | const { curSprite: curSensor, setCurSPrite: setCurSensor } = props; |
| | | |
| | | const sensorTypeSelectOptions = Utils.sensorTypeSelectOptions(intl); |
| | | const sensorTypeSelectOptions = sensorTypeSelectOptionsFn(intl); |
| | | |
| | | const [curSensorType, setCurSensorType] = React.useState(sensorTypeSelectOptions?.[0]?.value); |
| | | const [sensorList, setSensorList] = React.useState([]); |