From 80f209bb1a4efe14b6cfc1f1838346e127fbe686 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 23 Feb 2022 15:05:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=A6=81=E7=94=A8=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/user/list/index.vue | 37 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/pages/user/list/index.vue b/src/pages/user/list/index.vue index ca770cf..a0f785f 100644 --- a/src/pages/user/list/index.vue +++ b/src/pages/user/list/index.vue @@ -469,23 +469,26 @@ export default { }).catch(() => {}) }, switchOff(val,row,index) { - this.$post(this.api.modifyUser,{ - account: row.account, - accountId: row.accountId, - isEnable: val, - roleIds: row.roleId, - userId: row.userId, - userName: row.userName, - workNumber: row.workNumber, - platformId: Setting.platformId, - password: '', - schoolId: this.schoolId, - phone: '' - }).then((res) => { - val == 1 ? util.successMsg('启用成功') : util.successMsg('禁用成功') - }).catch((res) => { - row.isEnable = val == 1 ? 0 : 1 - }) + this.$post(`${this.api.getDetail}?accountId=${row.accountId}`).then(res => { + const { data } = res + this.$post(this.api.modifyUser,{ + account: row.account, + accountId: row.accountId, + isEnable: val, + roleIds: data.roleId.map(e => e.roleId), + userId: row.userId, + userName: row.userName, + workNumber: row.workNumber, + platformId: Setting.platformId, + password: '', + schoolId: this.schoolId, + phone: data.phone + }).then((res) => { + val == 1 ? util.successMsg('启用成功') : util.successMsg('禁用成功') + }).catch((res) => { + row.isEnable = val == 1 ? 0 : 1 + }) + }).catch(res => {}) }, handleSelectionChange(val) { this.multipleSelection = val