From 29a21acba5d4ae244871e131e408efdcd3a5a522 Mon Sep 17 00:00:00 2001 From: mbp <360013221@qq.com> Date: Thu, 17 Oct 2024 14:49:42 +0800 Subject: [PATCH] 333 --- .../Home/components/RoadAndEvents/index.vue | 1 + .../components/RoadAndEvents/utils/map.js | 7 +++-- .../views/JiHeExpressway/pages/Home/index.vue | 28 +++++++++++-------- ruoyi-ui/vue.config.js | 2 +- 4 files changed, 23 insertions(+), 15 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 2f868c7c..8c4a77c3 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,6 +201,7 @@ 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 41723323..9eba1809 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 @@ -48,7 +48,7 @@ export class MarkerCluster { infoWindow; mapContainer; data = []; //标注集合 - + vroot; constructor() {} getMap() { @@ -149,13 +149,16 @@ export class MarkerCluster { } }) if(aryPoints.length > 0){ - this.$root.$emit('refresh-gismap',pointsObj_new); + this.vroot.$emit('refresh-gismap',{pointList:aryPoints}); // map2d.addPointByArr( // pointsObj_new, // {pointList:aryPoints} 点位数据数组(按以下规范组装) // 'customLayer111', // jhlayers 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg // true // 当前新加图层是否启用聚合效果 // ); // console.log(aryPoints,'点位数组') + } else { + + Vue.prototype.mapIns.removeLayerByName('jhlayers222'); } // if(Vue.prototype.isMapStatck){ // Vue.prototype.mapIns.pileIsShow("jhlayers", true); diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue index d867002c..4a26d1b4 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/index.vue @@ -107,7 +107,7 @@ export default { mapBoxHeight: '100vh', mapZoom: '7.5', // 默认值'7.5' String类型 mapCenter: lnglat, //默认值[118.75, 36.46] Array类型 - + ttt:null }; }, provide() { @@ -135,15 +135,17 @@ export default { methods: { refreshLayer(layers){ console.log(layers,'更新图标') + //this.$refs.gisMap2d.addPointByArr( + // {pointList:[]}, // 点位数据数组(按以下规范组装) + // 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg + // true // 当前新加图层是否启用聚合效果 + //); + if(layers){ + this.ttt=layers; + } this.$refs.gisMap2d.addPointByArr( - {pointList:[]}, // 点位数据数组(按以下规范组装) - 'jhlayers', // 当前添加的数据 唯一标识(删除该图层时也会用到)//./事件专题/交通事故.svg - true // 当前新加图层是否启用聚合效果 - ); - this.$refs.gisMap2d.removeLayerByName('jhlayers'); - this.$refs.gisMap2d.addPointByArr( - layers, - "jhlayers", + pointsObj_new,//JSON.parse(JSON.stringify(layers)), + "jhlayers1111", true ); @@ -171,18 +173,19 @@ export default { }, bbbbb() { + console.log(this.ttt) this.$refs.gisMap2d.addPointByArr( // this.pointsObj, pointsObj_new, - "jhlayers", + "jhlayers1111", true ); }, ccccc() { - this.$refs.gisMap2d.removeLayerByName("jhlayers"); + this.$refs.gisMap2d.removeLayerByName("jhlayers1111"); }, ddddd() { - this.$refs.gisMap2d.pileIsShow("jhlayers", this.isShow); + this.$refs.gisMap2d.pileIsShow("jhlayers1111", this.isShow); // this.$refs.gisMap2d.pileIsShow("customLayer222", this.isShow); this.isShow = !this.isShow; }, @@ -376,6 +379,7 @@ export default { left: 5px; } .btnItem { + user-select: none; border: 1px #fff solid; padding: 3px; border-radius: 3px; diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index dc46ec67..6291d625 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -45,7 +45,7 @@ module.exports = { // target: `http://10.168.72.174:8087`, //赵祥龙 // target: `http://10.168.65.156:8097`, //孟凡峰 // target: `http://10.168.79.46:8089`, //王家宝 - target: `http://10.168.77.128:8087`, //王兴琳 + // target: `http://10.168.77.128:8087`, //王兴琳 changeOrigin: true, pathRewrite: { ["^" + process.env.VUE_APP_BASE_API]: "",