api.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import { axiosInstance } from '/@/utils/axios-utils';
  2. const BASE = '/api';
  3. // ── 流程定义扩展 ──
  4. export function publishFlow(id: number) {
  5. return axiosInstance.post(`${BASE}/approvalFlow/publish`, { id });
  6. }
  7. export function getBizTypes() {
  8. return axiosInstance.get<any>(`${BASE}/approvalFlow/bizTypes`);
  9. }
  10. // ── 业务类型管理 ──
  11. export function getBizTypeList() {
  12. return axiosInstance.get<any>(`${BASE}/bizType/list`);
  13. }
  14. export function getBizTypePage(data: { page: number; pageSize: number; code?: string; name?: string }) {
  15. return axiosInstance.post<any>(`${BASE}/bizType/page`, data);
  16. }
  17. export function addBizType(data: { code: string; name: string; remark?: string; isEnabled?: boolean }) {
  18. return axiosInstance.post<any>(`${BASE}/bizType/add`, data);
  19. }
  20. export function updateBizType(data: { id: number; code: string; name: string; remark?: string; isEnabled?: boolean }) {
  21. return axiosInstance.post(`${BASE}/bizType/update`, data);
  22. }
  23. export function deleteBizType(data: { id: number }) {
  24. return axiosInstance.post(`${BASE}/bizType/delete`, data);
  25. }
  26. // ── 流程实例 ──
  27. export function startFlow(data: { bizType: string; bizId: number; bizNo?: string; title?: string; comment?: string }) {
  28. return axiosInstance.post(`${BASE}/flowInstance/start`, data);
  29. }
  30. export function getInstanceDetail(id: number) {
  31. return axiosInstance.get<any>(`${BASE}/flowInstance/detail`, { params: { id } });
  32. }
  33. export function getInstanceByBiz(bizType: string, bizId: number) {
  34. return axiosInstance.get<any>(`${BASE}/flowInstance/getByBiz`, { params: { bizType, bizId } });
  35. }
  36. export function getTimeline(instanceId: number) {
  37. return axiosInstance.get<any>(`${BASE}/flowInstance/timeline`, { params: { instanceId } });
  38. }
  39. // ── 审批任务 ──
  40. export function myPendingPage(data: { page: number; pageSize: number; bizType?: string }) {
  41. return axiosInstance.post<any>(`${BASE}/flowTask/myPendingPage`, data);
  42. }
  43. export function myDonePage(data: { page: number; pageSize: number; bizType?: string }) {
  44. return axiosInstance.post<any>(`${BASE}/flowTask/myDonePage`, data);
  45. }
  46. export function myInitiatedPage(data: { page: number; pageSize: number; bizType?: string; status?: number }) {
  47. return axiosInstance.post<any>(`${BASE}/flowTask/myInitiatedPage`, data);
  48. }
  49. export function myPendingCount() {
  50. return axiosInstance.get<any>(`${BASE}/flowTask/myPendingCount`);
  51. }
  52. export function approveTask(data: { taskId: number; comment?: string }) {
  53. return axiosInstance.post(`${BASE}/flowTask/approve`, data);
  54. }
  55. export function rejectTask(data: { taskId: number; comment?: string }) {
  56. return axiosInstance.post(`${BASE}/flowTask/reject`, data);
  57. }
  58. export function transferTask(data: { taskId: number; targetUserId: number; comment?: string }) {
  59. return axiosInstance.post(`${BASE}/flowTask/transfer`, data);
  60. }
  61. export function withdrawFlow(data: { instanceId: number }) {
  62. return axiosInstance.post(`${BASE}/flowTask/withdraw`, data);
  63. }
  64. export function returnToPrev(data: { taskId: number; comment?: string }) {
  65. return axiosInstance.post(`${BASE}/flowTask/returnToPrev`, data);
  66. }
  67. export function addSign(data: { taskId: number; targetUserId: number; comment?: string }) {
  68. return axiosInstance.post(`${BASE}/flowTask/addSign`, data);
  69. }
  70. export function urgeFlow(data: { instanceId: number }) {
  71. return axiosInstance.post(`${BASE}/flowTask/urge`, data);
  72. }
  73. export function escalateTask(data: { taskId: number; comment?: string }) {
  74. return axiosInstance.post(`${BASE}/flowTask/escalate`, data);
  75. }
  76. export function getEscalationConfig(taskId: number) {
  77. return axiosInstance.get<any>(`${BASE}/flowTask/getEscalationConfig`, { params: { taskId } });
  78. }
  79. export function batchApprove(data: { taskIds: number[]; comment?: string }) {
  80. return axiosInstance.post<any>(`${BASE}/flowTask/batchApprove`, data);
  81. }
  82. export function batchReject(data: { taskIds: number[]; comment?: string }) {
  83. return axiosInstance.post<any>(`${BASE}/flowTask/batchReject`, data);
  84. }
  85. // ── 版本管理 ──
  86. export function getVersionHistory(flowId: number) {
  87. return axiosInstance.get<any>(`${BASE}/approvalFlow/versionHistory`, { params: { flowId } });
  88. }
  89. export function getVersionDetail(versionId: number) {
  90. return axiosInstance.get<any>(`${BASE}/approvalFlow/versionDetail`, { params: { versionId } });
  91. }
  92. export function revertVersion(data: { id: number }) {
  93. return axiosInstance.post(`${BASE}/approvalFlow/revertVersion`, data);
  94. }
  95. // ── 意见模板 ──
  96. export function getCommentTemplates() {
  97. return axiosInstance.get<any>(`${BASE}/flowCommentTemplate/myList`);
  98. }
  99. export function addCommentTemplate(data: { content: string; orderNo?: number }) {
  100. return axiosInstance.post<any>(`${BASE}/flowCommentTemplate/add`, data);
  101. }
  102. export function deleteCommentTemplate(data: { id: number }) {
  103. return axiosInstance.post(`${BASE}/flowCommentTemplate/delete`, data);
  104. }
  105. // ── 审批代理 ──
  106. export function getMyDelegates() {
  107. return axiosInstance.get<any>(`${BASE}/flowDelegate/myList`);
  108. }
  109. export function addDelegate(data: { delegateUserId: number; startTime: string; endTime: string; bizType?: string; remark?: string }) {
  110. return axiosInstance.post<any>(`${BASE}/flowDelegate/add`, data);
  111. }
  112. export function updateDelegate(data: { id: number; delegateUserId: number; startTime: string; endTime: string; bizType?: string; remark?: string; isEnabled: boolean }) {
  113. return axiosInstance.post(`${BASE}/flowDelegate/update`, data);
  114. }
  115. export function deleteDelegate(data: { id: number }) {
  116. return axiosInstance.post(`${BASE}/flowDelegate/delete`, data);
  117. }