feat: 添加用户、角色状态修改

This commit is contained in:
橙子
2023-02-19 22:18:04 +08:00
parent dffdaa8d68
commit 380f728de2
8 changed files with 64 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ export function dataScope(data) {
// 角色状态修改
export function changeRoleStatus(roleId, isDel) {
return request({
url: `/role/updateStatus?roleId=${roleId}&isDel=${isDel}`,
url: `/role/${roleId}/${isDel}`,
method: 'put'
})
}

View File

@@ -61,7 +61,7 @@ export function resetUserPwd(id, password) {
// 用户状态修改
export function changeUserStatus(userId, isDel) {
return request({
url: `/user/updateStatus?userId=${userId}&isDel=${isDel}`,
url: `/user/${userId}/${isDel}`,
method: 'put'
})
}

View File

@@ -51,7 +51,7 @@
<el-table-column label="显示顺序" prop="orderNum" />
<el-table-column label="状态" align="center">
<template #default="scope">
<el-switch v-model="scope.row.state" :active-value="true" :inactive-value="true"
<el-switch v-model="scope.row.state" :active-value="true" :inactive-value="false"
@change="handleStatusChange(scope.row)"></el-switch>
</template>
</el-table-column>
@@ -296,7 +296,7 @@ function handleSelectionChange(selection) {
}
/** 角色状态修改 */
function handleStatusChange(row) {
let text = row.state === false ? "启用" : "停用";
let text = row.state === true ? "启用" : "停用";
proxy.$modal
.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?')
.then(function () {
@@ -306,7 +306,7 @@ function handleStatusChange(row) {
proxy.$modal.msgSuccess(text + "成功");
})
.catch(function () {
row.state = row.state === "0" ? "1" : "0";
row.state = row.state === true ? false : true;
});
}
/** 更多操作 */

View File

@@ -375,7 +375,8 @@ function handleExport() {
};
/** 用户状态修改 */
function handleStatusChange(row) {
let text = row.state === false ? "启用" : "停用";
console.log(row.state);
let text = row.state === true ? "启用" : "停用";
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
return changeUserStatus(row.id, row.state);
}).then(() => {