Procházet zdrojové kódy

修改首页合计接口

zhangdan před 4 roky
rodič
revize
a064c7dc9f
2 změnil soubory, kde provedl 7 přidání a 4 odebrání
  1. 1 1
      api/index.js
  2. 6 3
      pages/index/index.vue

+ 1 - 1
api/index.js

@@ -19,7 +19,7 @@ export const gatherDetail = (params) => {
 // 采集信息总计
 export const gatherTotal = (params) => {
   return axios.request({
-    url: `gather/queryListSum`,
+    url: `gather/sumByOperator`,
     method: 'post',
 	data: params
   })

+ 6 - 3
pages/index/index.vue

@@ -196,9 +196,12 @@
 					beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
 					endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):''}).then(res=>{
 						if(res.status==200){
-							this.otherTotal=res.data.GATHER_OTHER ? (res.data.GATHER_OTHER/1000).toFixed(3)/1:0
-							this.jianzhuTotal=res.data.GATHER_BUILDING ? (res.data.GATHER_BUILDING/1000).toFixed(3)/1:0
-							this.chuyuTotal=res.data.GATHER_KITCHEN? (res.data.GATHER_KITCHEN/1000).toFixed(3)/1:0
+							const a = res.data.find(item=>item.rubbishType=='GATHER_BUILDING')
+							const b = res.data.find(item=>item.rubbishType=='GATHER_OTHER')
+							const c = res.data.find(item=>item.rubbishType=='GATHER_KITCHEN')
+							this.jianzhuTotal= a ? (a.rubbishWeight/1000).toFixed(3)/1 : '0'
+							this.chuyuTotal= c ? (c.rubbishWeight/1000).toFixed(3)/1 : '0'
+							this.otherTotal= b ? (b.rubbishWeight/1000).toFixed(3)/1 : '0'
 						}
 					console.log(res)
 					this.titleStatus = false