content.vue
4.83 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<template>
<div class="daily">
<div class="asis-table-wrapper">
<h3 class="asis-table-header single-report-header tf-table-header">
<span class="asis-table-download" @click="downloadData">{{$t('allPages.load')}}</span>
</h3>
<div class="asis-table-content" v-loading="loading">
<el-row>
<div ref="scatterChart" id="scatterChart" class="chart" :style="{ height: tableHeight + 'px' }"></div>
</el-row>
</div>
</div>
<export-data-dialog ref="exportDialog"></export-data-dialog>
</div>
</template>
<script>
import exportData from "../../public/exportData";
import echarts from 'echarts'
export default {
props: {
propparam: {
type: Object,
default: () => {}
}
},
components: {
"export-data-dialog": exportData,
},
data() {
return {
loading: false,
trafficFlow_title: "competitivePassengerFlowData", //报表
emitData: {},
chartData: {}, // 图数据
option:{
xAxis: {
name:this.$t('head.perSquare'),
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
yAxis: {
name:this.$t('head.humanEffect'),
splitLine: {
lineStyle: {
type: 'dashed'
}
},
scale: true
},
series: [
{
symbolSize: 20,
data: [],
type: 'scatter'
}
]
}
};
},
computed:{
tableHeight() {
let windowHeight = window.innerHeight,
scale = 0.34
scale = windowHeight <= 720
? 0.4
: windowHeight <= 768
? 0.38
: windowHeight <= 900
? 0.36
: windowHeight <= 1080
? 0.34
: 0.34
return windowHeight - windowHeight * scale
}
},
watch: {
propparam: {
handler: "refreshHandle",
// immediate: true,
deep: true
},
emitData: {
handler() {
},
immediate: true,
deep: true
}
},
mounted() {
this.myChart = echarts.init(this.$refs['scatterChart']);
},
methods: {
refreshHandle(param) {
if (param) {
this.emitData = param
this.getData();
}
},
getData() {
this.loading = true;
let param = {
orgId: this.$cookie.get('accountId'),
startDate: this.emitData.startDate,
endDate: this.emitData.endDate,
}
this.$api.businessAnalysisApi.getCostAnalysis(param).then(res => {
let resData = res.data.data;
this.loading = false;
this.chartData = resData
this.option.series = resData.series
this.option.series[0].emphasis = {
focus: 'series',
label: {
show: true,
formatter: function (param) {
return param.data[2];
},
position: 'top'
}
}
this.option.series[0].symbolSize =20
this.myChart.setOption(this.option,true)
})
},
downloadData() {
let exportNeed = {
domId: "scatterChart",
title: this.chartData.title,
data: {
url: `/report/account/cost/analysis/export`,
params: `orgId=${this.$cookie.get('accountId')}&startDate=${this.emitData.startDate}&endDate=${this.emitData.endDate}`
}
};
this.$refs.exportDialog.dialogInit(exportNeed);
},
}
};
</script>
<style scoped>
.asis-table-wrapper {
position: relative;
}
</style>