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

---
 src/components/BaseNav/WasteWater/WasteWaterIndex.vue |   16 ---
 src/components/BaseNav/WasteWater/HourData.vue        |  148 +++++++++++++----------------
 src/components/BaseNav/WasteWater/DayData.vue         |  111 +++++++++++----------
 3 files changed, 125 insertions(+), 150 deletions(-)

diff --git a/src/components/BaseNav/WasteWater/DayData.vue b/src/components/BaseNav/WasteWater/DayData.vue
index 656c4ea..35f43e5 100644
--- a/src/components/BaseNav/WasteWater/DayData.vue
+++ b/src/components/BaseNav/WasteWater/DayData.vue
@@ -295,9 +295,10 @@
       } else {
         dataUnit = '娴侀噺(m鲁/h)'
       }
+      const bzzList = this.bzzList
       var serLists = []
       for (var i = 0; i < ydatas.length; i++) {
-        // var zdcbcolor = ydatas[i].zdcbcolor
+        var zdcbcolor = ydatas[i].zxcolor
         var bz = ydatas[i].bzz
         var obj
         if (bz) {
@@ -306,34 +307,34 @@
             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 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
+                //   // 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
+                }
+              }
+            },
             type: 'line',
             data: ydatas[i].data,
             markLine: { // 骞冲潎鍊� 锛� 鍜� 鎸囨爣涓婇檺
@@ -363,31 +364,33 @@
             symbolSize: 10, // 澶у皬
             smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
             yAxisIndex: 1,
-            // itemStyle: {
-            //   normal: {
-            //     color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
-            //       // var biaozhuiz
-            //       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 > 9999999) {
-            //         return zdcbcolor
-            //       } else {
-            //         return '#33c95f'
-            //       }
-            //     },
-            //     lineStyle: { // 鎶樼嚎鐨勯鑹�
-            //       color: ydatas[i].zxcolor,
-            //       width: 5
-            //     },
-            //     borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
-            //     label: { // 鏄剧ず鍊�
-            //       show: false
-            //     }
-            //   }
-            // },
+            itemStyle: {
+              normal: {
+                color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
+                  let biaozhuiz
+                  for (let i = 0; i < bzzList.length; i++) {
+                    if (bzzList[i].name === c.seriesName) {
+                      biaozhuiz = bzzList[i].bzhui
+                    }
+                  }
+                  if (c.value[1] > biaozhuiz) {
+                    return zdcbcolor
+                  } else if (c.value[1] > biaozhuiz * 0.9) {
+                    return '#FFA500'
+                  } else {
+                    return '#33c95f'
+                  }
+                },
+                lineStyle: { // 鎶樼嚎鐨勯鑹�
+                  color: ydatas[i].zxcolor,
+                  width: 5
+                },
+                borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
+                label: { // 鏄剧ず鍊�
+                  show: false
+                }
+              }
+            },
             type: 'line',
             data: ydatas[i].data
           }
diff --git a/src/components/BaseNav/WasteWater/HourData.vue b/src/components/BaseNav/WasteWater/HourData.vue
index bb628fe..bda31d2 100644
--- a/src/components/BaseNav/WasteWater/HourData.vue
+++ b/src/components/BaseNav/WasteWater/HourData.vue
@@ -18,8 +18,8 @@
           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 v-model="formData.region" placeholder="璇烽�夋嫨" style="width: 80px">
+        <el-option v-for="(item,index) in formData.regionList" :key="index" :label="item" :value="item"></el-option>
       </el-select>
       <el-button @click="querySearch()">鏌ヨ</el-button>
       <el-button>鏄庣粏琛�</el-button>
@@ -33,7 +33,7 @@
 <script>
 import PublicDataStandard from '../PublicDataStandard'
 import dayjs from 'dayjs'
-import mapApi from '@/api/mapApi'
+import mapApi from '../../../api/mapApi'
 
 export default {
   name: 'HourData',
@@ -85,11 +85,11 @@
           }
         }],
       formData: {
+        region: '25',
+        regionList: [25, 50, 75, 100],
         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,
@@ -102,6 +102,7 @@
     this.draw24Chart()
   },
   methods: {
+    // 鐐瑰嚮鏌ヨ鍔熻兘
     querySearch () {
 
     },
@@ -114,26 +115,24 @@
         dataType: this.dataType
       }
       const result = (await mapApi.getQueryOnlineMonData(data)).Result.DataInfo
+      // console.log(result)
       this.get24HourDate(result)
     },
