diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/BMapContainer/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/BMapContainer/index.vue index 12bf4e07..7d7fe926 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/BMapContainer/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/BMapContainer/index.vue @@ -41,7 +41,8 @@ export default { // ); // Vue.prototype.map2d = this.$refs.gisMap2d; Vue.prototype.mapIns = this.$refs.gisMap2d; - Vue.prototype.mapInsOpenLayers = [] + Vue.prototype.mapIsLoading = false; //判断是否正在加载 + Vue.prototype.mapLoadingData = []; //加载的数据 this.$emit("update:isGisCompleted", true); }, methods: { 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..2f868c7c 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 @@ -201,7 +201,6 @@ export default { if(this.mapContainer === 'AMapContainer'){ getMinMapLayers(); } - markerClusterIns.vroot = this.$root; markerClusterIns.mapContainer = this.mapContainer; this.$root.$on('delete-event', this.handleRefresh); 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 d3ce5953..253703c2 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 @@ -98,18 +98,23 @@ export class MarkerCluster { } async refreshLayer(){ + if(Vue.prototype.mapIsLoading === true){ + return; + } + Vue.prototype.mapIsLoading = true; const map2d = Vue.prototype.mapIns // map2d.addPointByArr( // {pointList:[]}, // 点位数据数组(按以下规范组装) // 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg // true // 当前新加图层是否启用聚合效果 // ); + console.log('执行remove') const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)) - try{ - console.log('执行remove') + if(Vue.prototype.mapLoadingData.length > 0){ map2d.removeLayerByName('jhlayers') - await sleep(2000) - } catch(e){} + Vue.prototype.mapLoadingData = [] + } + await sleep(1000) console.log('执行remove完毕') const aryPoints = []; this.data.forEach(e=>{ @@ -157,15 +162,16 @@ export class MarkerCluster { } }) if(aryPoints.length > 0){ - console.log('执行show') + Vue.prototype.mapLoadingData = aryPoints; map2d.addPointByArr( {pointList:aryPoints}, // 点位数据数组(按以下规范组装) 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg true // 当前新加图层是否启用聚合效果 ); - await sleep(2000) - console.log('执行show完毕',aryPoints,'点位数组') + await sleep(1000) + console.log('执行show完毕',aryPoints,'点位数组') + Vue.prototype.mapIsLoading = false } if(Vue.prototype.isMapStatck){ Vue.prototype.mapIns.pileIsShow("jhlayers", true);