muzilei 4 yıl önce
ebeveyn
işleme
cbcd76d713
1 değiştirilmiş dosya ile 61 ekleme ve 8 silme
  1. 61 8
      src/views/cleanManage/statisticalReport.vue

+ 61 - 8
src/views/cleanManage/statisticalReport.vue

@@ -88,7 +88,7 @@
               :yMax="1000"
               yUnit="kg"
               :xAxisData="XdaysData1"
-              :seriesData="washTypeBarData"
+              :seriesData="hswTypeBarData"
               text="" />
             <span v-if="isNoData" class="noData">暂无数据</span>
           </a-col>
@@ -102,7 +102,7 @@
               :yMax="1000"
               :xAxisRotate="resize"
               :xAxisData="XdaysData1"
-              :seriesData="washTypeLineData"
+              :seriesData="hswTypeLineData"
               text="" />
             <span v-if="isNoData" class="noData">暂无数据</span>
           </a-col>
@@ -148,6 +148,7 @@ import getDate from '@/libs/getDate'
 import moment from 'moment'
 import { findTotalGroupRubbi, findTotalGroupUser, findTotalGroupDate, findTotalGroupDateAndRubbishType } from '@/api/cleanManage.js'
 import { stationList } from '@/api/releaseRecord.js'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'Home',
   components: {
@@ -279,15 +280,14 @@ export default {
           data: []
         }
       ],
-      washTypeBarData: [],
-      washTypeLineData: []
+      hswTypeBarData: [],
+      hswTypeLineData: []
     }
   },
   methods: {
     moment,
     // 时间改变
     dateChange (dates) {
-      console.log(dates, this.searchForm.queryWord, 'dddddd')
       this.curentType = ''
     },
     // 不可选日期
@@ -299,6 +299,34 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
+    // 查询分类数据字典
+    getTypeCode () {
+      let _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: 'RUBBISH_TYPE'
+      }).then(res => {
+        const list = res.data.list
+        list.map(item => {
+          // 柱状图
+          _this.hswTypeBarData.push({
+            name: item.dispName,
+            code: item.code,
+            type: 'bar',
+            data: []
+          })
+          // 折线图
+          _this.hswTypeLineData.push({
+            name: item.dispName,
+            code: item.code,
+            type: 'line',
+            data: []
+          })
+        })
+        _this.getGroupDateAndRubbishType()
+      })
+    },
     // 查询网点列表
     getListStation () {
       stationList().then(res => {
@@ -389,7 +417,6 @@ export default {
       findTotalGroupDate(params).then(res => {
         console.log(res, '清运量趋势')
         if (res.status == 200) {
-          // this.totalGroupUserData = res.data
           const a = res.data.cleanReportData
           const b = res.data.deliveryReportData
           for (var key in a) {
@@ -403,15 +430,41 @@ export default {
           this.isNoData = true
         }
       })
-      // 各回收物类型清运数据柱状图
+      
+      if(this.hswTypeBarData.length==0){
+        this.getTypeCode()
+      }else{
+        this.getGroupDateAndRubbishType()
+      }
+    },
+    // 各回收物类型清运数据柱状图
+    getGroupDateAndRubbishType(){
       findTotalGroupDateAndRubbishType(params).then(res => {
         console.log(res, '各回收物类型清运数据柱状图')
         if (res.status == 200) {
-          // this.totalGroupUserData = res.data
+          let data = res.data.cleanReportData
+          // x 时间轴
+          for(let key in data){
+            this.XdaysData1.push(key)
+          }
+          this.formAtGroupDateAndRubbishType(data,this.hswTypeBarData)
+          this.formAtGroupDateAndRubbishType(data,this.hswTypeLineData)
         } else {
           this.isNoData = true
         }
       })
+    },
+    // 格式化数据
+    formAtGroupDateAndRubbishType(data,obj){
+      obj.map(item => {
+        let ret = []
+        for(let key in data){
+          let leve2 = data[key]
+          let row = leve2[item.code]
+          ret.push(row?row.cleanWeight:0)
+        }
+        item.data = ret
+      })
     }
   },
   beforeRouteEnter (to, from, next) {