角色管理

This commit is contained in:
sjl
2024-11-14 11:34:25 +08:00
parent 44e7598b68
commit 39cbe0ff35
19 changed files with 873 additions and 359 deletions

View File

@@ -1,5 +1,6 @@
import type { ResPage } from '@/api/interface'
import type { Role } from './interface'
import type { Function } from './../function/interface/index';
import { ADMIN as rePrefix } from '@/api/config/serviceName'
import http from '@/api'
@@ -8,7 +9,7 @@ import http from '@/api'
*/
// 获取角色列表
export const getRoleList = (params: Role.ReqRoleParams) => {
return http.get(`/sysRole/list`, params)
return http.post(`/sysRole/list`, params)
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
@@ -21,17 +22,27 @@ export const addRole = (params: Role.RoleBO) => {
// 编辑角色
export const editRole = (params: Role.RoleBO) => {
return http.put(`/sysRole/edit`, params)
return http.put(`/sysRole/update`, params)
}
// 删除角色
export const deleteRole = (params: { id: string[] }) => {
return http.post(`/sysRole/del`, params)
return http.post(`/sysRole/delete`, params)
}
// 编辑角色资源
export const editRoleAndPermission = (params: Role.ReqRoleAndPermission) => {
return http.post(`/role/edit_RoleAndPermission`, params)
// 获取资源
export const getFunctionList = () => {
return http.get<Function.ResFunction>(`/sysFunction/functionTree`)
}
//获取角色id绑定的菜单
export const getRoleFunction = (params:Role.RoleBO) => {
return http.post(`/sysRole/getFunctionsByRoleId?id=${params.id}`)
}
//角色分配菜单
export const assignFunction = (params:Role.RoleBO,param:Role.RoleFunctionId) => {
return http.put(`/sysFunction/assignFunctionByRoleId`,{ roleId: params.id,functionIds:param.id })
}