-    // 缁樺埗灏忔椂鏁版嵁
-    get24HourDate (res) {
-      if (res.length > 0) {
-        const d = res
+    // 缁樺埗灏忔椂鏁版嵁鎶樼嚎鍥�
+    get24HourDate (result) {
+      if (result.length > 0) {
+        const d = result
         const nameList = [] // 瀛樻斁鍥句緥
         const dateList = [] // 瀛樻斁鏃堕棿
         let dataList = [] // 瀛樻斁鏁版嵁
         let data = []
         const bzh = []
-        // wrwIDS = []
         for (let i = 0; i < d.length; i++) {
           if (d[i].MonItemId === '29') {
             continue
           }
 
           const MonTimeStr = d[i].MonTimeStr
-
-          // getWRW(d[i])
 
           let strDate
           const d1 = MonTimeStr.split('/') // 鏈�
@@ -179,8 +178,6 @@
           if (nameList.length === 0) {
             nameList.push(d[i].PoltmtrlName.trim())
             dateList.push(strDate)
-            /*  let data=new Array();
-              data.push(d.MonQty); */
             if ((d[i].PoltmtrlName === '搴熸按娴侀噺' || d[i].PoltmtrlName === '搴熸按') && d[i].MonQty < 0) {
               d[i].MonQty = 0
             }
@@ -212,9 +209,6 @@
             data.push(d[i].MonQty)
           }
         }
-        // 澶勭悊鏁版嵁缁撴潫
-
-        // dateList=get24DateTime();
 
         const newList = []
 
@@ -224,31 +218,28 @@
         }
         dataList = newList
 
-        const divid = 'mycharteff'
-        const title = name
-
         const lengList = []
         let objTemp
 
         for (let l = 0; l < nameList.length; l++) {
           let obj
-          let iconurl
+          let iconUrl
           if (nameList[l] === 'COD') {
-            iconurl = 'image://../assets/imgs/legend/SO2.png'
+            iconUrl = 'image://../assets/imgs/legend/SO2.png'
           } else if (nameList[l] === '姘ㄦ爱') {
-            iconurl = 'image://../assets/imgs/legend/NOX.png'
+            iconUrl = 'image://../assets/imgs/legend/NOX.png'
           } else if (nameList[l] === '鎬荤7') {
-            iconurl = 'image://../assets/imgs/legend/YanChen.png'
+            iconUrl = 'image://../assets/imgs/legend/YanChen.png'
           } else if (nameList[l] === '鎬绘爱') {
-            iconurl = 'image://../assets/imgs/legend/zongdan.png'
+            iconUrl = 'image://../assets/imgs/legend/zongdan.png'
           } else {
-            iconurl = 'image://../assets/imgs/legend/VOCs.png'
+            iconUrl = 'image://../assets/imgs/legend/VOCs.png'
           }
 
           if (nameList[l] === '搴熸按' || nameList[l] === '搴熸按娴侀噺') { // 灏嗗簾姘存祦閲忔帓鍒版暟缁勬渶鍚�
             objTemp = {
               name: nameList[l],
-              icon: iconurl,
+              icon: iconUrl,
               textStyle: {
                 color: '#ccc'
               },
@@ -258,7 +249,7 @@
           } else {
             obj = {
               name: nameList[l],
-              icon: iconurl,
+              icon: iconUrl,
               textStyle: {
                 color: '#ccc'
               },
@@ -282,15 +273,9 @@
           } else if (nameList[j] === '姘ㄦ爱') {
             zdcbcolor = 'red'
             zxcolor = '#00B0F0'
-          } else if (nameList[j] === '鎬荤7') {
-            zdcbcolor = 'red'
-            zxcolor = '#f48183'
           } else if (nameList[j] === '搴熸按娴侀噺') {
             zdcbcolor = 'red'
-            zxcolor = '#9ACD32'
-          } else {
-            zdcbcolor = 'red'
-            zxcolor = '#d9f2f4'
+            zxcolor = '#8fdc6e'
           }
           const ydata = {
             name: nameList[j],
@@ -307,26 +292,31 @@
           this.bzzList.push(this.bzz)
           ydatas.push(ydata)
         }
-        console.log(ydatas)
+        // console.log(ydatas)
 
         const yname = '娴撳害(mg/l)'
 
-        this.effChartShow(divid, title, legend, xdata, ydatas, yname, this.jcdID, this.datatype)
+        this.effChartShow(legend, xdata, ydatas, yname, this.jcdID, this.datatype)
       }
     },
-    effChartShow (divid, title, legend, xdata, ydatas, yname, jcdID, datatype) {
+    effChartShow (legend, xdata, ydatas, yname, jcdID, datatype) {
+      // console.log(ydatas)
+      // 鍒濆鍖栧浘鏍�
       this.chart = this.$echarts.init(this.$refs.echartsHour)
-      console.log(ydatas)
-      // this.chart.clear()
+      this.chart.clear()
+      // const bzlist = this.bzzList
+      // const bzz = this.bz
+
       let dataUnit = ''
       if (datatype === 1) {
         dataUnit = '娴侀噺(m鲁/d)'
       } else {
         dataUnit = '娴侀噺(m鲁/h)'
       }
+      const bzzList = this.bzzList
       const serLists = []
       for (let i = 0; i < ydatas.length; i++) {
-        // let zdcbcolor = ydatas[i].zdcbcolor
+        const zdcbcolor = ydatas[i].zxcolor
         const bz = ydatas[i].bzz
         let obj
         if (bz) {
@@ -337,17 +327,15 @@
             smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
             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
+                // color: function (c) {
+                //   for (let i = 0; i < bzlist.length; i++) {
+                //     if (bzlist[i].name === c.seriesName) {
+                //       this.bzz = bzlist[i].bzhui
                 //     }
                 //   }
-                //   if (c.value > this.bz) {
+                //   if (c.value > bzz) {
                 //     return zdcbcolor
-                //   } else if (c.value > this.bz * 0.9) {
+                //   } else if (c.value > bzz * 0.9) {
                 //     return '#FFA500'
                 //   } else {
                 //     return '#33c95f'
@@ -381,8 +369,7 @@
                   type: 'dashed',
                   width: 2
                 }
-              }
-              ]
+              }]
             }
           }
         } else {
@@ -392,31 +379,33 @@
             symbolSize: 10, // 澶у皬
             smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
             yAxisIndex: 1,
-            // itemStyle: {
-            //   normal: {
-            //     color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
-            //       // let biaozhuiz
-            //       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 > 9999999) {
-            //         return zdcbcolor
-            //       } else {
-            //         return '#33c95f'
-            //       }
-            //     },
-            //     lineStyle: { // 鎶樼嚎鐨勯鑹�
-            //       color: ydatas[i].zxcolor,
-            //       width: 5
-            //     },
-            //     borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
-            //     label: { // 鏄剧ず鍊�
-            //       show: false
-            //     }
-            //   }
-            // },
+            itemStyle: {
+              normal: {
+                color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
+                  let biaozhuiz
+                  for (let i = 0; i < bzzList.length; i++) {
+                    if (bzzList[i].name === c.seriesName) {
+                      biaozhuiz = bzzList[i].bzhui
+                    }
+                  }
+                  if (c.value[1] > biaozhuiz) {
+                    return zdcbcolor
+                  } else if (c.value[1] > biaozhuiz * 0.9) {
+                    return '#FFA500'
+                  } else {
+                    return '#33c95f'
+                  }
+                },
+                lineStyle: { // 鎶樼嚎鐨勯鑹�
+                  color: ydatas[i].zxcolor,
+                  width: 5
+                },
+                borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
+                label: { // 鏄剧ず鍊�
+                  show: false
+                }
+              }
+            },
             type: 'line',
             data: ydatas[i].data
           }
