角色/用户授权

master
DongZeLiang 2024-04-12 15:17:18 +08:00
parent 043b0fc50f
commit cb2e890417
4 changed files with 1128 additions and 102 deletions

View File

@ -146,12 +146,61 @@ export default {
/** 查询授权用户列表 */ /** 查询授权用户列表 */
getList() { getList() {
this.loading = true; this.loading = true;
allocatedUserList(this.queryParams).then(response => { let response = {
this.userList = response.data.rows; "code": 200,
this.total = response.data.total; "msg": "查询成功",
this.loading = false; "data": {
"total": 1,
"rows": [
{
"createBy": null,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"userId": 2,
"deptId": 105,
"userName": "muyu",
"nickName": "牧鱼",
"email": "muyu@qq.com",
"phonenumber": "15666666666",
"sex": null,
"avatar": null,
"password": null,
"status": "0",
"delFlag": null,
"loginIp": null,
"loginDate": null,
"dept": {
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": null,
"ancestors": null,
"deptName": null,
"orderNum": null,
"leader": null,
"phone": null,
"email": null,
"status": null,
"delFlag": null,
"parentName": null,
"children": []
},
"roles": [],
"roleIds": null,
"postIds": null,
"roleId": null,
"remark": null,
"admin": false
}
]
} }
); }
this.userList = response.data.rows;
this.total = response.data.total;
this.loading = false;
}, },
// //
handleClose() { handleClose() {
@ -179,25 +228,14 @@ export default {
}, },
/** 取消授权按钮操作 */ /** 取消授权按钮操作 */
cancelAuthUser(row) { cancelAuthUser(row) {
const roleId = this.queryParams.roleId; this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(() => {
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () {
return authUserCancel({userId: row.userId, roleId: roleId});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功");
}).catch(() => {
}); });
}, },
/** 批量取消授权按钮操作 */ /** 批量取消授权按钮操作 */
cancelAuthUserAll(row) { cancelAuthUserAll(row) {
const roleId = this.queryParams.roleId; this.$modal.confirm('是否取消选中用户授权数据项?').then(() => {
const userIds = this.userIds.join(",");
this.$modal.confirm('是否取消选中用户授权数据项?').then(function () {
return authUserCancelAll({roleId: roleId, userIds: userIds});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消授权成功"); this.$modal.msgSuccess("取消授权成功");
}).catch(() => {
}); });
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -104,10 +104,60 @@ export default {
}, },
// //
getList() { getList() {
unallocatedUserList(this.queryParams).then(res => { let response = {
this.userList = res.data.rows; "code": 200,
this.total = res.data.total; "msg": "查询成功",
}); "data": {
"total": 1,
"rows": [
{
"createBy": null,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "锐腾",
"email": "muyu@163.com",
"phonenumber": "15888888888",
"sex": null,
"avatar": null,
"password": null,
"status": "0",
"delFlag": null,
"loginIp": null,
"loginDate": null,
"dept": {
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"deptId": 103,
"parentId": null,
"ancestors": null,
"deptName": null,
"orderNum": null,
"leader": null,
"phone": null,
"email": null,
"status": null,
"delFlag": null,
"parentName": null,
"children": []
},
"roles": [],
"roleIds": null,
"postIds": null,
"roleId": null,
"remark": null,
"admin": true
}
]
}
}
this.userList = response.data.rows;
this.total = response.data.total;
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
@ -127,13 +177,9 @@ export default {
this.$modal.msgError("请选择要分配的用户"); this.$modal.msgError("请选择要分配的用户");
return; return;
} }
authUserSelectAll({roleId: roleId, userIds: userIds}).then(res => { this.$modal.msgSuccess("分配用户成功")
this.$modal.msgSuccess(res.data.msg); this.visible = false;
if (res.data.code === 200) { this.$emit("ok");
this.visible = false;
this.$emit("ok");
}
});
} }
} }
}; };

View File

@ -930,7 +930,7 @@ export default {
"ancestors": "0,100,101", "ancestors": "0,100,101",
"deptName": "测试部门", "deptName": "测试部门",
"orderNum": 3, "orderNum": 3,
"leader": "锐腾", "leader": "牧鱼",
"phone": null, "phone": null,
"email": null, "email": null,
"status": "0", "status": "0",
@ -1019,7 +1019,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids;
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(() => {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) })
}, },