|
@@ -1,6 +1,6 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="common-screen-item" v-loading="loading">
|
3
|
|
- <el-button type="primary" plain size="mini" @click="visible = true">批量分配许可</el-button>
|
|
3
|
+ <el-button type="primary" plain size="mini" @click="$emit('updateAssignNum');handleReset();visible = true">批量分配许可</el-button>
|
4
|
4
|
<el-dialog
|
5
|
5
|
:visible.sync="visible"
|
6
|
6
|
:before-close="() => { visible = false }"
|
|
@@ -28,9 +28,13 @@
|
28
|
28
|
<div :class="['checkbox', item.is_select ? 'checkbox_active' : '']"><i class="el-icon-check"></i>
|
29
|
29
|
</div>
|
30
|
30
|
</div>
|
31
|
|
- <div class="memberItem" :style="item.is_open ? 'display:none' : ''"
|
32
|
|
- v-for="(item1, user_index) in item.user_list" :key="item1.user_id"
|
33
|
|
- @click="selectUserEvent('user', index, user_index)">
|
|
31
|
+ <div
|
|
32
|
+ v-for="(item1, user_index) in item.user_list"
|
|
33
|
+ :key="item1.user_id"
|
|
34
|
+ :class="['memberItem', item1.is_active == 1 ? 'disabled' : '']"
|
|
35
|
+ :style="item.is_open ? 'display:none' : ''"
|
|
36
|
+ @click="selectUserEvent('user', index, user_index)"
|
|
37
|
+ >
|
34
|
38
|
<div class="flex" style="flex:1">
|
35
|
39
|
<img class="memberImg" :src="item1.avatar" alt="">
|
36
|
40
|
<div class="memberInfo">
|
|
@@ -187,13 +191,11 @@ export default {
|
187
|
191
|
this.final_result = []
|
188
|
192
|
this.changeSelect()
|
189
|
193
|
isEmit && this.$emit('change', [])
|
190
|
|
- if (this.input_keyword != '') {
|
191
|
|
- this.input_keyword = '';
|
192
|
|
- this.resetFlag = !this.resetFlag
|
193
|
|
- this.init()
|
194
|
|
- }
|
|
194
|
+ this.input_keyword = '';
|
|
195
|
+ this.resetFlag = !this.resetFlag
|
|
196
|
+ this.init()
|
195
|
197
|
},
|
196
|
|
- defineEvent () {
|
|
198
|
+ async defineEvent () {
|
197
|
199
|
this.final_result = JSON.parse(JSON.stringify(this.selectUser))
|
198
|
200
|
let arr = this.selectUser.map((v) => {
|
199
|
201
|
return v.user_id
|
|
@@ -208,8 +210,37 @@ export default {
|
208
|
210
|
})
|
209
|
211
|
return
|
210
|
212
|
}
|
|
213
|
+
|
|
214
|
+ console.log('arr => ', arr)
|
|
215
|
+
|
|
216
|
+ const res = await this.handleSubmit(arr)
|
|
217
|
+ console.log('res => ', res)
|
211
|
218
|
this.visible = false
|
212
|
|
- this.$emit('change', arr)
|
|
219
|
+ this.$emit('change', res)
|
|
220
|
+ },
|
|
221
|
+ handleSubmit(userid_list) {
|
|
222
|
+ return new Promise(async (resolve, reject) => {
|
|
223
|
+ try {
|
|
224
|
+ const url = `${this.URL.BASEURL}${this.URL.member_batchActiveAccount}`
|
|
225
|
+ const params = {
|
|
226
|
+ userid_list,
|
|
227
|
+ corpid: this.$localSelfStore.getLocal('defaultCorp') && this.$localSelfStore.getLocal('defaultCorp') != 'undefined' ? JSON.parse(this.$localSelfStore.getLocal('defaultCorp')).corpid : '',
|
|
228
|
+ }
|
|
229
|
+ this.loading = true
|
|
230
|
+ const { data: res = {} } = await this.$axios.post(url, params)
|
|
231
|
+ if (res && res.errno == 0) {
|
|
232
|
+ this.$message.success('操作成功')
|
|
233
|
+ } else if (res.errno != 4002) {
|
|
234
|
+ this.$message.warning(res.err || '操作失败')
|
|
235
|
+ }
|
|
236
|
+ resolve(res)
|
|
237
|
+ } catch (error) {
|
|
238
|
+ console.log('error => ', error)
|
|
239
|
+ reject(error)
|
|
240
|
+ } finally {
|
|
241
|
+ this.loading = false
|
|
242
|
+ }
|
|
243
|
+ })
|
213
|
244
|
},
|
214
|
245
|
userSearch () {//模糊搜索
|
215
|
246
|
let search_user_list = []
|
|
@@ -281,6 +312,7 @@ export default {
|
281
|
312
|
selectUserEvent (type, main_index, user_index) {
|
282
|
313
|
let selectUser = _lodash.cloneDeep(this.selectUser)
|
283
|
314
|
let user_arr = _lodash.cloneDeep(this.userList[main_index])
|
|
315
|
+
|
284
|
316
|
if (type == 'all') {//点击部门全选时
|
285
|
317
|
if (!user_arr.is_select) {
|
286
|
318
|
selectUser = selectUser.concat(user_arr.user_list)
|
|
@@ -294,6 +326,12 @@ export default {
|
294
|
326
|
}
|
295
|
327
|
} else {//点击单个客服时
|
296
|
328
|
let brr = user_arr.user_list[user_index]
|
|
329
|
+
|
|
330
|
+ if (brr.is_active == 1) {
|
|
331
|
+ this.$message.warning('当前成员已分配过许可')
|
|
332
|
+ return false
|
|
333
|
+ }
|
|
334
|
+
|
297
|
335
|
if (brr.is_select) {
|
298
|
336
|
selectUser = selectUser.filter((v) => {
|
299
|
337
|
return v.user_id != brr.user_id
|
|
@@ -315,6 +353,7 @@ export default {
|
315
|
353
|
return false
|
316
|
354
|
}
|
317
|
355
|
|
|
356
|
+ selectUser = selectUser.filter(item => item.is_active != 1) // 过滤已分配成员
|
318
|
357
|
this.selectUser = selectUser
|
319
|
358
|
this.$set(this.userList, main_index, user_arr)
|
320
|
359
|
this.changeSelect()
|
|
@@ -501,6 +540,13 @@ export default {
|
501
|
540
|
|
502
|
541
|
.memberItem {
|
503
|
542
|
margin: 14px 0;
|
|
543
|
+ &.disabled {
|
|
544
|
+ cursor: not-allowed;
|
|
545
|
+ .checkbox {
|
|
546
|
+ border-color: #c7c7c7;
|
|
547
|
+ background-color: #dfdfdf;
|
|
548
|
+ }
|
|
549
|
+ }
|
504
|
550
|
|
505
|
551
|
.memberImg {
|
506
|
552
|
width: 38px;
|