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 4d0a9c7b..41723323 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 @@ -103,13 +103,6 @@ export class MarkerCluster { } refreshLayer(){ - const map2d = Vue.prototype.mapIns - // map2d.addPointByArr( - // {pointList:[]}, // 点位数据数组(按以下规范组装) - // 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg - // true // 当前新加图层是否启用聚合效果 - // ); - // map2d.removeLayerByName('jhlayers') const aryPoints = []; this.data.forEach(e=>{ if(e.lnglat){ @@ -155,12 +148,13 @@ export class MarkerCluster { }) } }) - if(aryPoints.length > 0){ - map2d.addPointByArr( - pointsObj_new, // {pointList:aryPoints} 点位数据数组(按以下规范组装) - 'customLayer111', // jhlayers 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg - true // 当前新加图层是否启用聚合效果 - ); + if(aryPoints.length > 0){ + this.$root.$emit('refresh-gismap',pointsObj_new); + // map2d.addPointByArr( + // pointsObj_new, // {pointList:aryPoints} 点位数据数组(按以下规范组装) + // 'customLayer111', // jhlayers 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg + // true // 当前新加图层是否启用聚合效果 + // ); // console.log(aryPoints,'点位数组') } // if(Vue.prototype.isMapStatck){ diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue index 8e6e23bc..d867002c 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue @@ -129,8 +129,25 @@ export default { // Vue.prototype.map2d = this.$refs.gisMap2d; Vue.prototype.mapIns = this.$refs.gisMap2d; this.isGisCompleted = true; + + this.$root.$on('refresh-gismap', this.refreshLayer); }, methods: { + refreshLayer(layers){ + console.log(layers,'更新图标') + this.$refs.gisMap2d.addPointByArr( + {pointList:[]}, // 点位数据数组(按以下规范组装) + 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg + true // 当前新加图层是否启用聚合效果 + ); + this.$refs.gisMap2d.removeLayerByName('jhlayers'); + this.$refs.gisMap2d.addPointByArr( + layers, + "jhlayers", + true + ); + + }, debug(){ this.$refs.Thumbnail.debug() }, @@ -157,15 +174,15 @@ export default { this.$refs.gisMap2d.addPointByArr( // this.pointsObj, pointsObj_new, - "customLayer111", + "jhlayers", true ); }, ccccc() { - this.$refs.gisMap2d.removeLayerByName("customLayer111"); + this.$refs.gisMap2d.removeLayerByName("jhlayers"); }, ddddd() { - this.$refs.gisMap2d.pileIsShow("customLayer111", this.isShow); + this.$refs.gisMap2d.pileIsShow("jhlayers", this.isShow); // this.$refs.gisMap2d.pileIsShow("customLayer222", this.isShow); this.isShow = !this.isShow; },