角色/用户授权

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() {
this.loading = true;
allocatedUserList(this.queryParams).then(response => {
let response = {
"code": 200,
"msg": "查询成功",
"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() {
@ -179,25 +228,14 @@ export default {
},
/** 取消授权按钮操作 */
cancelAuthUser(row) {
const roleId = this.queryParams.roleId;
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () {
return authUserCancel({userId: row.userId, roleId: roleId});
}).then(() => {
this.getList();
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(() => {
this.$modal.msgSuccess("取消授权成功");
}).catch(() => {
});
},
/** 批量取消授权按钮操作 */
cancelAuthUserAll(row) {
const roleId = this.queryParams.roleId;
const userIds = this.userIds.join(",");
this.$modal.confirm('是否取消选中用户授权数据项?').then(function () {
return authUserCancelAll({roleId: roleId, userIds: userIds});
}).then(() => {
this.getList();
this.$modal.confirm('是否取消选中用户授权数据项?').then(() => {
this.$modal.msgSuccess("取消授权成功");
}).catch(() => {
});
}
}

File diff suppressed because it is too large Load Diff

View File

@ -104,10 +104,60 @@ export default {
},
//
getList() {
unallocatedUserList(this.queryParams).then(res => {
this.userList = res.data.rows;
this.total = res.data.total;
});
let response = {
"code": 200,
"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() {
@ -127,14 +177,10 @@ export default {
this.$modal.msgError("请选择要分配的用户");
return;
}
authUserSelectAll({roleId: roleId, userIds: userIds}).then(res => {
this.$modal.msgSuccess(res.data.msg);
if (res.data.code === 200) {
this.$modal.msgSuccess("分配用户成功")
this.visible = false;
this.$emit("ok");
}
});
}
}
};
</script>

View File

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