From bd51480c21f012910e0516ade9595a345673004a Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期四, 29 四月 2021 15:07:04 +0800 Subject: [PATCH] wms全选BUG --- src/components/LayerController/service/WmsLayerService.js | 11 +++++------ src/conf/layers/LayerPipeLines.js | 2 +- src/Sgis.js | 4 ---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Sgis.js b/src/Sgis.js index d74d329..64977a5 100644 --- a/src/Sgis.js +++ b/src/Sgis.js @@ -28,10 +28,6 @@ const option = mapOption || MapConfig.mapOptions map = L.map(div, option) - map.on('click', (event, a, b) => { - console.log(event, a, b) - }) - // eventBus.$emit('map-obj', map) window.map = map diff --git a/src/components/LayerController/service/WmsLayerService.js b/src/components/LayerController/service/WmsLayerService.js index b286194..a303cc8 100644 --- a/src/components/LayerController/service/WmsLayerService.js +++ b/src/components/LayerController/service/WmsLayerService.js @@ -45,14 +45,13 @@ } add (config) { - const code = config.code - for (var k in this.layersConfig) { - if (code === k) { - return false + const wmsLayers = config.wmsLayers + if (wmsLayers) { + if (this.layers.indexOf(wmsLayers) < 0) { + this.layers.push(config.wmsLayers) + this.wmsLayer.setParams({ layers: this.layers.join(',') }) } } - this.layers.push(config.wmsLayers) - this.wmsLayer.setParams({ layers: this.layers.join(',') }) } remove (config) { diff --git a/src/conf/layers/LayerPipeLines.js b/src/conf/layers/LayerPipeLines.js index 4b4b345..a60e15b 100644 --- a/src/conf/layers/LayerPipeLines.js +++ b/src/conf/layers/LayerPipeLines.js @@ -35,7 +35,7 @@ name: '浜嬫晠姘寸嚎', sname: '浜嬫晠姘�', checked: false, - wmsLayers: 'sewer:pipeline_accident', + // wmsLayers: 'sewer:pipeline_accident', type: 0, minZoom: 13, wfs: WFS_URL + '?TYPENAME=浜嬫晠姘�' -- Gitblit v1.8.0