import { axiosInstance } from '/@/utils/axios-utils'; const BASE = '/api'; // ── 流程定义扩展 ── export function publishFlow(id: number) { return axiosInstance.post(`${BASE}/approvalFlow/publish`, { id }); } export function getBizTypes() { return axiosInstance.get(`${BASE}/approvalFlow/bizTypes`); } // ── 业务类型管理 ── export function getBizTypeList() { return axiosInstance.get(`${BASE}/bizType/list`); } export function getBizTypePage(data: { page: number; pageSize: number; code?: string; name?: string }) { return axiosInstance.post(`${BASE}/bizType/page`, data); } export function addBizType(data: { code: string; name: string; remark?: string; isEnabled?: boolean }) { return axiosInstance.post(`${BASE}/bizType/add`, data); } export function updateBizType(data: { id: number; code: string; name: string; remark?: string; isEnabled?: boolean }) { return axiosInstance.post(`${BASE}/bizType/update`, data); } export function deleteBizType(data: { id: number }) { return axiosInstance.post(`${BASE}/bizType/delete`, data); } // ── 流程实例 ── export function startFlow(data: { bizType: string; bizId: number; bizNo?: string; title?: string; comment?: string }) { return axiosInstance.post(`${BASE}/flowInstance/start`, data); } export function getInstanceDetail(id: number) { return axiosInstance.get(`${BASE}/flowInstance/detail`, { params: { id } }); } export function getInstanceByBiz(bizType: string, bizId: number) { return axiosInstance.get(`${BASE}/flowInstance/getByBiz`, { params: { bizType, bizId } }); } export function getTimeline(instanceId: number) { return axiosInstance.get(`${BASE}/flowInstance/timeline`, { params: { instanceId } }); } // ── 审批任务 ── export function myPendingPage(data: { page: number; pageSize: number; bizType?: string }) { return axiosInstance.post(`${BASE}/flowTask/myPendingPage`, data); } export function myDonePage(data: { page: number; pageSize: number; bizType?: string }) { return axiosInstance.post(`${BASE}/flowTask/myDonePage`, data); } export function myInitiatedPage(data: { page: number; pageSize: number; bizType?: string; status?: number }) { return axiosInstance.post(`${BASE}/flowTask/myInitiatedPage`, data); } export function myPendingCount() { return axiosInstance.get(`${BASE}/flowTask/myPendingCount`); } export function approveTask(data: { taskId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/approve`, data); } export function rejectTask(data: { taskId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/reject`, data); } export function transferTask(data: { taskId: number; targetUserId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/transfer`, data); } export function withdrawFlow(data: { instanceId: number }) { return axiosInstance.post(`${BASE}/flowTask/withdraw`, data); } export function returnToPrev(data: { taskId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/returnToPrev`, data); } export function addSign(data: { taskId: number; targetUserId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/addSign`, data); } export function urgeFlow(data: { instanceId: number }) { return axiosInstance.post(`${BASE}/flowTask/urge`, data); } export function escalateTask(data: { taskId: number; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/escalate`, data); } export function getEscalationConfig(taskId: number) { return axiosInstance.get(`${BASE}/flowTask/getEscalationConfig`, { params: { taskId } }); } export function batchApprove(data: { taskIds: number[]; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/batchApprove`, data); } export function batchReject(data: { taskIds: number[]; comment?: string }) { return axiosInstance.post(`${BASE}/flowTask/batchReject`, data); } // ── 版本管理 ── export function getVersionHistory(flowId: number) { return axiosInstance.get(`${BASE}/approvalFlow/versionHistory`, { params: { flowId } }); } export function getVersionDetail(versionId: number) { return axiosInstance.get(`${BASE}/approvalFlow/versionDetail`, { params: { versionId } }); } export function revertVersion(data: { id: number }) { return axiosInstance.post(`${BASE}/approvalFlow/revertVersion`, data); } // ── 意见模板 ── export function getCommentTemplates() { return axiosInstance.get(`${BASE}/flowCommentTemplate/myList`); } export function addCommentTemplate(data: { content: string; orderNo?: number }) { return axiosInstance.post(`${BASE}/flowCommentTemplate/add`, data); } export function deleteCommentTemplate(data: { id: number }) { return axiosInstance.post(`${BASE}/flowCommentTemplate/delete`, data); } // ── 审批代理 ── export function getMyDelegates() { return axiosInstance.get(`${BASE}/flowDelegate/myList`); } export function addDelegate(data: { delegateUserId: number; startTime: string; endTime: string; bizType?: string; remark?: string }) { return axiosInstance.post(`${BASE}/flowDelegate/add`, data); } export function updateDelegate(data: { id: number; delegateUserId: number; startTime: string; endTime: string; bizType?: string; remark?: string; isEnabled: boolean }) { return axiosInstance.post(`${BASE}/flowDelegate/update`, data); } export function deleteDelegate(data: { id: number }) { return axiosInstance.post(`${BASE}/flowDelegate/delete`, data); }