client.vue
7.4 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<template>
<div class="sub-container">
<GLCombiForm class="sub-form-style" :formObj="searchForm" :formData="clientGroupFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<!-- :tableId="$route.query.id" 去掉,表格组件也应该去掉 -->
<!-- <div class="leadList">
<div>
<span></span>
</div>
<el-button size="small" @click="handleExport">导出</el-button>
</div> -->
<GLTable ref="clientGroupDetail" @setTableFinishFun="setTableFinishFun" :hasNum="true" :pageConf="pageConf" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchFormTable" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }" :noDataImg="url">
<span slot="customerName" slot-scope="scope">
<el-tooltip effect="dark" :content="scope.scope.customerName" placement="top">
<span class="ellipsis-1" style="display: inline-block; max-width: 70px; text-align: left">{{ scope.scope.customerName }}</span>
</el-tooltip>
</span>
<span slot="customerSex" slot-scope="scope">
<span>{{ scope.scope.customerSex == 2 ? '女' : scope.scope.customerSex == 1 ? '男' : '未知' }}</span>
</span>
<span slot="joinScene" slot-scope="scope">
<span>{{ scope.scope.joinScene == 1 ? '直接邀请入群' : scope.scope.joinScene == 2 ? '通过邀请链接入群' : scope.scope.joinScene == 3 ? '通过扫描群二维码入群' : '' }}</span>
</span>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="goDetail(scope.scope.id)" class="blue-text">详情</span>
</template>
</GLTable>
</div>
</template>
<script>
import { getDetailTableList, clientExportApi } from '@/api/modules/clientGroupManage'
export default {
props: {
url: {
type: String,
default: ''
}
},
data() {
return {
searchForm: {},
searchFormTable: {},
clientGroupFormList: [
{
type: 'datePicker',
name: 'daterange',
label: '入群时间',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
},
{
type: 'select',
name: 'customerSex',
label: '性别',
optionLabel: 'label',
optionId: 'value',
placeholder: '请选择性别',
optionList: [
{
label: '全部',
value: null
},
{
label: '男',
value: 1
},
{
label: '女',
value: 2
},
{
label: '未知',
value: 0
}
]
},
{
type: 'input',
inputType: 'text',
name: 'groupNickName',
label: '本群昵称',
placeholder: '请输入本群昵称'
},
{
type: 'input',
inputType: 'text',
name: 'customerName',
label: '客户名称',
placeholder: '请输入客户名称'
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
tableColumns: [
{
label: '本群昵称',
prop: 'groupNickName',
width: 170,
line: 1
},
{
label: '客户名称',
prop: 'customerName',
addHtml: 'customerName',
width: 170,
line: 1
},
{
label: '手机号码',
prop: 'customerPhone',
line: 1,
width:200
},
{
label: '性别',
prop: 'customerSex',
addHtml: 'customerSex',
},
{
label: '入群方式',
prop: 'joinScene',
addHtml: 'joinScene',
width: 190,
line: 1
},
{
label: '邀请人',
prop: 'invitorName',
width: 120,
line: 1
},
{
label: '入群时间',
prop: 'joinTime',
width: 170,
}
],
tableOption: {
width: 62,
btnList: [
{
name: '详情',
pType: 'detail'
}
]
}
},
getListApi: getDetailTableList,
clientTableDataNum: 0
}
},
created() {
this.searchForm = {
id: this.$route.query.id
}
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (params.daterange) {
params.beginTime = this.searchForm.daterange[0]
params.endTime = this.searchForm.daterange[1]
} else {
if (params.beginTime) delete params.beginTime && delete params.endTime
}
delete params.daterange
return params
},
beforeSearchFn() {
// return new Promise((resolve, reject) => {
// this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
// if (this.searchFormTable.daterange) {
// this.searchFormTable.beginTime = this.searchForm.daterange[0]
// this.searchFormTable.endTime = this.searchForm.daterange[1]
// delete this.searchFormTable.daterange
// } else {
// if (this.searchFormTable.beginTime) delete this.searchFormTable.beginTime && delete this.searchFormTable.endTime
// }
// resolve()
// })
return new Promise((resolve, reject) => {
this.searchFormTable = this.getParams()
resolve()
})
},
setTableHeightEvent() {
this.$refs.clientGroupDetail.setTableHeightFun()
},
setTableFinishFun(content) {
//content是第一页的数据
this.clientTableDataNum = this.$refs.clientGroupDetail.total
// this.$emit('getTotal',this.clientTableDataNum)
//接收到的数据为空
// if (!this.$refs.clientGroupDetail.data.length) {
// this.$refs.clientGroupDetail.setTableHeightFun()
// }
this.$refs.clientGroupDetail.data.length ? (this.$refs.clientGroupDetail.tableHeightValues = '') : this.$refs.clientGroupDetail.setTableHeightFun()
},
//导出
handleExport() {
var params = this.getParams()
clientExportApi(params).then(res => {
this.$Utils.exportFn(res)
})
},
//搜索表格
searchTable() {
this.$refs.clientGroupDetail.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = { id: this.$route.query.id }
this.$refs.clientGroupDetail.refreshTable()
},
goDetail(msg) {
this.$emit('goDetail', msg)
}
}
}
</script>
<style lang="scss" scoped>
.sub-container {
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
border: 1px solid #5850ff;
}
}
}
</style>