From eb7ced97c1a12d49a09ec4a876082644fcc357a6 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 12 Aug 2022 17:58:07 +0800
Subject: [PATCH] 农事记录、农资使用记录、采收记录、任务记录、农事操作的地块筛选,有列表显示的随农场变化,

---
 src/views/farm/stockUseInfo.vue            |   25 +++++++-
 src/views/wel/farming.vue                  |    3 
 src/api/task/task.js                       |    2 
 src/views/traceability/addTraceability.vue |    7 +-
 src/views/farm/farmingrecord.vue           |   22 ++++++-
 src/views/farmplant/farmplant.vue          |   21 ++++++-
 src/views/recovery/recovery.vue            |   22 ++++++-
 src/views/task/task.vue                    |   19 +++++
 8 files changed, 100 insertions(+), 21 deletions(-)

diff --git a/src/api/task/task.js b/src/api/task/task.js
index 1474ba0..7ae8984 100644
--- a/src/api/task/task.js
+++ b/src/api/task/task.js
@@ -2,7 +2,7 @@
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/task/task/list',
+    url: '/api/task/task/page',
     method: 'get',
     params: {
       ...params,
diff --git a/src/views/farm/farmingrecord.vue b/src/views/farm/farmingrecord.vue
index f911ce4..0069e9f 100644
--- a/src/views/farm/farmingrecord.vue
+++ b/src/views/farm/farmingrecord.vue
@@ -264,13 +264,27 @@
                 }
             },
             immediate: true,
+        },
+        '$farmId':{
+            handler (newName, oldName) {
+                //获取农地数据
+                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
+                    }
+                })
+                this.query={}
+                this.onLoad(this.page)
+            }
         }
     },
     created () {
         this.initData()
     },
     computed: {
-        ...mapGetters(["permission", "userInfo"]),
+        ...mapGetters(["permission", "userInfo","$farmId"]),
         // permissionList() {
         //   return {
         //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -286,7 +300,7 @@
             })
             return ids.join(",")
         },
