From 4d265afb3419bd5cedc6f31ab78d570f6917b520 Mon Sep 17 00:00:00 2001
From: seatonwan9 <seatonwan9@163.com>
Date: 星期五, 21 五月 2021 14:30:44 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop

---
 src/components/LayerController/modules/LcServiceLayer.vue |   41 ++++++++++++++++++++++++++++++-----------
 1 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/src/components/LayerController/modules/LcServiceLayer.vue b/src/components/LayerController/modules/LcServiceLayer.vue
index 7ec8aa9..ef7dc4d 100644
--- a/src/components/LayerController/modules/LcServiceLayer.vue
+++ b/src/components/LayerController/modules/LcServiceLayer.vue
@@ -40,6 +40,11 @@
 export default {
   name: 'LcServiceLayer',
   components: { LcServiceLayerFilter },
+  data () {
+    return {
+      changeList: []
+    }
+  },
   computed: {
     serviceLayers () {
       return this.$store.state.map.serviceLayers.LayerSewersLine
@@ -51,8 +56,18 @@
     swAllLayers (item) {
       // eslint-disable-next-line no-debugger
       item.checked = !item.checked
-      this.toggleLayer(item)
-      this.swLayers(item.layers, item.checked)
+      // this.toggleLayer(item)
+      if (item.layers && item.layers.length > 0) {
+        this.swLayers(item.layers, item.checked)
+        if (item.checked) {
+          window.layerFactory.showAll(this.changeList)
+        } else {
+          window.layerFactory.hideAll(this.changeList)
+        }
+        this.changeList = []
+      } else {
+        this.toggleLayer(item)
+      }
       this.serviceLayers.forEach(function (item1, index1) {
         if (item1.layers) {
           item1.istrue = 0
@@ -90,19 +105,23 @@
           } else {
             item1.type = 1 // 鍗婇��
           }
+          if (item1.name === '浼佷笟搴旀��') {
+            console.log(item1)
+            bus.$emit('changeSearchBar', item1)
+          }
           // console.log(item1.layers.length, item1.istrue, item1.isfalse, item1.type)
         }
       })
-      console.log(this.serviceLayers)
+      // console.log(this.serviceLayers)
     },
-    swLayers (layers, checked) {
-      if (layers) {
-        for (let i = 0, len = layers.length; i < len; ++i) {
-          var layer = layers[i]
-          layer.checked = checked
-          this.toggleLayer(layer)
-          if (layer.layers) {
-            this.swLayers(layer.layers, checked)
+    swLayers (configs, checked) {
+      if (configs) {
+        for (let i = 0, len = configs.length; i < len; ++i) {
+          var config = configs[i]
+          config.checked = checked
+          this.changeList.push(config)
+          if (config.layers) {
+            this.swLayers(config.layers, checked)
           }
         }
       }

--
Gitblit v1.8.0