| | |
| | | const [filterSensorList, setFilterSensorList] = React.useState([]); |
| | | const [curSensorLabel, setCurSensorLabel] = React.useState(null); |
| | | |
| | | useEffect(() => { |
| | | const intervalID = setInterval(() => { |
| | | if (!curSensorLabel) { |
| | | let sensorListAll = getAllSensorList(curSensorType); |
| | | setSensorList(sensorListAll); |
| | | setFilterSensorList(sensorListAll); |
| | | } |
| | | }, 1000) |
| | | // useEffect(() => { |
| | | // const intervalID = setInterval(() => { |
| | | // if (!curSensorLabel) { |
| | | // let sensorListAll = getAllSensorList(curSensorType); |
| | | // setSensorList(sensorListAll); |
| | | // setFilterSensorList(sensorListAll); |
| | | // } |
| | | // }, 1000) |
| | | |
| | | return () => clearInterval(intervalID); |
| | | }, [props]); |
| | | // return () => clearInterval(intervalID); |
| | | // }, [props]); |
| | | |
| | | // first select |
| | | React.useEffect(() => { |
| | |
| | | // second select |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { return; } |
| | | if (sensorList && sensorList.length > 0) { |
| | | if (curSensorLabel && sensorList && sensorList.length > 0) { |
| | | setFilterSensorList(sensorList.filter(item => item.value.includes(curSensorLabel))); |
| | | } |
| | | }, [curSensorLabel]) |
| | |
| | | options={filterSensorList} |
| | | value={curSensorLabel} |
| | | onSelect={(value, option) => { |
| | | const uuid = option.label?.props?.children?.[1].props.children |
| | | const uuid = option.label?.props?.children?.[1].props.children; |
| | | setCurSensor(Utils.findSpriteByUuid(uuid)); |
| | | }} |
| | | onChange={setCurSensorLabel} |