mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-12-16 07:10:34 +08:00
feat: 新增角色管理、岗位管理
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { Tree } from "@/utils/tree";
|
||||
|
||||
export interface MenuQuery {
|
||||
isButton: boolean;
|
||||
@@ -7,7 +8,7 @@ export interface MenuQuery {
|
||||
/**
|
||||
* MenuDTO
|
||||
*/
|
||||
export interface MenuDTO {
|
||||
export interface MenuDTO extends Tree {
|
||||
createTime?: Date;
|
||||
isButton?: number;
|
||||
id?: number;
|
||||
|
||||
70
src/api/system/post.ts
Normal file
70
src/api/system/post.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface PostListCommand extends BasePageQuery {
|
||||
postCode?: string;
|
||||
postName?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface PostPageResponse {
|
||||
createTime: string;
|
||||
postCode: string;
|
||||
postId: number;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
remark: string;
|
||||
status: number;
|
||||
statusStr: string;
|
||||
}
|
||||
|
||||
export function getPostListApi(params: PostListCommand) {
|
||||
return http.request<ResponseData<PageDTO<PostPageResponse>>>(
|
||||
"get",
|
||||
"/system/post/list",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const exportPostExcelApi = (
|
||||
params: PostListCommand,
|
||||
fileName: string
|
||||
) => {
|
||||
return http.download("/system/post/excel", fileName, {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
export const deletePostApi = (data: Array<number>) => {
|
||||
return http.request<ResponseData<void>>("delete", "/system/post", {
|
||||
params: {
|
||||
// 需要将数组转换为字符串 否则Axios会将参数变成 noticeIds[0]:1 noticeIds[1]:2 这种格式,后端接收参数不成功
|
||||
ids: data.toString()
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export interface AddPostCommand {
|
||||
postCode: string;
|
||||
postName: string;
|
||||
postSort: number;
|
||||
remark?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export const addPostApi = (data: AddPostCommand) => {
|
||||
return http.request<ResponseData<void>>("post", "/system/post", {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export interface UpdatePostCommand extends AddPostCommand {
|
||||
postId: number;
|
||||
}
|
||||
|
||||
export const updatePostApi = (data: UpdatePostCommand) => {
|
||||
return http.request<ResponseData<void>>("put", "/system/post", {
|
||||
data
|
||||
});
|
||||
};
|
||||
65
src/api/system/role.ts
Normal file
65
src/api/system/role.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
export interface RoleQuery extends BasePageQuery {
|
||||
roleKey?: string;
|
||||
roleName?: string;
|
||||
status?: string;
|
||||
timeRangeColumn?: string;
|
||||
}
|
||||
|
||||
export interface RoleDTO {
|
||||
createTime: Date;
|
||||
dataScope: number;
|
||||
remark: string;
|
||||
roleId: number;
|
||||
roleKey: string;
|
||||
roleName: string;
|
||||
roleSort: number;
|
||||
selectedDeptList: number[];
|
||||
selectedMenuList: number[];
|
||||
status: number;
|
||||
}
|
||||
|
||||
export function getRoleListApi(params: RoleQuery) {
|
||||
return http.request<ResponseData<PageDTO<RoleDTO>>>(
|
||||
"get",
|
||||
"/system/role/list",
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getRoleInfoApi(roleId: number) {
|
||||
return http.request<ResponseData<RoleDTO>>("get", "/system/role/" + roleId);
|
||||
}
|
||||
|
||||
export interface AddRoleCommand {
|
||||
dataScope?: string;
|
||||
menuIds: number[];
|
||||
remark?: string;
|
||||
roleKey: string;
|
||||
roleName: string;
|
||||
roleSort: number;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export function addRoleApi(data: AddRoleCommand) {
|
||||
return http.request<void>("post", "/system/role", {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export interface UpdateRoleCommand extends AddRoleCommand {
|
||||
roleId: number;
|
||||
}
|
||||
|
||||
export function updateRoleApi(data: UpdateRoleCommand) {
|
||||
return http.request<void>("put", "/system/role", {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteRoleApi(roleId: number) {
|
||||
return http.request<void>("delete", "/system/role/" + roleId);
|
||||
}
|
||||
Reference in New Issue
Block a user