-    },
+    },   
     mounted () {
     },
     methods: {
@@ -297,7 +311,7 @@
         initData () {
             var that = this
             //获取农地数据
-            getLandList(this.userInfo.dept_id).then((res) => {
+            getLandList(this.$farmId).then((res) => {
                 if (res.data.code == 200) {
                     var landIdcolumn = that.findObject(that.option.column, "landId")
                     that.landList = res.data.data
@@ -435,7 +449,7 @@
             var datas = this.$route.query.id
             params.landId = datas
             params['tenantId'] = this.userInfo.tenant_id
-            params['deptId'] = this.userInfo.dept_id
+            params['farmId'] = this.$farmId
             if (this.landId) {
                 params['landId'] = this.landId
             }
diff --git a/src/views/farm/stockUseInfo.vue b/src/views/farm/stockUseInfo.vue
index 27ec78a..5f93b3a 100644
--- a/src/views/farm/stockUseInfo.vue
+++ b/src/views/farm/stockUseInfo.vue
@@ -133,7 +133,7 @@
         this.initData()
     },
     computed: {
-        ...mapGetters(["permission", "userInfo"]),
+        ...mapGetters(["permission", "userInfo","$farmId"]),
         ids () {
             let ids = []
             this.selectionList.forEach((ele) => {
@@ -142,6 +142,22 @@
             return ids.join(",")
         },
     },
+    watch:{
+        '$farmId':{
+            handler (newName, oldName) {
+                //获取农地数据
+                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
+                    }
+                })
+                this.query={}
+                this.onLoad(this.page)
+            }
+        }
+    },    
     mounted () {
     },
     methods: {
@@ -152,14 +168,13 @@
         initData () {
             var that = this
             //获取农地地块数据
-            getLandList(this.userInfo.dept_id).then((res) => {
+            getLandList(this.$farmId).then((res) => {
                 if (res.data.code == 200) {
                     var landIdcolumn = that.findObject(that.option.column, "landId")
                     that.landList = res.data.data
                     landIdcolumn.dicData = res.data.data
                 }
             })
-
         },
         beforeOpen (done, type) {
             if (["edit", "view"].includes(type)) {
@@ -196,11 +211,13 @@
             this.onLoad(this.page, this.query)
         },
         onLoad (page, params = {}) {
+            console.log(params)
             this.loading = true
             var datas = this.$route.query.id
             params.landId = datas
             params['tenantId'] = this.userInfo.tenant_id
-            params['deptId'] = this.userInfo.dept_id
+            params['farmId'] = this.$farmId
+            console.log(params)
             if (this.landId) {
                 params['landId'] = this.landId
             }
diff --git a/src/views/farmplant/farmplant.vue b/src/views/farmplant/farmplant.vue
index 3aa41ab..4227534 100644
--- a/src/views/farmplant/farmplant.vue
+++ b/src/views/farmplant/farmplant.vue
@@ -452,6 +452,20 @@
         }
     },
     watch: {
+        '$farmId':{
+            handler (newName, oldName) {
+                //获取农地数据
+                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
+                    }
+                })
+                this.query={}
+                this.onLoad(this.page)
+            }
+        }
         // "form.farmType": {
         //   handler(val) {
         //     var splantcolumn = this.findObject(this.option.column,"plant");
@@ -565,6 +579,7 @@
         //   },
         //   immediate: true
         // },
+
     },
     mounted () {
         if (this.activeName == "tab1") {
@@ -575,7 +590,7 @@
         this.initData()
     },
     computed: {
-        ...mapGetters(["permission", "userInfo"]),
+        ...mapGetters(["permission", "userInfo","$farmId"]),
         // permissionList() {
         //   return {
         //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -597,7 +612,7 @@
         initData () {
             var that = this
             //获取农地数据
-            getLandList(this.userInfo.dept_id).then((res) => {
+            getLandList(this.$farmId).then((res) => {
                 if (res.data.code == 200) {
                     var landIdcolumn = that.findObject(that.option.column, "landId")
                     that.landList = res.data.data
@@ -729,7 +744,7 @@
               params['landId'] = this.landId
             }
             params['tenantId'] = this.userInfo.tenant_id
-            params['deptId'] = this.userInfo.dept_id
+            params['farmId'] = this.$farmId
             this.loading = true
             getList(
                 page.currentPage,
diff --git a/src/views/recovery/recovery.vue b/src/views/recovery/recovery.vue
index 6b59b0a..e6b9f84 100644
--- a/src/views/recovery/recovery.vue
+++ b/src/views/recovery/recovery.vue
@@ -272,7 +272,7 @@
         }
     },
     computed: {
-        ...mapGetters(["permission", "userInfo"]),
+        ...mapGetters(["permission", "userInfo","$farmId"]),
         // permissionList() {
         //   return {
         //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -289,13 +289,29 @@
             return ids.join(",")
         },
     },
+    watch:{
+        '$farmId':{
+            handler (newName, oldName) {
+                //获取农地数据
+                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
+                    }
+                })
+                this.query={}
+                this.onLoad(this.page)
+            }
+        }
+    },
     mounted () { },
     methods: {
         //初始化数据
         initData () {
             var that = this
             //获取农地数据
-            getLandList(this.userInfo.dept_id).then((res) => {
+            getLandList(this.$farmId).then((res) => {
                 if (res.data.code == 200) {
                     var landIdcolumn = that.findObject(that.option.column, "landId")
                     that.landList = res.data.data
@@ -438,7 +454,7 @@
               params['landId'] = this.landId
             }
             params['tenantId'] = this.userInfo.tenant_id
-            params['deptId'] = this.userInfo.dept_id
+            params['farmId'] = this.$farmId
             this.loading = true
             getList(
                 page.currentPage,
diff --git a/src/views/task/task.vue b/src/views/task/task.vue
index 9bdf61e..19fb4bc 100644
--- a/src/views/task/task.vue
+++ b/src/views/task/task.vue
@@ -553,7 +553,7 @@
     this.initData();
   },
   computed: {
-    ...mapGetters(["permission", "userInfo"]),
+    ...mapGetters(["permission", "userInfo","$farmId"]),
     permissionList() {
       return {
         addBtn: this.vaildData(this.permission.task_add, false),
@@ -583,6 +583,20 @@
       },
       immediate: true,
     },
+      '$farmId':{
+      handler (newName, oldName) {
+          //获取农地数据
+          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
+              }
+          })
+          this.query={}
+          this.onLoad(this.page)
+      }
+    }
   },
   methods: {
     //入库
@@ -630,7 +644,7 @@
     initData() {
       var that = this;
       //获取农地数据
-      getLandList(this.userInfo.dept_id).then((res) => {
+      getLandList(this.$farmId).then((res) => {
         if (res.data.code == 200) {
           var landIdcolumn = that.findObject(that.option.column, "landId");
           that.landList = res.data.data;
@@ -745,6 +759,7 @@
     },
     onLoad(page, params = {}) {
       this.loading = true;
+      params["farmId"] = this.$farmId
       getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
         const data = res.data.data;
         this.page.total = data.total;
diff --git a/src/views/traceability/addTraceability.vue b/src/views/traceability/addTraceability.vue
index a95d189..807500e 100644
--- a/src/views/traceability/addTraceability.vue
+++ b/src/views/traceability/addTraceability.vue
@@ -29,7 +29,7 @@
                 <div style="width: 65%; float: left; font-size: 12px">
                   <div style="margin-top: 5px">
                     <input type="radio" v-model="radio" value="1" />
-                    不使用禁用农药兽药、停用兽药和非法添加物
+                    男不使用禁用农药兽药、停用兽药和非法添加物
                   </div>
                   <div style="margin-top: 3px">
                     <input type="radio" v-model="radio" value="1" />
@@ -438,7 +438,7 @@
     submit() {
       var that = this;
       that.formLabelAlign['tenantId'] = this.userInfo.tenant_id;
-      that.formLabelAlign['deptId'] = this.$farmId
+      that.formLabelAlign['deptId'] = this.$farmId;
       this.$refs["formLabelAlign"].validate((valid) => {
         if (valid) {
           that.formLabelAlign.createTime =
@@ -592,7 +592,7 @@
       //     }
       // })
       //获取农地数据
-      getLandList(this.userInfo.dept_id).then((res)=>{
+      getLandList(this.$farmId).then((res)=>{
           if(res.data.code==200){
               var landIdcolumn = that.findObject(that.option.column,"landId");
               that.landList = res.data.data;
@@ -658,6 +658,7 @@
     },
     onLoad(page, params = {}) {
       this.loading = true;
+      params["farmId"] = this.$farmId
       getList(
         page.currentPage,
         page.pageSize,
diff --git a/src/views/wel/farming.vue b/src/views/wel/farming.vue
index 983ba94..0a449a4 100644
--- a/src/views/wel/farming.vue
+++ b/src/views/wel/farming.vue
@@ -227,6 +227,7 @@
   computed: {
     ...mapState({
       userInfo: (state) => state.user.userInfo,
+      $farmId: state => state.user.$farmId,
     }),
   },
   watch: {
@@ -291,7 +292,7 @@
       this.visible = true;
       var that = this;
       //获取农地数据
-      getLandList(this.userInfo.dept_id).then((res) => {
+      getLandList(this.$farmId).then((res) => {
         if (res.data.code == 200) {
           var landIdcolumn = that.findObject(that.option.column, "landId");
           that.landList = res.data.data;

--
Gitblit v1.9.3