派生自 wuyushui/SewerAndRainNetwork

src/components/base-page/WasteGas/HourData.vue
@@ -1,5 +1,5 @@
<template>
  <div class="echarts-box">
  <div id="waste-gas-hours-chart-box" class="waste-gas-hours-chart-box echarts-box">
    <div class="tab-scroll">
      <PublicDataStandard :dataStandard="dataStandard"></PublicDataStandard>
    </div>
@@ -9,11 +9,18 @@
      <span class="demonstration">结束时间:</span>
      <el-date-picker v-model="formData.timeEnd" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" size="mini"></el-date-picker>
      <span class="demonstration">采样点数:</span>
      <el-select v-model="formData.region" placeholder="请选择" size="mini" >
      <el-select class="selectBox" v-model="formData.region" placeholder="请选择" size="mini" >
        <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 @click="ScheduleShow">明细表</el-button>
      <el-popover
          placement="top"
          width="100%"
          popper-class="popoverBoxStyle"
          trigger="click">
        <dynamic-table :tableData="tableData" :tableHeader="tableConfig" v-if="tableData"></dynamic-table>
        <el-button class="mingxiBtn" slot="reference" id="mingxiBtn">明细表</el-button>
      </el-popover>
    </div>
    <div class="echarts-chart">
      <div ref="wastegashour"></div>
