角色页面增加了与后端接口的交互

This commit is contained in:
GYYM
2024-10-29 18:31:25 +08:00
parent f9bb15ad24
commit f7fd18f6ae
6 changed files with 361 additions and 225 deletions

View File

@@ -8,40 +8,60 @@ import http from '@/api'
*/
// 获取角色列表
export const getRoleList = (params: Role.ReqRoleParams) => {
return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
return http.post<ResPage<Role.RoleBO>>(`/role/list`, params)
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
}
// 新增角色
export const addRole = (params: Role.RoleBO) => {
return http.post(`/role/add`, params)
}
// 编辑角色
export const editRole = (params: Role.RoleBO) => {
return http.post(`/role/edit`, params)
}
// 删除角色
export const deleteRole = (params: { id: string[] }) => {
return http.post(`/role/del`, params)
}
// 编辑角色资源
export const editRoleAndPermission = (params: Role.ReqRoleAndPermission) => {
return http.post(`/role/edit_RoleAndPermission`, params)
}
// // 获取树形用户列表
// export const getRoleTreeList = (params: Role.ReqRoleParams) => {
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/tree/list`, params)
// }
// 新增角色
export const addRole = (params: { id: string }) => {
return http.post(`/RoleList_Add`, params)
}
// export const addRole = (params: { id: string ; rolename: string;status: number; describe:string; }) => {
// return http.post(`/RoleList_Add`, params)
// }
// 批量添加角色
export const BatchAddRole = (params: FormData) => {
return http.post(`${rePrefix}/role/import`, params)
}
// export const BatchAddRole = (params: FormData) => {
// return http.post(`${rePrefix}/role/import`, params)
// }
// 编辑角色
export const editRole = (params: { id: string }) => {
return http.post(`${rePrefix}/role/edit`, params)
}
// 删除角色
export const deleteRole = (params: { id: string[] }) => {
return http.post(`/RoleList_Del`, params)
}
// 切换角色状态
export const changeRoleStatus = (params: { id: string; status: number }) => {
return http.post(`${rePrefix}/role/change`, params)
}
// // 切换角色状态
// export const changeRoleStatus = (params: { id: string; status: number }) => {
// return http.post(`${rePrefix}/role/change`, params)
// }
// 重置用户密码
// export const resetUserPassWord = (params: { id: string }) => {
@@ -49,14 +69,14 @@ export const changeRoleStatus = (params: { id: string; status: number }) => {
// }
// 导出角色数据
export const exportRoleInfo = (params: Role.ReqRoleParams) => {
return http.download(`${rePrefix}/role/export`, params)
}
// export const exportRoleInfo = (params: Role.ReqRoleParams) => {
// return http.download(`${rePrefix}/role/export`, params)
// }
// 获取角色状态字典
export const getRoleStatus = () => {
return http.get<Role.ResStatus[]>(`${rePrefix}/role/status`)
}
// export const getRoleStatus = () => {
// return http.get<Role.ResStatus[]>(`${rePrefix}/role/status`)
// }
// 获取用户性别字典
// export const getUserGender = () => {
@@ -64,9 +84,9 @@ export const getRoleStatus = () => {
// }
// 获取角色权限列表
export const getRoleDepartment = () => {
return http.get<Role.ResPermissionList[]>(`${rePrefix}/role/permission`)
}
// export const getRoleDepartment = () => {
// return http.get<Role.ResPermissionList[]>(`${rePrefix}/role/permission`)
// }
// 获取用户角色字典
// export const getUserRole = () => {