index.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import request from '@/utils/request';
  2. import { PostForm, PostQuery, PostVO } from './types';
  3. import { AxiosPromise } from 'axios';
  4. import { DeptTreeVO } from '../dept/types';
  5. // 查询岗位列表
  6. export function listPost(query: PostQuery): AxiosPromise<PostVO[]> {
  7. return request({
  8. url: '/system/post/list',
  9. method: 'get',
  10. params: query
  11. });
  12. }
  13. // 查询岗位详细
  14. export function getPost(postId: string | number): AxiosPromise<PostVO> {
  15. return request({
  16. url: '/system/post/' + postId,
  17. method: 'get'
  18. });
  19. }
  20. // 获取岗位选择框列表
  21. export function optionselect(deptId?: number | string, postIds?: (number | string)[]): AxiosPromise<PostVO[]> {
  22. return request({
  23. url: '/system/post/optionselect',
  24. method: 'get',
  25. params: {
  26. postIds: postIds,
  27. deptId: deptId
  28. }
  29. });
  30. }
  31. // 新增岗位
  32. export function addPost(data: PostForm) {
  33. return request({
  34. url: '/system/post',
  35. method: 'post',
  36. data: data
  37. });
  38. }
  39. // 修改岗位
  40. export function updatePost(data: PostForm) {
  41. return request({
  42. url: '/system/post',
  43. method: 'put',
  44. data: data
  45. });
  46. }
  47. // 删除岗位
  48. export function delPost(postId: string | number | (string | number)[]) {
  49. return request({
  50. url: '/system/post/' + postId,
  51. method: 'delete'
  52. });
  53. }
  54. /**
  55. * 查询部门下拉树结构
  56. */
  57. export const deptTreeSelect = (): AxiosPromise<DeptTreeVO[]> => {
  58. return request({
  59. url: '/system/post/deptTree',
  60. method: 'get'
  61. });
  62. };