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 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

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) {

--
Gitblit v1.8.0