From 6e4022b4c7eb1fad134e0563a1e1da14cbf80724 Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期日, 25 四月 2021 17:08:30 +0800
Subject: [PATCH] 废水废气图表问题修改

---
 src/components/BaseNav/WasteWater/HourData.vue |  324 +++++++++++++++++------------------------------------
 1 files changed, 107 insertions(+), 217 deletions(-)

diff --git a/src/components/BaseNav/WasteWater/HourData.vue b/src/components/BaseNav/WasteWater/HourData.vue
index b064875..bb628fe 100644
--- a/src/components/BaseNav/WasteWater/HourData.vue
+++ b/src/components/BaseNav/WasteWater/HourData.vue
@@ -1,30 +1,31 @@
 <template>
-  <div id="Tab">
-    <PublicDataStandard :dataStandard="dataStandard"></PublicDataStandard>
-    <div class="form-echrts">
-      <div class="from-search">
-        <div class="pickerMon">
-          <div class="pickerData">
-            <span> 寮�濮嬫椂闂�:</span>
-            <span class="pickerTable">
-                          <el-date-picker type="datetime" v-model="formInline.timeStart">
-                      </el-date-picker>
-                      </span>
-          </div>
-          <div class="pickerData">
-            <span>缁撴潫鏃堕棿:</span>
-            <span class="pickerTable">
-                        <el-date-picker type="datetime" v-model="formInline.timeEnd">
-                      </el-date-picker>
-                      </span>
-          </div>
-        </div>
-        <div class="detailbtn">鏌ヨ</div>
-        <div class="detailbtn">鏄庣粏琛�</div>
-      </div>
-      <div class="boxChart">
-        <div style="width: 5rem;height:2rem;" id="echarts" ref="echartsHour"></div>
-      </div>
+  <div class="echarts-box">
+    <div class="tab-scroll">
+      <PublicDataStandard :dataStandard="dataStandard"></PublicDataStandard>
+      <span class="time-select">{{ formData.startTime }}鈥攞{ formData.endTime }}</span>
+    </div>
+    <div class="echarts-form">
+      <span class="demonstration">寮�濮嬫椂闂达細</span>
+      <el-date-picker
+          v-model="formData.startTime"
+          value-format="yyyy-MM-dd HH"
+          type="datetime">
+      </el-date-picker>
+      <span class="demonstration">缁撴潫鏃堕棿锛�</span>
+      <el-date-picker
+          v-model="formData.endTime"
+          value-format="yyyy-MM-dd HH"
+          type="datetime">
+      </el-date-picker>
+      <span class="demonstration">閲囨牱鐐规暟锛�</span>
+      <el-select v-model="region" placeholder="璇烽�夋嫨" style="width: 80px">
+        <el-option v-for="(item,index) in regionList" :key="index" :label="item" :value="item"></el-option>
+      </el-select>
+      <el-button @click="querySearch()">鏌ヨ</el-button>
+      <el-button>鏄庣粏琛�</el-button>
+    </div>
+    <div class="echarts-chart">
+      <div style="width:5rem;height:1.5rem;" ref="echartsHour"></div>
     </div>
   </div>
 </template>
@@ -35,7 +36,7 @@
 import mapApi from '@/api/mapApi'
 
 export default {
-  name: 'ECharts',
+  name: 'HourData',
   components: {
     PublicDataStandard
   },
@@ -83,10 +84,12 @@
             val: null
           }
         }],
