list.vue
12.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
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<script>
import { getList, remove, getStat } from '@/api/communityOperating/oldCustomer'
export default {
components: {},
props: {},
data() {
return {
// 老客标签建群查询参数
query: {
pageNum: 1,
pageSize: 10,
taskName: '', // 任务名称
// sendType: '', // 发送方式
createBy: '', // 创建人
beginTime: '', // 创建开始时间
endTime: '', // 创建结束时间
},
total: 0, // 老客标签建群总数据量
loading: false, // 主页table加载状态
list: [], // 老客标签建群数据
// 可用的发送方式数据
// sendTypeOptions: [
// { label: '企业群发', value: 0 },
// { label: '个人群发', value: 1 }
// ],
dateRange: [], // 创建日期[开始时间, 结束时间]
multiSelect: [], // 多选数据
customerSearchId: '', // 客户统计所查询的任务ID
// 客户统计查询参数
customerQuery: {
pageNum: 1,
pageSize: 10,
customerName: '', // 客户名称
isInGroup: '', // 是否在群
isSent: '', // 是否送达
},
customerTotal: 0, // 客户统计总数据量
customerLoading: false, // 客户统计table加载状态
customerList: [], // 客户统计数据
customerShowList: [], // 展示用客户统计数据
// 是否在群选择项
inGroupOptions: [
{ label: '在群', value: 1 },
{ label: '不在群', value: 0 },
],
// 是否送达选择项
sendStatusOptions: [
{ label: '已送达', value: 1 },
{ label: '未送达', value: 0 },
],
dialogVisible: false, // 客户统计会话
}
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
},
dialogVisible(val) {
if (!val) this.$refs['customerForm'].resetFields()
this.customerList = []
this.customerTotal = 0
},
},
created() {
this.getList(1)
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>企业通过下发任务通知员工给选中的标签客户主动发送加群引导语以及群活码,客户扫码后入群。</div>
`,
)
},
methods: {
// 获取老客标签建群数据
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
// 获取客户统计数据
getStat(page) {
page && (this.customerQuery.pageNum = page)
this.customerLoading = true
getStat(this.customerSearchId, this.customerQuery)
.then(({ rows, total }) => {
this.customerList = rows
this.customerTotal = +total
this.customerLoading = false
})
.catch(() => {
this.customerLoading = false
})
},
// 新增/编辑老客数据
goRoute(id) {
this.$router.push({
path: 'oldCustomerAev',
query: { id: id },
})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.$nextTick(() => {
this.getList(1)
})
},
// 获取显示用tag字符串
// getDisplayTags(row) {
// if (!(row && row.tagList.length > 0)) return ''
// return row.tagList.map((d) => d.name).join(' ')
// },
// 批量删除
handleBulkRemove() {
this.$confirm('确认删除当前数据?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const ids = this.multiSelect.map((t) => t.taskId)
remove(ids + '').then((res) => {
if (res.code === 200) {
this.getList()
} else {
}
})
})
.catch(() => {})
},
// 删除
handleRemove(id) {
this.$confirm('确认删除当前数据?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
remove(id + '').then((res) => {
if (res.code === 200) {
this.getList()
} else {
}
})
})
.catch(() => {})
},
// 处理多选
handleSelectionChange(val) {
this.multiSelect = val
},
// 打开客户统计会话
openCustomerDialog(id) {
this.customerSearchId = id
this.dialogVisible = true
this.getStat(1)
},
// 过滤客户统计数据
customerFilter() {
const l = []
for (let data of this.customerList) {
if (this.customerQuery.customerName !== '' && !this.customerQuery.customerName.includes(data.customerName))
continue
if (this.customerQuery.isInGroup !== '' && this.customerQuery.isInGroup !== data.isInGroup) continue
if (this.customerQuery.isSent !== '' && this.customerQuery.isSent !== data.isSent) continue
l.push(data)
}
this.customerShowList = l.slice(
this.customerQuery.pageNum * this.customerQuery.pageSize,
this.customerQuery.pageSize,
)
},
// 客户统计查询
customerSearch() {
this.getStat()
// this.customerFilter()
},
// 客户统计重置
resetCustomerQuery() {
this.$refs['customerForm'].resetFields()
this.getStat(1)
// this.customerFilter()
},
},
}
</script>
<template>
<div>
<el-form inline label-position="right" :model="query" label-width="100px" ref="queryForm" class="top-search">
<el-form-item label="任务名称" prop="taskName">
<el-input clearable v-model="query.taskName" placeholder="请输入"></el-input>
</el-form-item>
<!-- <el-form-item label="发送方式" prop="sendType">
<el-select v-model="query.sendType" placeholder="请选择" >
<el-option
v-for="(sendType, index) in sendTypeOptions"
:label="sendType.label"
:value="sendType.value"
:key="index"
></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="创建人" prop="createBy">
<el-input clearable v-model="query.createBy" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
clearable
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"></el-date-picker>
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="getList(1)">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="mid-action">
<el-button type="primary" @click="goRoute()">新建任务</el-button>
<el-button :disabled="multiSelect.length === 0" @click="handleBulkRemove" type="danger">批量删除</el-button>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column
label="任务名称"
align="center"
prop="taskName"
:show-overflow-tooltip="true"></el-table-column>
<!-- <el-table-column prop="sendType" label="发送方式" align="center">
<template #default="{ row }">
{{ parseInt(row.sendType) === 0 ? '企业群发' : '个人群发' }}
</template>
</el-table-column> -->
<el-table-column label="当前群人数" align="center" width="100">
<template #default="{ row }">
<el-button type="text" @click="openCustomerDialog(row.taskId)">
{{ row.totalMember }}
</el-button>
</template>
</el-table-column>
<el-table-column label="客户标签" align="center">
<div v-if="row.tagList" slot-scope="{ row }">
<TagEllipsis :list="row.tagList"></TagEllipsis>
</div>
<span v-else>无标签</span>
<!-- <template #default="{ row }">
<el-popover placement="bottom" width="200" trigger="hover" :content="getDisplayTags(row)">
<div slot="reference" class="table-desc overflow-ellipsis">
{{ getDisplayTags(row) }}
</div>
</el-popover>
</template> -->
</el-table-column>
<el-table-column prop="createBy" label="创建人" align="center"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="160"></el-table-column>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" @click="goRoute(scope.row.taskId)">编辑</el-button>
<el-button type="text" @click="handleRemove(scope.row.taskId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()" />
</div>
<el-dialog title="客户统计" :visible.sync="dialogVisible" :close-on-click-modal="false">
<div>
<el-form
inline
label-position="right"
:model="customerQuery"
label-width="80px"
ref="customerForm"
class="top-search">
<el-form-item prop="customerName">
<el-input v-model="customerQuery.customerName" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item prop="isInGroup">
<el-select v-model="customerQuery.isInGroup" placeholder="全部">
<el-option
v-for="(inGroup, index) in inGroupOptions"
:label="inGroup.label"
:value="inGroup.value"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="isSent">
<el-select v-model="customerQuery.isSent" placeholder="全部状态">
<el-option
v-for="(status, index) in sendStatusOptions"
:label="status.label"
:value="status.value"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label>
<el-button type="primary" @click="customerSearch">查询</el-button>
<el-button @click="resetCustomerQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="customerLoading" :data="customerList">
<el-table-column label="客户名" align="center" prop="customerName"></el-table-column>
<el-table-column prop="sent" label="送达状态" align="center">
<template #default="{ row }">
<template v-if="row.sent">已送达</template>
<template v-else>未送达</template>
</template>
</el-table-column>
<el-table-column prop="inGroup" label="是否在群" align="center">
<template #default="{ row }">
<template v-if="row.inGroup">在群</template>
<template v-else>不在群</template>
</template>
</el-table-column>
</el-table>
<pagination
v-show="customerTotal > 0"
:total="customerTotal"
:page.sync="customerQuery.pageNum"
:limit.sync="customerQuery.pageSize"
@pagination="customerSearch" />
</div>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
// .overflow-ellipsis {
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// .table-desc {
// max-width: 120px;
// }
</style>