lilei 4 gadi atpakaļ
vecāks
revīzija
2528d3ffb8

+ 36 - 35
src/components/Echarts/bar.vue

@@ -5,10 +5,7 @@
 <script>
 import echarts from 'echarts'
 import tdTheme from './theme.json'
-import {
-  on,
-  off
-} from '@/libs/tools'
+import { on, off } from '@/libs/tools'
 
 echarts.registerTheme('tdTheme', tdTheme)
 export default {
@@ -18,7 +15,7 @@ export default {
     value: {
       type: Array,
       default: function () {
-		  return []
+        return []
       }
     },
     text: String,
@@ -99,9 +96,9 @@ export default {
     },
     value: {
       handler (nVal, oVal) {
-		  if (nVal) {
-		    this.pageInit()
-		  }
+        if (nVal) {
+          this.pageInit()
+        }
       },
       deep: true,
       immediate: true
@@ -121,8 +118,8 @@ export default {
     pageInit () {
       const legend = this.seriesData.map(_ => _.name)
       this.$nextTick(() => {
-		  const keys = this.value.map(item => item = item.name)
-		  const values = this.value.map(item => item = item.value)
+        const keys = this.value.map(item => (item = item.name))
+        const values = this.value.map(item => (item = item.value))
         const xAxisData = this.value.length ? keys : this.xAxisData
         const seriesData = this.value.length ? values : this.seriesData
         const option = {
@@ -138,16 +135,18 @@ export default {
           tooltip: {
             trigger: 'axis'
           },
-          dataZoom: [{
-            type: 'slider',
-            show: this.isShowZoom, // flase直接隐藏图形
-            xAxisIndex: [0],
-            left: '9%', // 滚动条靠左侧的百分比
-            bottom: -5,
-            start: 0, // 滚动条的起始位置
-            end: this.xZoomEnd, // 滚动条的截止位置(按比例分割你的柱状图x轴长度)
-            zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
-          }],
+          dataZoom: [
+            {
+              type: 'slider',
+              show: this.isShowZoom, // flase直接隐藏图形
+              xAxisIndex: [0],
+              left: '9%', // 滚动条靠左侧的百分比
+              bottom: -5,
+              start: 0, // 滚动条的起始位置
+              end: this.xZoomEnd, // 滚动条的截止位置(按比例分割你的柱状图x轴长度)
+              zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
+            }
+          ],
           xAxis: {
             type: 'category',
             data: xAxisData,
@@ -166,25 +165,27 @@ export default {
             // interval: 2,
             position: 'left'
           },
-		  grid: {
-			  left: '3%',
-			  right: '4%',
-			  bottom: '3%',
-			  containLabel: true
-		  }
+          grid: {
+            left: '3%',
+            right: '4%',
+            bottom: '3%',
+            containLabel: true
+          }
         }
         if (this.value) {
-          option.series = [{
-            data: seriesData,
-            type: 'bar',
-            barWidth: 35,
-            label: {
-              normal: {
-                show: true,
-                position: 'top'
+          option.series = [
+            {
+              data: seriesData,
+              type: 'bar',
+              barWidth: 35,
+              label: {
+                normal: {
+                  show: true,
+                  position: 'top'
+                }
               }
             }
-          }]
+          ]
         } else {
           console.log(this.seriesData, '111111111')
           option.series = this.seriesData

+ 0 - 2
src/components/Echarts/line.vue

@@ -51,7 +51,6 @@ export default {
   watch: {
     xAxisData: {
       handler (nVal, oVal) {
-        console.log(nVal, 'nnnnnnnn')
         if (nVal) {
           // 根据x轴时间长度控制滚动条位置及显示状态 x轴长度大于25时,显示滚动条并且滚动条结束位置在80%
           if (nVal.length > 25) {
@@ -107,7 +106,6 @@ export default {
       const legend = this.seriesData.map(_ => _.name)
       this.$nextTick(() => {
         const xAxisData = this.value ? Object.keys(this.value) : this.xAxisData
-        console.log(xAxisData, 'xAxisData')
         const seriesData = this.value ? Object.values(this.value) : this.seriesData
         const option = {
           color: [this.color],

+ 40 - 31
src/views/cleanManage/statisticalReport.vue

@@ -85,7 +85,7 @@
               style="height: 300px;"
               color="#6C6FBE"
               :xAxisRotate="resize"
-              :yMax="1000"
+              :yMax="1000000"
               yUnit="kg"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeBarData"
@@ -99,7 +99,7 @@
               style="height: 300px;"
               color="#6C6FBE"
               yUnit="kg"
-              :yMax="1000"
+              :yMax="1000000"
               :xAxisRotate="resize"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeLineData"
@@ -197,24 +197,28 @@ export default {
     qyTotalPieData () {
       const list = this.totalGroupRubbiData ? this.totalGroupRubbiData.cleanReportData : []
       const temp = []
-      list.map(item => {
-        temp.push({
-          name: item.rubbishTypeDictValue,
-          value: Number(item.cleanWeight / 1000).toFixed(2)
+      if (list) {
+        list.map(item => {
+          temp.push({
+            name: item.rubbishTypeDictValue,
+            value: Number(item.cleanWeight / 1000).toFixed(2)
+          })
         })
-      })
+      }
       return temp
     },
     // 各清运司机占比
     sjTotalPieData () {
       const list = this.totalGroupUserData ? this.totalGroupUserData.cleanReportData : []
       const temp = []
-      list.map(item => {
-        temp.push({
-          name: item.operatorName,
-          value: Number(item.cleanWeight / 1000).toFixed(2)
+      if (list) {
+        list.map(item => {
+          temp.push({
+            name: item.operatorName,
+            value: Number(item.cleanWeight / 1000).toFixed(2)
+          })
         })
-      })
+      }
       return temp
     }
   },
@@ -300,8 +304,8 @@ export default {
       )
     },
     // 查询分类数据字典
-    getTypeCode () {
-      let _this = this
+    getTypeCode (params) {
+      const _this = this
       getLookUpData({
         pageNo: 1,
         pageSize: 1000,
@@ -324,7 +328,9 @@ export default {
             data: []
           })
         })
-        _this.getGroupDateAndRubbishType()
+        setTimeout(() => {
+          _this.getGroupDateAndRubbishType(params)
+        }, 500)
       })
     },
     // 查询网点列表
@@ -348,6 +354,8 @@ export default {
         const searchTime = this.searchForm.queryWord.toString().split(',')
         this.beginDate = this.exitTime(searchTime[0])
         this.endDate = this.exitTime(searchTime[1])
+        this.XdaysData = []
+        this.XdaysData1 = []
         this.getPageData()
       } else {
         this.$message.error('请选择统计区间')
@@ -430,41 +438,42 @@ export default {
           this.isNoData = true
         }
       })
-      
-      if(this.hswTypeBarData.length==0){
-        this.getTypeCode()
-      }else{
-        this.getGroupDateAndRubbishType()
+
+      if (this.hswTypeBarData.length == 0) {
+        this.getTypeCode(params)
+      } else {
+        this.getGroupDateAndRubbishType(params)
       }
     },
     // 各回收物类型清运数据柱状图
-    getGroupDateAndRubbishType(){
+    getGroupDateAndRubbishType (params) {
       findTotalGroupDateAndRubbishType(params).then(res => {
         console.log(res, '各回收物类型清运数据柱状图')
         if (res.status == 200) {
-          let data = res.data.cleanReportData
+          const data = res.data.cleanReportData
           // x 时间轴
-          for(let key in data){
+          for (const key in data) {
             this.XdaysData1.push(key)
           }
-          this.formAtGroupDateAndRubbishType(data,this.hswTypeBarData)
-          this.formAtGroupDateAndRubbishType(data,this.hswTypeLineData)
+          this.formAtGroupDateAndRubbishType(data, this.hswTypeBarData)
+          this.formAtGroupDateAndRubbishType(data, this.hswTypeLineData)
         } else {
           this.isNoData = true
         }
       })
     },
     // 格式化数据
-    formAtGroupDateAndRubbishType(data,obj){
+    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)
+        const ret = []
+        for (const key in data) {
+          const leve2 = data[key]
+          const row = leve2[item.code]
+          ret.push(row ? (Number(row.cleanWeight / 1000).toFixed(2)) : 0)
         }
         item.data = ret
       })
+      console.log(obj, 'obj')
     }
   },
   beforeRouteEnter (to, from, next) {