#
luxiaotao1123
2024-03-15 7e34a8f7c50a8c2d546b31e5375073f2cc570318
zy-asrs-flow/src/pages/map/utils.js
@@ -316,7 +316,8 @@
    return options;
}
export const fetchMapData = async () => {
export const fetchMapData = async (intl) => {
    clearMapData();
    await Http.doPostPromise('api/map/list', {}, (res) => {
        const mapItemList = res.data.itemList;
        mapItemList.forEach(item => {
@@ -382,4 +383,26 @@
        closeLoading();
        console.error(error);
    })
}
export const clearMapData = (intl) => {
    if (!mapContainer) {
        return;
    }
    let childList = [];
    mapContainer.children.forEach(child => {
        if (child.data?.uuid) {
            childList.push(child);
        }
    })
    if (childList.length > 0) {
        childList.forEach(child => {
            mapContainer.removeChild(child);
            child.destroy({ children: true, texture: false, baseTexture: false });
        })
        childList.forEach((child, index) => {
            childList[index] = null;
        });
        childList = [];
    }
}