DeptApi.ts 898 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import FetchRequest from "@/api/FetchRequest";
  2. class DeptApi {
  3. static url = "/api/sys/depts";
  4. /**
  5. * 获取父部门
  6. * @param deptId 部门ID
  7. */
  8. static parent(deptId: string): Promise<any> {
  9. return FetchRequest.get(`${this.url}/parent?deptId=${deptId}`, true);
  10. }
  11. /**
  12. * 获取所有部门
  13. */
  14. static list(): Promise<any> {
  15. return FetchRequest.get(this.url, true);
  16. }
  17. /**
  18. * 获取部门
  19. * @param id 部门ID
  20. */
  21. static get(id: string): Promise<any> {
  22. return FetchRequest.get(`${this.url}/${id}`, true);
  23. }
  24. /**
  25. * 获取部门用户
  26. * @param deptId 部门ID
  27. */
  28. static users(deptId: string): Promise<any> {
  29. return FetchRequest.get(`${this.url}/${deptId}/users`, true);
  30. }
  31. /**
  32. * 获取部门人数
  33. */
  34. static count(): Promise<any> {
  35. return FetchRequest.get(`${this.url}/count`, true);
  36. }
  37. }
  38. export default DeptApi;