1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| <script>
| import exceptionApi from '@/api/exceptionApi.js'
| import lineChart from '@/utils/chartFunction/lineChart.js'
| import index from '@/utils/risk_estimate_common_function/index.js'
| import time from '@/utils/time.js'
| import FYLineChart from '@/components/chart/FYLineChart.vue'
| export default {
| props: {
| fetchParams: {
| type: Object,
| default: {
| name: null,
| number: null,
| beginTime: null,
| endTime: null
| }
| }
| },
| components: {
| FYLineChart
| },
| data() {
| return {
| chart: {
| // 日均值 折线图结果
| chartDataAvg: {},
| // 日有效率 折线图结果
| chartDataValid: {},
| // 无数据配置时间段
| areaColor: []
| }
| }
| },
| watch: {
| fetchParams: {
| handler() {
| if(this.fetchParams.name != '' && this.fetchParams.name != null){
| this.fetchDayAnalysisData()
| }
| },
| deep: true
| }
| },
| mounted() {
| },
| methods: {
| // 根据目前站点,月份,查折线图日统计数据
| fetchDayAnalysisData() {
| exceptionApi
| .analysisdata(
| this.fetchParams.name,
| this.fetchParams.beginTime,
| this.fetchParams.endTime,
| 'day'
| )
| .then((response) => {
| const chartData = response.data.data
| console.log('数据为',chartData);
| if (response.data.data.length == 0) {
| return
| }
| chartData.sort(time.compareByScore)
| // 分析数据中的最早时间
| let begin = chartData[0].lst
| // 分析数据中的最晚时间
| let end = chartData[chartData.length - 1].lst
|
| // 无数据的时间段
| let noDataTimeInteval = lineChart.backNoDataInteval(begin, end)
| // 无数据配置时间段
| this.chart.areaColor = lineChart.getMarkArea(noDataTimeInteval)
| this.setChart(chartData, this.fetchParams.beginTime, this.fetchParams.endTime)
|
| })
| },
|
| // 选择其他值类型时
| setChart(cData, bt, et) {
| if (cData.length!=0) {
| // 构建折线图x,y数据
| let obj = lineChart.getLineChartXYData(cData, bt, et)
| console.log('设置:',obj);
| this.chart.chartDataAvg = {
| x: obj.xData,
| y: obj.yAvg
| }
| this.chart.chartDataValid = {
| x: obj.xData,
| y: obj.yValid
| }
| }
| },
| }
| }
| </script>
|
| <template>
| <el-row :gutter="20">
| <el-col :span="12">
| <el-card shadow="never">
| <FYLineChart
| title="日均值"
| :chartData="chart.chartDataAvg"
| yName="mg/m³"
| seriesName="日均值"
| :areaColor="chart.areaColor"
| />
| </el-card>
| </el-col>
|
| <el-col :span="12">
| <el-card shadow="never">
| <FYLineChart
| title="日有效率"
| :chartData="chart.chartDataValid"
| yName="%"
| seriesName="日有效率"
| :areaColor="chart.areaColor"
| />
| </el-card>
| </el-col>
| </el-row>
| </template>
|
| <style scoped></style>
|
|