F2-7: 审批办理 UI 前端——ApprovalBar + trace 时间线 + e2e
- src/api/approval.ts:completeTask/delegateTask/fetchTrace API - src/components/ApprovalBar.tsx:办理动作条(同意/驳回/转办+意见输入; 流程轨迹抽屉 TraceTimeline 时间线;转办 Drawer 弹窗) - src/pages/TodoPage.tsx:行内展开 ApprovalBar,办理后刷新列表+回调 - e2e/approval.spec.ts:4 个场景(UI展示/complete链路/trace/delegate), 自起 E2E- 前缀流程实例,测后 psql 清理,4/4 通过 - docs/P1/F2-7审批UI报告.md:端点增补清单、e2e 证据、环境限制说明 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
53
src/api/approval.ts
Normal file
53
src/api/approval.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
// 审批办理 API —— complete(同意/驳回) / delegate(转办) / trace(轨迹)
|
||||
import { http } from './http';
|
||||
|
||||
export interface CompleteRequest {
|
||||
variables?: Record<string, unknown>;
|
||||
businessKey?: string;
|
||||
processInstanceId?: string;
|
||||
tableName?: string;
|
||||
}
|
||||
|
||||
export interface CompleteResult {
|
||||
completed: boolean;
|
||||
statusWritten: boolean;
|
||||
processEnded: boolean;
|
||||
}
|
||||
|
||||
export interface DelegateRequest {
|
||||
delegateUserId: string;
|
||||
}
|
||||
|
||||
export interface TraceNode {
|
||||
taskId?: string;
|
||||
taskName?: string;
|
||||
assignee?: string;
|
||||
assigneeName?: string;
|
||||
comment?: string;
|
||||
result?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
current?: boolean;
|
||||
}
|
||||
|
||||
export async function completeTask(
|
||||
taskId: string,
|
||||
req: CompleteRequest,
|
||||
): Promise<CompleteResult> {
|
||||
const { data } = await http.post<CompleteResult>(`/api/task/${taskId}/complete`, req);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function delegateTask(
|
||||
taskId: string,
|
||||
req: DelegateRequest,
|
||||
): Promise<void> {
|
||||
await http.post(`/api/task/${taskId}/delegate`, req);
|
||||
}
|
||||
|
||||
export async function fetchTrace(processInstanceId: string): Promise<TraceNode[]> {
|
||||
const { data } = await http.get<TraceNode[]>(
|
||||
`/api/flow/process/${processInstanceId}/trace`,
|
||||
);
|
||||
return Array.isArray(data) ? data : [];
|
||||
}
|
||||
Reference in New Issue
Block a user