index.vue
11 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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<template>
<div>
<div class="scrm-sub-client-container">
<!-- <p class="pageTitle">客户群管理</p> -->
<div class="pageContent">
<search-form class="searchTop border-shadow" :isHasSyncBtn="true" :showDefaultTime="false" :merchantModel="merchantModel" :accountLevel="accountLevel" :formModel="searchForm" :formList="clientGroupFormList" @setTableHeightEvent="setTableHeightEvent" @resetTable="resetTable" @searchTable="searchTable" @handleExport="handleExport" @syncClick="syncClick">
<span class="inline-b" slot="form-slot">
<el-button plain @click="resetTable">重置</el-button>
<el-button type="primary" @click="searchTable">查询</el-button>
<el-button type="primary" @click="handleExport">导出</el-button>
<!-- v-if="(merchantModel == 1 && accountLevel == 1) || (merchantModel == 2 && accountLevel == 4)"允许所有人同步 -->
<!-- <el-button type="primary" @click="syncClick" :loading="sloading">同步数据</el-button> -->
</span>
</search-form>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="clientGroupManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :pageConf="pageConf" :searchForm="searchFormTable" :tableParams="tableParams">
<span slot="status" slot-scope="scope">
<!-- <span class="dot" :class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"></span> -->
<span class="statusText" :class="scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[1] : ''">{{ scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[0] : '--' }}</span>
</span>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- <auth-button :data="scope.scope"></auth-button> -->
<span @click="goDetail(scope.scope.id, scope.scope.custGroupName)" class="blue-text">详情</span>
<!-- <GLButton @click="goDetail(scope.scope.id, scope.scope.custGroupName)" fn="客户群详情" type="text">详情</GLButton> -->
</template>
</GLTable>
</div>
</div>
</div>
</template>
<script>
import { getTableList, syncCustomerBase, getStatus, clientGroupExportApi } from '@/api/modules/clientGroupManage'
import url from '@/assets/clientDataOverview/nodata.png'
export default {
name: 'clientGroupManage',
// inject: ['reload'],
data() {
return {
isReload: true,
url: url,
sloading: false,
searchForm: {},
searchFormTable: {},
clientGroupFormList: [
{
type: 'daterange',
prop: 'daterange',
label: '创建时间',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
},
{
type: 'input',
inputType: 'text',
prop: 'custGroupName',
label: '群聊名称',
placeholder: '请输入群聊名称'
},
{
type: 'input',
inputType: 'text',
prop: 'groupHostName',
label: '群主',
placeholder: '请输入群主'
},
{
type: 'input',
inputType: 'text',
prop: 'groupAdminName',
label: '管理员',
placeholder: '请输入管理员'
},
{
type: 'select',
prop: 'creationMethod',
label: '创建方式',
placeholder: '请选择',
options: [
{
label: '全部',
value: null
},
{
label: '手动拉群',
value: 1
},
{
label: '一客一群',
value: 2
}
]
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
tableColumns: [
{
label: '群聊名称',
prop: 'custGroupName',
minWidth: 160
},
{
label: '当前成员总数',
prop: 'allMembers',
minWidth: 140
},
{
label: '当前客户数',
prop: 'totalCount',
minWidth: 100
},
{
label: '当日新增入群客户数',
prop: 'newCustomerCount',
minWidth: 160
},
{
label: '当日新增退群客户数',
prop: 'delCustomerCount',
minWidth: 160
},
{
label: '当前跟进员工数',
prop: 'staffs',
minWidth: 140
},
{
label: '群主',
prop: 'groupHostName'
},
{
label: '管理员',
prop: 'groupAdminName'
},
{
label: '创建方式',
prop: 'creationMethod',
formatter: cellValue => {
return cellValue.creationMethod == 1 ? '手动拉群' : cellValue.creationMethod == 2 ? '一客一群' : ''
},
minWidth: 140
},
{
label: '创建时间',
prop: 'addTime',
width: 95
}
],
tableOption: {
width: 170
// btnList: [
// {
// name: '详情',
// // pType: 'detail'
// }
// ]
}
},
getListApi: getTableList,
merchantModel: 1,
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
flushTime: false
}
},
// activated() {
// this.searchTable()
// },
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
}
},
// watch: {
// 'searchForm.daterange':{
// deep: true,
// handler(val) {
// console.log('val值:',val)
// if(val){
// this.searchTable()
// }
// }
// }
// },
beforeDestroy() {
this.$message.closeAll()
},
mounted() {
this.wxTips()
},
methods: {
jumpWx() {
this.$history.push('/settings/enterpriseWechat/index')
},
wxTips() {
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (!item.children) {
return
}
item.children.forEach(itm => {
if (itm.path == '/enterpriseWechat/index') {
getStatus({}).then(res => {
if (res.status != 'SUCCESS') {
const h = this.$createElement
this.$message({
showClose: true,
duration: 0,
message: h('p', null, [h('span', null, '此功能需完成【企业微信授权】后方可使用! '), h('span', { on: { click: this.jumpWx }, style: { marginRight: '150px', cursor: 'pointer', color: '#5850ff' } }, ['企业微信授权 ', h('i', { class: 'el-icon-d-arrow-right' }, '')])])
})
}
})
}
})
})
},
syncClick() {
let _this = this
_this.sloading = true
syncCustomerBase({})
.then(res => {
if (!res) {
return
}
_this.sloading = false
this.$message.success('已同步客户群')
this.$refs.clientGroupManage.refreshTable()
})
.catch(err => {
_this.sloading = false
})
.finally(() => {
_this.sloading = false
})
},
setTableHeightEvent() {
this.$refs.clientGroupManage.setTableHeightFun()
},
setTableFinishFun(content) {
console.log(content, this.$refs.clientGroupManage.data.length, '获取数据')
// if (!this.flushTime) {
// this.flushTime = true
// this.searchTable()
// }
//接收到的数据为空
// if (!this.$refs.clientGroupManage.data.length) {
// this.$refs.clientGroupManage.setTableHeightFun()
// }
this.$refs.clientGroupManage.data.length ? (this.$refs.clientGroupManage.tableHeightValues = '') : this.$refs.clientGroupManage.setTableHeightFun()
},
//导出
handleExport() {
var params = this.getParams()
clientGroupExportApi(params).then(res => {
this.$Utils.exportFn(res)
})
},
searchTable() {
this.$refs.clientGroupManage.refreshTable()
},
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()
})
},
resetTable() {
this.isReload = false
this.searchForm = {}
this.$nextTick(() => {
this.isReload = true
})
},
goDetail(id, name) {
this.$router.push({
path: '/clientGroupManage/clientGroupDetail',
query: {
id: id,
groupName: name
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.scrm-sub-client-container {
.pageTitle {
position: relative;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.glsx-table {
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
padding: 6px 20px 30px;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
// min-width: 1300px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
}
.el-message--info {
height: 40px;
background: #e6e9ff;
border: 1px solid $btnBlue;
border-radius: 4px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
}
.el-message .el-icon-info {
color: $btnBlue;
font-size: 16px;
}
}
</style>