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