From 082613d446e29e4ec1c16bfaa52345106a498b23 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 08 Nov 2022 09:03:49 +0800
Subject: [PATCH] 农事操作隐藏后四个,地图模式2d改为3d

---
 src/views/mapPattern/index.vue |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/views/mapPattern/index.vue b/src/views/mapPattern/index.vue
index 6d67a3e..d178ba1 100644
--- a/src/views/mapPattern/index.vue
+++ b/src/views/mapPattern/index.vue
@@ -199,9 +199,17 @@
 
     },
     computed: {
-        ...mapGetters(["userInfo","$farmId"]),
+        ...mapGetters(["userInfo", "$farmId"]),
     },
     created () {
+        if (this.$farmId == 0){
+          if (sessionStorage.getItem("myFarmId")){
+            this.$store.commit("SET_FARMID",JSON.parse(sessionStorage.getItem("myFarmId")))
+          }
+        }
+        window.addEventListener('beforeunload', () => {
+          sessionStorage.setItem('myFarmId', JSON.stringify(this.$farmId))
+        })
         //获取种样品列表
         this.getFarmPlantList(this.page)
         //获取地块列表
@@ -255,8 +263,11 @@
                     }
                 })
 
-                this.plotPlantBreed = arr
+                arr.forEach((e)=>{
+                    e.area = e.area.toFixed(3)
+                })
 
+                this.plotPlantBreed = arr
 
                 this.loading = false
 
@@ -267,6 +278,7 @@
         },
         //获取地块列表
         getLandList (page, params = {}) {
+          const that = this
             params['farmId'] = this.$farmId
             params['tenantId'] = this.userInfo.tenant_id
             this.loading = true
@@ -287,8 +299,7 @@
                         arr.forEach(it => {
                             brr.push(it.split(' '))
                         })
-
-                        this.$refs.plotMap.addPlotPolygon(brr, item)
+                      that.$refs.plotMap.addPlotPolygon(brr, item)
                     }
                 })
 
@@ -300,6 +311,7 @@
         },
         //返回上一页
         goToBack () {
+            this.$EventBus.$emit("getFarmObj", this.farmInfo);
             this.$router.go(-1)
         },
         //获取农场信息
@@ -318,20 +330,19 @@
         //获取地块轮廓统计信息
         getLandIsAreaStatistic () {
             getLandIsAreaStatistic(this.$farmId).then(res => {
-                console.log(res)
                 this.landIsAreaStatistic = res.data.data
             })
         },
 
         // 地块定位
         setCenter (item) {
+            console.log(item)
             this.$refs.plotMap.setPlotCenter(item)
         },
 
         plotDetailsPopupShow (params) {
             this.currentPlotDetails = params
             this.currentPlotName = params.landName
-
             let arr = []
 
             this.farmPlantList.forEach((item, index) => {
@@ -352,7 +363,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