Post.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import axiosInstance from '../utils/axios';
  2. // 岗位状态枚举
  3. export enum PostStatus {
  4. DISABLE = 0, // 禁用
  5. ENABLE = 1 // 启用
  6. }
  7. // 岗位 VO
  8. export interface PostVO {
  9. id?: number;
  10. name: string;
  11. code: string;
  12. sort: number;
  13. status: number;
  14. remark: string;
  15. createTime?: Date;
  16. }
  17. // 分页参数类型
  18. export interface PageParam {
  19. pageNo?: number;
  20. pageSize?: number;
  21. name?: string;
  22. code?: string;
  23. status?: number;
  24. [key: string]: any;
  25. }
  26. // 分页响应类型
  27. export interface PageResponse<T> {
  28. list: T[];
  29. total: number;
  30. }
  31. // 岗位管理 API
  32. export const postApi = {
  33. // 查询岗位列表(分页)
  34. getPostPage: (params?: PageParam) => {
  35. return axiosInstance.get<PageResponse<PostVO>>('/system/post/page', { params });
  36. },
  37. // 获取岗位精简信息列表
  38. getSimplePostList: () => {
  39. return axiosInstance.get<PostVO[]>('/system/post/simple-list');
  40. },
  41. // 查询岗位详情
  42. getPost: (id: number) => {
  43. return axiosInstance.get<PostVO>(`/system/post/get?id=${id}`);
  44. },
  45. // 新增岗位
  46. createPost: (data: PostVO) => {
  47. return axiosInstance.post('/system/post/create', data);
  48. },
  49. // 修改岗位
  50. updatePost: (data: PostVO) => {
  51. return axiosInstance.put('/system/post/update', data);
  52. },
  53. // 删除岗位
  54. deletePost: (id: number) => {
  55. return axiosInstance.delete(`/system/post/delete?id=${id}`);
  56. },
  57. // 导出岗位
  58. exportPost: (params?: PageParam) => {
  59. return axiosInstance.get('/system/post/export', {
  60. params,
  61. responseType: 'blob'
  62. });
  63. },
  64. };