From 7e98976e49b810265924568a03df37cbf15bcaa8 Mon Sep 17 00:00:00 2001
From: zhangshuaibao <15731629597@163.com>
Date: 星期三, 17 三月 2021 18:02:48 +0800
Subject: [PATCH] Merge branch 'master' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork
---
src/components/panel/ToolBoxPanel.vue | 58 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/src/components/panel/ToolBoxPanel.vue b/src/components/panel/ToolBoxPanel.vue
index 8d942da..aaa5514 100644
--- a/src/components/panel/ToolBoxPanel.vue
+++ b/src/components/panel/ToolBoxPanel.vue
@@ -20,13 +20,13 @@
>
<el-button slot="reference" class="el-button" :class="active === index ? 'tools-panel-choose':''"
@click="changeChoose(index)">
- <img :src="item.iconSelecd" alt="" v-if="active === index"/>
+ <img :src="item.iconSelecd" alt="" v-if="active === index && checked === true"/>
<img :src="item.icon" alt="" v-else/>
<span>{{ item.label }}</span>
</el-button>
<el-button v-for="(itemT,indexT) in item.items" :key="indexT" @click="choiceItem(itemT,indexT)"
v-show="item.index!=='2'">
- <img :src="itemT.iconChoose" :title="itemT.title" v-if="Selecd === indexT"/>
+ <img :src="itemT.iconChoose" :title="itemT.title" v-if="Selecd === indexT && checked === true"/>
<img :src="itemT.icon" :title="itemT.title" v-else/>
</el-button>
<div class="base-map-inner-panel" v-show="!isShow&&item.index==='2'">
@@ -92,6 +92,8 @@
name: 'ToolBoxPanel',
data () {
return {
+ checked: false,
+ checkbuuton: -1,
isShow: true,
currentBaseMapCode: 'tianditu_img',
basemapList: [],
@@ -242,6 +244,7 @@
],
selectGroup: false,
drawLayer: null,
+ drawLayerArray: [],
map: null,
// L: window.L,
active: -1,
@@ -287,6 +290,16 @@
if (this.drawLayer == null) {
this.drawLayer = this.L.layerGroup().addTo(this.map)
}
+ if (this.checkbuuton === index) {
+ this.checked = !this.checked
+ } else {
+ if (this.checkbuuton === -1) {
+ this.checked = !this.checked
+ } else {
+ this.checked = true
+ }
+ }
+ this.checkbuuton = index
},
choiceItem (itemT, indexT) {
this.Selecd = indexT
@@ -298,33 +311,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)
@@ -365,9 +379,9 @@
break
}
},
- setLogic (layer) {
- layer.on('dblclick', this.L.DomEvent.stop).on('dblclick', layer.toggleEdit)
- layer.setStyle({
+ setLogic () {
+ this.drawLayer.on('dblclick', this.L.DomEvent.stop).on('dblclick', this.drawLayer.toggleEdit)
+ this.drawLayer.setStyle({
color: 'red'
})
},
--
Gitblit v1.8.0