feat(P25-2/P25-3/P26-2/P28-1/P24-2/P29-3): 落地内部OA够用版前端入口与运营页面
关联 Issue: P25-2, P25-3, P25-4, P26-2, P26-4, P28-1, P28-2, P28-3, P28-4, P24-2, P29-3
这个提交包含在:
@@ -0,0 +1,45 @@
|
||||
import { apiRequestData } from "./http";
|
||||
|
||||
export type WorkflowDefinitionEditorModel = {
|
||||
id: string;
|
||||
entityType: "reimbursement" | "leave" | "purchase_request" | "travel_request";
|
||||
name: string;
|
||||
version: number;
|
||||
status: "draft" | "published" | "archived" | "derived_readonly";
|
||||
steps: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
assigneeRule:
|
||||
| { type: "department_manager" }
|
||||
| { type: "role"; value: string }
|
||||
| { type: "specific_user"; value: string };
|
||||
}>;
|
||||
notes?: string;
|
||||
source: "manual" | "approval_rules_projection";
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
publishedAt: string | null;
|
||||
archivedAt: string | null;
|
||||
};
|
||||
|
||||
export async function fetchWorkflowDefinitions() {
|
||||
return apiRequestData<{ items: WorkflowDefinitionEditorModel[] }>("/api/workflow-definitions");
|
||||
}
|
||||
export async function fetchWorkflowDefinition(id: string) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel }>(`/api/workflow-definitions/${id}`);
|
||||
}
|
||||
export async function fetchActiveWorkflowDefinition(entityType: WorkflowDefinitionEditorModel["entityType"]) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel | null }>(`/api/workflow-definitions/entity/${entityType}/active`);
|
||||
}
|
||||
export async function createWorkflowDefinition(payload: { entityType: WorkflowDefinitionEditorModel["entityType"]; name: string; steps: WorkflowDefinitionEditorModel["steps"]; notes?: string }) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel }>("/api/workflow-definitions", { method: "POST", body: JSON.stringify(payload) });
|
||||
}
|
||||
export async function updateWorkflowDefinition(id: string, payload: Partial<{ name: string; steps: WorkflowDefinitionEditorModel["steps"]; notes?: string }>) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel }>(`/api/workflow-definitions/${id}`, { method: "PATCH", body: JSON.stringify(payload) });
|
||||
}
|
||||
export async function publishWorkflowDefinition(id: string) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel }>(`/api/workflow-definitions/${id}/publish`, { method: "POST", body: JSON.stringify({}) });
|
||||
}
|
||||
export async function archiveWorkflowDefinition(id: string) {
|
||||
return apiRequestData<{ item: WorkflowDefinitionEditorModel }>(`/api/workflow-definitions/${id}/archive`, { method: "POST", body: JSON.stringify({}) });
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户