@@ -31,6 +38,7 @@
<script>
import Scheduleof from '@components/base-page/WasteGas/Scheduleof'
import PublicDataStandard from '../PublicDataStandard'
import DynamicTable from '../../../views/popup/DynamicHeader/DynamicTable' // 多级表头表格
import 'dayjs/locale/es'
import dayjs from 'dayjs'
@@ -41,69 +49,149 @@
  components: {
    // PublicDetailedList
    PublicDataStandard,
    Scheduleof
    Scheduleof,
    DynamicTable
  },
  props: {
    OnlineMonEmissPointId: {
      type: Number
    }
  },
  data () {
    return {
      // tab栏传递接收数据
      dataStandard: [
        {
          current: {
            name: '氮氧化物',
            val: 29.93
          },
          standard: {
            name: '标准',
            val: 100
          }
        },
        {
          current: {
            name: '二氧化硫',
            val: 17.34
          },
          standard: {
            name: '标准',
            val: 50
          }
        },
        {
          current: {
            name: '烟尘',
            val: 6.93
          },
          standard: {
            name: '标准',
            val: 30
          }
        },
        {
          current: {
            name: '废气流量',
            val: 120
          },
          standard: {
            name: '',
            val: null
          }
        }],
      dataStandard: [],
      formData: {
        region: '25',
        regionList: [25, 50, 75, 100],
        timeStart: dayjs().subtract(24, 'hours').format('YYYY-MM-DD HH:mm:ss'),
        timeEnd: dayjs().format('YYYY-MM-DD HH:mm:ss')
      },
      tableData: [],
      showSchedule: false,
      dataType: 2,
      myChart: null,
      exhbzz: null,
      jcdID: 1,
      exhbzzList: []
      exhbzzList: [],
      // 配置明细表表头
      tableConfig: [
        {
          id: 100,
          label: '排放点',
          prop: 'OnLineMonEmissPointName'
        },
        {
          id: 200,
          label: '监测时间',
          prop: 'MonTimeStr'
        },
        {
          id: 300,
          label: '氮氧化物',
          prop: 'PoltmtrlName',
          children: [
            {
              id: 310,
              label: '浓度(mg/m³)',
              prop: '氮氧化物_OrglQty'
            },
            {
              id: 320,
              label: '折算值(mg/m³))',
              prop: '氮氧化物_ConvertQty'
            },
            {
              id: 330,
              label: '标准值(mg/m³)',
              prop: '氮氧化物_StdValue'
            },
            {
              id: 340,
              label: '排放量(kg/h)',
              prop: '氮氧化物_EmissQty'
            }
          ]
        },
        {
          id: 400,
          label: '二氧化硫',
          prop: 'PoltmtrlName',
          children: [
            {
              id: 410,
              label: '浓度(mg/m³)',
              prop: '氮氧化物_OrglQty'
            },
            {
              id: 420,
              label: '折算值(mg/m³))',
              prop: '氮氧化物_ConvertQty'
            },
            {
              id: 430,
              label: '标准值(mg/m³)',
              prop: '氮氧化物_StdValue'
            },
            {
              id: 440,
              label: '排放量(kg/h)',
              prop: '氮氧化物_EmissQty'
            }
          ]
        },
        {
          id: 500,
          label: '烟尘',
          prop: 'PoltmtrlName',
          children: [
            {
              id: 510,
              label: '浓度(mg/m³)',
              prop: '氮氧化物_OrglQty'
            },
            {
              id: 520,
              label: '折算值(mg/m³))',
              prop: '氮氧化物_ConvertQty'
            },
            {
              id: 530,
              label: '标准值(mg/m³)',
              prop: '氮氧化物_StdValue'
            },
            {
              id: 540,
              label: '排放量(kg/h)',
              prop: '氮氧化物_EmissQty'
            }
          ]
        },
        {
          id: 600,
          label: '废气流量',
          prop: '',
          children: [
            {
              id: 610,
              label: '气量(m³/h)',
              prop: '废气流量_MonQty'
            }
          ]
        }
      ]
    }
  },
  mounted () {
    this.$nextTick(() => {
      this.initnData()
      if (!this.OnlineMonEmissPointId) {
        document.querySelector('#waste-gas-hours-chart-box').innerHTML = '没有查询到数据!'
        document.querySelector('#waste-gas-hours-chart-box').style.textAlign = 'center'
        document.querySelector('#waste-gas-hours-chart-box').style.height = '2.02rem'
        document.querySelector('#waste-gas-hours-chart-box').style.lineHeight = '1rem'
      } else {
        this.initnData()
      }
    })
  },
  methods: {
@@ -116,8 +204,11 @@
    },
    async initnData () {
      const data = {
        onLineMonEmissPointId: 23,
        monItemId: 28,
        poltSourceId: '',
        poltMtrlId: '',
        emissTypeId: '',
        onLineMonEmissPointId: this.OnlineMonEmissPointId,
        monItemId: '28,31,226',
        beginTime: this.formData.timeStart,
        endTime: this.formData.timeEnd,
        dataType: this.dataType
@@ -128,6 +219,8 @@
    },
    get24HourDate (res) {
      if (res.length > 0) {
        this.dataStandard = []
        this.tableData = this.analysisResult(res) // 小时明细表解析结果
        // 处理数据开始
        const d = res
        const nameList = [] // 存放图例
@@ -210,21 +303,41 @@
          if (nameList.length === 0) {
            nameList.push(d[i].PoltmtrlName.trim())
            this.dataStandard.push({
              current: {
                name: d[i].PoltmtrlName.trim(),
                val: 29.93
              },
              standard: {
                name: '标准',
                val: 100
              }
            })
            dateList.push(strDate)
            if ((d[i].PoltmtrlName === '废气流量' || d[i].PoltmtrlName === '废气') && d[i].MonQty < 0) {
              d[i].MonQty = 0
            }
            data.push(d[i].MonQty)
            if (d[i].MonQty !== null)data.push(d[i].MonQty)
            bzh.push(d[i].StdValue)
          } else if (nameList.indexOf(d[i].PoltmtrlName.trim()) < 0) {
            nameList.push(d[i].PoltmtrlName)
            this.dataStandard.push({
              current: {
                name: d[i].PoltmtrlName.trim(),
                val: 29.93
              },
              standard: {
                name: '标准',
                val: 100
              }
            })
            bzh.push(d[i].StdValue)
            dataList.push(data)
            data = []
            if ((d[i].PoltmtrlName === '废气流量' || d[i].PoltmtrlName === '废气') && d[i].MonQty < 0) {
              d[i].MonQty = 0
            }
            data.push(d[i].MonQty)
            if (d[i].MonQty !== null)data.push(d[i].MonQty)
          } else if (i === d.length - 1) {
            if ((d[i].PoltmtrlName === '废气流量' || d[i].PoltmtrlName === '废气') && d[i].MonQty < 0) {
              d[i].MonQty = 0
@@ -238,7 +351,7 @@
            if ((d[i].PoltmtrlName === '废气流量' || d[i].PoltmtrlName === '废气') && d[i].MonQty < 0) {
              d[i].MonQty = 0
            }
            data.push(d[i].MonQty)
            if (d[i].MonQty !== null)data.push(d[i].MonQty)
          }
        }
        // 处理数据结束
@@ -337,7 +450,10 @@
        }
        const yname = '浓度(mg/m³)'
        for (var t = 0; t < this.dataStandard.length; t++) {
          this.dataStandard[t].current.val = ydatas[t].data[ydatas[t].data.length - 1].toFixed(2)
          this.dataStandard[t].standard.val = ydatas[t].bzz
        }
        this.CreateChart(id, title, legend, xdata, ydatas, yname, this.jcdID, this.datatype)
      }
    },
