index.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import request from '@/config/axios'
  2. export interface DeptVO {
  3. id?: number
  4. name: string
  5. parentId: number
  6. status: number
  7. sort: number
  8. leaderUserId: number
  9. phone: string
  10. email: string
  11. factoryIds: string[]
  12. costCenterIds: string[]
  13. stockLocationIds: string[]
  14. createTime: Date
  15. }
  16. // 查询部门(精简)列表
  17. export const getSimpleDeptList = async (): Promise<DeptVO[]> => {
  18. return await request.get({ url: '/system/dept/simple-list' })
  19. }
  20. // 查询当前用户所属的公司级部门列表 项目 日报
  21. export const companyLevelDepts = async (): Promise<DeptVO[]> => {
  22. return await request.get({ url: '/system/dept/companyLevelDepts' })
  23. }
  24. // 获取公司层级的部门 及所有子部门
  25. export const companyLevelChildrenDepts = async (): Promise<DeptVO[]> => {
  26. return await request.get({ url: '/system/dept/companyLevelChildrenDepts' })
  27. }
  28. // 查询部门列表
  29. export const getDeptPage = async (params: PageParam) => {
  30. return await request.get({ url: '/system/dept/list', params })
  31. }
  32. // 查询部门详情
  33. export const getDept = async (id: number) => {
  34. return await request.get({ url: '/system/dept/get?id=' + id })
  35. }
  36. // 新增部门
  37. export const createDept = async (data: DeptVO) => {
  38. return await request.post({ url: '/system/dept/create', data: data })
  39. }
  40. // 修改部门
  41. export const updateDept = async (params: DeptVO) => {
  42. return await request.put({ url: '/system/dept/update', data: params })
  43. }
  44. // 删除部门
  45. export const deleteDept = async (id: number) => {
  46. return await request.delete({ url: '/system/dept/delete?id=' + id })
  47. }