From e20d96c28a7e1a40a593a8011a2080ce80cd8bf0 Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期三, 17 三月 2021 14:55:47 +0800
Subject: [PATCH] Merge branch 'master' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into master

---
 src/components/panel/ToolBoxPanel.vue |   60 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/components/panel/ToolBoxPanel.vue b/src/components/panel/ToolBoxPanel.vue
index 2fdb720..37a43a2 100644
--- a/src/components/panel/ToolBoxPanel.vue
+++ b/src/components/panel/ToolBoxPanel.vue
@@ -92,11 +92,6 @@
       isShow: true,
       currentBaseMapCode: 'tianditu_img',
       basemapList: [],
-      selectGroup: false,
-      drawLayer: null,
-      map: null,
-      active: -1,
-      Selecd: -1,
       menuList: [
         {
           icon: plot,
@@ -241,7 +236,14 @@
             }
           ]
         }
-      ]
+      ],
+      selectGroup: false,
+      drawLayer: null,
+      drawLayerArray: [],
+      map: null,
+      // L: window.L,
+      active: -1,
+      Selecd: -1
     }
   },
   computed: {
@@ -283,9 +285,6 @@
         console.log('鍙栨秷褰撳墠閫変腑鐘舵��')
       }
       this.active = index
-      if (this.drawLayer == null) {
-        this.drawLayer = this.L.layerGroup().addTo(this.map)
-      }
     },
     choiceItem (itemT, indexT) {
       this.Selecd = indexT
@@ -297,33 +296,34 @@
             iconAnchor: [13, 16],
             popupAnchor: [26, -32]
           })
-          var drawLayerMarker = this.map.editTools.startMarker()
-          drawLayerMarker.setIcon(myIcon)
-          this.drawLayer.addLayer(drawLayerMarker)
-          this.setLogic(drawLayerMarker)
+          this.drawLayer = this.map.editTools.startMarker()
+          this.drawLayer.setIcon(myIcon)
+          this.drawLayerArray.push(this.drawLayer)
           break
         case '绾挎爣缁�':
-          var drawLayerLine = this.map.editTools.startPolyline()
-          this.drawLayer.addLayer(drawLayerLine)
-          this.setLogic(drawLayerLine)
+          this.drawLayer = this.map.editTools.startPolyline()
+          this.drawLayerArray.push(this.drawLayer)
+          this.setLogic()
           break
         case '澶氳竟褰�':
-          var drawLayerPolygonD = this.map.editTools.startPolygon()
-          this.drawLayer.addLayer(drawLayerPolygonD)
-          this.setLogic(drawLayerPolygonD)
+          this.drawLayer = this.map.editTools.startPolygon()
+          this.drawLayerArray.push(this.drawLayer)
+          this.setLogic()
           break
         case '鐭╁舰':
-          var drawLayerPolygonJ = this.map.editTools.startRectangle()
-          this.drawLayer.addLayer(drawLayerPolygonJ)
-          this.setLogic(drawLayerPolygonJ)
+          this.drawLayer = this.map.editTools.startRectangle()
+          this.drawLayerArray.push(this.drawLayer)
+          this.setLogic()
           break
         case '鍦嗗舰':
-          var drawLayerPolygonY = this.map.editTools.startCircle()
-          this.drawLayer.addLayer(drawLayerPolygonY)
-          this.setLogic(drawLayerPolygonY)
+          this.drawLayer = this.map.editTools.startCircle()
+          this.drawLayerArray.push(this.drawLayer)
+          this.setLogic()
           break
         case '鍒犻櫎':
-          this.drawLayer.clearLayers()
+          for (let i = 0; i < this.drawLayerArray.length; i++) {
+            this.map.removeLayer(this.drawLayerArray[i])
+          }
           break
         case '娓呴櫎':
           Measure.clearMeasure(this.map, this.L)
@@ -364,10 +364,10 @@
           break
       }
     },
-    setLogic (layer) {
-      layer.on('dblclick', this.L.DomEvent.stop).on('dblclick', layer.toggleEdit)
-      layer.setStyle({
-        color: 'yellow'
+    setLogic () {
+      this.drawLayer.on('dblclick', this.L.DomEvent.stop).on('dblclick', this.drawLayer.toggleEdit)
+      this.drawLayer.setStyle({
+        color: 'red'
       })
     },
     changeSelect () {

--
Gitblit v1.8.0