|
|
@@ -78,9 +78,14 @@
|
|
|
<el-option label="水位" value="0"></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
+ <div class="tabs">
|
|
|
+ <div class="tab-pane" :class="{ active: swActive }" @click="toChangeSwTab(true)">水位</div>
|
|
|
+ <div class="tab-pane" :class="{ active: !swActive }" @click="toChangeSwTab(false)">流量</div>
|
|
|
+ </div>
|
|
|
<div class="right">更多</div>
|
|
|
</div>
|
|
|
- <LineChart style="height: 1.8rem" :option="swOption" v-if="chartShow"/>
|
|
|
+ <LineChart ref="vLineChart" style="height: 1.8rem" :option="swOption" v-if="chartShow && swActive" />
|
|
|
+ <LineChart ref="vLineChart2" style="height: 1.8rem" :option="lOption" v-if="chartShow && !swActive" />
|
|
|
</div>
|
|
|
</template>
|
|
|
</BaseMain>
|
|
|
@@ -94,11 +99,12 @@ import BaseMain from '@/components/base-main/base-main.vue'
|
|
|
import LineChart from './line-chart/index.vue'
|
|
|
import * as echarts from 'echarts'
|
|
|
import { getHydrologicalList } from '@/api/hydrologicalStationApi'
|
|
|
-import { getMonitoringStatistics } from '@/api/monitoringDataApi'
|
|
|
+import { getMonitoringStatistics, getMonitoringStatisticsByFlow } from '@/api/monitoringDataApi'
|
|
|
import moment from 'moment'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ swActive: true,
|
|
|
dateVal: 1,
|
|
|
jcDateVal: 1,
|
|
|
jcActive: true,
|
|
|
@@ -120,7 +126,8 @@ export default {
|
|
|
val: '0'
|
|
|
}
|
|
|
],
|
|
|
- chartShow:false,
|
|
|
+ lOption: {},
|
|
|
+ chartShow: false,
|
|
|
selectedVal: '0',
|
|
|
selectedVal1: '0',
|
|
|
selectedVal2: '',
|
|
|
@@ -261,104 +268,212 @@ export default {
|
|
|
},
|
|
|
changeSwOpt(id) {
|
|
|
this.chartShow = false
|
|
|
+ if (this.swActive) {
|
|
|
+ this.getMonitoringStatistics(id)
|
|
|
+ } else {
|
|
|
+ this.getMonitoringStatisticsByFlow(id)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getMonitoringStatistics(id) {
|
|
|
getMonitoringStatistics({ stationId: id }).then((res) => {
|
|
|
- if(res.data){
|
|
|
- this.chartShow = true
|
|
|
- const option = {
|
|
|
- backgroundColor: 'transparent',
|
|
|
- color: ['#66DC95'],
|
|
|
- grid: {
|
|
|
- left: 16,
|
|
|
- right: 16,
|
|
|
- top: 20,
|
|
|
- bottom: 8,
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- trigger: 'axis',
|
|
|
+ if (res.data) {
|
|
|
+ this.chartShow = true
|
|
|
+ const option = {
|
|
|
backgroundColor: 'transparent',
|
|
|
- borderColor: 'transparent',
|
|
|
- borderWidth: 0,
|
|
|
- extraCssText: 'box-shadow: none;',
|
|
|
- formatter: function (params) {
|
|
|
- let value = params[params.length - 1].value
|
|
|
- let date = params[params.length - 1].name
|
|
|
- return `<div style="background-color: #2F5481; color: white; padding: 5px; border-radius: 5px;">
|
|
|
+ color: ['#66DC95'],
|
|
|
+ grid: {
|
|
|
+ left: 16,
|
|
|
+ right: 16,
|
|
|
+ top: 20,
|
|
|
+ bottom: 8,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ backgroundColor: 'transparent',
|
|
|
+ borderColor: 'transparent',
|
|
|
+ borderWidth: 0,
|
|
|
+ extraCssText: 'box-shadow: none;',
|
|
|
+ formatter: function (params) {
|
|
|
+ let value = params[params.length - 1].value
|
|
|
+ let date = params[params.length - 1].name
|
|
|
+ return `<div style="background-color: #2F5481; color: white; padding: 5px; border-radius: 5px;">
|
|
|
${date} 高程${value}m
|
|
|
</div>`
|
|
|
- }
|
|
|
- },
|
|
|
- xAxis: [
|
|
|
- {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- data: res.data.statisticalArray,
|
|
|
- axisLine: {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ data: res.data.statisticalArray,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#374672',
|
|
|
+ width: 1 //这里是为了突出显示加上的
|
|
|
+ }
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
lineStyle: {
|
|
|
color: '#374672',
|
|
|
- width: 1 //这里是为了突出显示加上的
|
|
|
+ width: 1
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: function (value) {
|
|
|
+ return moment(value).format('MM/DD')
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false
|
|
|
- },
|
|
|
- lineStyle: {
|
|
|
- color: '#374672',
|
|
|
- width: 1
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- formatter: function (value) {
|
|
|
- return moment(value).format('MM/DD');
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ splitLine: { show: false },
|
|
|
+ // min: 380,
|
|
|
+ // interval: 10,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#374672',
|
|
|
+ width: 1 //这里是为了突出显示加上的
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- ],
|
|
|
- yAxis: [
|
|
|
- {
|
|
|
- type: 'value',
|
|
|
- splitLine: { show: false },
|
|
|
- // min: 380,
|
|
|
- // interval: 10,
|
|
|
- axisLine: {
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: { width: 1, color: '#66DC95' },
|
|
|
+ symbol: 'circle',
|
|
|
+ symbolSize: 7,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#ffff', // 点颜色
|
|
|
+ borderColor: '#66DC95', // 点的边框颜色
|
|
|
+ borderWidth: 2 // 点的边框宽度
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ borderWidth: 4, // 鼠标悬停时边框加粗
|
|
|
+ shadowBlur: 10, // 阴影模糊大小,实现放大的效果
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.3)' // 阴影颜色
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ { offset: 1, color: 'rgba(102,220,149,0)' },
|
|
|
+ { offset: 0, color: 'rgba(102,220,149,0.25)' }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: res.data.realTimeElevation
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ this.swOption = option
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getMonitoringStatisticsByFlow(id) {
|
|
|
+ getMonitoringStatisticsByFlow({ stationId: id }).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.chartShow = true
|
|
|
+ const option = {
|
|
|
+ backgroundColor: 'transparent',
|
|
|
+ color: ['#4487D7'],
|
|
|
+ grid: {
|
|
|
+ left: 16,
|
|
|
+ right: 16,
|
|
|
+ top: 20,
|
|
|
+ bottom: 8,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ backgroundColor: 'transparent',
|
|
|
+ borderColor: 'transparent',
|
|
|
+ borderWidth: 0,
|
|
|
+ extraCssText: 'box-shadow: none;',
|
|
|
+ formatter: function (params) {
|
|
|
+ let value = params[params.length - 1].value
|
|
|
+ let date = params[params.length - 1].name
|
|
|
+ return `<div style="background-color: #2F5481; color: white; padding: 5px; border-radius: 5px;">
|
|
|
+ ${date} 流量${value}m³/s
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ data: res.data.statisticalArray,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#374672',
|
|
|
+ width: 1 //这里是为了突出显示加上的
|
|
|
+ }
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
lineStyle: {
|
|
|
color: '#374672',
|
|
|
- width: 1 //这里是为了突出显示加上的
|
|
|
+ width: 1
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ formatter: function (value) {
|
|
|
+ return moment(value).format('MM/DD')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- ],
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- lineStyle: { width: 1, color: '#66DC95' },
|
|
|
- symbol: 'circle',
|
|
|
- symbolSize: 7,
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- color: '#ffff', // 点颜色
|
|
|
- borderColor: '#66DC95', // 点的边框颜色
|
|
|
- borderWidth: 2 // 点的边框宽度
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
- borderWidth: 4, // 鼠标悬停时边框加粗
|
|
|
- shadowBlur: 10, // 阴影模糊大小,实现放大的效果
|
|
|
- shadowColor: 'rgba(0, 0, 0, 0.3)' // 阴影颜色
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ splitLine: { show: false },
|
|
|
+ // min: 380,
|
|
|
+ // interval: 10,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#374672',
|
|
|
+ width: 1 //这里是为了突出显示加上的
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- areaStyle: {
|
|
|
- opacity: 0.8,
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
- { offset: 1, color: 'rgba(102,220,149,0)' },
|
|
|
- { offset: 0, color: 'rgba(102,220,149,0.25)' }
|
|
|
- ])
|
|
|
- },
|
|
|
- data: res.data.maxElevationYesterday
|
|
|
- }
|
|
|
- ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: { width: 1, color: '#4487D7' },
|
|
|
+ symbol: 'circle',
|
|
|
+ symbolSize: 7,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#ffff', // 点颜色
|
|
|
+ borderColor: '#4487D7', // 点的边框颜色
|
|
|
+ borderWidth: 2 // 点的边框宽度
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ borderWidth: 4, // 鼠标悬停时边框加粗
|
|
|
+ shadowBlur: 10, // 阴影模糊大小,实现放大的效果
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.3)' // 阴影颜色
|
|
|
+ }
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ { offset: 1, color: ' rgba(73,142,227,0)' },
|
|
|
+ { offset: 0, color: 'rgba(73,142,227,0.25)' }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: res.data.realtimeDischarge
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ this.lOption = option
|
|
|
}
|
|
|
- this.swOption = option
|
|
|
- }
|
|
|
})
|
|
|
},
|
|
|
changeDate(val) {
|
|
|
@@ -366,6 +481,20 @@ export default {
|
|
|
},
|
|
|
toChangeTab(d) {
|
|
|
this.jcActive = d
|
|
|
+ },
|
|
|
+ toChangeSwTab(a) {
|
|
|
+ this.swActive = a
|
|
|
+ if (this.swActive) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.vLineChart.initChart()
|
|
|
+ })
|
|
|
+ this.getMonitoringStatistics(this.selectedVal2)
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.vLineChart2.initChart()
|
|
|
+ })
|
|
|
+ this.getMonitoringStatisticsByFlow(this.selectedVal2)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -541,6 +670,20 @@ export default {
|
|
|
color: #5e93c9;
|
|
|
}
|
|
|
}
|
|
|
+ .tabs {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: px-to-rem(20);
|
|
|
+ .tab-pane {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: px-to-rem(16);
|
|
|
+ color: #f5f5f5;
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ color: #4488d9;
|
|
|
+ border-bottom: px-to-rem(1) solid #4488d9;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|