2024-11-18 09:02:57 +08:00
|
|
|
import type { Role } from '@/api/user/interface/role'
|
|
|
|
|
import type { Function } from '@/api/user/interface/function'
|
2024-10-16 11:27:17 +08:00
|
|
|
import http from '@/api'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @name 角色管理模块
|
|
|
|
|
*/
|
|
|
|
|
// 获取角色列表
|
|
|
|
|
export const getRoleList = (params: Role.ReqRoleParams) => {
|
2024-11-14 11:34:25 +08:00
|
|
|
return http.post(`/sysRole/list`, params)
|
2024-10-23 20:53:58 +08:00
|
|
|
|
2024-10-29 18:31:25 +08:00
|
|
|
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
|
|
|
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
2024-10-16 11:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增角色
|
2024-10-29 18:31:25 +08:00
|
|
|
export const addRole = (params: Role.RoleBO) => {
|
2024-11-12 18:56:33 +08:00
|
|
|
return http.post(`/sysRole/add`, params)
|
2024-10-16 11:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑角色
|
2024-10-29 18:31:25 +08:00
|
|
|
export const editRole = (params: Role.RoleBO) => {
|
2024-11-15 09:38:25 +08:00
|
|
|
return http.post(`/sysRole/update`, params)
|
2024-10-16 11:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除角色
|
|
|
|
|
export const deleteRole = (params: { id: string[] }) => {
|
2024-11-14 11:34:25 +08:00
|
|
|
return http.post(`/sysRole/delete`, params)
|
2024-10-16 11:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
2024-10-29 18:31:25 +08:00
|
|
|
|
2024-11-14 11:34:25 +08:00
|
|
|
// 获取资源
|
|
|
|
|
export const getFunctionList = () => {
|
|
|
|
|
return http.get<Function.ResFunction>(`/sysFunction/functionTree`)
|
2024-10-16 11:27:17 +08:00
|
|
|
}
|
|
|
|
|
|
2024-11-14 11:34:25 +08:00
|
|
|
|
|
|
|
|
//获取角色id绑定的菜单
|
|
|
|
|
export const getRoleFunction = (params:Role.RoleBO) => {
|
|
|
|
|
return http.post(`/sysRole/getFunctionsByRoleId?id=${params.id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//角色分配菜单
|
|
|
|
|
export const assignFunction = (params:Role.RoleBO,param:Role.RoleFunctionId) => {
|
2024-11-15 09:38:25 +08:00
|
|
|
return http.post(`/sysFunction/assignFunctionByRoleId`,{ roleId: params.id,functionIds:param.id })
|
2024-11-14 11:34:25 +08:00
|
|
|
}
|