| | |
| | | return options; |
| | | } |
| | | |
| | | function getAllSensorList(curSensorType) { |
| | | let sensorListAll = []; |
| | | Utils.getMapContainer().children.forEach(child => { |
| | | if (child?.data?.type === curSensorType && child?.data?.no) { |
| | | sensorListAll.push({ |
| | | value: child.data.no, |
| | | label: renderTitle(child.data.no, child.data.uuid) |
| | | }) |
| | | } |
| | | }); |
| | | return sensorListAll; |
| | | } |
| | | |
| | | const MapSearch = (props) => { |
| | | const intl = useIntl(); |
| | | const { curSprite: curSensor, setCurSPrite: setCurSensor } = props; |
| | |
| | | useEffect(() => { |
| | | const intervalID = setInterval(() => { |
| | | if (!curSensorLabel) { |
| | | let sensorListAll = updateSensorList(); |
| | | let sensorListAll = getAllSensorList(curSensorType); |
| | | setSensorList(sensorListAll); |
| | | setFilterSensorList(sensorListAll); |
| | | } |
| | |
| | | |
| | | // first select |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { |
| | | return |
| | | } |
| | | let sensorListAll = updateSensorList(); |
| | | if (!Utils.getMapContainer()) { return; } |
| | | let sensorListAll = getAllSensorList(curSensorType); |
| | | setSensorList(sensorListAll); |
| | | setFilterSensorList(sensorListAll); |
| | | setCurSensorLabel(null); |
| | |
| | | |
| | | // second select |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { |
| | | return |
| | | } |
| | | if (!Utils.getMapContainer()) { return; } |
| | | if (sensorList && sensorList.length > 0) { |
| | | setFilterSensorList(sensorList.filter(item => item.value.includes(curSensorLabel))); |
| | | } |
| | | }, [curSensorLabel]) |
| | | |
| | | function updateSensorList() { |
| | | let sensorListAll = []; |
| | | Utils.getMapContainer().children.forEach(child => { |
| | | if (child?.data?.type === curSensorType && child?.data?.no) { |
| | | sensorListAll.push({ |
| | | value: child.data.no, |
| | | label: renderTitle(child.data.no, child.data.uuid) |
| | | }) |
| | | } |
| | | }); |
| | | return sensorListAll; |
| | | } |
| | | |
| | | return ( |
| | | <> |