|
|
@@ -5,40 +5,40 @@
|
|
|
<div class="top">
|
|
|
<el-form ref="form" :model="form" label-width="auto" size="small">
|
|
|
<el-row :gutter="24">
|
|
|
- <el-col :span="14">
|
|
|
+ <el-col :span="16">
|
|
|
<el-form-item label="监测站点:" style="padding:0">
|
|
|
- <el-select v-model="form.siteId" filterable placeholder="选择站点">
|
|
|
+ <el-select v-model="form.siteId" filterable placeholder="选择站点" style="width:100%">
|
|
|
<el-option v-for="(item,index) in siteOption" :key="index" :label="item.siteName" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="10">
|
|
|
- <el-form-item label-width="0">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label-width="0" style="text-align: right;">
|
|
|
<el-button type="primary" size="small" style="width:85px">图上选点</el-button>
|
|
|
- <el-button type="primary" size="small" style="width:85px" @click="query()">查询</el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="13" style="padding-right:0">
|
|
|
+ <el-col :span="16">
|
|
|
<el-form-item label="日期范围:" style="padding:0">
|
|
|
- <el-date-picker v-model="form.date" type="daterange" align="right" unlink-panels range-separator="-"
|
|
|
- start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" value-format="yyyy-MM-dd"
|
|
|
- format="yyyy/MM/dd" style="width:100%" :clearable="false">
|
|
|
+ <el-date-picker v-model="form.date" type="daterange" align="right" unlink-panels range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" value-format="yyyy-MM-dd" format="yyyy/MM/dd" style="width:100%" :clearable="false">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="11" style="padding-right:0">
|
|
|
- <el-form-item label-width="0">
|
|
|
- <el-radio-group v-model="radio">
|
|
|
- <el-radio :label="1">实时</el-radio>
|
|
|
- <el-radio :label="2">每小时均值</el-radio>
|
|
|
- <el-radio :label="3">每日均值</el-radio>
|
|
|
- </el-radio-group>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label-width="0" style="text-align: right;">
|
|
|
+ <el-button type="primary" size="small" style="width:85px" @click="query()">查询</el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
+ <div class="time-select">
|
|
|
+ <el-radio-group v-model="radio">
|
|
|
+ <el-radio :label="1">实时</el-radio>
|
|
|
+ <el-radio :label="2">每小时均值</el-radio>
|
|
|
+ <el-radio :label="3">每日均值</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
<!-- 标签页 -->
|
|
|
<el-tabs v-model="activeName" type="card" style="height:500px">
|
|
|
<el-tab-pane label="图表" name="first">
|
|
|
@@ -48,8 +48,7 @@
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="列表" name="second" style="height:100%">
|
|
|
- <el-table :data="tableData" stripe height="100%"
|
|
|
- :header-cell-style="{background:'#e0eafb',color:'rgb(50,59,65)',height:'39px',textAlign:'center',fontWeight:'600'}">
|
|
|
+ <el-table :data="tableData" stripe height="100%" :header-cell-style="{background:'#e0eafb',color:'rgb(50,59,65)',height:'39px',textAlign:'center',fontWeight:'600'}">
|
|
|
<template slot="empty">
|
|
|
<img src="@/assets/icon/null.png" alt="" />
|
|
|
<p style="margin-top: -7px">暂无数据</p>
|
|
|
@@ -57,10 +56,9 @@
|
|
|
<el-table-column prop="date" label="序号" width="50" align="center">
|
|
|
<template slot-scope="scope">{{scope.$index+1}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column v-for="(item,index) in targetData" :key="index" :prop="item.targetCode+'s'" :label="item.targetName"
|
|
|
- width="100" align="center">
|
|
|
- </el-table-column>
|
|
|
<el-table-column prop="collectionDates" label="采集时间" width="200" align="center"></el-table-column>
|
|
|
+ <el-table-column v-for="(item,index) in targetData" :key="index" :prop="item.targetCode+'s'" :label="item.targetName" width="100" align="center">
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
@@ -71,9 +69,9 @@
|
|
|
<script>
|
|
|
import { getHistoryCurve, getSites } from '@/views/spectrum/dynamicMonitor/api/api'
|
|
|
|
|
|
-import * as echarts from 'echarts';
|
|
|
+import * as echarts from 'echarts'
|
|
|
export default {
|
|
|
- name: "historyCurve",
|
|
|
+ name: 'historyCurve',
|
|
|
data() {
|
|
|
return {
|
|
|
pickerOptions: {
|
|
|
@@ -81,35 +79,39 @@ export default {
|
|
|
{
|
|
|
text: '今天',
|
|
|
onClick(picker) {
|
|
|
- const start = new Date();
|
|
|
- const end = new Date();
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const start = new Date()
|
|
|
+ const end = new Date()
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
}
|
|
|
- }, {
|
|
|
+ },
|
|
|
+ {
|
|
|
text: '最近一周',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
}
|
|
|
- }, {
|
|
|
+ },
|
|
|
+ {
|
|
|
text: '最近一个月',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
}
|
|
|
- }, {
|
|
|
+ },
|
|
|
+ {
|
|
|
text: '最近一年',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
|
|
|
- picker.$emit('pick', [start, end]);
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
}
|
|
|
- }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
areaColor: [
|
|
|
['rgba(126, 215, 243)', 'rgba(250, 253, 254)'],
|
|
|
@@ -124,27 +126,21 @@ export default {
|
|
|
dialogVisible: false,
|
|
|
siteOption: [],
|
|
|
form: {
|
|
|
- date: [
|
|
|
- this.$moment().format('YYYY-MM-DD 00:00:00'),
|
|
|
- this.$moment().format('YYYY-MM-DD 23:59:59')
|
|
|
- ]
|
|
|
+ date: [this.$moment().format('YYYY-MM-DD 00:00:00'), this.$moment().format('YYYY-MM-DD 23:59:59')]
|
|
|
},
|
|
|
radio: 1,
|
|
|
activeName: 'first',
|
|
|
targetData: [], // 图表类型
|
|
|
- tableData: [], // 列表数据
|
|
|
+ tableData: [] // 列表数据
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
-
|
|
|
- },
|
|
|
+ mounted() {},
|
|
|
watch: {
|
|
|
radio(val, oldVal) {
|
|
|
if (val == 3) this.form['date'] = this.getSevenDate()
|
|
|
- else this.form['date'] = [
|
|
|
- this.$moment().format('YYYY-MM-DD 00:00:00'),
|
|
|
- this.$moment().format('YYYY-MM-DD 23:59:59')
|
|
|
- ]
|
|
|
+ else
|
|
|
+ this.form['date'] = [this.$moment().format('YYYY-MM-DD 00:00:00'), this.$moment().format('YYYY-MM-DD 23:59:59')]
|
|
|
+ this.query()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -157,7 +153,7 @@ export default {
|
|
|
* 获取站点
|
|
|
*/
|
|
|
getSites(siteId) {
|
|
|
- getSites({ projectId: this.$store.state.project.project.id, size: 1000 }).then(res => {
|
|
|
+ getSites({ projectId: this.$store.state.project.project.id, size: 1000 }).then((res) => {
|
|
|
if (res.code && res.code == 1) {
|
|
|
this.siteOption = res.result.records
|
|
|
this.$set(this.form, 'siteId', siteId)
|
|
|
@@ -177,19 +173,20 @@ export default {
|
|
|
// // params['beginTime'] = this.$moment(this.form.date[0]).format('YYYY-MM-DD 00:00:00')
|
|
|
// // params['endTime'] = this.$moment(this.form.date[1]).format('YYYY-MM-DD 23:59:59')
|
|
|
// // }
|
|
|
- getHistoryCurve(params).then(res => {
|
|
|
+ getHistoryCurve(params).then((res) => {
|
|
|
if (res.code && res.code == 1) {
|
|
|
if (!res.result || !res.result.list || res.result.list instanceof Array == false) return
|
|
|
- const result = res.result.list[0];
|
|
|
- let target = result.targetVos; // 要展示曲线的指标
|
|
|
- let collectionDates = result.collectionDates.map(item => {
|
|
|
- if (this.radio == 3) return this.$moment(item).format("MM-DD")
|
|
|
- else return this.$moment(item).format("DD HH")
|
|
|
- }); // 选择日期
|
|
|
- this.targetData = target;
|
|
|
+ const result = res.result.list[0]
|
|
|
+ let target = result.targetVos // 要展示曲线的指标
|
|
|
+ // let collectionDates = result.collectionDates.map((item) => {
|
|
|
+ // if (this.radio == 3) return this.$moment(item).format('MM-DD')
|
|
|
+ // else return this.$moment(item).format('DD HH')
|
|
|
+ // }) // 选择日期
|
|
|
+ let collectionDates = result.collectionDates
|
|
|
+ this.targetData = target
|
|
|
for (let index = 0; index < target.length; index++) {
|
|
|
- const item = target[index];
|
|
|
- const yData = result[item.targetCode + "s"]
|
|
|
+ const item = target[index]
|
|
|
+ const yData = result[item.targetCode + 's']
|
|
|
this.$nextTick(() => {
|
|
|
this.loadChart(index, collectionDates, yData, this.areaColor[index])
|
|
|
})
|
|
|
@@ -213,8 +210,8 @@ export default {
|
|
|
* 加载图表
|
|
|
*/
|
|
|
loadChart(domIndex, xData, yData, areaColor) {
|
|
|
- let chartDom = document.getElementById('curve-chart' + domIndex);
|
|
|
- let myChart = echarts.init(chartDom);
|
|
|
+ let chartDom = document.getElementById('curve-chart' + domIndex)
|
|
|
+ let myChart = echarts.init(chartDom)
|
|
|
let option = {
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
|
@@ -232,13 +229,16 @@ export default {
|
|
|
bottom: '2%',
|
|
|
containLabel: true
|
|
|
},
|
|
|
- xAxis: [
|
|
|
- {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- data: xData
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ data: xData,
|
|
|
+ axisLabel: {
|
|
|
+ formatter: (dateTime) => {
|
|
|
+ return this.$moment(dateTime).format('DD日HH时')
|
|
|
+ }
|
|
|
}
|
|
|
- ],
|
|
|
+ },
|
|
|
yAxis: [
|
|
|
{
|
|
|
type: 'value'
|
|
|
@@ -276,38 +276,35 @@ export default {
|
|
|
data: yData
|
|
|
}
|
|
|
]
|
|
|
- };
|
|
|
+ }
|
|
|
myChart.clear()
|
|
|
- option && myChart.setOption(option);
|
|
|
+ option && myChart.setOption(option)
|
|
|
},
|
|
|
/**
|
|
|
* 加载列表
|
|
|
*/
|
|
|
loadTable(data) {
|
|
|
- let arr = [];
|
|
|
+ let arr = []
|
|
|
data.collectionDates.forEach((item, index) => {
|
|
|
- arr.push({ serialnum: (index + 1) });
|
|
|
+ arr.push({ serialnum: index + 1 })
|
|
|
data.targetVos.forEach((item1, index1) => {
|
|
|
- let columnName = item1.targetCode + "s";
|
|
|
- let columnVal = data[columnName];
|
|
|
+ let columnName = item1.targetCode + 's'
|
|
|
+ let columnVal = data[columnName]
|
|
|
arr[index][columnName] = columnVal[index] ? columnVal[index] : '/'
|
|
|
- });
|
|
|
- arr[index]["collectionDates"] = item;
|
|
|
- });
|
|
|
+ })
|
|
|
+ arr[index]['collectionDates'] = item
|
|
|
+ })
|
|
|
this.tableData = arr
|
|
|
},
|
|
|
/**
|
|
|
* 获取近7天时间区间
|
|
|
*/
|
|
|
getSevenDate() {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
- return [
|
|
|
- this.$moment(start).format('YYYY-MM-DD 00:00:00'),
|
|
|
- this.$moment(end).format('YYYY-MM-DD 23:59:59')
|
|
|
- ]
|
|
|
- },
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
+ return [this.$moment(start).format('YYYY-MM-DD 00:00:00'), this.$moment(end).format('YYYY-MM-DD 23:59:59')]
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -336,21 +333,29 @@ export default {
|
|
|
padding: 0;
|
|
|
}
|
|
|
}
|
|
|
- >>> .el-date-editor {
|
|
|
- .el-input__icon {
|
|
|
- display: none;
|
|
|
- }
|
|
|
- .el-range-input {
|
|
|
- width: 50%;
|
|
|
- }
|
|
|
- }
|
|
|
+ // >>> .el-date-editor {
|
|
|
+ // .el-input__icon {
|
|
|
+ // display: none;
|
|
|
+ // }
|
|
|
+ // .el-range-input {
|
|
|
+ // width: 50%;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
- .el-radio {
|
|
|
- margin-right: 4px;
|
|
|
- >>> .el-radio__label {
|
|
|
- padding-left: 2px !important;
|
|
|
+ .time-select {
|
|
|
+ position: absolute;
|
|
|
+ right: 15px;
|
|
|
+ top: 20p;
|
|
|
+ margin-top: 15px;
|
|
|
+ z-index: 99;
|
|
|
+ .el-radio {
|
|
|
+ margin-right: 4px;
|
|
|
+ >>> .el-radio__label {
|
|
|
+ padding-left: 2px !important;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.el-tabs {
|
|
|
>>> .el-tabs__content {
|
|
|
height: calc(100% - 55px);
|