From be5de5e262e26901c31cfd35578a8c67ed218bdb Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 13 Sep 2022 10:25:06 +0800
Subject: [PATCH] 绘图提交之后隐藏按钮

---
 src/components/leafletDraw.vue |   13 ++++++++-----
 src/components/revampDraw.vue  |   16 ++++++++++------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/components/leafletDraw.vue b/src/components/leafletDraw.vue
index ae6a0a1..181907f 100644
--- a/src/components/leafletDraw.vue
+++ b/src/components/leafletDraw.vue
@@ -2,7 +2,7 @@
     <div ref="imageWrapper">
         <div class="btn-grounp">
             <button v-if="addShow" class="draw" @click="draw()">开始绘制</button>
-            <button v-if="!addShow" class="repeal" @click="repeal()">撤销</button>
+            <button v-if="!addShow&&repealShow" class="repeal" @click="repeal()">撤销</button>
             <button v-if="regionFull" class="save" @click="save()">保存</button>
         </div>
         <!-- <button class="disDraw" @click="disDraw()">关闭绘制</button> -->
@@ -24,6 +24,7 @@
             lng: "",
             lat: "",
             addShow: false,
+            repealShow:false,
 
             currentPolygons: [],
 
@@ -146,7 +147,7 @@
             this.complete.remove()
 
             this.addShow = true
-
+            this.repealShow = false
             this.regionFull = false
 
             // Object.values(this.map._layers).forEach(item => {
@@ -197,6 +198,8 @@
             var parmasObj = this.getUrlParams(str)
 
             if(parmasObj.status){//后台镜头移动
+                this.repealShow = false
+                this.regionFull = false
                 if(this.rectangleLayer.getBounds() != this.tempBounds){
                     if(this.map.getZoom()>16){
                         this.rectangleLayer.getBounds()._northEast.lng = this.rectangleLayer.getBounds()._northEast.lng+0.007
@@ -246,7 +249,7 @@
                         console.error('oops, something went wrong!', error)
                     }) 
                 }   
-            }, 1500);
+            }, 1000);
         },
 
         getUrlParams(urlParams) {
@@ -274,7 +277,7 @@
             this.map.on('pm:drawstart', ({ workingLayer }) => {
 
                 this.addShow = false
-
+                this.repealShow = false
                 that.rectangleLayer = workingLayer
 
                 console.log(workingLayer, 5465456)
@@ -291,7 +294,7 @@
             })
 
             this.map.on("pm:create", e => {
-
+                that.repealShow = true
                 that.regionFull = true
 
                 // 绘制坐标
diff --git a/src/components/revampDraw.vue b/src/components/revampDraw.vue
index e094cc3..f8085c0 100644
--- a/src/components/revampDraw.vue
+++ b/src/components/revampDraw.vue
@@ -1,7 +1,7 @@
 <template>
     <div ref="imageWrapper">
         <div class="btn-grounp">
-            <button v-if="addShow" class="draw" @click="draw()">重新绘制</button>
+            <button v-if="addShow&&rewrite" class="draw" @click="draw()">重新绘制</button>
             <button v-if="!addShow" class="repeal" @click="repeal()">撤销</button>
             <button v-if="regionFull" class="save" @click="save()">保存</button>
         </div>
@@ -38,6 +38,7 @@
             imgUrl: "",
             file: "",
             regionFull: false,
+            rewrite:false,
             tempBounds:""
         }
     },
@@ -48,6 +49,7 @@
             // 用户编辑
             this.addShow = true
             this.regionFull = true
+            this.rewrite = true
         } else {
             // 单纯展示
             this.addShow = false
@@ -248,7 +250,7 @@
             }
 
             this.regionFull = false
-
+            this.rewrite = false
             this.getlatLngs()
 
             this.map.pm.enableDraw("Polygon", {
@@ -279,7 +281,7 @@
 
             this.regionFull = false
 
-
+            this.rewrite = true
 
             // Object.values(this.map._layers).forEach(item => {
             //     if (item._leaflet_id == this.rectangleLayer._leaflet_id) {
@@ -326,6 +328,8 @@
             var parmasObj = this.getUrlParams(str)
 
             if(parmasObj.status){//后台镜头移动
+                this.rewrite = false
+                this.regionFull = false
                 if(this.polygonLayer){//编辑层
                     if(this.polygonLayer.getBounds() != this.tempBounds){
                     if(this.map.getZoom()>16){
@@ -401,7 +405,7 @@
                         console.error('oops, something went wrong!', error)
                     }) 
                 }   
-            }, 1100);
+            }, 1000);
 
             
 
@@ -450,7 +454,7 @@
             this.map.on('pm:drawstart', ({ workingLayer }) => {
 
                 this.addShow = false
-
+                this.rewrite = false
                 that.rectangleLayer = workingLayer
 
                 workingLayer.on('pm:vertexadded', e => {
@@ -468,7 +472,7 @@
 
                 that.addShow = true
                 that.regionFull = true
-
+                that.rewrite = true
                 // 绘制坐标
                 that.polygons = e.layer._latlngs[0]
 

--
Gitblit v1.9.3