From 9a7a37389c784684cb848d86817fcc15f22e0f4a Mon Sep 17 00:00:00 2001 From: chenzeping <ChenZeping02609@163.com> Date: 星期三, 21 四月 2021 14:31:58 +0800 Subject: [PATCH] 弹框废气相关修改 --- src/components/BaseNav/WasteGas/RealData.vue | 126 +++++++++++++++++------------------------ 1 files changed, 53 insertions(+), 73 deletions(-) diff --git a/src/components/BaseNav/WasteGas/RealData.vue b/src/components/BaseNav/WasteGas/RealData.vue index 2f38d20..b440dda 100644 --- a/src/components/BaseNav/WasteGas/RealData.vue +++ b/src/components/BaseNav/WasteGas/RealData.vue @@ -27,7 +27,7 @@ <el-option label="100" value="100"></el-option> </el-select> </div> - <div class="detailbtn" @click="onSubmit">鏌ヨ</div> + <div class="detailbtn" @click="querySearch">鏌ヨ</div> </div> <div style="width:5rem;height:1.5rem;" ref="echarts"></div> </div> @@ -97,21 +97,15 @@ // 寮�濮� /缁撴潫 鏃堕棿 鍜岄噰鏍风偣鍊肩殑缁戝畾鍊兼暟鎹� formInline: { region: '', - timeStart: '', - timeEnd: '' - }, - - // echarts鐨刼ptions鏁版嵁浼犲叆 - echartsOptions: { - legend: [], - ydatas: [], - yname: ' 娴撳害(mg/m鲁)' + timeEnd: '', + timeStart: '' }, // 瀹炴椂鏁版嵁鍒楄〃 - RealTimeDataList: [], + EXHRealTimeDataList: [], bzz: null, - bzzList: [] + exhbzz: [], + exhbzzList: [] } }, mounted () { @@ -121,14 +115,14 @@ }, methods: { // 鐐瑰嚮鏌ヨ鎸夐挳鍔熻兘 - onSubmit () { - this.DrawEXHRealTimeDateChart() + querySearch () { + // 鐢ㄤ簬鎺ュ彛鏁版嵁璇锋眰鐨勫弬鏁� 寮�濮�/缁撴潫鏃堕棿 || 鍙�夋嫨鏌ヨ鐨勫紑濮�/缁撴潫鏃堕棿 + this.formInline.timeEnd = dayjs().format('YYYYMMDD HHmmss') + this.formInline.timeStart = dayjs().subtract(3, 'minute').format('YYYYMMDD HHmmss') + 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, @@ -136,6 +130,7 @@ $step: 15 } const result = (await mapApi.DataItems(data)).data + console.log(result) this.getRtdb15s(result) }, // echarts鏁版嵁澶勭悊 @@ -144,27 +139,25 @@ // 澶勭悊鏁版嵁寮�濮� 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 = [] + let data // 鏁版嵁绫诲瀷// let data={name:'',value:[now1.getFullYear(), now1.getMonth() + 1, now1.getDate().join('/'),value]} + let datalist // 瀛樻斁data鐨勬暟缁� + // let bzh = [] for (let i = 0; i < d.length; i++) { if (d[i].ErrorMessage != null) { continue } + // const name = CFG.DATA_REALTIME_TAGCODETABLE[d[i].UnionTagCode].TagName // 涓存椂name鏁版嵁 const nameListTemp = [ { - 'TJIP45.lscl2tbAIA-10505-1': '姘哀鍖栫墿', - 'TJIP45.lscl2tbAIA-10505-2': '鐑熷皹', - 'TJIP45.lscl2tb552AISA11202A': '浜屾哀鍖栫7', - 'TJIP45.lscl2tb552AISA11201B': 'ph', - 'TJIP45.lscl2tb552AI10710': '浜屾哀鍖栫⒊' + 'TJIP45.y2h508CEMS01NOX': '姘哀鍖栫墿', + 'TJIP45.y2h508CEMS01SO2': '鐑熷皹', + 'TJIP45.y2h508CEMS01F': '浜屾哀鍖栫7', + 'TJIP45.y2h508CEMS01PM': 'ph' + // 'TJIP45.lscl2tb552AI10710': '浜屾哀鍖栫⒊' } ] - const name = nameListTemp[0][d[i].UnionTagCode] if (nameList.length === 0) { @@ -178,17 +171,10 @@ name: name, data: [data] } - - this.RealTimeDataList.push(datalist) - // console.log(this.RealTimeDataList) - - // bzh.push(d[i].StdValue); + this.EXHRealTimeDataList.push(datalist) } 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] @@ -197,11 +183,10 @@ name: name, data: [data] } - this.RealTimeDataList.push(datalist) + this.EXHRealTimeDataList.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, @@ -211,16 +196,16 @@ name: name, data: [data] } - this.RealTimeDataList.push(datalist) + this.EXHRealTimeDataList.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) + for (let k = 0; k < this.EXHRealTimeDataList.length; k++) { + if (this.EXHRealTimeDataList[k].name === name) { + this.EXHRealTimeDataList[k].data.push(data) } } } @@ -230,20 +215,19 @@ name: name, value: [newdate, d[i].TagValue] } - for (let k = 0; k < this.RealTimeDataList.length; k++) { - if (this.RealTimeDataList[k].name === name) { - this.RealTimeDataList[k].data.push(data) + for (let k = 0; k < this.EXHRealTimeDataList.length; k++) { + if (this.EXHRealTimeDataList[k].name === name) { + this.EXHRealTimeDataList[k].data.push(data) } } } } + // console.log(this.EXHRealTimeDataList) - const divid = 'mycharteff_second' + const divid = 'mychart_ss' const title = name - const lengList = [] - let objTemp = [] - // console.log(objTemp) + let objTemp for (let l = 0; l < nameList.length; l++) { let obj @@ -260,8 +244,7 @@ iconurl = 'image://../assets/imgs/legend/VOCs.png' } - if (nameList[l] === '搴熸按' || nameList[l] === '搴熸按娴侀噺') { // 灏嗗簾姘存祦閲忔帓鍒版暟缁勬渶鍚� - // eslint-disable-next-line no-const-assign + if (nameList[l] === '搴熸皵' || nameList[l] === '搴熸皵娴侀噺') { // 灏嗗簾姘旀祦閲忔帓鍒版暟缁勬渶鍚� objTemp = { name: nameList[l], icon: iconurl, @@ -283,12 +266,10 @@ } 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++) { @@ -314,46 +295,45 @@ const BBZMAPPING = [ { COD: 35, - 搴熸按娴侀噺: null, + ph: 9, 鎬绘爱: 15, 鎬荤7: 0.3, - 榛贰: 3 + 姘ㄦ爱: 3 } ] - for (let m = 0; m < this.RealTimeDataList.length; m++) { + for (let m = 0; m < this.EXHRealTimeDataList.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] - }) + if (this.EXHRealTimeDataList[m].name === nameList[j]) { + for (const i in this.BBZMAPPING) { + console.log(i) + stdValue = BBZMAPPING[this.EXHRealTimeDataList[m].name] + } + ydata = { name: nameList[j], - data: this.RealTimeDataList[m].data, + data: this.EXHRealTimeDataList[m].data, zdcbcolor: zdcbcolor, zxcolor: zxcolor, bzz: stdValue } - this.bzz = { + this.exhbzz = { name: nameList[j], bzhui: stdValue } - this.bzzList.push(this.bzz) + this.exhbzzList.push(this.exhbzz) ydatas.push(ydata) } } } - const yname = '娴撳害(mg/l)' + + const yname = '娴撳害(mg/m鲁)' + this.DrawRealTimeDateChart(divid, title, legend, ydatas, yname) - // - // this.IntervalRealTimeDate(id, unionTagCodeList, BBZMAPPING) - this.IntervalRealTimeDate() } }, // 鑾峰彇鏁版嵁鐢ㄤ簬echarts鍥捐〃缁樺埗 DrawRealTimeDateChart (id, title, legend, ydatas, yname) { + // console.log(ydatas) this.myChart = this.$echarts.init(this.$refs.echarts) const serLists = [] let dataUnit @@ -371,7 +351,7 @@ normal: { color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹� let biaozhuiz - for (var i = 0; i < this.bzzList.length; i++) { + for (let i = 0; i < this.bzzList.length; i++) { if (this.bzzList[i].name === c.seriesName) { biaozhuiz = this.bzzList[i].bzhui } @@ -472,13 +452,13 @@ 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) + // let valueFliter = formatter(value) const valueFliter = parseFloat(value).toFixed(2) let maker = params[i].marker -- Gitblit v1.8.0