From ec4d5c1827487f4c901b69bd9eae58e111e82b32 Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期四, 20 五月 2021 18:05:25 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
---
src/components/BaseNav/WasteWater/WasteWaterRealChart.vue | 403 +++++++++++++++++++++++----------------------------------
1 files changed, 163 insertions(+), 240 deletions(-)
diff --git a/src/components/BaseNav/WasteWater/WasteWaterRealChart.vue b/src/components/BaseNav/WasteWater/WasteWaterRealChart.vue
index c73f030..b332667 100644
--- a/src/components/BaseNav/WasteWater/WasteWaterRealChart.vue
+++ b/src/components/BaseNav/WasteWater/WasteWaterRealChart.vue
@@ -2,31 +2,23 @@
<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>
+ <el-date-picker v-model="formData.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" size="mini"></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>
+ <el-date-picker v-model="formData.endTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" size="mini"></el-date-picker>
<span class="demonstration">閲囨牱鐐规暟锛�</span>
- <el-select v-model="region" placeholder="璇烽�夋嫨" style="width: 80px">
- <el-option v-for="(item,index) in regionList" :key="index" :label="item" :value="item"></el-option>
+ <el-select 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>鏄庣粏琛�</el-button>
+ <!-- <el-button>鏄庣粏琛�</el-button>-->
</div>
<div class="echarts-chart">
- <div style="width:5rem;height:1.5rem;" ref="echarts"></div>
+ <div ref="echarts"></div>
</div>
+ <span class="time-select">{{ formData.startTime }}鈥攞{ formData.endTime }}</span>
</div>
</template>
@@ -45,7 +37,6 @@
},
data () {
return {
- a: '',
// tab鏍忎紶閫掓帴鏀舵暟鎹�
dataStandard: [
{
@@ -88,19 +79,22 @@
val: null
}
}],
+ // 琛ㄥ崟鏁版嵁缁戝畾鍊�
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')
},
- region: '25',
- regionList: [25, 50, 75, 100],
- datatype: 1,
+ // 鏁版嵁鍒嗙被澶勭悊瀛樺偍鍒楄〃
RealTimeDataList: [],
- bzz: null,
- bzzList: [],
+ // 鐢ㄤ簬澶勭悊鏍囧噯鍊�
+ standardValues: null,
+ // 鏍囧噯鍊煎垪琛�
+ standardValuesList: [],
+ // 鐢ㄤ簬鍥捐〃灞曠ず璁剧疆鏁扮粍
nameList: [],
- // legend绫诲埆鍥捐〃灞曠ず璁剧疆鏁扮粍
- lengList: [],
+ legendList: [],
ydatas: []
}
},
@@ -122,46 +116,47 @@
$endTime: this.formData.endTime,
$step: 15
}
- // console.log(data)
const result = (await mapApi.getDataItems(data)).data
// 鏁版嵁鎸夌被鍒垎缁�
this.pointsSet(result)
// 鍥炬爣瀛樺偍澶勭悊
this.legendSet()
- // ydata鏁版嵁
+ // y杞磀ata鏁版嵁
this.yDataSet()
// 鏍规嵁宸叉湁鏁版嵁缁樺埗鍥捐〃
this.drawRealTimeDateChart()
},
// 鎺ュ彛鏁版嵁鎸夌収 鏁版嵁鍐呭垎绫诲埆璁剧疆
pointsSet (d) {
- let data = []
- let datalist = []
+ // 鏁扮粍鏁版嵁缃┖
this.nameList = []
this.RealTimeDataList = []
+
+ let data = []
+ let datalist = []
+
for (let i = 0; i < d.length; i++) {
- // this.RealTimeDataList = []
// 鍒ゆ柇鏄惁缁х画鎵ц
if (d[i].ErrorMessage != null) {
continue
}
+
// temp 涓存椂鏁版嵁鍒ゆ柇鏂规硶
const tempList = [
{
- 'TJIP45.lscl2tbAIA-10505-1': '姘哀鍖栫墿',
- 'TJIP45.lscl2tbAIA-10505-2': '鐑熷皹',
- 'TJIP45.lscl2tb552AISA11202A': '浜屾哀鍖栫7',
- 'TJIP45.lscl2tb552AISA11201B': 'pH',
- 'TJIP45.lscl2tb552AI10710': '浜屾哀鍖栫⒊'
+ 'TJIP45.lscl2tb552AISA11201B': 'COD',
+ 'TJIP45.lscl2tbAIA-10505-1': '姘ㄦ爱',
+ 'TJIP45.lscl2tbAIA-10505-2': '鎬荤7',
+ 'TJIP45.lscl2tb552AI10710': '鎬绘爱',
+ 'TJIP45.lscl2tb552AISA11202A': '搴熸按娴侀噺'
}
]
- // 鎸囨爣
+ // 鎸囨爣 涓存椂鐢ㄤ簬鏁版嵁澶勭悊
const name = tempList[0][d[i].UnionTagCode]
- // 鍒ゆ柇甯傚眬绫诲瀷杩涜鍒嗙粍
+
+ // 鍒ゆ柇甯傚眬绫诲瀷杩涜鍒嗙粍 =>鏁扮粍涓虹┖鏃�
if (this.nameList.length === 0) {
- // 鏁扮粍涓虹┖鏃�
this.nameList.push(name)
- // todo 鐢╠ayjs
const newDate = new Date(d[i].ReadTime)
data = {
name: name,
@@ -171,7 +166,6 @@
name: name,
data: [data]
}
- // console.log('1111111')
this.RealTimeDataList.push(datalist)
} else if (this.nameList.indexOf(name) < 0) {
// 娌℃湁鎸囨爣鏃�
@@ -185,7 +179,6 @@
name: name,
data: [data]
}
- // console.log('222222222')
this.RealTimeDataList.push(datalist)
} else if (i === d.length - 1) {
// 寰幆鍒版渶鍚�
@@ -200,7 +193,6 @@
name: name,
data: [data]
}
- // console.log('3333333')
this.RealTimeDataList.push(datalist)
} else {
const newDate = new Date(d[i].ReadTime)
@@ -208,7 +200,6 @@
name: name,
value: [newDate, d[i].TagValue]
}
- // console.log('444444')
for (let k = 0; k < this.RealTimeDataList.length; k++) {
if (this.RealTimeDataList[k].name === name) {
this.RealTimeDataList[k].data.push(data)
@@ -228,24 +219,23 @@
}
}
}
- // console.log(this.RealTimeDataList)
},
// legend绫诲埆鍥捐〃灞曠ず璁剧疆鏁扮粍
legendSet () {
- this.lengList = []
+ this.legendList = []
let objTemp
for (let l = 0; l < this.nameList.length; l++) {
let obj
let IconUrl
- if (this.nameList[l] === 'pH') {
- IconUrl = 'image://../assets/imgs/legend/WenDu.png'
- } else if (this.nameList[l] === '姘哀鍖栫墿') {
+ if (this.nameList[l] === 'COD') {
+ IconUrl = 'image://../assets/imgs/legend/SO2.png'
+ } else if (this.nameList[l] === '姘ㄦ爱') {
IconUrl = 'image://../assets/imgs/legend/NOX.png'
- } else if (this.nameList[l] === '鐑熷皹') {
- IconUrl = 'image://../assets/imgs/legend/zongdan.png'
- } else if (this.nameList[l] === '浜屾哀鍖栫⒊') {
+ } else if (this.nameList[l] === '鎬荤7') {
IconUrl = 'image://../assets/imgs/legend/YanChen.png'
- } else if (this.nameList[l] === '浜屾哀鍖栫7') {
+ } else if (this.nameList[l] === '鎬绘爱') {
+ IconUrl = 'image://../assets/imgs/legend/zongdan.png'
+ } else if (this.nameList[l] === '搴熸按娴侀噺') {
IconUrl = 'image://../assets/imgs/legend/VOCs.png'
}
if (this.nameList[l] === '搴熸按' || this.nameList[l] === '搴熸按娴侀噺') { // 灏嗗簾姘存祦閲忔帓鍒版暟缁勬渶鍚�
@@ -268,66 +258,60 @@
itemWidth: 20,
itemHeight: 5
}
- this.lengList.push(obj)
+ this.legendList.push(obj)
}
}
- this.lengList.push(objTemp)
+ this.legendList.push(objTemp)
},
// yDataSet 鏁版嵁澶勭悊
yDataSet () {
- this.bzzList = []
+ // 鏁扮粍娣诲姞鏁版嵁 缃┖
+ this.standardValuesList = []
this.ydatas = []
for (let j = 0; j < this.nameList.length; j++) {
- let zdcbcolor, zxcolor
- if (this.nameList[j] === 'pH') {
- zdcbcolor = 'red'
- zxcolor = '#900090'
+ let pointColor, lineColor
+ if (this.nameList[j] === 'COD') {
+ pointColor = 'red'
+ lineColor = '#ffff00'
} else if (this.nameList[j] === '姘ㄦ爱') {
- zdcbcolor = 'red'
- zxcolor = '#00B0F0'
- } else if (this.nameList[j] === '鐑熷皹') {
- zdcbcolor = 'red'
- zxcolor = '#f48183'
+ pointColor = 'red'
+ lineColor = '#00B0F0'
+ } else if (this.nameList[j] === '鎬荤7') {
+ pointColor = 'red'
+ lineColor = '#f48183'
} else if (this.nameList[j] === '鎬绘爱') {
- zdcbcolor = 'red'
- zxcolor = '#e0ffff'
- } else {
- zdcbcolor = 'red'
- zxcolor = '#9ACD32'
+ pointColor = 'red'
+ lineColor = '#e0ffff'
+ } else if (this.nameList[j] === '搴熸按娴侀噺') {
+ pointColor = 'red'
+ lineColor = '#9ACD32'
}
- let ydata
// 涓存椂鏁版嵁
const BBZMAPPING = {
COD: 35,
- pH: 9,
- 鎬绘爱: 15,
+ 姘ㄦ爱: 30,
鎬荤7: 0.3,
- 姘ㄦ爱: 3
+ 鎬绘爱: 15,
+ 搴熸按娴侀噺: 3
}
for (let m = 0; m < this.RealTimeDataList.length; m++) {
let stdValue = null
if (this.RealTimeDataList[m].name === this.nameList[j]) {
- for (const p in BBZMAPPING) {
- // console.log('p' + p)
- this.a = p
- stdValue = BBZMAPPING[this.RealTimeDataList[m].name]
- }
- // console.log(stdValue)
- this.bzz = {
+ stdValue = BBZMAPPING[this.RealTimeDataList[m].name]
+ this.standardValues = {
name: this.nameList[j],
- bzhui: stdValue
+ standardValue: stdValue
}
- ydata = {
+ const yData = {
name: this.nameList[j],
data: this.RealTimeDataList[m].data,
- zdcbcolor: zdcbcolor,
- zxcolor: zxcolor,
- bzz: stdValue
+ pointColor: pointColor,
+ lineColor: lineColor,
+ standardValue: stdValue
}
- // console.log(stdValue)
- this.bzzList.push(this.bzz)
- this.ydatas.push(ydata)
+ this.standardValuesList.push(this.standardValues)
+ this.ydatas.push(yData)
}
}
}
@@ -337,53 +321,58 @@
this.myChart = this.$echarts.init(this.$refs.echarts)
this.myChart.clear()
- const legend = this.lengList
- const yname = '娴撳害(mg/m鲁)'
- const bzzList = this.bzzList
+ // y杞翠晶杈规爣棰榥eme
+ const ySideName = '娴撳害(mg/m鲁)'
+ // 鏍囧噯鍊煎垪琛�
+ const standardValuesList = this.standardValuesList
+ // 搴旂敤浜庢暟鎹粨鏋滃垽鏂爣鍑嗗��
+ let standardValue
+
+ // series鏁版嵁瀛樺偍
const serLists = []
for (let i = 0; i < this.ydatas.length; i++) {
- const zdcbcolor = this.ydatas[i].zdcbcolor
- const bz = this.ydatas[i].bzz
- // console.log(bz)
- let obj
+ // 搴旂敤浜庢暟鎹鐞�
+ const pointColor = this.ydatas[i].pointColor
+ // 鏁版嵁鏍囧噯鍊�
+ const bz = this.ydatas[i].standardValue
+ let seriesObj
+
if (bz) {
- obj = {
+ seriesObj = {
name: this.ydatas[i].name,
- // symbol:'circle', // 鎶樼偣褰㈢姸
- // symbolSize: 3, //澶у皬
- smooth: true, // 鐩寸嚎 锛宼rue 涓烘洸绾�
+ smooth: true,
+ type: 'line',
+ data: this.ydatas[i].data,
+ // borderColor: this.ydatas[i].pointColor,
+ borderColor: '#fff',
itemStyle: {
normal: {
- color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
- let biaozhuiz
- for (let i = 0; i < bzzList.length; i++) {
- if (bzzList[i].name === c.seriesName) {
- biaozhuiz = bzzList[i].bzhui
+ color: function (c) {
+ for (let i = 0; i < standardValuesList.length; i++) {
+ if (standardValuesList[i].name === c.seriesName) {
+ standardValue = standardValuesList[i].standardValue
}
}
- if (c.value[1] > biaozhuiz) {
- return zdcbcolor
- } else if (c.value[1] > biaozhuiz * 0.9) {
+ if (c.value[1] > standardValue) {
+ return pointColor
+ } else if (c.value[1] > standardValue * 0.7) {
return '#FFA500'
} else {
return '#33c95f'
}
},
- lineStyle: { // 鎶樼嚎鐨勯鑹�
- color: this.ydatas[i].zxcolor,
+ lineStyle: {
+ color: this.ydatas[i].lineColor,
width: 2
},
- // borderColor:'black', //鎶樼偣杈规鐨勯鑹�
label: { // 鏄剧ず鍊�
show: false
}
}
},
- type: 'line',
- data: this.ydatas[i].data,
- markLine: { // 骞冲潎鍊� 锛� 鍜� 鎸囨爣涓婇檺
+ markLine: {
symbol: 'none',
data: [{
label: {
@@ -396,16 +385,15 @@
yAxis: bz,
lineStyle: {
normal: {
- color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
- let biaozhuiz
- for (let i = 0; i < bzzList.length; i++) {
- if (bzzList[i].name === c.seriesName) {
- biaozhuiz = bzzList[i].bzhui
+ color: function (c) {
+ for (let i = 0; i < standardValuesList.length; i++) {
+ if (standardValuesList[i].name === c.seriesName) {
+ standardValue = standardValuesList[i].standardValue
}
}
- if (c.value[1] > biaozhuiz) {
- return zdcbcolor
- } else if (c.value[1] > biaozhuiz * 0.9) {
+ if (c.value[1] > standardValue) {
+ return pointColor
+ } else if (c.value[1] > standardValue * 0.7) {
return '#FFA500'
} else {
return '#33c95f'
@@ -413,62 +401,55 @@
}
}
}
- }
- ]
+ }]
}
}
} else {
- obj = {
+ seriesObj = {
name: this.ydatas[i].name,
- symbol: 'circle', // 鎶樼偣褰㈢姸
- symbolSize: 10, // 澶у皬
- smooth: false, // 鐩寸嚎 锛宼rue 涓烘洸绾�
+ symbol: 'circle',
+ symbolSize: 10,
+ smooth: false,
yAxisIndex: 1,
- // itemStyle: {
- // normal: {
- // color: function (c) { // 鏍规嵁value 鏄剧ず涓嶅悓鐨勬姌鐐归鑹�
- // for (let i = 0; i < this.bzzList.length; i++) {
- // let biaozhuizs
- // if (this.bzzList[i].name === c.seriesName) {
- // biaozhuizs = this.bzzList[i].bzhui
- // }
- // console.log(biaozhuizs)
- // }
- // if (c.value[1] > 9) {
- // return zdcbcolor
- // } else {
- // return '#33c95f'
- // }
- // },
- // lineStyle: { // 鎶樼嚎鐨勯鑹�
- // color: this.ydatas[i].zxcolor,
- // width: 5
- // },
- // borderColor: 'black', // 鎶樼偣杈规鐨勯鑹�
- // label: { // 鏄剧ず鍊�
- // show: false
- // }
- // }
- // },
+ // borderColor:'black',
type: 'line',
- data: this.ydatas[i].data
+ data: this.ydatas[i].data,
+ itemStyle: {
+ normal: {
+ color: function (c) {
+ for (let i = 0; i < standardValuesList.length; i++) {
+ if (standardValuesList[i].name === c.seriesName) {
+ standardValue = standardValuesList[i].standardValue
+ }
+ }
+ if (c.value[1] > standardValue) {
+ return pointColor
+ } else if (c.value[1] > standardValue * 0.9) {
+ return '#FFA500'
+ } else {
+ return '#33c95f'
+ }
+ },
+ lineStyle: { // 鎶樼嚎鐨勯鑹�
+ color: this.ydatas[i].lineColor,
+ width: 2
+ },
+ label: { // 鏄剧ず鍊�
+ show: false
+ }
+ }
+ }
}
}
- if (this.ydatas[i].name === '搴熸皵娴侀噺' || this.ydatas[i].name === '搴熸皵') {
- obj.yAxisIndex = 1
+ if (this.ydatas[i].name === '搴熸按娴侀噺' || this.ydatas[i].name === '搴熸按') {
+ seriesObj.yAxisIndex = 1
}
- serLists.push(obj)
+ serLists.push(seriesObj)
}
- // console.log(serLists)
- let dataUnit = ''
- if (this.datatype === 1) {
- dataUnit = '娴侀噺(m鲁/d)'
- } else {
- dataUnit = '娴侀噺(m鲁/h)'
- }
+ const dataUnit = '娴侀噺(m鲁/h)'
// echarts鍥捐〃option鏁版嵁
const options = {
- tooltip: { // 鎻愮ず妗�
+ tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
@@ -479,8 +460,6 @@
formatter: function (params) {
let s = params[0].name + '<br />'
for (let i = 0; i < params.length; i++) {
- // let name = params[i].name
- // 鍥捐〃title鍚嶇О
const seriesName = params[i].seriesName
// 鍊�
const value = params[i].value[1]
@@ -491,19 +470,19 @@
let maker = params[i].marker
let colo = ''
switch (seriesName) {
- case 'pH':
- colo = '#900090'
+ case 'COD':
+ colo = '#ffff00'
break
- case '浜屾哀鍖栫⒊':
+ case '姘ㄦ爱':
colo = '#00B0F0'
break
- case '鐑熷皹':
+ case '鎬绘爱':
colo = '#e0ffff'
break
- case '姘哀鍖栫墿':
+ case '搴熸按娴侀噺':
colo = '#9ACD32'
break
- case '浜屾哀鍖栫7':
+ case '鎬荤7':
colo = '#f48183'
break
default:
@@ -516,17 +495,17 @@
return s
}
},
- toolbox: { // 鎵撳嵃绛夊伐鍏�
+ toolbox: {
show: false,
feature: {
saveAsImage: {}
}
},
- grid: { // 缃戞牸
+ grid: {
top: '20%'
},
legend: {
- data: legend
+ data: this.legendList
},
dataZoom: [{
type: 'inside',
@@ -546,10 +525,10 @@
shadowOffsetY: 2
}
}],
- xAxis: { // x 杞磋缃�
+ xAxis: {
type: 'time',
boundaryGap: false,
- axisLabel: { // x杞村叏閮ㄦ樉绀�
+ axisLabel: {
// rotate: 30,
margin: 6,
interval: 0,
@@ -557,7 +536,7 @@
color: '#fff'
}
},
- splitLine: { // 缃戞牸鍨傜洿绾夸负 铏氱嚎
+ splitLine: {
show: true,
lineStyle: {
type: 'dashed'
@@ -569,16 +548,15 @@
axisLine: {
lineStyle: {
color: '#FFFFFF',
- width: 1// 杩欓噷鏄负浜嗙獊鍑烘樉绀哄姞涓婄殑
+ width: 1
}
}
- // data: xdata
},
yAxis: [{
type: 'value',
- name: yname,
+ name: ySideName,
max: function (value) {
- return parseInt(value.max + 30)
+ return parseInt(value.max + 3)
},
axisLabel: {
formatter: '{value}',
@@ -591,11 +569,11 @@
},
splitLine: {
show: false
- }, // y杞� 缃戞牸绾夸笉鏄剧ず,
+ },
axisLine: {
lineStyle: {
color: '#FFFFFF',
- width: 1// 杩欓噷鏄负浜嗙獊鍑烘樉绀哄姞涓婄殑
+ width: 1
}
}
}, {
@@ -612,14 +590,14 @@
},
splitLine: {
show: false
- }, // y杞� 缃戞牸绾夸笉鏄剧ず,
+ },
// inverse: true,
// nameLocation: 'start',
// max:500,
axisLine: {
lineStyle: {
color: '#FFFFFF',
- width: 1// 杩欓噷鏄负浜嗙獊鍑烘樉绀哄姞涓婄殑
+ width: 1
}
}
}],
@@ -633,60 +611,5 @@
</script>
<style scoped lang="less">
-.echarts-box {
- .tab-scroll {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .time-select {
- cursor: pointer;
- padding: 5px;
- border: 1px solid #2b87c8;
- border-radius: 4px;
- text-align: center;
- color: #fff;
- font-size: 11px;
- width: 280px;
- }
- }
-
- .echarts-form {
- height: 0.3rem;
- line-height: 0.3rem;
-
- .demonstration {
- color: #00fff6;
- font-size: 12px;
- margin-left: 10px;
- }
-
- /deep/ .el-input__inner {
- height: 0.15rem;
- background-color: #2e4967;
- color: #fff;
- font-size: 12px;
- padding: 0;
- border-color: #00fff6;
- text-align: center;
- }
-
- .el-button {
- margin: 0 15px;
- width: 0.3rem;
- height: 0.15rem;
- display: inline-block;
- background-color: #2e4967;
- color: #fff;
- font-size: 12px;
- padding: 0;
- border-color: #00fff6;
- text-align: center;
- }
- }
-
- /deep/ .el-icon-time:before {
- content: " ";
- }
-}
</style>
--
Gitblit v1.8.0