diff --git a/src/views/wpm_bx/monitor_detail.vue b/src/views/wpm_bx/monitor_detail.vue index 406ebdbf..9b8b3a13 100644 --- a/src/views/wpm_bx/monitor_detail.vue +++ b/src/views/wpm_bx/monitor_detail.vue @@ -7,7 +7,32 @@ destroy-on-close @closed="$emit('closed')" > -
+
+ + + + + + + + + + + + +
+
{ let height = document.getElementById("tableWap").clientHeight; that.tableHeight = height - 345; + that.tableHeight1 = height - 40; + that.chartHeight =(height - 40)+'px'; }) that.params.timex__gte = that.startTime; that.params.timex__lte = that.endTime; @@ -109,7 +143,14 @@ export default { that.activeName = res[0].nickname; that.params.mpoint = res[0].id; that.apiObj = that.$API.enm.mplogx; - that.handleClick(); + if(this.route_code =='zlybcl'){ + let obj = {name:'折线图',nickname:'折线图',id:'666'}; + that.mpointList.push(obj); + that.chartData(); + that.handleClick1(); + }else{ + that.handleClick(); + } }else{ that.$message.error("该设备没有监测点"); } @@ -118,7 +159,7 @@ export default { handleClick(val){ let that = this; that.option.xAxis.data = []; - that.option.series.data = []; + that.option.series[0].data = []; that.mpointList.forEach(item=>{ if(item.nickname == that.activeName){ that.query.mpoint = item.id; @@ -141,11 +182,64 @@ export default { that.option.yAxis.min = minNum; that.option.yAxis.max = maxNum; that.option.xAxis.data = xAxisData; - that.option.series.data = seriesData; + that.option.series[0].data = seriesData; }) } }) }, + handleClick1(val){ + let that = this; + that.mpointList.forEach(item=>{ + if(item.nickname == that.activeName){ + that.query.mpoint = item.id; + that.query.page = 1; + } + }) + }, + chartData(){ + let that = this; + const promises = that.mpointList.map(item => { + if (item.name !== '折线图') { + let params = { + mpoint: item.id, + timex__gte: that.startTime, + timex__lte: that.endTime, + page: 0 + }; + return that.$API.enm.mplogx.req(params); + } + }); + Promise.all(promises).then(responses => { + that.option.xAxis.data = []; + that.option.series.data = []; + let minNum = null,maxNum = 0,series = []; + responses.forEach((res,index) => { + if(res!==undefined){ + let minNum0=0,maxNum0=0,seriesData = [],xAxisData = []; + res.forEach(item=>{ + xAxisData.unshift(item.timex); + let value = Number(item.val_float); + seriesData.unshift(value); + }) + that.option.xAxis.data = xAxisData; + minNum0 = seriesData.reduce((a, b) => a < b ? a : b); + minNum = minNum === null ? minNum0 : Math.min(minNum,minNum0); + maxNum0 = Math.max(...seriesData); + maxNum = Math.max(maxNum,maxNum0); + series.push({ + name: that.mpointList[index].nickname, + type: "line", + data: seriesData, + }) + } + }); + that.option.yAxis.min = minNum; + that.option.yAxis.max = maxNum; + that.option.series = series; + }).catch(error => { + console.error('Error:', error); + }); + }, }, };