|
@@ -1,3 +1,4 @@
|
|
|
+<!-- 多站点分析结果展示 -->
|
|
|
<template>
|
|
|
<div class="page-panel">
|
|
|
<div class="head-title">{{ title }}</div>
|
|
@@ -38,7 +39,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getManySiteCurv } from '@/views/spectrum/statisticalAnalysis/api/api'
|
|
|
+import { getManySiteCurv , getRain} from '@/views/spectrum/statisticalAnalysis/api/api'
|
|
|
import { getSiteIcon } from '@/views/spectrum/common/siteIcon/siteIcon' // 站点图标
|
|
|
import { MapPopup } from '@/views/spectrum/common/mapPopup/mapPopup'
|
|
|
import * as echarts from 'echarts'
|
|
@@ -53,7 +54,8 @@ export default {
|
|
|
title: '',
|
|
|
sliderMax: 0,
|
|
|
dateCollection: [], // 日期
|
|
|
- targetVos: [] // 数据
|
|
|
+ targetVos: [], // 数据
|
|
|
+ rainFallNum:[]//降雨量数据
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -76,12 +78,69 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.getRainNum(2)
|
|
|
this.getManySiteCurv()
|
|
|
},
|
|
|
destroyed() {
|
|
|
this.clearSites()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 得到降雨量
|
|
|
+ */
|
|
|
+ getRainNum(type) {
|
|
|
+ let params = {}
|
|
|
+ let paramstemp = {
|
|
|
+ beginDate: this.param.params.beginTime,
|
|
|
+ endDate: this.param.params.endTime,
|
|
|
+ siteId: this.param.params.siteId[0]
|
|
|
+ }
|
|
|
+ if (type == 1) {
|
|
|
+ var begin = paramstemp.beginDate.substr(0, 10)
|
|
|
+ var end = paramstemp.endDate.substr(0, 10)
|
|
|
+ params = {
|
|
|
+ beginDate: begin,
|
|
|
+ endDate: end,
|
|
|
+ siteId: this.param.params.siteId[0]
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ params = JSON.parse(JSON.stringify(paramstemp))
|
|
|
+ }
|
|
|
+ // console.log("降雨量请求数据" + JSON.stringify(params))
|
|
|
+ getRain(params).then((res) => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ // console.log("降雨量数据" + JSON.stringify(res))
|
|
|
+ var rainNum = []
|
|
|
+ var time = []
|
|
|
+ for (let index = 0; index < res.result.length; index++) {
|
|
|
+ rainNum.push(res.result[index].rfall);
|
|
|
+ time.push(res.result[index].xposition)
|
|
|
+ }
|
|
|
+ // 处理Y轴,降雨量
|
|
|
+ let _data = rainNum.map((item) => {
|
|
|
+ return item || 0
|
|
|
+ })
|
|
|
+ let seriesdataBar = {
|
|
|
+ name: '降雨量',
|
|
|
+ type: 'bar',
|
|
|
+ data: _data
|
|
|
+ }
|
|
|
+ this.rainFallNum.push(seriesdataBar)
|
|
|
+ // // 处理X轴,时间
|
|
|
+ // let _dataX = []
|
|
|
+ // let _formatterVal = 'YYYY-MM-DD'
|
|
|
+ // if (this.radio == '2') {
|
|
|
+ // _formatterVal = 'MM-DD HH'
|
|
|
+ // }
|
|
|
+ // // 格式化时间
|
|
|
+ // time.forEach((item) => {
|
|
|
+ // _dataX.push(this.$moment(item).format(_formatterVal))
|
|
|
+ // })
|
|
|
+ // console.log("降雨量" + JSON.stringify(seriesdataBar))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
getManySiteCurv() {
|
|
|
this.title = this.param.titleName
|
|
|
let params = this.param.params
|
|
@@ -89,12 +148,12 @@ export default {
|
|
|
getManySiteCurv(params).then((res) => {
|
|
|
let siteData = res.result
|
|
|
let vosData = res.result.vos
|
|
|
- let _targetListVos = siteData.targetListVos //数据
|
|
|
- let _collectionDates = siteData.collectionDates //时间
|
|
|
+ let _targetListVos = siteData.targetListVos //监测数据
|
|
|
+ let _collectionDates = siteData.collectionDates //监测时间
|
|
|
|
|
|
- this.dateCollection = JSON.parse(JSON.stringify(siteData.collectionDates))
|
|
|
+ this.dateCollection = JSON.parse(JSON.stringify(siteData.collectionDates))//时间
|
|
|
this.sliderMax = this.dateCollection.length > 0 ? this.dateCollection.length - 1 : 0
|
|
|
- this.targetVos = JSON.parse(JSON.stringify(siteData.targetListVos))
|
|
|
+ this.targetVos = JSON.parse(JSON.stringify(siteData.targetListVos))//监测值
|
|
|
|
|
|
let _dataX = []
|
|
|
|
|
@@ -102,6 +161,7 @@ export default {
|
|
|
if (this.radio == '2') {
|
|
|
_formatterVal = 'MM-DD HH'
|
|
|
}
|
|
|
+ // 格式化时间
|
|
|
_collectionDates.forEach((item) => {
|
|
|
_dataX.push(this.$moment(item).format(_formatterVal))
|
|
|
})
|
|
@@ -155,17 +215,26 @@ export default {
|
|
|
}
|
|
|
_seriesdataBar.push(seriesdataBar)
|
|
|
})
|
|
|
+ var seriesdata = []
|
|
|
+ seriesdata.push(_seriesdataLine)
|
|
|
+ // 将降雨量数据和折线监测指标数据组合在一起
|
|
|
+ seriesdata[0].push(this.rainFallNum[0])
|
|
|
let chartDataLine = {
|
|
|
id: 'linedata',
|
|
|
- seriesdata: _seriesdataLine,
|
|
|
+ seriesdata: seriesdata,
|
|
|
collectionDates: _dataX
|
|
|
}
|
|
|
|
|
|
+ var seriesdata2 = []
|
|
|
+ seriesdata2.push(_seriesdataBar)
|
|
|
+ // 将降雨量数据和柱状图监测指标数据组合在一起
|
|
|
+ seriesdata2[0].push(this.rainFallNum[0])
|
|
|
let chartDataBar = {
|
|
|
id: 'bardata',
|
|
|
- seriesdata: _seriesdataBar,
|
|
|
+ seriesdata: seriesdata2,
|
|
|
collectionDates: _dataX
|
|
|
}
|
|
|
+
|
|
|
this.$nextTick(() => {
|
|
|
this.loadChart(chartDataLine, 'chart1')
|
|
|
})
|
|
@@ -175,16 +244,19 @@ export default {
|
|
|
this.tableData = JSON.parse(JSON.stringify(vosData))
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
*改变统计类型
|
|
|
*/
|
|
|
radioChange(val) {
|
|
|
+ this.getRainNum(val)
|
|
|
this.getManySiteCurv()
|
|
|
},
|
|
|
/**
|
|
|
* 加载图表
|
|
|
*/
|
|
|
loadChart(chartData, domId) {
|
|
|
+ // console.log("统计图中的数据"+JSON.stringify(chartData))
|
|
|
let chartDom = this.$refs[domId]
|
|
|
let myChart = echarts.init(chartDom)
|
|
|
let colorAry = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc']
|
|
@@ -220,8 +292,8 @@ export default {
|
|
|
},
|
|
|
yAxis: {
|
|
|
type: 'value'
|
|
|
- },
|
|
|
- series: chartData.seriesdata
|
|
|
+ },
|
|
|
+ series: chartData.seriesdata[0]
|
|
|
}
|
|
|
myChart.clear()
|
|
|
option && myChart.setOption(option)
|