From ffafeb1548168dd8ee9526030e0ec3a7e7c7089a Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期五, 23 四月 2021 13:46:23 +0800
Subject: [PATCH] 废水实时数据弹框相关修改

---
 src/components/BaseNav/WasteWater/RealData.vue |  762 ++++++++++++++++++++++++++--------------------------------
 1 files changed, 345 insertions(+), 417 deletions(-)

diff --git a/src/components/BaseNav/WasteWater/RealData.vue b/src/components/BaseNav/WasteWater/RealData.vue
index affcae3..c11e43f 100644
--- a/src/components/BaseNav/WasteWater/RealData.vue
+++ b/src/components/BaseNav/WasteWater/RealData.vue
@@ -1,34 +1,30 @@
 <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>
-          <span>閲囨牱鐐规暟:</span>
-          <el-select v-model="formInline.region" placeholder="50">
-            <el-option label="0" value="0"></el-option>
-            <el-option label="25" value="25"></el-option>
-            <el-option label="50" value="50"></el-option>
-            <el-option label="75" value="75"></el-option>
-            <el-option label="100" value="100"></el-option>
-          </el-select>
-        </div>
-        <div class="detailbtn" @click="onSubmit">鏌ヨ</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:mm:ss"
+          type="datetime">
+      </el-date-picker>
+      <span class="demonstration">缁撴潫鏃堕棿锛�</span>
+      <el-date-picker
+          v-model="formData.endTime"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          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="echarts"></div>
     </div>
   </div>
@@ -36,10 +32,11 @@
 
 <script>
 
-import PublicDataStandard from '@/components/BaseNav/PublicDataStandard'
-import mapApi from '@/api/mapApi'
 import 'dayjs/locale/es'
 import dayjs from 'dayjs'
