|
|
|
@ -32,8 +32,8 @@ |
|
|
|
size="small" |
|
|
|
style="width: 240px" |
|
|
|
> |
|
|
|
<el-option label="启用" :value="0" /> |
|
|
|
<el-option label="禁用" :value="1" /> |
|
|
|
<el-option label="启用" :value="false" /> |
|
|
|
<el-option label="禁用" :value="true" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
@ -101,8 +101,8 @@ |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch |
|
|
|
v-model="scope.row.status" |
|
|
|
active-value="0" |
|
|
|
inactive-value="1" |
|
|
|
:active-value="false" |
|
|
|
:inactive-value="true" |
|
|
|
@change="handleStatusChange(scope.row)" |
|
|
|
></el-switch> |
|
|
|
</template> |
|
|
|
@ -209,8 +209,8 @@ |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-radio-group v-model="form.status"> |
|
|
|
<el-radio :label="0">启用</el-radio> |
|
|
|
<el-radio :label="1">禁用</el-radio> |
|
|
|
<el-radio :label="false">启用</el-radio> |
|
|
|
<el-radio :label="true">禁用</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
@ -466,6 +466,15 @@ export default { |
|
|
|
// }); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
normalizeBooleanStatus(value) { |
|
|
|
if (value === true || value === "true" || value === 1 || value === "1") { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (value === false || value === "false" || value === 0 || value === "0") { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return false; |
|
|
|
}, |
|
|
|
normalizeRoleOptions(list = []) { |
|
|
|
return (Array.isArray(list) ? list : []).map(item => ({ |
|
|
|
roleId: item.roleId != null ? item.roleId : item.id, |
|
|
|
@ -485,7 +494,7 @@ export default { |
|
|
|
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { |
|
|
|
this.userList = response.data.list.map(user => ({ |
|
|
|
...user, |
|
|
|
status: String(user.status) // 确保状态是字符串类型 |
|
|
|
status: this.normalizeBooleanStatus(user.status) |
|
|
|
})); |
|
|
|
// console.log(this.userList[0].googleAuthSecret) |
|
|
|
this.total = Number(response.data.total); |
|
|
|
@ -511,7 +520,7 @@ export default { |
|
|
|
}, |
|
|
|
// 用户状态修改 |
|
|
|
handleStatusChange(row) { |
|
|
|
let text = row.status === "0" ? "启用" : "停用"; |
|
|
|
let text = row.status ? "禁用" : "启用"; |
|
|
|
this.$confirm('确认要"' + text + '""' + row.account + '"用户吗?', "警告", { |
|
|
|
confirmButtonText: "确定", |
|
|
|
cancelButtonText: "取消", |
|
|
|
@ -521,7 +530,7 @@ export default { |
|
|
|
}).then(() => { |
|
|
|
this.msgSuccess(text + "成功"); |
|
|
|
}).catch(function() { |
|
|
|
row.status = row.status === "0" ? "1" : "0"; |
|
|
|
row.status = !row.status; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 取消按钮 |
|
|
|
@ -544,7 +553,7 @@ export default { |
|
|
|
phonenumber: undefined, |
|
|
|
email: undefined, |
|
|
|
sex: undefined, |
|
|
|
status: 0, |
|
|
|
status: false, |
|
|
|
remark: undefined, |
|
|
|
postIds: [], |
|
|
|
roleIds: [] |
|
|
|
@ -608,6 +617,7 @@ export default { |
|
|
|
this.form = Object.assign({}, data, { |
|
|
|
postIds: userRes.postIds || [], |
|
|
|
roleIds: roleIds, |
|
|
|
status: this.normalizeBooleanStatus(data.status), |
|
|
|
passwordHash: undefined |
|
|
|
}); |
|
|
|
this.$set(this.form, "roleIds", roleIds); |
|
|
|
@ -674,7 +684,7 @@ export default { |
|
|
|
nickName: this.employeeForm.nickName, |
|
|
|
account: this.employeeForm.account, |
|
|
|
passwordHash: this.employeeForm.passwordHash, |
|
|
|
status: 0, |
|
|
|
status: false, |
|
|
|
roleIds: (this.employeeForm.roleIds || []).map(id => Number(id)) |
|
|
|
}; |
|
|
|
addEmployeeUser(submitData).then(() => { |
|
|
|
|