From 3558e9f2b0cb9f9e899eec4a33c37174ac97f7e2 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Thu, 11 Aug 2022 17:32:18 +0800
Subject: [PATCH] 数据统计随农场选择变换,dept_id更换成farmId

---
 src/views/land/cs.vue                               |   16 ++++----
 src/views/statistics/farmproductstockstatistics.vue |   14 ++++++-
 src/views/statistics/farmplantarea.vue              |   16 ++++++--
 src/views/statistics/stock.vue                      |   19 ++++++++-
 4 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/src/views/land/cs.vue b/src/views/land/cs.vue
index 1ce9628..8d5af08 100644
--- a/src/views/land/cs.vue
+++ b/src/views/land/cs.vue
@@ -132,14 +132,14 @@
         ...mapGetters(["userInfo","$farmId"]),
     },
     watch: {
-    '$farmId':{
-      handler (newName, oldName) {
-        this.farm.id = newName
-        //地块页面
-        this.onLoad()
-      }
-    }
-  },
+        '$farmId':{
+        handler (newName, oldName) {
+            this.farm.id = newName
+            //地块页面
+            this.onLoad()
+        }
+        }
+    },
     created () {
         this.farm.id = this.$farmId
         this.onLoad(this.page)
diff --git a/src/views/statistics/farmplantarea.vue b/src/views/statistics/farmplantarea.vue
index d321c08..2692d34 100644
--- a/src/views/statistics/farmplantarea.vue
+++ b/src/views/statistics/farmplantarea.vue
@@ -28,6 +28,7 @@
         return {
             visible: true,
             form: {},
+            farm:{},
             query: {},
             search: {},
             loading: true,
@@ -133,9 +134,18 @@
     },
     created () {
         this.initData()
+        this.farm.id = this.$farmId
     },
+      watch: {
+    '$farmId':{
+      handler (newName, oldName) {
+        this.farm.id = newName
+        this.onLoad(this.page)
+      }
+    }
+  },
     computed: {
-        ...mapGetters(["permission", "userInfo"]),
+        ...mapGetters(["permission", "userInfo","$farmId"]),
         ids () {
             let ids = []
             this.selectionList.forEach((ele) => {
@@ -179,8 +189,6 @@
                     }
                 }
             })
-            // sums = sums.toFixed(3)
-            console.log(sums,11111111)
             return sums
         },
         getStartTime () {
@@ -257,7 +265,7 @@
             this.loading = true
             const { releaseTimeRange } = this.query
             params['tenantId'] = this.userInfo.tenant_id
-            params['deptId'] = this.userInfo.dept_id
+            params['deptId'] = this.farm.id
             let values = {
                 ...params,
             }
diff --git a/src/views/statistics/farmproductstockstatistics.vue b/src/views/statistics/farmproductstockstatistics.vue
index 7007f99..4cdf276 100644
--- a/src/views/statistics/farmproductstockstatistics.vue
+++ b/src/views/statistics/farmproductstockstatistics.vue
@@ -32,6 +32,7 @@
     return {
       visible: true,
       form: {},
+      farm:{},
       query: {},
       loading: true,
       excelBox: false,
@@ -209,10 +210,11 @@
     };
   },
   created() {
+    this.farm.id = this.$farmId
     this.initData();
   },
   computed: {
-    ...mapGetters(["permission", "userInfo"]),
+    ...mapGetters(["permission", "userInfo","$farmId"]),
     // permissionList() {
     //   return {
     //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -229,6 +231,14 @@
       return ids.join(",");
     },
   },
+  watch: {
+    '$farmId':{
+      handler (newName, oldName) {
+        this.farm.id = newName
+        this.onLoad(this.page)
+      }
+    }
+  },  
   mounted() {
     var params = {
       startTime:this.getStartTime(),
@@ -337,7 +347,7 @@
     },
     onLoad(page, params = {}) {
       params['tenantId'] = this.userInfo.tenant_id;
-      params['deptId'] = this.userInfo.dept_id;
+      params['deptId'] = this.farm.id
       this.loading = true;
       const { releaseTimeRange } = this.query;
       let values = {
diff --git a/src/views/statistics/stock.vue b/src/views/statistics/stock.vue
index 46f97d1..c8de5a4 100644
--- a/src/views/statistics/stock.vue
+++ b/src/views/statistics/stock.vue
@@ -40,6 +40,7 @@
     return {
       visible: true,
       form: {},
+      farm:{},
       query: {},
       loading: true,
       excelBox: false,
@@ -153,7 +154,7 @@
   ,
   computed: {
     ...
-      mapGetters(["permission", "userInfo"]),
+      mapGetters(["permission", "userInfo","$farmId"]),
     // permissionList() {
     //   return {
     //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -172,6 +173,17 @@
     ,
   }
   ,
+  watch: {
+    '$farmId':{
+      handler (newName, oldName) {
+        this.farm.id = newName
+        this.onLoad(this.page)
+      }
+    }
+  },
+  created () {
+    this.farm.id = this.$farmId
+  },
   mounted() {
     var params = {
       startTime: this.getStartTime(),
@@ -382,7 +394,7 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      params.deptId= this.userInfo.dept_id;
+      params.deptId= this.farm.id;
       this.loading = true;
       const {releaseTimeRange} = this.query;
       let values = {
@@ -402,6 +414,9 @@
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
+        // this.data = this.data.filter((e)=>{
+        //   return !(e.bfcknum == e.cgnum == e.dbcknum == e.dbrknum == e.lycknum == e.rknum == 0)
+        // })
         this.loading = false;
         this.selectionClear();
       });

--
Gitblit v1.9.3