派生自 wuyushui/SewerAndRainNetwork

zhangshuaibao
2021-04-14 b4946988c1cdcb33f0d3c27154f61aec512b5aca
src/components/BaseNav/PublicBounced/common/echarts/EChartsRealWasteWater.vue
@@ -3,9 +3,9 @@
  <div id="Tab">
    <div class="animation">
      <div class="infomation">
        <span class="grid-content">COD : <i style="color: #e8ee0b">11.24385</i> 标准 : 50</span>
        <span class="grid-content">氮氧 :<i style="color: #e8ee0b">0.1889014</i>  标准 : 30</span>
        <span class="grid-content">总磷 : <i style="color: #e8ee0b">0.03812287</i> 标准 : 5</span>
        <span class="grid-content">COD : <i style="color: #e8ee0b">11.24385</i> 标准 : <i style="color: #fff">50</i>></span>
        <span class="grid-content">氮氧 :<i style="color: #e8ee0b">0.1889014</i>  标准 : <i style="color: #fff">30</i></span>
        <span class="grid-content">总磷 : <i style="color: #e8ee0b">0.03812287</i> 标准 : <i style="color: #fff">5</i></span>
        <span class="grid-content">废水流量 : <i style="color: #e8ee0b">32.16287</i></span>
      </div>
    </div>
@@ -250,14 +250,16 @@
    }
  },
  mounted () {
    this.DrawRealTimeDateChart(this.JsonRealWasteWater.id, this.JsonRealWasteWater.title, this.JsonRealWasteWater.legend, this.JsonRealWasteWater.ydatas, this.JsonRealWasteWater.yname)
    // this.formInline.timeEnd = dayjs().format('YYYY-MM-DD HH:mm:ss')
    // this.formInline.timeStart = dayjs().subtract(1, 'minute').format('YYYY-MM-DD HH:mm:ss')
    // this.DrawEXHRealTimeDateChart(this.JsonRealWasteWater.id, this.JsonRealWasteWater.title, this.JsonRealWasteWater.legend, this.JsonRealWasteWater.ydatas, this.JsonRealWasteWater.yname)
  },
  methods: {
    onSubmit () {
      this.DrawRealTimeDateChart(this.JsonRealWasteWater.id, this.JsonRealWasteWater.title, this.JsonRealWasteWater.legend, this.JsonRealWasteWater.ydatas, this.JsonRealWasteWater.yname)
    },
    DrawRealTimeDateChart (id, title, legend, ydatas, yname) {
      this.RealTimeChart = this.$echarts.init(this.$refs.main)
      this.RealTimeChart = this.$echarts.init(this.$refs.echarts)
      var serLists = []
      for (var i = 0; i < ydatas.length; i++) {
        // var zdcbcolor = ydatas[i].zdcbcolor
@@ -272,20 +274,20 @@
            itemStyle: {
              normal: {
                color: function (c) { // 根据value 显示不同的折点颜色
                  /* var biaozhuiz
                  for (var 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'
                  }
                  {
                    return '#33c95f'
                  } */
                  // var biaozhuiz
                  // for (var 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'
                  // }
                  // {
                  //   return '#33c95f'
                  // }
                },
                lineStyle: { // 折线的颜色
                  color: ydatas[i].zxcolor,
@@ -348,7 +350,7 @@
          }
        }
        if (ydatas[i].name === '废水流量' || ydatas[i].name === '废水') {
        if (ydatas[i].name === '废气流量' || ydatas[i].name === '废气') {
          obj.yAxisIndex = 1
        }
        serLists.push(obj)
@@ -374,19 +376,29 @@
              var seriesName = params[i].seriesName
              // 值
              var value = params[i].value[1]
              var valueFliter = this.formatter(value)
              var valueFliter = formatter(value)
              var 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 === '总磷') {
                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 {
                maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#9ACD32;"></span>'
              var colo = ''
              switch (seriesName) {
                case 'COD':
                  colo = '#fff21c'
                  break
                case '氨氮':
                  colo = '#00B0F0'
                  break
                case '总磷':
                  colo = '#f48183'
                  break
                case '总氮':
                  colo = '#e0ffff'
                  break
                default:
                  colo = '#9ACD32'
                  break
              }
              maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + colo + ';"></span>'
              s += maker + seriesName + ':' + valueFliter + '<br />'
            }
            return s
@@ -399,7 +411,9 @@
          }
        },
        grid: { // 网格
          top: '20%'
          top: '20%',
          left: '7%',
          bottom: '10%'
        },
        legend: {
          data: legend
@@ -425,9 +439,6 @@
        xAxis: { // x 轴设置
          type: 'time',
          boundaryGap: false,
          nameTextStyle: {
            fontSize: 15
          },
          axisLabel: { // x轴全部显示
            // rotate: 30,
            margin: 6,
@@ -457,8 +468,7 @@
          type: 'value',
          name: yname,
          max: function (value) {
            var ma = value.max > 100 ? value.max : 100
            return parseInt(ma)
            return parseInt(value.max + 30)
          },
          axisLabel: {
            formatter: '{value}',
@@ -493,6 +503,9 @@
          splitLine: {
            show: false
          }, // y轴 网格线不显示,
          // inverse: true,
          // nameLocation: 'start',
          // max:500,
          axisLine: {
            lineStyle: {
              color: '#FFFFFF',
@@ -578,20 +591,7 @@
          }
        }
        RealTimeChart.setOption(op)
      })
    },
    drawChart: function () {
      window.onresize = function () {
        var h1 = document.documentElement.clientHeight// 获取屏幕的高度
        if (h1 > 700) {
          this.myChart.getDom().style.height = 3 + 'rem'
          this.myChart.getDom().style.width = 6 + 'rem'
        } else {
          this.myChart.getDom().style.height = 3 + 'rem'
          this.myChart.getDom().style.width = 6 + 'rem'
        }
        this.myChart.resize()
      } */
      }) */
    }
  }
}