index.ts 1.2 KB

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