+
+import mapApi from '../../../api/mapApi'
+import PublicDataStandard from '../PublicDataStandard'
 
 export default {
   name: 'ECharts',
@@ -48,6 +45,7 @@
   },
   data () {
     return {
+      a: '',
       // tab鏍忎紶閫掓帴鏀舵暟鎹�
       dataStandard: [
         {
@@ -90,28 +88,20 @@
             val: null
           }
         }],
-
-      // echarts鐨勬暟鎹缃�
-      myChart: null,
-
-      // 寮�濮� /缁撴潫 鏃堕棿 鍜岄噰鏍风偣鍊肩殑缁戝畾鍊兼暟鎹�
-      formInline: {
-        region: '',
-        timeStart: '',
-        timeEnd: ''
+      formData: {
+        startTime: dayjs().subtract(3, 'minute').format('YYYY-MM-DD HH:mm:ss'),
+        endTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
       },
-
-      // echarts鐨刼ptions鏁版嵁浼犲叆
-      echartsOptions: {
-        legend: [],
-        ydatas: [],
-        yname: ' 娴撳害(mg/m鲁)'
-      },
-
-      // 瀹炴椂鏁版嵁鍒楄〃
+      region: '25',
+      regionList: [25, 50, 75, 100],
+      datatype: 1,
       RealTimeDataList: [],
       bzz: null,
-      bzzList: []
+      bzzList: [],
+      nameList: [],
+      // legend绫诲埆鍥捐〃灞曠ず璁剧疆鏁扮粍
+      lengList: [],
+      ydatas: []
     }
   },
   mounted () {
@@ -120,250 +110,239 @@
     })
   },
   methods: {
-    // 鐐瑰嚮鏌ヨ鎸夐挳鍔熻兘
-    onSubmit () {
-      this.DrawEXHRealTimeDateChart()
+    // 鏌ヨ鎼滅储鍔熻兘
+    querySearch () {
+      this.initEchartsData()
     },
-    // 鍒濆鍖栨暟鎹幏鍙杄charts鐨刼ptions鏁版嵁
     async initEchartsData () {
-      // 鐢ㄤ簬鎺ュ彛鏁版嵁璇锋眰鐨勫弬鏁� 寮�濮�/缁撴潫鏃堕棿 || 鍙�夋嫨鏌ヨ鐨勫紑濮�/缁撴潫鏃堕棿
-      this.formInline.timeEnd = dayjs().format('YYYY-MM-DD HH:mm:ss')
-      this.formInline.timeStart = dayjs().subtract(3, 'minute').format('YYYY-MM-DD HH:mm:ss')
       const data = {
         $tagCodeList: 'TJIP45.y2h508CEMS01NOX,CTJIP45.y2h508CEMS01SO2,CTJIP45.y2h508CEMS01F,CTJIP45.y2h508CEMS01PM',
-        $startTime: this.formInline.timeEnd,
-        $endTime: this.formInline.timeStart,
+        $startTime: this.formData.startTime,
+        $endTime: this.formData.endTime,
         $step: 15
       }
       const result = (await mapApi.getDataItems(data)).data
-      this.getRtdb15s(result)
+      this.pointsSet(result)
+      this.legendSet()
+      this.yDataSet()
+      this.drawRealTimeDateChart()
     },
-    // echarts鏁版嵁澶勭悊
-    getRtdb15s (res) {
-      if (res.length > 0) {
-        // 澶勭悊鏁版嵁寮�濮�
-        const d = res
-        const nameList = [] // 瀛樻斁鍥句緥
-        // 鏁版嵁绫诲瀷// var data={name:'',value:[now1.getFullYear(), now1.getMonth() + 1, now1.getDate().join('/'),value]}
-        let data = {}
-        // 瀛樻斁data鐨勬暟缁�
-        let datalist
-        // var bzh = []
-
-        for (let i = 0; i < d.length; i++) {
-          if (d[i].ErrorMessage != null) {
-            continue
+    // 鎺ュ彛鏁版嵁鎸夌収 鏁版嵁鍐呭垎绫诲埆璁剧疆
+    pointsSet (d) {
+      let data = []
+      let datalist = []
+      for (let i = 0; i < d.length; i++) {
+        // this.RealTimeDataList = []
+        // 鍒ゆ柇鏄惁缁х画鎵ц
+        if (d[i].ErrorMessage != null) {
+          continue
+        }
+        // temp 涓存椂鏁版嵁鍒ゆ柇鏂规硶
+        const tempList = [
+          {
+            'TJIP45.lscl2tbAIA-10505-1': '姘哀鍖栫墿',
+            'TJIP45.lscl2tbAIA-10505-2': '鐑熷皹',
+            'TJIP45.lscl2tb552AISA11202A': '浜屾哀鍖栫7',
+            'TJIP45.lscl2tb552AISA11201B': 'pH',
+            'TJIP45.lscl2tb552AI10710': '浜屾哀鍖栫⒊'
           }
-          // 涓存椂name鏁版嵁
-          const nameListTemp = [
-            {
-              'TJIP45.lscl2tbAIA-10505-1': '姘哀鍖栫墿',
-              'TJIP45.lscl2tbAIA-10505-2': '鐑熷皹',
-              'TJIP45.lscl2tb552AISA11202A': '浜屾哀鍖栫7',
-              'TJIP45.lscl2tb552AISA11201B': 'ph',
-              'TJIP45.lscl2tb552AI10710': '浜屾哀鍖栫⒊'
-            }
-          ]
-
-          const name = nameListTemp[0][d[i].UnionTagCode]
-
-          if (nameList.length === 0) {
-            nameList.push(name)
-            const newdate = new Date(d[i].ReadTime)
+        ]
+        // 鎸囨爣
+        const name = tempList[0][d[i].UnionTagCode]
+        // 鍒ゆ柇甯傚眬绫诲瀷杩涜鍒嗙粍
+        if (this.nameList.length === 0) {
+          // 鏁扮粍涓虹┖鏃�
+          this.nameList.push(name)
+          // todo 鐢╠ayjs
+          const newDate = new Date(d[i].ReadTime)
+          data = {
+            name: name,
+            value: [newDate, d[i].TagValue]
+          }
+          datalist = {
+            name: name,
+            data: [data]
+          }
+          // console.log('1111111')
+          this.RealTimeDataList.push(datalist)
+        } else if (this.nameList.indexOf(name) < 0) {
+          // 娌℃湁鎸囨爣鏃�
+          this.nameList.push(name)
+          const newDate = new Date(d[i].ReadTime)
+          data = {
+            name: name,
+            value: [newDate, d[i].TagValue]
+          }
+          datalist = {
+            name: name,
+            data: [data]
+          }
+          // console.log('222222222')
+          this.RealTimeDataList.push(datalist)
+        } else if (i === d.length - 1) {
+          // 寰幆鍒版渶鍚�
+          if (this.nameList.indexOf(name) < 0) {
+            this.nameList.push(name)
+            const newDate = new Date(d[i].ReadTime)
             data = {
               name: name,
-              value: [newdate, d[i].TagValue]
+              value: [newDate, d[i].TagValue]
             }
             datalist = {
               name: name,
               data: [data]
             }
-
+            // console.log('3333333')
             this.RealTimeDataList.push(datalist)
-            // console.log(this.RealTimeDataList)
-
-            // bzh.push(d[i].StdValue);
-          } else if (nameList.indexOf(name) < 0) {
-            nameList.push(name)
-            // bzh.push(d[i].StdValue);
-
-            const newdate = new Date(d[i].ReadTime)
-
-            data = {
-              name: name,
-              value: [newdate, d[i].TagValue]
-            }
-            datalist = {
-              name: name,
-              data: [data]
-            }
-            this.RealTimeDataList.push(datalist)
-          } else if (i === d.length - 1) {
-            if (nameList.indexOf(name) < 0) {
-              nameList.push(name)
-              // bzh.push(d[i].StdValue);
-              const newdate = new Date(d[i].ReadTime)
-              data = {
-                name: name,
-                value: [newdate, d[i].TagValue]
-              }
-              datalist = {
-                name: name,
-                data: [data]
-              }
-              this.RealTimeDataList.push(datalist)
-            } else {
-              const newdate = new Date(d[i].ReadTime)
-              data = {
-                name: name,
-                value: [newdate, d[i].TagValue]
-              }
-              for (var k = 0; k < this.RealTimeDataList.length; k++) {
-                if (this.RealTimeDataList[k].name === name) {
-                  this.RealTimeDataList[k].data.push(data)
-                }
-              }
-            }
           } else {
-            const newdate = new Date(d[i].ReadTime)
+            const newDate = new Date(d[i].ReadTime)
             data = {
               name: name,
-              value: [newdate, d[i].TagValue]
+              value: [newDate, d[i].TagValue]
             }
+            // console.log('444444')
             for (let k = 0; k < this.RealTimeDataList.length; k++) {
               if (this.RealTimeDataList[k].name === name) {
                 this.RealTimeDataList[k].data.push(data)
               }
             }
           }
-        }
-
-        const divid = 'mycharteff_second'
-        const title = name
-
-        const lengList = []
-        let objTemp = []
-        // console.log(objTemp)
-
-        for (let l = 0; l < nameList.length; l++) {
-          let obj
-          let iconurl
-          if (nameList[l] === 'ph') {
-            iconurl = 'image://../assets/imgs/legend/WenDu.png'
-          } else if (nameList[l] === '姘哀鍖栫墿') {
-            iconurl = 'image://../assets/imgs/legend/NOX.png'
-          } else if (nameList[l] === '鐑熷皹') {
-            iconurl = 'image://../assets/imgs/legend/zongdan.png'
-          } else if (nameList[l] === '浜屾哀鍖栫7') {
-            iconurl = 'image://../assets/imgs/legend/YanChen.png'
-          } else if (nameList[l] === '浜屾哀鍖栫⒊') {
-            iconurl = 'image://../assets/imgs/legend/VOCs.png'
+        } else {
+          const newDate = new Date(d[i].ReadTime)
+          data = {
+            name: name,
+            value: [newDate, d[i].TagValue]
           }
-
-          if (nameList[l] === '搴熸按' || nameList[l] === '搴熸按娴侀噺') { // 灏嗗簾姘存祦閲忔帓鍒版暟缁勬渶鍚�
-            // eslint-disable-next-line no-const-assign
-            objTemp = {
-              name: nameList[l],
-              icon: iconurl,
-              textStyle: {
-                color: '#ccc'
-              },
-              itemWidth: 20,
-              itemHeight: 5
-            }
-          } else {
-            obj = {
-              name: nameList[l],
-              icon: iconurl,
-              textStyle: {
-                color: '#ccc'
-              },
-              itemWidth: 20,
-              itemHeight: 5
-            }
-            lengList.push(obj)
-          }
-          // console.log(lengList)
-        }
-        lengList.push(objTemp)
-
-        const legend = lengList
-        // const xdata = dateList.reverse();
-        const ydatas = []
-
-        for (let j = 0; j < nameList.length; j++) {
-          let zdcbcolor, zxcolor
-          if (nameList[j] === 'ph') {
-            zdcbcolor = 'red'
-            zxcolor = '#f206ff'
-          } else if (nameList[j] === '鐑熷皹') {
-            zdcbcolor = 'red'
-            zxcolor = '#e0ffff'
-          } else if (nameList[j] === '姘哀鍖栫墿') {
-            zdcbcolor = 'red'
-            zxcolor = '#00B0F0'
-          } else if (nameList[j] === '浜屾哀鍖栫⒊') {
-            zdcbcolor = 'red'
-            zxcolor = '#9ACD32'
-          } else if (nameList[j] === '浜屾哀鍖栫7') {
-            zdcbcolor = 'red'
-            zxcolor = '#f48183'
-          }
-          let ydata
-          // 涓存椂鏁版嵁
-          const BBZMAPPING = [
-            {
-              COD: 35,
-              ph: 9,
-              鎬绘爱: 15,
-              鎬荤7: 0.3,
-              姘ㄦ爱: 3
-            }
-          ]
-          for (let m = 0; m < this.RealTimeDataList.length; m++) {
-            let stdValue = null
-            if (this.RealTimeDataList[m].name === nameList[j]) {
-              // for (let p in BBZMAPPING) {
-              //   stdValue = BBZMAPPING[this.RealTimeDataList[m].name]
-              // }
-              BBZMAPPING.forEach((item) => {
-                stdValue = BBZMAPPING[this.RealTimeDataList[m].name]
-              })
-              ydata = {
-                name: nameList[j],
-                data: this.RealTimeDataList[m].data,
-                zdcbcolor: zdcbcolor,
-                zxcolor: zxcolor,
-                bzz: stdValue
-              }
-              this.bzz = {
-                name: nameList[j],
-                bzhui: stdValue
-              }
-              this.bzzList.push(this.bzz)
-              ydatas.push(ydata)
+          for (let k = 0; k < this.RealTimeDataList.length; k++) {
+            if (this.RealTimeDataList[k].name === name) {
+              this.RealTimeDataList[k].data.push(data)
             }
           }
         }
-        const yname = '娴撳害(mg/l)'
-        this.DrawRealTimeDateChart(divid, title, legend, ydatas, yname)
-        //
-        // this.IntervalRealTimeDate(id, unionTagCodeList, BBZMAPPING)
-        this.IntervalRealTimeDate()
+      }
+      console.log(this.RealTimeDataList)
+    },
+    // legend绫诲埆鍥捐〃灞曠ず璁剧疆鏁扮粍
+    legendSet () {
+      this.lengList = []
+      let objTemp
+      for (let l = 0; l < this.nameList.length; l++) {
+        let obj
+        let IconUrl
+        if (this.nameList[l] === 'pH') {
+          IconUrl = 'image://../assets/imgs/legend/WenDu.png'
+        } else if (this.nameList[l] === '姘哀鍖栫墿') {
+          IconUrl = 'image://../assets/imgs/legend/NOX.png'
+        } else if (this.nameList[l] === '鐑熷皹') {
+          IconUrl = 'image://../assets/imgs/legend/zongdan.png'
+        } else if (this.nameList[l] === '浜屾哀鍖栫⒊') {
+          IconUrl = 'image://../assets/imgs/legend/YanChen.png'
+        } else if (this.nameList[l] === '浜屾哀鍖栫7') {
+          IconUrl = 'image://../assets/imgs/legend/VOCs.png'
+        }
+        if (this.nameList[l] === '搴熸按' || this.nameList[l] === '搴熸按娴侀噺') { // 灏嗗簾姘存祦閲忔帓鍒版暟缁勬渶鍚�
+          objTemp = {
+            name: this.nameList[l],
+            icon: IconUrl,
+            textStyle: {
+              color: '#ccc'
+            },
+            itemWidth: 20,
+            itemHeight: 5
+          }
+        } else {
+          obj = {
+            name: this.nameList[l],
+            icon: IconUrl,
+            textStyle: {
+              color: '#ccc'
+            },
+            itemWidth: 20,
+            itemHeight: 5
+          }
+          this.lengList.push(obj)
+        }
+      }
+      this.lengList.push(objTemp)
+    },
+    // yDataSet 鏁版嵁澶勭悊
+    yDataSet () {
+      this.bzzList = []
+      this.ydatas = []
+      for (let j = 0; j < this.nameList.length; j++) {
+        let zdcbcolor, zxcolor
+        if (this.nameList[j] === 'pH') {
+          zdcbcolor = 'red'
+          zxcolor = '#900090'
+        } else if (this.nameList[j] === '姘ㄦ爱') {
+          zdcbcolor = 'red'
+          zxcolor = '#00B0F0'
+        } else if (this.nameList[j] === '鐑熷皹') {
+          zdcbcolor = 'red'
+          zxcolor = '#f48183'
+        } else if (this.nameList[j] === '鎬绘爱') {
+          zdcbcolor = 'red'
+          zxcolor = '#e0ffff'
+        } else {
+          zdcbcolor = 'red'
+          zxcolor = '#9ACD32'
+        }
+        let ydata
+
+        // 涓存椂鏁版嵁
+        const BBZMAPPING = {
+          COD: 35,
+          pH: 9,
+          鎬绘爱: 15,
+          鎬荤7: 0.3,
+          姘ㄦ爱: 3
+        }
+        for (let m = 0; m < this.RealTimeDataList.length; m++) {
+          let stdValue = null
+          if (this.RealTimeDataList[m].name === this.nameList[j]) {
+            for (const p in BBZMAPPING) {
+              // console.log('p' + p)
+              this.a = p
+              stdValue = BBZMAPPING[this.RealTimeDataList[m].name]
+            }
+            // console.log(stdValue)
+            this.bzz = {
+              name: this.nameList[j],
+              bzhui: stdValue
+            }
+            ydata = {
+              name: this.nameList[j],
+              data: this.RealTimeDataList[m].data,
+              zdcbcolor: zdcbcolor,
+              zxcolor: zxcolor,
+              bzz: stdValue
+            }
+            // console.log(stdValue)
+            this.bzzList.push(this.bzz)
+            this.ydatas.push(ydata)
+          }
+        }
       }
     },
-    // 鑾峰彇鏁版嵁鐢ㄤ簬echarts鍥捐〃缁樺埗
-    DrawRealTimeDateChart (id, title, legend, ydatas, yname) {
+    // 鏍规嵁澶勭悊濂界殑鏁扮粍杩涜echarts鍥炬爣鐨勬覆鏌�
+    drawRealTimeDateChart () {
       this.myChart = this.$echarts.init(this.$refs.echarts)
+      this.myChart.clear()
+
+      const legend = this.lengList
+      const yname = '娴撳害(mg/m鲁)'
+      const bzzList = this.bzzList
+
       const serLists = []
-      let dataUnit
-      for (let i = 0; i < ydatas.length; i++) {
-        const zdcbcolor = ydatas[i].zdcbcolor
-        const bz = ydatas[i].bzz
+
+      for (let i = 0; i < this.ydatas.length; i++) {
+        const zdcbcolor = this.ydatas[i].zdcbcolor
+        const bz = this.ydatas[i].bzz
+        // console.log(bz)
         let obj
         if (bz) {
           obj = {
-            name: ydatas[i].name,
+            name: this.ydatas[i].name,
             // symbol:'circle', // 鎶樼偣褰㈢姸
             // symbolSize: 3,   //澶у皬
             smooth: true, // 鐩寸嚎 锛宼rue 涓烘洸绾�
@@ -371,9 +350,9 @@
               normal: {
                 color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
                   let biaozhuiz
-                  for (var i = 0; i < this.bzzList.length; i++) {
-                    if (this.bzzList[i].name === c.seriesName) {
-                      biaozhuiz = this.bzzList[i].bzhui
+                  for (let i = 0; i < bzzList.length; i++) {
+                    if (bzzList[i].name === c.seriesName) {
+                      biaozhuiz = bzzList[i].bzhui
                     }
                   }
                   if (c.value[1] > biaozhuiz) {
@@ -385,7 +364,7 @@
                   }
                 },
                 lineStyle: { // 鎶樼嚎鐨勯鑹�
-                  color: ydatas[i].zxcolor,
+                  color: this.ydatas[i].zxcolor,
                   width: 2
                 },
                 // borderColor:'black',  //鎶樼偣杈规鐨勯鑹�
@@ -393,25 +372,38 @@
                   show: false
                 }
               }
-
             },
             type: 'line',
-            data: ydatas[i].data,
+            data: this.ydatas[i].data,
             markLine: { // 骞冲潎鍊� 锛� 鍜� 鎸囨爣涓婇檺
               symbol: 'none',
               data: [{
                 label: {
                   normal: {
                     position: 'end',
-                    formatter: ''// ydatas[i].name+'鏍囧噯鍊�' //+'{c}'
+                    formatter: bz
                   }
                 },
                 name: '鏍囧噯鍊�',
                 yAxis: bz,
                 lineStyle: {
-                  color: ydatas[i].zxcolor,
-                  type: 'dashed',
-                  width: 2
+                  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'
+                      }
+                    }
+                  }
                 }
               }
               ]
@@ -419,48 +411,55 @@
           }
         } else {
           obj = {
-            name: ydatas[i].name,
-            // symbol:'circle', // 鎶樼偣褰㈢姸
-            // symbolSize: 3,   //澶у皬
-            smooth: true, // 鐩寸嚎 锛宼rue 涓烘洸绾�
+            name: this.ydatas[i].name,
+            symbol: 'circle', // 鎶樼偣褰㈢姸
+            symbolSize: 10, // 澶у皬
+            smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
             yAxisIndex: 1,
-            itemStyle: {
-              normal: {
-                color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
-                  return '#33c95f'
-                },
-                lineStyle: { // 鎶樼嚎鐨勯鑹�
-                  color: ydatas[i].zxcolor,
-                  width: 2
-                },
-                // borderColor:'black',  //鎶樼偣杈规鐨勯鑹�
-                label: { // 鏄剧ず鍊�
-                  show: false
-                }
-              }
-
-            },
+            // itemStyle: {
+            //   normal: {
+            //     color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
+            //       for (let i = 0; i < this.bzzList.length; i++) {
+            //         let biaozhuizs
+            //         if (this.bzzList[i].name === c.seriesName) {
+            //           biaozhuizs = this.bzzList[i].bzhui
+            //         }
+            //         console.log(biaozhuizs)
+            //       }
+            //       if (c.value[1] > 9) {
+            //         return zdcbcolor
+            //       } else {
+            //         return '#33c95f'
+            //       }
+            //     },
+            //     lineStyle: { // 鎶樼嚎鐨勯鑹�
+            //       color: this.ydatas[i].zxcolor,
+            //       width: 5
+            //     },
+            //     borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
+            //     label: { // 鏄剧ず鍊�
+            //       show: false
+            //     }
+            //   }
+            // },
             type: 'line',
-            data: ydatas[i].data
+            data: this.ydatas[i].data
           }
         }
-
-        if (ydatas[i].name === '搴熸皵娴侀噺' || ydatas[i].name === '搴熸皵') {
+        if (this.ydatas[i].name === '搴熸皵娴侀噺' || this.ydatas[i].name === '搴熸皵') {
           obj.yAxisIndex = 1
-        }
-        // 涓存椂
-        const datatype = 1
-        if (datatype === 1) {
-          dataUnit = '娴侀噺(m鲁/d)'
-        } else {
-          dataUnit = '娴侀噺(m鲁/h)'
         }
         serLists.push(obj)
       }
-      const option = {
-        /*  title: {
-              text: title,
-          }, */
+      // console.log(serLists)
+      let dataUnit = ''
+      if (this.datatype === 1) {
+        dataUnit = '娴侀噺(m鲁/d)'
+      } else {
+        dataUnit = '娴侀噺(m鲁/h)'
+      }
+      // echarts鍥捐〃option鏁版嵁
+      const options = {
         tooltip: { // 鎻愮ず妗�
           trigger: 'axis',
           axisPointer: {
@@ -472,28 +471,28 @@
           formatter: function (params) {
             let s = params[0].name + '<br />'
             for (let i = 0; i < params.length; i++) {
-              // var name = params[i].name
+              // let name = params[i].name
               // 鍥捐〃title鍚嶇О
               const seriesName = params[i].seriesName
               // 鍊�
               const value = params[i].value[1]
 
-              // var valueFliter = formatter(value)
+              // const valueFliter = formatter(value)
               const valueFliter = parseFloat(value).toFixed(2)
 
               let maker = params[i].marker
               let colo = ''
               switch (seriesName) {
-                case 'ph':
-                  colo = '#f206ff'
+                case 'pH':
+                  colo = '#900090'
                   break
-                case '姘哀鍖栫墿':
+                case '浜屾哀鍖栫⒊':
                   colo = '#00B0F0'
                   break
                 case '鐑熷皹':
                   colo = '#e0ffff'
                   break
-                case '浜屾哀鍖栫⒊':
+                case '姘哀鍖栫墿':
                   colo = '#9ACD32'
                   break
                 case '浜屾哀鍖栫7':
@@ -509,15 +508,14 @@
             return s
           }
         },
-        toolbox: {
+        toolbox: { // 鎵撳嵃绛夊伐鍏�
           show: false,
           feature: {
             saveAsImage: {}
           }
         },
-        grid: {
-          top: '20%',
-          bottom: '15%'
+        grid: { // 缃戞牸
+          top: '20%'
         },
         legend: {
           data: legend
@@ -619,139 +617,69 @@
         }],
         series: serLists
       }
-      this.myChart.setOption(option)
-    },
-    // 瀹氭椂鍣� 鏍规嵁鏃堕棿闂撮殧璇锋眰鏁版嵁
-    IntervalRealTimeDate (id, unionTagCodeList, BBZMAPPING) {
-      // const interValHander = setInterval(function () {
-      //   this.initEchartsData()
-      // console.log('闂撮殧璇锋眰鏁版嵁')
-      // }, 1500)
-      // console.log(interValHander)
+      this.myChart.setOption(options, true)
+      console.log(options)
+      window.onresize = this.myChart.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: #ffffff;
-  }
-}
-
-.animation {
-  //width: 600px;
-  //height: 0.06rem;
-  .infomation {
-    padding: 5px 10px;
-  }
-}
-
-.form-echrts {
-  width: 100%;
-  border-top: 1px solid #396d83;
-  //margin: 10px 10px 10px 10px;
-  .from-search {
+.echarts-box {
+  .tab-scroll {
     display: flex;
-    padding: 5px;
+    align-items: center;
+    justify-content: space-between;
 
-    > div {
-      margin-left: 10px
+    .time-select {
+      cursor: pointer;
+      padding: 5px;
+      border: 1px solid #2b87c8;
+      border-radius: 4px;
+      text-align: center;
+      color: #fff;
+      font-size: 11px;
+      width: 280px;
     }
+  }
 
-    .pickerMon {
-      display: flex;
+  .echarts-form {
+    height: 0.3rem;
+    line-height: 0.3rem;
 
-      > 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%;
+    .demonstration {
+      color: #00fff6;
+      font-size: 12px;
+      margin-left: 10px;
     }
 
     /deep/ .el-input__inner {
-      position: relative;
-      width: 140px;
+      height: 0.15rem;
       background-color: #2e4967;
       color: #fff;
       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;
+    .el-button {
+      margin: 0 15px;
+      width: 0.3rem;
+      height: 0.15rem;
+      display: inline-block;
       background-color: #2e4967;
-      border: none;
-      border-radius: 6px;
-      width: 80px;
-      height: 22px;
-    }
-
-    input::-webkit-calendar-picker-indicator {
-      opacity: 100;
-    }
-
-    .detailbtn {
-      background-color: #2e4967;
+      color: #fff;
+      font-size: 12px;
+      padding: 0;
+      border-color: #00fff6;
       text-align: center;
-      padding: 0 7px;
-      line-height: 20px;
-      border-radius: 4px;
-      margin-right: 6px;
     }
-
   }
 
-  .el-dialog-div {
-    //height: 50vh!important;
-    overflow: auto;
-    //overflow: hidden;
-  }
-
-  #echarts {
-    margin: 0;
-    padding: 0;
-    //height: 3rem;
-    //border: 1px solid #396d83;
-    //margin: 10px 10px 10px 10px;
+  /deep/ .el-icon-time:before {
+    content: " ";
   }
 }
 </style>

--
Gitblit v1.8.0