record.vue
4.02 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
<template>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<div class="live-table-header">
<h2>
已累计
<label>{{ peopleNum }}</label>
人观看
<label>{{ roomNum }}</label>
次观看
</h2>
<el-button :size="size" type="primary" plain @click="detailexport">导出</el-button>
</div>
<GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="nickname" slot-scope="scope">
<div class="nickname-border">
<img :src="scope.scope.avatar" />
<span>{{ scope.scope.nickname }}</span>
</div>
</div>
</GLTable>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import { downloadUrl } from '@/utils'
export default {
name: 'LiveIndex',
props: {
roomNum: Number,
peopleNum: {
type: Number,
default: 0
}
},
data() {
return {
size: 'small',
url: url,
searchForm: {
nickname: '',
phone: '',
sourceShopName: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '微信昵称',
name: 'nickname',
type: 'input',
maxlength: 20
},
{
label: '手机号',
name: 'phone',
type: 'input',
maxlength: 20
},
{
label: '来源门店',
name: 'sourceShopName',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.console.detailpage,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '微信昵称',
prop: 'nickname',
addHtml: 'nickname'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '访问来源',
prop: 'visitSource'
},
{
label: '来源门店',
prop: 'sourceShopName'
},
{
label: '观看时长',
prop: 'visitDuration'
},
{
label: '最后浏览',
prop: 'lastVisitTime',
width: 200
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
inject: ['elFormItem'],
methods: {
detailexport() {
const getParams = Object.assign(this.getParams(), {
pageSize: 1000000,
currentPage: 1
})
this.$apis.console.detailexport(getParams).then(res => {
res && downloadUrl(res)
})
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.id = this.$route.query.id
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.classifyRef.data.length ? (this.$refs.classifyRef.tableHeightValues = '') : this.$refs.classifyRef.setTableHeightFun()
},
handleSearch() {
this.$refs.classifyRef.refreshTable()
},
handleReset() {
this.searchForm = {}
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.container {
::v-deep {
.el-form-item--small {
width: 25%;
}
}
.live-table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
color: #333333;
font-size: 16px;
label {
color: #5850ff;
}
}
}
.nickname-border {
display: flex;
align-items: center;
img {
width: 36px;
height: 36px;
margin-right: 10px;
}
}
</style>