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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* 点播趋势图 */
<template>
<div class="trend-wrapper height100 overview-detail">
<div class="btn-group" v-if="isExport">
<el-button
class="export"
type="primary"
icon="el-icon-download"
@click="handleExport"
>导出文件</el-button
>
</div>
<div id="bodyCanvas" :class="isExport ? '' : 'export'">
<div class="ecahrts-panel-box">
<div class="panel-box-header">
<span class="title">趋势图</span>
<el-date-picker
v-model="monthVal"
value-format="yyyyMM"
type="monthrange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="pickerOptions"
@change="handleChange"
>
</el-date-picker>
<div class="tip">
<span class="tip-title">页面说明:</span>
<span
>默认展示当月点播总量趋势图及详情表格,可按照时间段进行检索,图表可以联动变化。。</span
>
</div>
</div>
<div class="panel-box-content">
<trend-line ref="echarts" :data="echartsData" />
</div>
</div>
<div class="rank-panel-box">
<div class="panel-box-header">
<span class="title">点播趋势排行</span>
</div>
<div class="panel-box-content">
<rank-table :tList="tList" :data="data" />
</div>
</div>
</div>
</div>
</template>
<script>
import { trendLine, rankTable } from "./components";
import { getCurDate } from "@/utils/util.time";
export default {
data() {
return {
value1: "",
tList: ["排名", "统计时间", "点播总量"],
playDate: "1",
data: [],
echartsData: {},
value2: "",
monthVal: "",
timer: null,
isExport: false,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: '本月',
onClick(picker) {
picker.$emit('pick', [new Date(), new Date()]);
}
}, {
text: '今年至今',
onClick(picker) {
const end = new Date();
const start = new Date(new Date().getFullYear(), 0);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近六个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 6);
picker.$emit('pick', [start, end]);
}
}]
},
};
},
components: { trendLine, rankTable },
mounted() {
let roleList = localStorage.getItem("roleList");
if (roleList) {
this.isExport = localStorage.getItem("roleList").includes("1");
}
this.getList()
},
methods: {
getList(frequencyDate) {
let _this = this;
let url = `tBoardStatistic/getBoardPageList`
if(frequencyDate){
url +=`?beginDate=${frequencyDate[0]}&endDate=${frequencyDate[1]}`
}
_this
.$https({
method: "post",
url:url,
authType: this.backToken,
})
.then((res) => {
if (res.status == 200) {
if (res.data.resultCode == 200) {
_this.echartsData = {};
_this.echartsData.xAxisData = res.data.data.dateList;
_this.echartsData.yAxisData = res.data.data.cntList;
_this.data = res.data.data.page.records;
} else {
_this.echartsData = {};
_this.data = [];
}
} else {
_this.echartsData = {};
_this.data = [];
}
setTimeout(() => {
_this.init();
}, 100);
})
.catch((err) => {
_this.$message.error(err.message);
_this.echartsData = {};
_this.data = [];
});
},
handleChange(val) {
this.getList(val);
},
init() {
this.$refs.echarts.init();
},
handleExport() {
let _this = this;
if (this.timer) {
return false;
}
this.timer = setTimeout(() => {
clearTimeout(_this.timer);
_this.timer = null;
}, 30000);
_this.getPdf("#bodyCanvas", "趋势分析");
const loading = this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
setTimeout(() => {
loading.close();
}, 2000);
},
},
};
</script>
<style lang="less" scoped>
.trend-wrapper {
.btn-group {
margin-bottom: 20px;
height: 36px;
}
/deep/ .el-button.export {
width: 128px;
float: right;
.el-icon-download {
font-size: 18px;
font-weight: bold;
}
}
.el-select {
margin-left: 40px;
/deep/.el-input__inner {
border-radius: 22px;
background-color: @party-bg-gray;
border-color: @party-border-color;
}
}
#bodyCanvas {
height: calc(100% - 56px);
&.export {
height: 100%;
}
}
.ul-wrapper {
background-color: @party-white;
}
}
</style>