#
luxiaotao1123
2024-03-14 8c7e8d53afc8d652d94bc1b99c76970d7f961424
#
1个文件已修改
38 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/header/search.jsx 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/header/search.jsx
@@ -45,6 +45,19 @@
    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;
@@ -59,7 +72,7 @@
    useEffect(() => {
        const intervalID = setInterval(() => {
            if (!curSensorLabel) {
                let sensorListAll = updateSensorList();
                let sensorListAll = getAllSensorList(curSensorType);
                setSensorList(sensorListAll);
                setFilterSensorList(sensorListAll);
            }
@@ -70,10 +83,8 @@
    // 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);
@@ -81,26 +92,11 @@
    // 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 (
        <>