Browse Source

对多牧场 各个页面备件接口更换牧场id

Shan9312 3 months ago
parent
commit
d4840d9168

+ 41 - 0
src/views/cost/diesel/index.vue

@@ -328,6 +328,7 @@
       <!-- 折线图 -->
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogECharts" :close-on-click-modal="false" width="80%">
       <div>
+        <h3 style="text-align: center;">月总用量: {{mountTotal}} 升</h3>
         <div id="chart7" style="width: 100%;height:400px;" />
       </div>
 
@@ -358,6 +359,10 @@ export default {
   directives: { waves },
   data() {
     return {
+      mountTotal:0,
+      pastureName: Cookies.get('pasturename'),
+       year: new Date().getFullYear(),
+      month: new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
       employename: Cookies.get('employename'),
       isokDisable: false,
       isDieselUpdate: [],
@@ -547,12 +552,46 @@ export default {
   },
 
   methods: {
+       // 电年度每月总用量
+    // 各牧场年度用水量对比
+    getChart1() {
+      let date = new Date();
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let startTime = ''
+      let endTime = ''
+      let lastDay = new Date(year, month, 0).getDate();
+       if(this.getdataListParm.parammaps.inputDatetime !== null && this.getdataListParm.parammaps.inputDatetime.length > 0){
+        startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}') + '-01'
+        endTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}') + '-' + lastDay
+      }else{
+        startTime = parseTime(new Date(),  '{y}-{m}') + '-01'
+        endTime = parseTime(new Date(), '{y}-{m}') + '-' + lastDay
+      }
+      let datas = {
+        name: "getPastureSumMonthDiesel",
+        parammaps: {
+          startTime: startTime,
+          endTime: endTime,
+          pastureName: this.pastureName.toString(),
+        },
+      }
+      GetReportform(datas).then(response => {
+        console.log('牧场每月用水量', response)
+        if (response.data) {
+            this.mountTotal = response.data.chart_data.nowYear[0][0]
+          }else{
+            this.mountTotal = 0;
+          }
+      })
 
+    },
     // 折线图
     formEchart() {
       this.dialogECharts = true;
       this.dialogStatus = 'echarts'
       this.getChart7();
+      this.getChart1();
     },
     // XX月每日用电量
     getChart7() {
@@ -566,6 +605,8 @@ export default {
         this.getChart7Parm.parammaps.date = parseTime(new Date(), '{y}-{m}')
       }
 
+      // this.getChart1();
+
       let data = {
         name:"getPastureSumDayDiesel",
         parammaps:{

+ 40 - 2
src/views/cost/elec/index.vue

@@ -305,6 +305,7 @@
      <!-- 折线图 -->
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogECharts" :close-on-click-modal="false" width="80%">
       <div>
+        <h3 style="text-align: center;">月总用量: {{mountTotal}} 度</h3>
         <div id="chart7" style="width: 100%;height:400px;" />
       </div>
 
@@ -321,7 +322,7 @@
 // 引入
 require('script-loader!file-saver')
 import echarts from 'echarts'
-import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, GetAccount,GetReportform } from '@/api/common'
+import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, GetAccount,GetReportform ,getJson} from '@/api/common'
 // import {  DownloadExcel, GetDataByNameXlsx } from '@/api/common'
 import waves from '@/directive/waves' // waves directive
 // eslint-disable-next-line no-unused-vars
@@ -337,6 +338,10 @@ export default {
   directives: { waves },
   data() {
     return {
+      mountTotal:0,
+      pastureName: Cookies.get('pasturename'),
+       year: new Date().getFullYear(),
+      month: new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
       selectionList:[],
       myHeight:document.documentElement.clientHeight - 85- 200,
       isokDisable: false,
@@ -527,7 +532,40 @@ export default {
   },
 
   methods: {
+     // 电年度每月总用量
+    // 各牧场年度用水量对比
+    getChart1() {
+      let date = new Date();
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let startTime = ''
+      let endTime = ''
+      let lastDay = new Date(year, month, 0).getDate();
+       if(this.getdataListParm.parammaps.inputDatetime !== null && this.getdataListParm.parammaps.inputDatetime.length > 0){
+        startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}') + '-01'
+        endTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}') + '-' + lastDay
+      }else{
+        startTime = parseTime(new Date(),  '{y}-{m}') + '-01'
+        endTime = parseTime(new Date(), '{y}-{m}') + '-' + lastDay
+       }
+      let datas = {
+        name: "getPastureSumMonthElec",
+        parammaps: {
+          startTime: startTime,
+          endTime: endTime,
+          pastureName: this.pastureName.toString(),
+        },
+      }
+      GetReportform(datas).then(response => {
+        console.log('牧场每月用水量', response)
+        if (response.data) {
+            this.mountTotal = response.data.chart_data.nowYear[0][0]
+          }else{
+            this.mountTotal = 0;
+          }
+      })
 
+    },
     // 折线图
     formEchart() {
       this.dialogECharts = true;
@@ -545,7 +583,7 @@ export default {
         this.getChart7Parm.parammaps.endTime = ''
         this.getChart7Parm.parammaps.date = parseTime(new Date(), '{y}-{m}')
       }
-
+      this.getChart1();
       let data = {
         name:"getPastureSumDayElec",
         parammaps:{

+ 44 - 3
src/views/cost/water/index.vue

@@ -297,6 +297,7 @@
      <!-- 折线图 -->
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogECharts" :close-on-click-modal="false" width="80%">
       <div>
+        <h3 style="text-align: center;"> 月总用量: {{mountTotal}} 吨</h3>
         <div id="chart7" style="width: 100%;height:400px;" />
       </div>
 
@@ -312,7 +313,7 @@
 // 引入
 require('script-loader!file-saver')
 import echarts from 'echarts'
-import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, GetAccount,GetReportform } from '@/api/common'
+import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, GetAccount,GetReportform, getJson } from '@/api/common'
 import waves from '@/directive/waves'
 import { parseTime, sortChange } from '@/utils/index.js'
 import Pagination from '@/components/Pagination' // secondary package based on el-pagination
@@ -326,6 +327,10 @@ export default {
   directives: { waves },
   data() {
     return {
+      mountTotal:0,
+      pastureName: Cookies.get('pasturename'),
+      year: new Date().getFullYear(),
+      month: new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
       myHeight:document.documentElement.clientHeight - 85- 200,
       isokDisable: false,
       isWaterAdd: [],
@@ -518,11 +523,47 @@ export default {
   },
 
   methods: {
+    // 水年度每月总用量
+    // 各牧场年度用水量对比
+    getChart1() {
+      let date = new Date();
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let startTime = ''
+      let endTime = ''
+      let lastDay = new Date(year, month, 0).getDate();
+       if(this.getdataListParm.parammaps.inputDatetime !== null && this.getdataListParm.parammaps.inputDatetime.length > 0){
+        startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}') + '-01'
+        endTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}') + '-' + lastDay
+      }else{
+        startTime = parseTime(new Date(),  '{y}-{m}') + '-01'
+        endTime = parseTime(new Date(), '{y}-{m}') + '-' + lastDay
+      }
+      let datas = {
+        name: "getPastureSumMonthWater",
+        parammaps: {
+          startTime: startTime,
+          endTime: endTime,
+          pastureName: this.pastureName.toString(),
+        },
+      }
+      GetReportform(datas).then(response => {
+        console.log('牧场每月用水量', response.data.chart_data.nowYear[0])
+        if (response.data) {
+            this.mountTotal = response.data.chart_data.nowYear[0][0]
+          }else{
+            this.mountTotal = 0;
+        }
+            console.log('this.mountTotal', this.mountTotal)
+      })
+
+    },
     // 折线图
-    formEchart() {
+    formEchart(){
       this.dialogECharts = true;
       this.dialogStatus = 'echarts'
       this.getChart7();
+
     },
     // XX月每日用水量
     getChart7() {
@@ -535,7 +576,7 @@ export default {
         this.getChart7Parm.parammaps.endTime = ''
         this.getChart7Parm.parammaps.date = parseTime(new Date(), '{y}-{m}')
       }
-
+       this.getChart1();
       let data = {
         name:"getPastureSumDayWater",
         parammaps:{

+ 2 - 0
src/views/custom/storage/index.vue

@@ -1304,6 +1304,7 @@ export default {
       this.getCreateNumber()
     },
     handleChageOrder(val) {
+      this.storage.pastureId = val;
       const arr = [
         { name: 'findAllProviderByCt', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': val } },
         { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': val } },
@@ -1345,6 +1346,7 @@ export default {
       if (this.storage.providerId !== '') {
         this.requestBuyeCode.parammaps['buyeCode'] = queryString
         this.requestBuyeCode.parammaps['providerId'] = this.storage.providerId
+        this.requestBuyeCode.parammaps['pastureId'] =  this.storage.pastureId
         GetDataByName(this.requestBuyeCode).then(response => {
           console.log('采购单号模糊查询搜索data', response.data.list)
           if (response.data.list === null) {

+ 1 - 0
src/views/custom/subscribe/index.vue

@@ -3341,6 +3341,7 @@ export default {
       this.requestSparePart.parammaps['partCode'] = queryString
       // this.createTemp.partCode = queryString
       this.$set(this.requestSparePart.parammaps, 'partCode', queryString)
+      this.$set(this.requestSparePart.parammaps, 'pastureId', this.createTemp.pastureId )
       this.$set(this.createTemp, 'partCode', queryString)
       GetDataByName(this.requestSparePart).then((response) => {
         console.log('备件模糊查询搜索data', response.data.list)