From 58a99842d2eedb136d85987ceaf4e491881d02b9 Mon Sep 17 00:00:00 2001 From: little4 <360013221@qq.com> Date: Thu, 17 Oct 2024 16:54:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/components/RoadAndEvents/index.vue | 9 ++++++++- .../Home/components/RoadAndEvents/utils/map.js | 16 ++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) 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() {