From 7d8e4eccb1ada1eea39ea34c68481179fa5b3d42 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Wed, 31 Aug 2022 15:43:46 +0800
Subject: [PATCH] 农场地块添加秧苗

---
 src/views/farm/index.vue      |   38 ++++++++++++++++++++++++++++++++++----
 src/api/farm/farmingrecord.js |   11 +++++++++++
 2 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/api/farm/farmingrecord.js b/src/api/farm/farmingrecord.js
index 08197d3..d8cdb5b 100644
--- a/src/api/farm/farmingrecord.js
+++ b/src/api/farm/farmingrecord.js
@@ -53,6 +53,17 @@
     })
 }
 
+// 获取种植记录(秧苗)
+export const getFarmPlantYMList = (params) => {
+    return request({
+        url: '/farmPlant/getFarmPlantYMList',
+        method: 'get',
+        params: {
+            ...params
+        }
+    })
+}
+
 export const remove = (ids) => {
     return request({
         url: '/farmingRecord/remove',
diff --git a/src/views/farm/index.vue b/src/views/farm/index.vue
index 8d306a9..fb40dcd 100644
--- a/src/views/farm/index.vue
+++ b/src/views/farm/index.vue
@@ -127,6 +127,17 @@
                         <span>{{item.landUnit == 0 ? '亩' : item.landUnit == 1 ? '分' : '平方米'}}</span>
                     </div>
                 </div>
+
+                <div v-for="(item, index) in farmPlantYMList" :key="'farmPlantYMList'+index">
+                    <div class="title">
+                        <img :src="item.url" alt />
+                        {{item.strainName}}
+                    </div>
+                    <div class="num-unit">
+                        {{item.area}}
+                        <span>{{item.landUnit == 0 ? '亩' : item.landUnit == 1 ? '分' : '平方米'}}</span>
+                    </div>
+                </div>
             </div>
 
             <div v-show="zydksb == 'dk'" class="lists-box dk">
@@ -316,7 +327,7 @@
                             <div class="title">{{item.strainName}}</div>
                             <div
                                 class="time"
-                            >{{item.createTime}} {{item.plantingWay == 0 ? '移摘' : item.plantingWay == 1 ? '直播' : '秧苗'}}</div>
+                            >{{item.createTime}} {{item.plantingWay == 0 ? '移栽' : item.plantingWay == 1 ? '直播' : '秧苗'}}</div>
                         </div>
                     </div>
                 </div>
@@ -545,7 +556,8 @@
 import {
     getLandList,
     getFarmingRecordList,
-    getFarmPlantList
+    getFarmPlantList,
+    getFarmPlantYMList
 } from '@/api/farm/farmingrecord'
 import dateUtils from '@/utils/dateUtils'
 import { getStationDateByStcd, queryEquipmentList } from '@/api/equipment/equipment'
@@ -565,6 +577,7 @@
             sourceList: [],
             farmRecordList: [],
             farmPlantList: [],
+            farmPlantYMList:[],
             plotLists: [],
             // 溯源码编号
             sourceCode: '',
@@ -601,6 +614,7 @@
             this.getSourceList({ code: '' })
             this.getFarmingRecordList()
             this.getFarmPlantList()
+            this.getFarmPlantYMList()
             this.getLandList()
             this.getStationAndVideo()
         })
@@ -633,10 +647,18 @@
             this.currentClickPlot = params
             this.plotDetailsPlantList = []
             this.plotDetailsRecordList = []
-            getFarmPlantList({ farmId: this.currentDetails.id, landId: params.id }).then(res => {
+            getFarmPlantList({ farmId: this.currentDetails.id, landId: params.id,status:1 }).then(res => {
                 this.plotDetailsPlantList = res.data.data
-            })
 
+                getFarmPlantYMList({ farmId: this.currentDetails.id, landId: params.id,status:1  }).then(res => {
+                    // res.data.data.forEach((e)=>{
+                    //     e.strainName = e.strainName+"("+"秧苗"+")"
+                    // })
+                    res.data.data.forEach((e)=>{
+                        this.plotDetailsPlantList.push(e)
+                    })
+                })
+            })
             getFarmingRecordList({ farmId: this.currentDetails.id, landId: params.id }).then(res => {
                 this.plotDetailsRecordList = res.data.data
             })
@@ -704,6 +726,14 @@
             })
         },
 
+        getFarmPlantYMList(){
+            getFarmPlantYMList({ farmId: this.currentDetails.id, status: 1 }).then(res => {
+                res.data.data.forEach((e)=>{
+                    e.strainName = e.strainName+"("+"秧苗"+")"
+                })
+                this.farmPlantYMList = res.data.data
+            })
+        },
         getLandList () {
             getLandList({ farmId: this.currentDetails.id }).then(res => {
                 res.data.data.forEach(item => {

--
Gitblit v1.9.3