-      formInline: {
-        timeStart: '',
-        timeEnd: ''
+      formData: {
+        startTime: dayjs().subtract(16, 'hour').format('YYYY-MM-DD HH'),
+        endTime: dayjs().format('YYYY-MM-DD HH')
       },
+      region: '25',
+      regionList: [25, 50, 75, 100],
       chart: null,
       jcdID: 1,
       dataType: 2,
@@ -99,15 +102,15 @@
     this.draw24Chart()
   },
   methods: {
+    querySearch () {
+
+    },
     async draw24Chart () {
-      // 鐢ㄤ簬鎺ュ彛鏁版嵁璇锋眰鐨勫弬鏁� 寮�濮�/缁撴潫鏃堕棿 || 鍙�夋嫨鏌ヨ鐨勫紑濮�/缁撴潫鏃堕棿
-      this.formInline.timeEnd = dayjs().format('YYYY-MM-DD HH:mm:ss')
-      this.formInline.timeStart = dayjs().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss')
       const data = {
         onLineMonEmissPointId: 23,
         monItemId: 28,
-        beginTime: this.formInline.timeStart,
-        endTime: this.formInline.timeEnd,
+        beginTime: this.formData.startTime,
+        endTime: this.formData.endTime,
         dataType: this.dataType
       }
       const result = (await mapApi.getQueryOnlineMonData(data)).Result.DataInfo
@@ -128,7 +131,7 @@
             continue
           }
 
-          var MonTimeStr = d[i].MonTimeStr
+          const MonTimeStr = d[i].MonTimeStr
 
           // getWRW(d[i])
 
@@ -176,7 +179,7 @@
           if (nameList.length === 0) {
             nameList.push(d[i].PoltmtrlName.trim())
             dateList.push(strDate)
-            /*  var data=new Array();
+            /*  let data=new Array();
               data.push(d.MonQty); */
             if ((d[i].PoltmtrlName === '搴熸按娴侀噺' || d[i].PoltmtrlName === '搴熸按') && d[i].MonQty < 0) {
               d[i].MonQty = 0
@@ -216,7 +219,7 @@
         const newList = []
 
         for (let i = 0; i < dataList.length; i++) {
-          var list = dataList[i].reverse()
+          const list = dataList[i].reverse()
           newList.push(list)
         }
         dataList = newList
@@ -267,11 +270,11 @@
         }
         lengList.push(objTemp)
 
-        var legend = lengList
-        var xdata = dateList.reverse()
-        var ydatas = []
+        const legend = lengList
+        const xdata = dateList.reverse()
+        const ydatas = []
 
-        for (var j = 0; j < nameList.length; j++) {
+        for (let j = 0; j < nameList.length; j++) {
           let zdcbcolor, zxcolor
           if (nameList[j] === 'COD') {
             zdcbcolor = 'red'
@@ -282,12 +285,12 @@
           } else if (nameList[j] === '鎬荤7') {
             zdcbcolor = 'red'
             zxcolor = '#f48183'
-          } else if (nameList[j] === '鎬绘爱') {
-            zdcbcolor = 'red'
-            zxcolor = '#d9f2f4'
-          } else {
+          } else if (nameList[j] === '搴熸按娴侀噺') {
             zdcbcolor = 'red'
             zxcolor = '#9ACD32'
+          } else {
+            zdcbcolor = 'red'
+            zxcolor = '#d9f2f4'
           }
           const ydata = {
             name: nameList[j],
@@ -304,61 +307,62 @@
           this.bzzList.push(this.bzz)
           ydatas.push(ydata)
         }
+        console.log(ydatas)
 
-        var yname = '娴撳害(mg/l)'
+        const yname = '娴撳害(mg/l)'
 
         this.effChartShow(divid, title, legend, xdata, ydatas, yname, this.jcdID, this.datatype)
       }
     },
     effChartShow (divid, title, legend, xdata, ydatas, yname, jcdID, datatype) {
       this.chart = this.$echarts.init(this.$refs.echartsHour)
-      console.log(this.chart)
-      this.chart.clear()
-      var dataUnit = ''
+      console.log(ydatas)
+      // this.chart.clear()
+      let dataUnit = ''
       if (datatype === 1) {
         dataUnit = '娴侀噺(m鲁/d)'
       } else {
         dataUnit = '娴侀噺(m鲁/h)'
       }
-      var serLists = []
-      for (var i = 0; i < ydatas.length; i++) {
-        // var zdcbcolor = ydatas[i].zdcbcolor
-        var bz = ydatas[i].bzz
-        var obj
+      const serLists = []
+      for (let i = 0; i < ydatas.length; i++) {
+        // let zdcbcolor = ydatas[i].zdcbcolor
+        const bz = ydatas[i].bzz
+        let obj
         if (bz) {
           obj = {
             name: ydatas[i].name,
             symbol: 'circle', // 鎶樼偣褰㈢姸
             symbolSize: 10, // 澶у皬
             smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
-            // itemStyle: {
-            //   normal: {
-            //     color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
-            //       // var biaozhuiz
-            //       let bzlist = this.bzzList
-            //       for (let i = 0; i < this.bzzList.length; i++) {
-            //         if (this.bzzList[i].name === c.seriesName) {
-            //           this.bz = this.bzzList[i].bzhui
-            //         }
-            //       }
-            //       if (c.value > this.bz) {
-            //         return zdcbcolor
-            //       } else if (c.value > this.bz * 0.9) {
-            //         return '#FFA500'
-            //       } else {
-            //         return '#33c95f'
-            //       }
-            //     },
-            //     lineStyle: { // 鎶樼嚎鐨勯鑹�
-            //       color: ydatas[i].zxcolor,
-            //       width: 5
-            //     },
-            //     borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
-            //     label: { // 鏄剧ず鍊�
-            //       show: false
-            //     }
-            //   }
-            // },
+            itemStyle: {
+              normal: {
+                // color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
+                //   // let biaozhuiz
+                //   let bzlist = this.bzzList
+                //   for (let i = 0; i < this.bzzList.length; i++) {
+                //     if (this.bzzList[i].name === c.seriesName) {
+                //       this.bz = this.bzzList[i].bzhui
+                //     }
+                //   }
+                //   if (c.value > this.bz) {
+                //     return zdcbcolor
+                //   } else if (c.value > this.bz * 0.9) {
+                //     return '#FFA500'
+                //   } else {
+                //     return '#33c95f'
+                //   }
+                // },
+                lineStyle: { // 鎶樼嚎鐨勯鑹�
+                  color: ydatas[i].zxcolor,
+                  width: 5
+                },
+                borderColor: ydatas[i].zxcolor, // 鎶樼偣杈规鐨勯鑹�
+                label: { // 鏄剧ず鍊�
+                  show: false
+                }
+              }
+            },
             type: 'line',
             data: ydatas[i].data,
             markLine: { // 骞冲潎鍊� 锛� 鍜� 鎸囨爣涓婇檺
@@ -391,7 +395,7 @@
             // itemStyle: {
             //   normal: {
             //     color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
-            //       // var biaozhuiz
+            //       // let biaozhuiz
             //       for (let i = 0; i < this.bzzList.length; i++) {
             //         if (this.bzzList[i].name === c.seriesName) {
             //           this.bz = this.bzzList[i].bzhui
@@ -419,7 +423,7 @@
         }
         serLists.push(obj)
       }
-      var option = {
+      const option = {
         /*  title: {
           text: title,
       }, */
@@ -432,28 +436,28 @@
             }
           },
           formatter: function (params) {
-            var s = params[0].name + '<br />'
-            for (var i = 0; i < params.length; i++) {
-              // var name = params[i].name
+            let s = params[0].name + '<br />'
+            for (let i = 0; i < params.length; i++) {
+              // let name = params[i].name
               // 鍥捐〃title鍚嶇О
-              var seriesName = params[i].seriesName
+              const seriesName = params[i].seriesName
               // 鍊�
-              var value = params[i].value
+              const value = params[i].value
 
-              // var valueFliter = formatter(value)
-              var valueFliter = value
+              // let valueFliter = formatter(value)
+              const valueFliter = parseFloat(value).toFixed(2)
 
-              var maker = params[i].marker
+              let maker = params[i].marker
               if (seriesName === 'COD') {
                 maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#fff21c;"></span>'
               } else if (seriesName === '姘ㄦ爱') {
                 maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#00B0F0;"></span>'
               } else if (seriesName === '鎬荤7') {
                 maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#f48183;"></span>'
-              } else if (seriesName === '鎬绘爱') {
-                maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#d9f2f4;"></span>'
-              } else {
+              } else if (seriesName === '搴熸按娴侀噺') {
                 maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#9ACD32;"></span>'
+              } else {
+                maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#d9f2f4;"></span>'
               }
               s += maker + seriesName + ':' + valueFliter + '<br />'
             }
@@ -467,8 +471,8 @@
           }
         },
         grid: { // 缃戞牸
-          top: '20%',
-          left: '5%'
+          top: '20%'
+          // left: '15%'
         },
         legend: {
           data: legend
@@ -495,8 +499,8 @@
           type: 'category',
           boundaryGap: false,
           axisLabel: { // x杞村叏閮ㄦ樉绀�
-            rotate: 20,
-            interval: 0,
+            // rotate: 20,
+            // interval: 0,
             textStyle: {
               color: '#fff'
             }
@@ -522,7 +526,7 @@
           type: 'value',
           name: yname,
           // max: function (value) {
-          //   var max_val_list = [] // 鎵�鏈夋樉绀烘姌绾跨殑鏍囧噯鍊�
+          //   let max_val_list = [] // 鎵�鏈夋樉绀烘姌绾跨殑鏍囧噯鍊�
           //   if (bzzList && bzzList.length > 0) {
           //     $.each(bzzList, function (index, item) {
           //       max_val_list.push(item.bzhui)
@@ -531,7 +535,7 @@
           //   max_val_list = max_val_list.sort(function (a, b) {
           //     return a - b
           //   }) // 鎺掑簭
-          //   var ma = value.max > max_val_list[max_val_list.length - 1] ? value.max + 5 : max_val_list[max_val_list.length - 1]
+          //   let ma = value.max > max_val_list[max_val_list.length - 1] ? value.max + 5 : max_val_list[max_val_list.length - 1]
           //   return parseInt(ma)
           // },
           axisLabel: {
@@ -580,126 +584,12 @@
         series: serLists
       }
       this.chart.setOption(option)
+      window.onresize = this.chart.resize
     }
   }
 }
 </script>
 
 <style scoped lang="less">
-.grid-content {
-  font-size: 8px;
-  background-color: #2e4967;
-  text-align: center;
-  border-radius: 2px;
-  margin-right: 10px;
-  padding: 0 10px
-  //>i{
-  //    color: #f00;
-  //  }
-}
 
-.infomation {
-  padding: 5px 10px;
-}
-
-.form-echrts {
-  width: 100%;
-  border-top: 1px solid #396d83;
-  //margin: 10px 10px 10px 10px;
-  .from-search {
-    display: flex;
-    padding: 5px;
-
-    > div {
-      margin-left: 10px
-    }
-
-    .pickerMon {
-      display: flex;
-
-      > div:first-child {
-        margin-right: 10px;
-      }
-
-      .pickerData {
-        flex: 1;
-        display: flex;
-
-        > span {
-          line-height: 22px
-        }
-
-        .pickerTable {
-          margin-left: 3px;
-        }
-      }
-    }
-
-    /deep/ .el-date-editor--datetime {
-      width: 100%;
-    }
-
-    /deep/ .el-input__inner {
-      position: relative;
-      width: 140px;
-      background-color: #2e4967;
-      color: #ffffff;
-      font-size: 12px;
-      height: 24px;
-      padding: 0;
-      border-color: #00fff6;
-      text-align: center;
-      z-index: 9999;
-      //padding-left:20px ;
-      //padding: 0!important;
-    }
-
-    /deep/ .el-input__icon {
-      display: block;
-      width: 140px;
-      height: 22px;
-      line-height: 22px;
-      cursor: pointer;
-      font-size: 0;
-    }
-
-    .echatsInput {
-      color: #00ffff;
-      background-color: #2e4967;
-      border: none;
-      border-radius: 6px;
-      width: 80px;
-      height: 22px;
-      text-align: center;
-    }
-
-    input::-webkit-calendar-picker-indicator {
-      opacity: 100;
-    }
-
-    .detailbtn {
-      background-color: #2e4967;
-      text-align: center;
-      padding: 0 7px;
-      line-height: 24px;
-      border-radius: 4px;
-      margin-right: 6px;
-    }
-
-    .detailbtn:hover {
-      box-shadow: 0 0 0.03rem #fff700 !important;
-      color: #fff700 !important;
-      cursor: pointer;
-    }
-  }
-
-  .el-dialog-div {
-    overflow: auto;
-  }
-
-  #echarts {
-    margin: 0;
-    padding: 0;
-  }
-}
 </style>

--
Gitblit v1.8.0