From b8ef6f8946de7dc00d9711eb6ba9d1aefe24cde1 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Wed, 31 Aug 2022 11:09:28 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhny_web

---
 src/views/wel/index.vue |   62 ++++++++++++++++++++++++++++---
 1 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/src/views/wel/index.vue b/src/views/wel/index.vue
index cf012de..6a05abb 100644
--- a/src/views/wel/index.vue
+++ b/src/views/wel/index.vue
@@ -53,8 +53,8 @@
                             </div>
                         </div>
                     </div>
-                    <div class="map-view">
-                        <img src="../../../public/img/map.png" />
+                    <div class="map-view" @click="goToMapModel">
+                        <img src="../../../public/img/map.png"  />
                         <div class="title">农场地图→</div>
                     </div>
                 </div>
@@ -74,6 +74,24 @@
                         <div class="btn">
                             <el-button plain size="small" @click="recovery(item)">
                                 <span style="color: #5abf78">采收</span>
+                            </el-button>
+                            <!-- <el-button plain size="small" @click="over(item.id)">结束</el-button> -->
+                            <el-button plain size="small" @click="over(item)">结束</el-button>
+                        </div>
+                    </div>
+                    <!-- 秧苗 -->
+                    <div class="farm" v-for="(item, index) in farmPlanListYM" :key="index">
+                        <div class="farm-img" @click="recoveryDetail(item)">
+                            <img :src="item.url" class="img" />
+                        </div>
+                        <div class="cai">{{ item.strainName }}(秧苗)</div>
+                        <div class="area">
+                            种植面积:
+                            <span>{{ item.area }}</span>亩
+                        </div>
+                        <div class="btn">
+                            <el-button plain size="small" @click="plant(item)">
+                                <span style="color: #5abf78">移栽</span>
                             </el-button>
                             <!-- <el-button plain size="small" @click="over(item.id)">结束</el-button> -->
                             <el-button plain size="small" @click="over(item)">结束</el-button>
@@ -184,7 +202,7 @@
 
 <script>
 import { mapGetters } from "vuex"
-import { getList, update,getStrainCount } from "@/api/farmplant/farmplant"
+import { getList, update,getStrainCount,getStrainCountYM } from "@/api/farmplant/farmplant"
 import { getFarmingCount, getFarmingStatis } from "@/api/farm/farmingrecord"
 import { selectCount } from "@/api/land/land"
 import { StockCount } from "@/api/stock/stock"
@@ -219,6 +237,7 @@
             total: 0,
             farmingCount: 0,
             farmPlanList: [],
+            farmPlanListYM:[],
             recoveryVisible: false,
             overVisible:false,
             landVisible: false,
@@ -235,6 +254,17 @@
         ...mapGetters(["userInfo","$farmId"]),
     },
   created () {
+                
+        this.$EventBus.$on('getFarmObj', (farmObj)=>{
+            // this.$nextTick(() => {
+            //     this.$EventBus.$emit("setFarmId", farmObj.id);
+            // });
+            setTimeout(() => {
+                this.$EventBus.$emit("setFarmId", farmObj.id);
+            }, 100);
+        })
+
+
         //初始化农场信息
         // let farmId = this.userInfo.$farmId
         this.farm.id = this.$farmId
@@ -248,12 +278,15 @@
         //本年农事操作记录,分组
         this.getFarmingStatis()
         this.StockCount()
+
     },
   watch: {
     '$farmId':{
       handler (newName, oldName) {
         this.farm.id = newName
-          //农场概览 地块使用率
+
+        setTimeout(() => {
+        //农场概览 地块使用率
         this.getCountStatis ()
         //本年农事操作记录
         this.getFarmingCount()
@@ -262,6 +295,8 @@
         this.StockCount()
         //当前农场种养品种
         this.onLoad()
+        }, 100);
+
       }
     }
   },
@@ -356,6 +391,14 @@
                     e.area = fixed.fixedNum(e.area)
                 })
             })
+
+            getStrainCountYM(1, 100, Object.assign(params)).then((res) => {
+                const data = res.data.data.records
+                this.farmPlanListYM = data
+                this.farmPlanListYM.forEach((e)=>{
+                    e.area = fixed.fixedNum(e.area)
+                })
+            })
         },
         //采收
         recovery (data) {
@@ -402,10 +445,10 @@
             })
         },
         //种植
-        plant () {
+        plant (item) {
             this.plantVisible = true
             this.$nextTick(() => {
-                this.$refs.plant.init()
+                this.$refs.plant.init(item)
             })
         },
         //农事操作
@@ -484,6 +527,13 @@
                 query: data,
             })
         },
+        //进入地图模式
+        goToMapModel () {
+            this.$router.push({
+                path: `/mapPattern`,
+                // query: row,
+            })
+        }
     },
 };
 </script>

--
Gitblit v1.9.3