subOrgPage.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { httpApp } from "@/plugins/axiosApp";
  2. /** 机构分页查询 */
  3. export function getSubOrgList(params: {
  4. code?: string;
  5. name?: string;
  6. enable?: boolean;
  7. rootOrgId: string;
  8. pageNo?: number;
  9. pageSize?: number;
  10. }) {
  11. return httpApp.post("/api/ess/org/page", params);
  12. }
  13. /** 更新机构 */
  14. export function updateSubOrg(params: {
  15. code?: string;
  16. enable?: boolean;
  17. id?: number;
  18. name?: string;
  19. rootOrgId?: string;
  20. }) {
  21. // params.rootId = params.rootOrgId;
  22. return httpApp.post("/api/ess/org/save", params);
  23. }
  24. /** 禁用、启用机构 */
  25. export function toggleSubOrg(enable: boolean, ids: number[]) {
  26. return httpApp.post(
  27. `/api/ess/org/${enable ? "enable" : "disable"}`,
  28. new URLSearchParams([["ids", ids.join(",")]])
  29. );
  30. }
  31. /** 删除机构 */
  32. export function delOrg(ids: number[]) {
  33. return httpApp.post(
  34. `/api/ess/org/delete`,
  35. new URLSearchParams([["ids", ids.join(",")]])
  36. // { ids: ids.join(",") },
  37. // { headers: { "content-type": "application/x-www-form-urlencoded" } }
  38. );
  39. }
  40. /** 导入机构 */
  41. export function importOrg(rootOrgId: string, file: File) {
  42. const f = new FormData();
  43. f.append("rootOrgId", rootOrgId);
  44. f.append("file", file);
  45. return httpApp.post(`/api/ess/org/import`, f);
  46. }
  47. /** 导出机构 */
  48. export function exportOrg(params: {
  49. rootOrgId: string;
  50. code: string;
  51. name: string;
  52. enable?: boolean;
  53. }) {
  54. return httpApp.post(`/api/ess/org/export`, params);
  55. }