From e1bd6ba743a490547ef768c80f158a10aadcb953 Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Tue, 02 Aug 2022 17:52:49 +0800
Subject: [PATCH] 地块详情添加采收和种植结束功能

---
 src/views/farmplant/farmplant.vue |   41 +++++++++++++++++++++++++++++++++++++++--
 src/views/land/LandDetail.vue     |    2 +-
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/views/farmplant/farmplant.vue b/src/views/farmplant/farmplant.vue
index 9da890a..2a4395d 100644
--- a/src/views/farmplant/farmplant.vue
+++ b/src/views/farmplant/farmplant.vue
@@ -30,6 +30,8 @@
                 >删 除</el-button>
             </template>
             <template slot-scope="{ type, size, row }" slot="menu">
+              <el-button icon="el-icon-check" :size="size" :type="type" @click="recovery(row)">采 收</el-button>
+              <el-button icon="el-icon-error" :size="size" :type="type" @click="over(row.id)">结 束</el-button>
                 <el-button
                     :type="type"
                     :size="size"
@@ -40,7 +42,10 @@
         </avue-crud>
         <!-- 检测报告 -->
         <detection v-if="detectionVisible" ref="detection"></detection>
+        <!-- 弹窗, 采收 -->
+        <recovery v-if="recoveryVisible" ref="recovery"></recovery>
     </basic-container>
+
 </template>
 
 <script>
@@ -49,8 +54,10 @@
 import { getLandList } from "@/api/land/land"
 import { mapGetters } from "vuex"
 import detection from "./detection.vue"
+import recovery from "../wel/recovery.vue"
 export default {
     components: {
+        recovery,
         detection
     },
     props: [
@@ -58,6 +65,7 @@
     ],
     data () {
         return {
+            recoveryVisible: false,
             detectionVisible: false,
             visible: true,
             form: {},
@@ -79,7 +87,7 @@
                 delBtn: true,
                 viewBtn: true,
                 header:false,
-                menuWidth: 280,
+                menuWidth: 580,
                 menuAlign: "center",
                 align: "center",
                 selection: true,
@@ -115,7 +123,6 @@
                         hide: true,
                         labelWidth: 110,
                         type: "tree",
-                        // dicUrl: `/api/strain/strain-tree?strainType=0`,
                         dicData: [],
                         props: {
                             label: "strainName",
@@ -715,6 +722,36 @@
                 this.$refs.detection.init(row.id)
             })
         },
+        //采收
+        recovery (data) {
+          this.recoveryVisible = true
+          this.$nextTick(() => {
+            this.$refs.recovery.init(data)
+          })
+        },
+        //结束种植
+        over (id) {
+            var that = this
+            that.$confirm("确定结束当前种植的农产品?", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            })
+            .then(() => {
+                const data = {
+                  id: id,
+                  status: 2,
+                }
+                return update(data)
+            })
+            .then(() => {
+                that.onLoad(this.page, this.query)
+                that.$message({
+                  type: "success",
+                  message: "操作成功!",
+                })
+            })
+        },
     },
 };
 </script>
diff --git a/src/views/land/LandDetail.vue b/src/views/land/LandDetail.vue
index 85ab848..1a3f86d 100644
--- a/src/views/land/LandDetail.vue
+++ b/src/views/land/LandDetail.vue
@@ -17,7 +17,7 @@
                     <el-button @click="btnGrounpShow = !btnGrounpShow" icon="el-icon-menu"></el-button>
 
                     <div v-show="btnGrounpShow" class="btn-grounp">
-                        <el-button @click="DelLand(delId)">删除地块</el-button>
+                        <el-button size="small" @click="DelLand(delId)">删除地块</el-button>
                         <el-button size="small" @click="land">编辑地块</el-button>
                     </div>
                 </div>

--
Gitblit v1.9.3