| | |
| | | <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="querySearch">查询</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="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> |
| | | </div> |
| | | <div class="echarts-chart"> |
| | | <div style="width:5rem;height:1.5rem;" ref="echarts"></div> |
| | | <!-- <public-chart :propsData="propsData"></public-chart>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import PublicDataStandard from '@/components/BaseNav/PublicDataStandard' |
| | | import mapApi from '@/api/mapApi' |
| | | // import PublicChart from '../PublicChart' |
| | | import PublicDataStandard from '../PublicDataStandard' |
| | | import mapApi from '../../../api/mapApi' |
| | | import 'dayjs/locale/es' |
| | | import dayjs from 'dayjs' |
| | | |
| | | export default { |
| | | name: 'WasteGasRealChart', |
| | | components: { |
| | | // PublicChart, |
| | | PublicDataStandard |
| | | }, |
| | | data () { |
| | |
| | | val: null |
| | | } |
| | | }], |
| | | propsData: {}, |
| | | |
| | | // 开始 /结束 时间 和采样点值的绑定值数据 |
| | | formData: { |
| | | region: '25', |
| | | regionList: [25, 50, 75, 100], |
| | | startTime: dayjs().subtract(3, 'minute').format('YYYY-MM-DD HH:mm:ss'), |
| | | endTime: dayjs().format('YYYY-MM-DD HH:mm:ss') |
| | | }, |
| | | |
| | | // echarts的数据设置 |
| | | myChart: null, |
| | | |
| | | // 开始 /结束 时间 和采样点值的绑定值数据 |
| | | formInline: { |
| | | region: '', |
| | | timeEnd: '', |
| | | timeStart: '' |
| | | }, |
| | | |
| | | res: [], |
| | | |
| | | // 实时数据列表 |
| | | EXHRealTimeDataList: [], |
| | | bzz: null, |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 初始化数据获取echarts的options数据 |
| | | // 点击查询按钮功能 查询搜索功能 |
| | | querySearch () { |
| | | this.initEchartsData() |
| | | // console.log(this.EXHRealTimeDataList) |
| | | }, |
| | | // 初始化数据请求 |
| | | async initEchartsData () { |
| | | const data = { |
| | | $tagCodeList: 'TJIP45.y2h508CEMS01NOX,CTJIP45.y2h508CEMS01SO2,CTJIP45.y2h508CEMS01F,CTJIP45.y2h508CEMS01PM', |
| | | $startTime: dayjs().subtract(3, 'minute').format('YYYYMMDD HHmmss'), |
| | | $endTime: dayjs().format('YYYYMMDD HHmmss'), |
| | | $step: 15 |
| | | } |
| | | this.res = (await mapApi.DataItems(data)).data |
| | | this.getRtdb15s(this.res) |
| | | }, |
| | | // 点击查询按钮功能 |
| | | async querySearch () { |
| | | // 用于接口数据请求的参数 开始/结束时间 || 可选择查询的开始/结束时间 |
| | | // this.formInline.timeEnd = dayjs().format('YYYYMMDD HHmmss') |
| | | // this.formInline.timeStart = dayjs().subtract(3, 'minute').format('YYYYMMDD HHmmss') |
| | | 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.DataItems(data)).data |
| | | this.getRtdb15s(result) |
| | | this.dealWithData(result) |
| | | }, |
| | | // echarts数据处理 |
| | | getRtdb15s (res) { |
| | | dealWithData (res) { |
| | | if (res.length > 0) { |
| | | // 处理数据开始 |
| | | const d = res |
| | | const nameList = [] // 存放图例 |
| | | |
| | | let data // 数据类型// let data={name:'',value:[now1.getFullYear(), now1.getMonth() + 1, now1.getDate().join('/'),value]} |
| | | let datalist // 存放data的数组 |
| | | // let bzh = [] |
| | | let data |
| | | // 存放data的数组 |
| | | let datalist |
| | | this.EXHRealTimeDataList = [] |
| | | this.nameList = [] |
| | | for (let i = 0; i < d.length; i++) { |
| | | if (d[i].ErrorMessage != null) { |
| | | continue |
| | |
| | | const nameListTemp = [ |
| | | { |
| | | 'TJIP45.y2h508CEMS01NOX': '氮氧化物', |
| | | 'TJIP45.y2h508CEMS01SO2': '烟尘', |
| | | 'TJIP45.y2h508CEMS01F': '二氧化磷', |
| | | 'TJIP45.y2h508CEMS01PM': 'ph' |
| | | 'TJIP45.y2h508CEMS01SO2': '氧含量', |
| | | 'TJIP45.y2h508CEMS01F': '温度', |
| | | 'TJIP45.y2h508CEMS01PM': '废气流量' |
| | | // 'TJIP45.lscl2tb552AI10710': '二氧化碳' |
| | | } |
| | | ] |
| | |
| | | } |
| | | } |
| | | } |
| | | // console.log(this.EXHRealTimeDataList) |
| | | |
| | | const divid = 'mychart_ss' |
| | | const title = name |
| | | const lengList = [] |
| | | const legendList = [] |
| | | let objTemp |
| | | |
| | | for (let l = 0; l < nameList.length; l++) { |
| | | let obj |
| | | let iconurl |
| | | if (nameList[l] === 'ph') { |
| | | iconurl = 'image://../assets/imgs/legend/WenDu.png' |
| | | let iconUrl |
| | | if (nameList[l] === '温度') { |
| | | iconUrl = 'image://../assets/imgs/legend/WenDu.png' |
| | | } else if (nameList[l] === '氮氧化物') { |
| | | iconurl = 'image://../assets/imgs/legend/NOX.png' |
| | | iconUrl = 'image://../assets/imgs/legend/NOX.png' |
| | | } else if (nameList[l] === '烟尘') { |
| | | iconurl = 'image://../assets/imgs/legend/zongdan.png' |
| | | } else if (nameList[l] === '二氧化磷') { |
| | | iconurl = 'image://../assets/imgs/legend/YanChen.png' |
| | | } else if (nameList[l] === '二氧化碳') { |
| | | iconurl = 'image://../assets/imgs/legend/VOCs.png' |
| | | iconUrl = 'image://../assets/imgs/legend/zongdan.png' |
| | | } else if (nameList[l] === '氧含量') { |
| | | iconUrl = 'image://../assets/imgs/legend/VOCs.png' |
| | | } else if (nameList[l] === '废气流量') { |
| | | iconUrl = 'image://../assets/imgs/legend/VOCs.png' |
| | | } |
| | | |
| | | if (nameList[l] === '废气' || nameList[l] === '废气流量') { // 将废气流量排到数组最后 |
| | | objTemp = { |
| | | name: nameList[l], |
| | | icon: iconurl, |
| | | icon: iconUrl, |
| | | textStyle: { |
| | | color: '#ccc' |
| | | }, |
| | |
| | | } else { |
| | | obj = { |
| | | name: nameList[l], |
| | | icon: iconurl, |
| | | icon: iconUrl, |
| | | textStyle: { |
| | | color: '#ccc' |
| | | }, |
| | | itemWidth: 20, |
| | | itemHeight: 5 |
| | | } |
| | | lengList.push(obj) |
| | | legendList.push(obj) |
| | | } |
| | | } |
| | | lengList.push(objTemp) |
| | | legendList.push(objTemp) |
| | | |
| | | const legend = lengList |
| | | const legend = legendList |
| | | const ydatas = [] |
| | | |
| | | for (let j = 0; j < nameList.length; j++) { |
| | | let zdcbcolor, zxcolor |
| | | if (nameList[j] === 'ph') { |
| | | if (nameList[j] === '温度') { |
| | | zdcbcolor = 'red' |
| | | zxcolor = '#f206ff' |
| | | } else if (nameList[j] === '烟尘') { |
| | |
| | | } else if (nameList[j] === '氮氧化物') { |
| | | zdcbcolor = 'red' |
| | | zxcolor = '#00B0F0' |
| | | } else if (nameList[j] === '二氧化碳') { |
| | | } else if (nameList[j] === '废气流量') { |
| | | zdcbcolor = 'red' |
| | | zxcolor = '#9ACD32' |
| | | } else if (nameList[j] === '二氧化磷') { |
| | | } else if (nameList[j] === '氧含量') { |
| | | zdcbcolor = 'red' |
| | | zxcolor = '#f48183' |
| | | zxcolor = '#008000' |
| | | } |
| | | let ydata |
| | | // 临时数据 |
| | | const BBZMAPPING = [ |
| | | { |
| | | 氮氧化物: 35, |
| | | 烟尘: 9, |
| | | 二氧化磷: 15, |
| | | ph: 0.3 |
| | | } |
| | | ] |
| | | const BBZMAPPING = { |
| | | 氮氧化物: 30, |
| | | 烟尘: 9, |
| | | 二氧化磷: 15, |
| | | ph: 0.3 |
| | | } |
| | | for (let m = 0; m < this.EXHRealTimeDataList.length; m++) { |
| | | let stdValue = null |
| | | if (this.EXHRealTimeDataList[m].name === nameList[j]) { |
| | |
| | | // i++ |
| | | // stdValue = BBZMAPPING[this.EXHRealTimeDataList[m].name] |
| | | // } |
| | | BBZMAPPING.forEach(item => { |
| | | // BBZMAPPING.forEach(item => { |
| | | // stdValue = BBZMAPPING[this.EXHRealTimeDataList[m].name] |
| | | // }) |
| | | for (const p in BBZMAPPING) { |
| | | // console.log('p' + p) |
| | | this.a = p |
| | | stdValue = BBZMAPPING[this.EXHRealTimeDataList[m].name] |
| | | }) |
| | | } |
| | | |
| | | ydata = { |
| | | name: nameList[j], |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | const yname = '浓度(mg/m³)' |
| | | |
| | | this.DrawRealTimeDateChart(divid, title, legend, ydatas, yname) |
| | | const yName = '浓度(mg/m³)' |
| | | this.drawRealTimeDateChart(legend, ydatas, yName) |
| | | } |
| | | }, |
| | | // 获取数据用于echarts图表绘制 |
| | | DrawRealTimeDateChart (id, title, legend, ydatas, yname) { |
| | | // console.log(ydatas) |
| | | drawRealTimeDateChart (legend, ydatas, yName) { |
| | | // 每次绘制图表进行图表实例化 |
| | | this.myChart = this.$echarts.init(this.$refs.echarts) |
| | | // 图表数据清除 |
| | | this.myChart.clear() |
| | | // 定义series数据 |
| | | const serLists = [] |
| | | let dataUnit |
| | | for (let i = 0; i < ydatas.length; i++) { |
| | | const zdcbcolor = ydatas[i].zdcbcolor |
| | | const bz = ydatas[i].bzz |
| | | // console.log(bz) |
| | | let obj |
| | | let biaozhuiz |
| | | const exhbzzList = this.exhbzzList |
| | | // console.log(exhbzzList) |
| | | if (bz) { |
| | | obj = { |
| | | name: ydatas[i].name, |
| | |
| | | itemStyle: { |
| | | normal: { |
| | | color: function (c) { // 根据value 显示不同的折点颜色 |
| | | for (let i = 0; i < this.exhbzzList.length; i++) { |
| | | if (this.exhbzzList[i].name === c.seriesName) { |
| | | this.biaozhuiz = this.exhbzzList[i].bzhui |
| | | for (let i = 0; i < exhbzzList.length; i++) { |
| | | if (exhbzzList[i].name === c.seriesName) { |
| | | biaozhuiz = exhbzzList[i].bzhui |
| | | } |
| | | } |
| | | if (c.value[1] > this.biaozhuiz) { |
| | | if (c.value[1] > biaozhuiz) { |
| | | return zdcbcolor |
| | | } else if (c.value[1] > this.biaozhuiz * 0.9) { |
| | | } else if (c.value[1] > biaozhuiz * 0.9) { |
| | | return '#FFA500' |
| | | } else { |
| | | return '#33c95f' |
| | |
| | | itemStyle: { |
| | | normal: { |
| | | color: function (c) { // 根据value 显示不同的折点颜色 |
| | | // let biaozhuiz |
| | | // for (let i = 0; i < this.exhbzzList.length; i++) { |
| | | // if (this.exhbzzList[i].name === c.seriesName) { |
| | | // this.biaozhuiz = this.exhbzzList[i].bzhui |
| | | // } |
| | | // } |
| | | if (c.value[1] > 20) { |
| | | for (let i = 0; i < exhbzzList.length; i++) { |
| | | if (exhbzzList[i].name === c.seriesName) { |
| | | biaozhuiz = exhbzzList[i].bzhui |
| | | } |
| | | } |
| | | if (c.value[1] > biaozhuiz) { |
| | | return zdcbcolor |
| | | } else if (c.value[1] > 15 * 0.9) { |
| | | } else if (c.value[1] > biaozhuiz * 0.8) { |
| | | return '#FFA500' |
| | | } else { |
| | | return '#33c95f' |
| | |
| | | let maker = params[i].marker |
| | | let colo = '' |
| | | switch (seriesName) { |
| | | case 'ph': |
| | | case '温度': |
| | | colo = '#f206ff' |
| | | break |
| | | case '氮氧化物': |
| | |
| | | case '烟尘': |
| | | colo = '#e0ffff' |
| | | break |
| | | case '二氧化碳': |
| | | case '废气流量': |
| | | colo = '#9ACD32' |
| | | break |
| | | case '二氧化磷': |
| | | colo = '#f48183' |
| | | case '氧含量': |
| | | colo = '#008000' |
| | | break |
| | | default: |
| | | colo = '' |
| | |
| | | xAxis: { // x 轴设置 |
| | | type: 'time', |
| | | boundaryGap: false, |
| | | axisLabel: { // x轴全部显示 |
| | | axisLabel: { |
| | | // rotate: 30, |
| | | margin: 6, |
| | | // margin: 6, |
| | | interval: 0, |
| | | textStyle: { |
| | | color: '#fff' |
| | |
| | | width: 1// 这里是为了突出显示加上的 |
| | | } |
| | | } |
| | | // data: xdata |
| | | }, |
| | | yAxis: [{ |
| | | type: 'value', |
| | | name: yname, |
| | | // max: function (value) { |
| | | // console.log(value) |
| | | // return parseInt(value.max + 30) |
| | | // }, |
| | | name: yName, |
| | | max: function (value) { |
| | | return parseInt(value.max + 30) |
| | | }, |
| | | axisLabel: { |
| | | formatter: '{value}', |
| | | textStyle: { |
| | |
| | | }, |
| | | splitLine: { |
| | | show: false |
| | | }, // y轴 网格线不显示, |
| | | // inverse: true, |
| | | // nameLocation: 'start', |
| | | // max:500, |
| | | }, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: '#FFFFFF', |
| | |
| | | series: serLists |
| | | } |
| | | this.myChart.setOption(option) |
| | | }, |
| | | // 定时器 根据时间间隔请求数据 |
| | | IntervalRealTimeDate (id, unionTagCodeList, BBZMAPPING) { |
| | | // const interValHander = setInterval(function () { |
| | | // this.initEchartsData() |
| | | // console.log('间隔请求数据') |
| | | // }, 1500) |
| | | // console.log(interValHander) |
| | | } |
| | | } |
| | | } |
| | | </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> |