refactor: 使用用户选择器组件重构角色分配功能

This commit is contained in:
2024-11-11 21:50:54 +08:00
parent 84148b6a68
commit 449e5128d7
6 changed files with 86 additions and 129 deletions

View File

@@ -9,10 +9,7 @@ const BASE_URL = '/common'
export function listDeptTree(query: { description: string }) {
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/dept`, query)
}
/** @desc 查询部门用户树 */
export function listDeptWithUsersTree(query: { description?: string, status: number }) {
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/deptWithUsers`, query)
}
/** @desc 查询菜单树 */
export function listMenuTree(query: { description: string }) {
return http.get<TreeNodeData[]>(`${BASE_URL}/tree/menu`, query)

View File

@@ -29,11 +29,13 @@ export function updateRole(data: any, id: string) {
export function deleteRole(ids: string | Array<string>) {
return http.del(`${BASE_URL}/${ids}`)
}
/** @desc 获取角色绑定的用户列表 */
/** @desc 查询角色关联用户 */
export function listRoleUsers(id: string) {
return http.get(`${BASE_URL}/listRoleUsers/${id}`)
return http.get(`${BASE_URL}/${id}/user`)
}
export function bindUsers(id: string, userIds: Array<string>) {
return http.post(`${BASE_URL}/bindUsers/${id}`, userIds)
/** @desc 分配角色给用户 */
export function assignToUsers(id: string, userIds: Array<string>) {
return http.post(`${BASE_URL}/${id}/user`, userIds)
}