|
@@ -85,7 +85,7 @@
|
85
|
85
|
<div class="name">选择主体:</div>
|
86
|
86
|
<div class="ipt">
|
87
|
87
|
<el-select class="select-cls" style="width: 100%" size="small" v-model="corp_ids" :disabled="is_super_admin == 1" multiple
|
88
|
|
- placeholder="请选择">
|
|
88
|
+ placeholder="请选择" filterable>
|
89
|
89
|
<el-option v-for="item in corpList" :key="item.id" :label="item.corp_name" :value="item.id">
|
90
|
90
|
</el-option>
|
91
|
91
|
</el-select>
|
|
@@ -95,7 +95,7 @@
|
95
|
95
|
<div class="name">选择角色:</div>
|
96
|
96
|
<div class="ipt">
|
97
|
97
|
<el-select class="select-cls" style="width: 100%" size="small" v-model="role_ids" :disabled="is_super_admin == 1" multiple
|
98
|
|
- placeholder="请选择">
|
|
98
|
+ placeholder="请选择" filterable>
|
99
|
99
|
<el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id">
|
100
|
100
|
</el-option>
|
101
|
101
|
</el-select>
|
|
@@ -271,6 +271,10 @@ export default {
|
271
|
271
|
corp_id: this.corp_ids,
|
272
|
272
|
is_promoter: this.is_promoter ? 1 : 0,
|
273
|
273
|
|
|
274
|
+ is_all_adq: this.is_all_adq ? 1 : 0,
|
|
275
|
+ adq_account: this.is_all_adq ? '' : (this.adq_account.map(account => account.id).join(',') || ''), // 如果全选则不需要传账号列表
|
|
276
|
+ is_all_mp: this.is_all_mp ? 1 : 0,
|
|
277
|
+ mp_account: this.is_all_mp ? '' : (this.mp_account.map(account => account.id).join(',') || ''), // 如果全选则不需要传账号列表
|
274
|
278
|
can_export: this.can_export ? 1 : 0,
|
275
|
279
|
}).then((res) => {
|
276
|
280
|
var res = res.data
|
|
@@ -304,6 +308,10 @@ export default {
|
304
|
308
|
id: this.id,
|
305
|
309
|
is_promoter: this.is_promoter ? 1 : 0,
|
306
|
310
|
|
|
311
|
+ is_all_adq: this.is_all_adq ? 1 : 0,
|
|
312
|
+ adq_account: this.is_all_adq ? '' : (this.adq_account.map(account => account.id).join(',') || ''), // 如果全选则不需要传账号列表
|
|
313
|
+ is_all_mp: this.is_all_mp ? 1 : 0,
|
|
314
|
+ mp_account: this.is_all_mp ? '' : (this.mp_account.map(account => account.id).join(',') || ''), // 如果全选则不需要传账号列表
|
307
|
315
|
can_export: this.can_export ? 1 : 0,
|
308
|
316
|
}).then((res) => {
|
309
|
317
|
var res = res.data
|
|
@@ -340,6 +348,8 @@ export default {
|
340
|
348
|
// this.is_super_admin=res.rst.is_super_admin
|
341
|
349
|
this.role_ids = res.rst.role_id
|
342
|
350
|
this.corp_ids = res.rst.corp_id
|
|
351
|
+
|
|
352
|
+ this.handleGetAccountData(res.rst) // 回显关联账号相关数据
|
343
|
353
|
} else {
|
344
|
354
|
this.$message({
|
345
|
355
|
message: res.err,
|
|
@@ -393,6 +403,90 @@ export default {
|
393
|
403
|
console.log('this.mp_account => ', this.mp_account)
|
394
|
404
|
console.log('this.is_all_mp => ', this.is_all_mp)
|
395
|
405
|
},
|
|
406
|
+ // 编辑账号 - 回显关联账号相关数据
|
|
407
|
+ async handleGetAccountData(detailData) {
|
|
408
|
+ console.log('detailData => ', detailData)
|
|
409
|
+ const { is_all_adq, is_all_mp, can_export, adq_account, mp_account } = detailData
|
|
410
|
+ this.is_all_adq = is_all_adq == 1 ? true : false
|
|
411
|
+ this.is_all_mp = is_all_mp == 1 ? true : false
|
|
412
|
+ this.can_export = can_export == 1 ? true : false
|
|
413
|
+ this.adq_account = []
|
|
414
|
+ this.mp_account = []
|
|
415
|
+
|
|
416
|
+ // 回显 ADQ账号
|
|
417
|
+ const allAdqAccount = await this.handleGetAdqAccount()
|
|
418
|
+ if (this.is_all_adq) { // 全选 => 回显全部账号
|
|
419
|
+ this.adq_account = [...allAdqAccount]
|
|
420
|
+ } else if (adq_account) { // 接口中有值 => 回显接口中的账号
|
|
421
|
+ this.adq_account = adq_account.split(',').map(account => ({ id: account, name: account })) // adq账号 id 和 name取值相同
|
|
422
|
+ }
|
|
423
|
+
|
|
424
|
+ // 回显 MP账号
|
|
425
|
+ const allMpAccount = await this.handleGetMpAccount()
|
|
426
|
+ if (this.is_all_mp) { // 全选 => 回显全部账号
|
|
427
|
+ this.mp_account = [...allMpAccount]
|
|
428
|
+ } else if (mp_account) { // 接口中有值 => 回显接口中的账号
|
|
429
|
+ const _temp = mp_account.split(',').map(account => ({ id: account, name: '' }))
|
|
430
|
+ // 回显mp账号名称
|
|
431
|
+ _temp.forEach(item => {
|
|
432
|
+ const isFound = allMpAccount.find(account => item.id === account.id)
|
|
433
|
+ if (isFound) item.name = isFound.name
|
|
434
|
+ })
|
|
435
|
+ this.mp_account = [..._temp]
|
|
436
|
+ }
|
|
437
|
+ console.log('this.adq_account => ', this.adq_account)
|
|
438
|
+ console.log('this.mp_account => ', this.mp_account)
|
|
439
|
+ },
|
|
440
|
+ // 获取全部ADQ账号
|
|
441
|
+ handleGetAdqAccount() {
|
|
442
|
+ return new Promise(async (resolve, reject) => {
|
|
443
|
+ try {
|
|
444
|
+ this.dialogLoading = true
|
|
445
|
+ const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_list, {
|
|
446
|
+ params: { is_select: 1 }
|
|
447
|
+ })
|
|
448
|
+ if (res && res.errno == 0) {
|
|
449
|
+ const allAdqAccount = res.rst.map(item => ({
|
|
450
|
+ id: item.account_id,
|
|
451
|
+ name: item.account_id,
|
|
452
|
+ }))
|
|
453
|
+ resolve(allAdqAccount)
|
|
454
|
+ } else if (res.errno != 4002) {
|
|
455
|
+ this.$message.warning(res.err)
|
|
456
|
+ reject(res.err)
|
|
457
|
+ }
|
|
458
|
+ } catch (error) {
|
|
459
|
+ console.log('error => ', error)
|
|
460
|
+ } finally {
|
|
461
|
+ this.dialogLoading = false
|
|
462
|
+ }
|
|
463
|
+ })
|
|
464
|
+ },
|
|
465
|
+ // 获取全部MP账号
|
|
466
|
+ handleGetMpAccount() {
|
|
467
|
+ return new Promise(async (resolve, reject) => {
|
|
468
|
+ try {
|
|
469
|
+ this.dialogLoading = true
|
|
470
|
+ const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.pitcher_wxAccountList, {
|
|
471
|
+ params: { is_select: 1 }
|
|
472
|
+ })
|
|
473
|
+ if (res && res.errno == 0) {
|
|
474
|
+ const allMpAccount = res.rst.map(item => ({
|
|
475
|
+ id: item.wechat_account_id,
|
|
476
|
+ name: item.account_name,
|
|
477
|
+ }))
|
|
478
|
+ resolve(allMpAccount)
|
|
479
|
+ } else if (res.errno != 4002) {
|
|
480
|
+ this.$message.warning(res.err)
|
|
481
|
+ reject(res.err)
|
|
482
|
+ }
|
|
483
|
+ } catch (error) {
|
|
484
|
+ console.log('error => ', error)
|
|
485
|
+ } finally {
|
|
486
|
+ this.dialogLoading = false
|
|
487
|
+ }
|
|
488
|
+ })
|
|
489
|
+ },
|
396
|
490
|
}
|
397
|
491
|
}
|
398
|
492
|
</script>
|