@@ -424,10 +413,7 @@
         serLists.push(obj)
       }
       const option = {
-        /*  title: {
-          text: title,
-      }, */
-        tooltip: { // 鎻愮ず妗�
+        tooltip: {
           trigger: 'axis',
           axisPointer: {
             type: 'cross',
@@ -464,7 +450,7 @@
             return s
           }
         },
-        toolbox: { // 鎵撳嵃绛夊伐鍏�
+        toolbox: {
           show: false,
           feature: {
             saveAsImage: {}
diff --git a/src/components/BaseNav/WasteWater/WasteWaterIndex.vue b/src/components/BaseNav/WasteWater/WasteWaterIndex.vue
index e95cc75..e64189b 100644
--- a/src/components/BaseNav/WasteWater/WasteWaterIndex.vue
+++ b/src/components/BaseNav/WasteWater/WasteWaterIndex.vue
@@ -9,20 +9,6 @@
         <span></span>
         <span></span>
         <span></span>
-        <!--        <el-tabs v-model="activeName" @tab-click="handleClick">-->
-        <!--          <el-tab-pane label="瀹炴椂鏁版嵁" name="first">-->
-        <!--            <RealData></RealData>-->
-        <!--          </el-tab-pane>-->
-        <!--          <el-tab-pane label="灏忔椂鏁板眳" name="second">-->
-        <!--            <HourData></HourData>-->
-        <!--          </el-tab-pane>-->
-        <!--          <el-tab-pane label="鏃ユ暟鎹�" name="third">-->
-        <!--            <DayData></DayData>-->
-        <!--          </el-tab-pane>-->
-        <!--          <el-tab-pane label="浜哄伐鐩戞祴鏁版嵁" name="fourth">-->
-        <!--            <Detail></Detail>-->
-        <!--          </el-tab-pane>-->
-        <!--        </el-tabs>-->
         <div class="navigation">
           <div class="navigation-left">
             <div :class="active===0?'hover':''" class="uncheck" @click='tabTaggle("RealData",0)'>瀹炴椂鏁版嵁</div>
@@ -30,7 +16,7 @@
             <div :class="active===2?'hover':''" class="uncheck" @click='tabTaggle("DayData",2)'>鏃ユ暟鎹�</div>
             <div :class="active===3?'hover':''" class="uncheck" @click='tabTaggle("Detail",3)'>浜哄伐鐩戞祴鏁版嵁</div>
           </div>
-          <div class="navigation-right">
+          <div class="navigation-right" v-if="active !== 3">
             <p>姝e父</p>
             <i style=" background: #4ec99c;"></i>
             <p>棰勮</p>

--
Gitblit v1.8.0