فهرست منبع

Merge branch 'deploy_0106' of http://git.chelingzhu.com/chelingzhu-web/zxyj-admin-html into deploy_0106

zhangdan 4 سال پیش
والد
کامیت
80d50cb86f
2فایلهای تغییر یافته به همراه28 افزوده شده و 20 حذف شده
  1. 1 3
      src/components/Echarts/bar.vue
  2. 27 17
      src/views/cleanManage/statisticalReport.vue

+ 1 - 3
src/components/Echarts/bar.vue

@@ -172,7 +172,7 @@ export default {
             containLabel: true
           }
         }
-        if (this.value) {
+        if (this.value.length) {
           option.series = [
             {
               data: seriesData,
@@ -187,10 +187,8 @@ export default {
             }
           ]
         } else {
-          console.log(this.seriesData, '111111111')
           option.series = this.seriesData
         }
-        // console.log(option.series, 'ppppppp')
         this.dom = echarts.init(this.$refs.dom, 'tdTheme')
         this.dom.setOption(option)
         this.dom.resize() // 解决首次加载宽度超出容器bug

+ 27 - 17
src/views/cleanManage/statisticalReport.vue

@@ -44,7 +44,7 @@
           style="height: 300px;"
           color="#6C6FBE"
           ref="chartLine"
-          :yMax="5000"
+          :yMax="maxClearnData"
           yUnit="kg"
           :xAxisRotate="resize"
           :xAxisData="XdaysData"
@@ -78,13 +78,13 @@
               style="height: 300px;"
               color="#6C6FBE"
               :xAxisRotate="resize"
-              :yMax="100000"
+              :yMax="maxHswType"
               yUnit="kg"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeBarData"
               text=""
             />
-            <span v-if="isNoData" class="noData">暂无数据</span>
+            <span v-if="isNoData1" class="noData">暂无数据</span>
           </a-col>
           <!-- 变化趋势 -->
           <a-col span="24" v-if="currentTabChart == 'tab2'">
@@ -93,13 +93,13 @@
               style="height: 300px;"
               color="#6C6FBE"
               yUnit="kg"
-              :yMax="100000"
+              :yMax="maxHswType"
               :xAxisRotate="resize"
               :xAxisData="XdaysData1"
               :seriesData="hswTypeLineData"
               text=""
             />
-            <span v-if="isNoData" class="noData">暂无数据</span>
+            <span v-if="isNoData1" class="noData">暂无数据</span>
           </a-col>
         </a-row>
       </a-card>
@@ -225,6 +225,7 @@ export default {
       timer: false,
       form: this.$form.createForm(this, { name: 'searchForm' }),
       isNoData: false, // 是否有每天营业额及进店量数据
+      isNoData1: false,
       stationList: [], // 清运网点列表
       searchForm: {
         queryWord: null, // 时间查询条件,默认本周
@@ -266,6 +267,8 @@ export default {
       currentTabChart: 'tab1', // 洗车类型详情数据与变化趋势的tab 默认展示详情数据
       XdaysData: [], // 图表X轴时间集合
       XdaysData1: [],
+      maxHswType: 100000,
+      maxClearnData: 100000,
       // 各类型占比
       washTypePieColor: ['#ffaa00', '#ff5500', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#00ffff'],
       couponColor: ['#ffaa00', '#ff5500', '#00aaff', '#ff55ff', '#1dc5d4', '#8465c7', '#00ffff'],
@@ -404,8 +407,6 @@ export default {
         console.log(res, '各回收物类型占比')
         if (res.status == 200) {
           this.totalGroupRubbiData = res.data
-        } else {
-          this.isNoData = true
         }
       })
       // 各清运司机占比
@@ -413,8 +414,6 @@ export default {
         console.log(res, '各清运司机占比')
         if (res.status == 200) {
           this.totalGroupUserData = res.data
-        } else {
-          this.isNoData = true
         }
       })
       // 清运量趋势
@@ -423,13 +422,20 @@ export default {
         if (res.status == 200) {
           const a = res.data.cleanReportData
           const b = res.data.deliveryReportData
+          const max = []
           for (var key in a) {
-            this.clearnChartData[0].data.push(Number(a[key] / 1000).toFixed(2))
+            const val = Number(a[key] / 1000).toFixed(2)
+            this.clearnChartData[0].data.push(val)
+            max.push(val)
           }
           for (var key in b) {
             this.XdaysData.push(key)
-            this.clearnChartData[1].data.push(Number(b[key] / 1000).toFixed(2))
+            const val = Number(a[key] / 1000).toFixed(2)
+            this.clearnChartData[1].data.push(val)
+            max.push(val)
           }
+          // 计算最大值
+          this.maxClearnData = Math.max.apply(null, max)
         } else {
           this.isNoData = true
         }
@@ -445,33 +451,37 @@ export default {
     getGroupDateAndRubbishType (params) {
       findTotalGroupDateAndRubbishType(params).then(res => {
         console.log(res, '各回收物类型清运数据柱状图')
-        if (res.status == 200) {
+        if (res.status == 200 && res.data.cleanReportData) {
           const data = res.data.cleanReportData
           // x 时间轴
           for (const key in data) {
             this.XdaysData1.push(key)
           }
 
-          // this.hswTypeBarData = this.formAtGroupDateAndRubbishType(data, this.hswTypeBarData)
+          this.hswTypeBarData = this.formAtGroupDateAndRubbishType(data, this.hswTypeBarData)
           this.hswTypeLineData = this.formAtGroupDateAndRubbishType(data, this.hswTypeLineData)
-          console.log(JSON.stringify(this.hswTypeBarData), 'hswTypeBarData')
-          console.log(JSON.stringify(this.hswTypeLineData), 'hswTypeLineData')
         } else {
-          this.isNoData = true
+          this.isNoData1 = true
         }
       })
     },
     // 格式化数据
     formAtGroupDateAndRubbishType (data, obj) {
+      const max = []
       obj.map(item => {
         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)
+          const val = row ? Number(row.cleanWeight / 1000).toFixed(2) : 0
+          ret.push(val)
+          max.push(val)
         }
         item.data = ret
       })
+      // 获取最大值
+      this.maxHswType = Math.max.apply(null, max)
+      console.log(this.maxHswType)
       return obj
     }
   },