| | |
| | | |
| | | const MapSearch = (props) => { |
| | | const intl = useIntl(); |
| | | const { curSprite: curSensor, setCurSPrite: setCurSensor } = props; |
| | | const { |
| | | curSprite: curSensor, |
| | | setCurSPrite: setCurSensor, |
| | | setSpriteBySettings, |
| | | model, |
| | | setModel, |
| | | ModelEnum, |
| | | } = props; |
| | | |
| | | const sensorTypeSelectOptions = sensorTypeSelectOptionsFn(intl); |
| | | const [curSensorType, setCurSensorType] = React.useState(sensorTypeSelectOptions?.[0]?.value); |
| | |
| | | setFilterSensorList(sensorList.filter(item => item.value.includes(curSensorLabel))); |
| | | } |
| | | }, [curSensorLabel]) |
| | | |
| | | const onSecondSelect = (value, option) => { |
| | | const uuid = option.label?.props?.children?.[1].props.children; |
| | | const selectSensor = Utils.findSpriteByUuid(uuid); |
| | | if (selectSensor) { |
| | | Utils.beCenter(selectSensor); |
| | | } |
| | | switch (model) { |
| | | case ModelEnum.OBSERVER_MODEL: |
| | | setCurSensor(selectSensor); |
| | | break; |
| | | case ModelEnum.MOVABLE_MODEL: |
| | | setModel(ModelEnum.SETTINGS_MODEL); |
| | | setSpriteBySettings(selectSensor); |
| | | break; |
| | | case ModelEnum.SETTINGS_MODEL: |
| | | setSpriteBySettings(selectSensor); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | |
| | | popupMatchSelectWidth={500} |
| | | options={filterSensorList} |
| | | value={curSensorLabel} |
| | | onSelect={(value, option) => { |
| | | const uuid = option.label?.props?.children?.[1].props.children; |
| | | const selectSensor = Utils.findSpriteByUuid(uuid); |
| | | setCurSensor(selectSensor); |
| | | if (selectSensor) { |
| | | Utils.beCenter(selectSensor); |
| | | } |
| | | }} |
| | | onSelect={onSecondSelect} |
| | | onChange={setCurSensorLabel} |
| | | /> |
| | | </> |