@@ -525,10 +641,12 @@
            saveAsImage: {}
          }
        },
        grid: { // 网格
        grid: {
          // 与绝对定位相似,top,left,right,bottom 设定是根据上级盒子宽高来计算
          top: '20%',
          left: '15%'
          // containLabel: true
          left: '6%',
          right: '8%',
          bottom: '12%'
        },
        legend: { // 图例
          data: legend
@@ -646,10 +764,90 @@
        series: serLists
      }
      this.myChart.setOption(option)
    },
    analysisResult (result) {
      // 处理表格头
      const json = {}
      const arr = []
      // 处理表格内容
      const bodyDataList = []
      const dataMap = {}
      for (let i = 0; i < result.length; i++) {
        json[result[i].PoltmtrlName] = result[i].PoltmtrlName
        const rgdata = result[i]
        const timeTag = rgdata.MonTimeStr
        if (!dataMap[timeTag]) {
          dataMap[timeTag] = { MonTimeStr: '' + rgdata.MonTimeStr }
        }
        // 往数据中添加属性数据
        const el = dataMap[timeTag]
        el.OnLineMonEmissPointName = rgdata.OnLineMonEmissPointName
        el[rgdata.PoltmtrlName + '_OrglQty'] = rgdata.OrglQty ? rgdata.OrglQty.toFixed(2) : '--' // 原始值
        el[rgdata.PoltmtrlName + '_ConvertQty'] = rgdata.ConvertQty ? rgdata.ConvertQty.toFixed(2) : '--' // 折标量
        el[rgdata.PoltmtrlName + '_StdValue'] = rgdata.StdValue ? rgdata.StdValue.toFixed(2) : '--' // 标准值
        el[rgdata.PoltmtrlName + '_EmissQty'] = rgdata.EmissQty ? rgdata.EmissQty.toFixed(2) : '--' // 排放量
        el[rgdata.PoltmtrlName + '_MonQty'] = rgdata.MonQty ? rgdata.MonQty.toFixed(2) : '--' // 监测量
      }
      let FQLLtemp = ''
      let FQWDtemp = ''
      let FQYHLtemp = ''
      for (var key in json) {
        if (key === '废气流量' || key === '废气') {
          FQLLtemp = key
        } else if (key === '温度') {
          FQWDtemp = key
        } else if (key === '氧含量') {
          FQYHLtemp = key
        } else {
          arr.push(key)
        }
      }
      if (FQLLtemp != null) {
        arr.push(FQLLtemp)
      }
      if (FQWDtemp != null) {
        arr.push(FQWDtemp)
      }
      if (FQYHLtemp != null) {
        arr.push(FQYHLtemp)
      }
      for (var p in dataMap) {
        bodyDataList.push(dataMap[p])
      }
      return bodyDataList
    }
  }
}
</script>
<style scoped lang="less">
<style lang="less">
.waste-gas-hours-chart-box .echarts-form .el-input__inner {
  background-color: rgba(0, 0, 0, 0);
  height: .13rem;
  border-color: #336fa4;
}
.waste-gas-hours-chart-box .echarts-form{
  margin-top: 1px
}
.waste-gas-hours-chart-box .echarts-form .el-input__icon{
  height: .13rem;
  top: -.02rem;
  right: -0.03rem;
  position: absolute;
  color: #00d0f9;
}
.waste-gas-hours-chart-box .echarts-form .selectBox .el-input__icon:last-child{
  top: .02rem;
}
.waste-gas-hours-chart-box .echarts-form .selectBox .is-reverse{
  top: -.02rem !important;
}
.waste-gas-hours-chart-box .echarts-form .el-button{
  background-color: rgba(0, 0, 0, 0);
  height: .13rem;
}
.waste-gas-hours-chart-box .echarts-form .mingxiBtn{
  margin-left: -.02rem;
}
</style>