From d0c05096374565228d277e93c56c55d10d93bd1b Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 30 Aug 2022 09:49:24 +0800
Subject: [PATCH] 地图模式返回,原页面显示当前农场

---
 src/views/land/cs.vue          |   11 ++++++++---
 src/components/map/plotMap.vue |    3 +--
 src/views/mapPattern/index.vue |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/components/map/plotMap.vue b/src/components/map/plotMap.vue
index 632c6b5..ec98f0f 100644
--- a/src/components/map/plotMap.vue
+++ b/src/components/map/plotMap.vue
@@ -242,7 +242,7 @@
                 position += `${item[0]}, ${item[1]};`
             })
 
-            console.log(position, 565656)
+            // console.log(position, 565656)
 
             const polyline = new global.DC.Polyline(position)
             polyline.setStyle({
@@ -323,7 +323,6 @@
                 that.drawLandPolyLine(positions)
             })
 
-            console.log(item, 123)
 
             plotRegionLayer.addOverlay(polygon)
             addPlotLayers.push({ center, name: item.landName, id: item.id })
diff --git a/src/views/land/cs.vue b/src/views/land/cs.vue
index aeede76..8a92b8e 100644
--- a/src/views/land/cs.vue
+++ b/src/views/land/cs.vue
@@ -143,14 +143,19 @@
     watch: {
         '$farmId': {
             handler (newName, oldName) {
-                this.farm.id = newName
+                // this.farm.id = newName
                 //地块页面
                 this.onLoad()
             }
         }
     },
     created () {
-        this.farm.id = this.$farmId
+        // this.farm.id = this.$farmId
+        this.$EventBus.$on('getFarmObj', (farmObj)=>{
+            this.$nextTick(() => {
+                this.$EventBus.$emit("setFarmId", farmObj.id);
+            });
+        })
         this.onLoad(this.page)
     },
     methods: {
@@ -204,7 +209,7 @@
             if (typeof (page) == "undefined") {
                 page = this.page
             }
-            Object.assign(params, { farmId: this.farm.id })
+            Object.assign(params, { farmId: this.$farmId })
             getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                 const data = res.data.data
                 this.page.total = data.total
diff --git a/src/views/mapPattern/index.vue b/src/views/mapPattern/index.vue
index a76b24d..ffa60d6 100644
--- a/src/views/mapPattern/index.vue
+++ b/src/views/mapPattern/index.vue
@@ -303,6 +303,7 @@
         },
         //返回上一页
         goToBack () {
+            this.$EventBus.$emit("getFarmObj", this.farmInfo);
             this.$router.go(-1)
         },
         //获取农场信息
@@ -355,7 +356,6 @@
             }
 
             if (this.$refs.showCP) {
-                console.log(1)
                 let isSelf = this.$refs.showCP.contains(e.target)
                 if (!isSelf) {
                     this.plotClickNum = 0

--
Gitblit v1.9.3