diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue index 8c4a77c3..05b6bc7c 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue @@ -166,7 +166,14 @@ export default { isGisCompleted: { async handler(bool) { if (!bool) return; - await Promise.allSettled((this.tabContentData || []).map(item => this.handleDeviceImmediate(item, true))) + const list = await Promise.allSettled((this.tabContentData || [])) + function sleep(time){ + return new Promise((resolve) => setTimeout(resolve, time)); + } + for(let item of list) { + this.handleDeviceImmediate(item, true) + await sleep(500) + } // Object.keys(lngLatMap).forEach(key => { // addInGraphHandle(lngLatMap[key]); // }); diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js index 16ae3251..74438614 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js @@ -135,8 +135,8 @@ export class MarkerCluster { Vue.prototype.mapIns.removeLayerByName(id); } - removeData(_id, data) { - data.forEach((item, index) => { + removeData(_id, _data) { + _data.forEach((item, index) => { const findIndex = this.data.findIndex( (removeData) => removeData === item ); @@ -163,11 +163,15 @@ export class MarkerCluster { } if (findIndex > -1) this.data.splice(findIndex, 1); }); + console.log('remove',_id,_data) Vue.prototype.mapIns.removeLayerByName(_id); - const self = this; - setTimeout(() => { - self.refreshLayer(_id, _data); - }, 500); + if(_data && Array.isArray(_data) && _data.length > 0){ + const self = this; + setTimeout(() => { + self.refreshLayer(_id, _data); + }, 500); + } + } clear() {