content.vue
5.14 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
150
151
152
153
154
155
156
157
158
159
<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="lineChart" id="lineChart" 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:{
tooltip:{
trigger:'axis'
},
color:["#3BB8FF", "#FFC62E"],
xAxis: {
type: 'category',
data:[],
axisLabel:{
show:false
},
axisLine:{
show:false
},
axisTick:{
show:false
}
},
yAxis: [
{
type:'value',
name:''
},
{
type:'value',
name:''
}
],
series: [
{
data: [],
type: 'line',
smooth: true
},
{
data: [],
type: 'line',
smooth: true,
yAxisIndex:1
}
]
}
};
},
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['lineChart']);
},
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.getCustomerExperience(param).then(res => {
let resData = res.data.data;
this.loading = false;
this.chartData = resData
this.option.xAxis.data = resData.xaxis.data
resData.series.forEach((item,index)=>{
this.option.yAxis[index].name=item.name
this.option.series[index].data=item.data
this.option.series[index].name=item.name
})
this.myChart.setOption(this.option,true)
})
},
downloadData() {
let exportNeed = {
domId: "lineChart",
title: this.chartData.title,
data: {
url: `/report/account/customer/experience/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>