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/plant.vue |   57 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/src/views/wel/plant.vue b/src/views/wel/plant.vue
index 0c07615..2722cdc 100644
--- a/src/views/wel/plant.vue
+++ b/src/views/wel/plant.vue
@@ -15,9 +15,9 @@
 <script>
 
 import { mapState } from "vuex";
-import { getLandList } from "@/api/land/land";
+import { getLandList,getLandListNoPage } from "@/api/land/land";
 import { getStrainList } from "@/api/farmplant/strain";
-import { save } from "@/api/farmplant/farmplant";
+import { save,getList } from "@/api/farmplant/farmplant";
 import { getFarmList } from "../../api/farm/farm";
 export default {
   data() {
@@ -30,7 +30,7 @@
         gutter: 30,
         column: [
           {
-            label: "品种",
+            label: "种类",
             prop: "strainId",
             labelWidth:110,
             type:"tree",
@@ -48,7 +48,7 @@
             ],
           },
           {
-            label: "品种描述",
+            label: "品种",
             prop: "varieties",
             labelWidth:110,
             // rules: [
@@ -170,7 +170,7 @@
               },
             ],
           },
-                    {
+          {
             label: "秧苗来源农场",
             prop: "farmId",
             type: "tree",
@@ -296,9 +296,8 @@
     }),
   },
   watch: {
-  "form.plantingWay": {
+    "form.plantingWay": {
       handler(val) {
-        console.log("plantingWay",val)
         var farmColumn = this.findObject(this.option.column,"farmId")
         var landColumn = this.findObject(this.option.column,"otherLandId")
         if(val != 0 ){
@@ -312,6 +311,19 @@
       },
       immediate: true,
     },
+    "$farmId":{
+      handler(val){
+        this.form.farmId = this.$farmId
+        //获取农地数据
+        getLandList(this.$farmId).then((res)=>{
+            if(res.data.code==200){
+              var landIdcolumn = this.findObject(this.option.column,"landId");
+              this.landList = res.data.data;
+              landIdcolumn.dicData = res.data.data;
+            }
+        })
+      }
+    }
   },
   methods: {
     //计算当前时间
@@ -330,7 +342,7 @@
         //秒 getSeconds():(0 ~ 59)
         var second = date.getSeconds();
         //赋值
-        this.form['time'] = year + '-'
+        this.form['transplanTime'] = year + '-'
                           + this.addZero(month) + '-'
                           + this.addZero(day) + ' '
                           + this.addZero(hour) + ':'
@@ -341,12 +353,37 @@
       return s < 10 ? ('0' + s) : s;
     },
     //初始化
-    init() {
+    init(item) {
+      var that = this;
       this.form['operator'] = this.userInfo.user_id;
       //计算当前时间
       this.getNowTime();
+      var strainColumn = that.findObject(that.option.column,"strainId");
+      var otherLandColumn = that.findObject(that.option.column,"otherLandId");
+      if(item.strainId){
+        that.form.strainId = item.strainId
+        strainColumn.disabled = true
+        
+      }else{
+        strainColumn.disabled = false
+        that.form.farmId = that.$farmId
+      }
+      var params = {}
+        params['tenantId'] = this.userInfo.tenant_id
+        params['farmId'] = this.$farmId
+        params['strainId'] = item.strainId
+        // params['plantingWay'] = "2"
+        getLandListNoPage(params).then((res)=>{
+          var landArr = []
+          res.data.data.forEach(e => {
+            landArr.push({
+              id:e.landId,
+              landName:e.landName
+            })
+          });
+          otherLandColumn.dicData = landArr
+        })
       this.visible = true;
-      var that = this;
       //获取农地数据
       getLandList(this.$farmId).then((res)=>{
           if(res.data.code==200){

--
Gitblit v1.9.3