pvpage.vue
5.88 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
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
204
205
206
207
<template>
<div class="page-container">
<div class="tool-wrap">
<div>
<el-form :inline="true" :model="filters">
<el-form-item>
<el-input @change="changeHandler()" v-model="filters.mobilePhone" placeholder="请输入访问页面"></el-input>
</el-form-item>
<el-form-item>
<el-date-picker @change="changeHandler()" v-model="filters.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions2">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" v-on:click="reqQuery">查询</el-button>
</el-form-item>
</el-form>
</div>
<div>
<el-button class="reset-btn" @click="showDialog()">导出数据</el-button>
</div>
</div>
<el-table :data="totalData.reservationList" highlight-current-row v-loading="listLoading" style="width: 100%;">
<el-table-column prop="page_name" label="访问页面">
</el-table-column>
<el-table-column prop="hdp_created" :formatter="formatTableDate" label="访问时间">
</el-table-column>
<el-table-column prop="nickname" label="微信昵称">
</el-table-column>
<el-table-column label="微信头像">
<template slot-scope="scope">
<div class="avatar-wrap">
<img class="avatar" :src="scope.row.avatar" alt="">
</div>
</template>
</el-table-column>
<el-table-column prop="openid" label="openid">
</el-table-column>
</el-table>
<!--工具条-->
<el-col :span="24" class="toolbar">
<div class="page-tips">总共{{total}}条记录,每页{{pageSize}}条,总共{{pageNum}}页</div>
<el-pagination layout="prev, pager, next,jumper" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;">
</el-pagination>
</el-col>
<el-dialog class="dialog" center title="导出数据设定" :visible.sync="exportDialogVisible" :close-on-click-modal="false">
<span class="tips">导出日期</span>
<el-date-picker v-model="exportDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions2">
</el-date-picker>
<div slot="footer" class="dialog-footer">
<el-button style="width:120px;" @click.native="exportDialogVisible = false">取消</el-button>
<el-button style="width:120px;" type="primary" @click.native="exportHandler()">导出</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { Base64 } from "js-base64";
import { exportTable } from "./../../api/api.js";
import { formatDate } from "./../../common/utils.js";
export default {
data() {
return {
exportDate: [
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 7),
new Date().getTime()
],
exportDialogVisible: false,
listLoading: false,
page: 1,
pageSize: 10,
total: 0,
totalData: {
reservationList: []
},
selDate: [
new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 7),
new Date()
],
pickerOptions2: {
disabledDate(time) {
return time.getTime() > Date.now();
}
},
filters: {
mobilePhone: "",
date: ""
}
};
},
computed: {
pageNum() {
return Math.ceil(this.total / this.pageSize);
},
startTime() {
let date = this.filters.date;
let result = (date && date[0]) || "";
if (result) {
result = date[0].getTime();
}
return result;
},
endTime() {
let date = this.filters.date;
let result = (date && date[1]) || "";
if (result) {
result = date[1].getTime() + 1000 * 60 * 60 * 24;
}
return result;
}
},
methods: {
changeHandler() {
this.reqQuery();
},
exportHandler() {
let data = {
start_time: new Date(this.exportDate[0]).getTime(),
end_time: new Date(this.exportDate[1]).getTime() + 1000 * 60 * 60 * 24,
mobile_phone: "",
startIndex: 0,
size: 1000000
};
var encoder = HDP.getEncoder();
var encrypted = encoder.encode(JSON.stringify(data));
let params = {
appId: "df69fd8153f711ea8c527cd30aeb749e",
appKey: "5e19fbac20474d6587105eee7c624319",
func: "queryStatPageList",
data: encrypted
};
exportTable(params);
},
showDialog() {
this.exportDialogVisible = true;
},
formatTableDate(row, column) {
return formatDate.format(new Date(row.hdp_created), "yyyy-MM-dd hh:mm");
},
handleCurrentChange(val) {
this.page = val;
this.reqQuery();
},
reqQuery() {
let _this = this;
_this.listLoading = true;
let data = {
startIndex: (this.page - 1) * this.pageSize,
size: this.pageSize,
mobile_phone: this.filters.mobilePhone,
start_time: this.startTime,
end_time: this.endTime
};
as.queryFunV2("queryStatPageListAppb8vC", data, res => {
_this.page = 1;
_this.listLoading = false;
if (res) {
let reservationList = res[0];
let total = res[1][0].total;
_this.total = total;
_this.$set(_this.totalData, "reservationList", reservationList);
}
});
}
},
mounted() {
this.reqQuery();
},
created() {}
};
</script>
<style lang="scss" scoped>
.page-container {
padding: 20px;
}
.tool-wrap {
padding: 24px 0;
display: flex;
border-bottom: solid 1px #cccccc;
justify-content: space-between;
}
.toolbar {
display: flex;
justify-content: space-between;
.page-tips {
height: 32px;
line-height: 32px;
color: #333333;
}
}
.dialog {
.tips {
margin-right: 24px;
}
}
</style>