feat(frontend): 更新 TS 类型定义与 API 服务层,对接后端重构接口
types/api.ts: - TaskSummary/TaskResponse 新增 is_rework, reject_reason, received_at, completed_at 字段 - 新增 TASK_STATUS 常量 (PENDING/WIP/COMPLETED/REJECTED/ARCHIVED) - 新增 TaskTransferResponse, TaskRejectPayload, TaskTransferPayload 类型 - ProductScanResponse 新增 current_location_id, task_tree 字段 types/admin.ts: - ProductResponse 新增 current_location_id 字段 services/taskApi.ts: - 新增 getTaskTree(serialNumber) — 产品全景任务树 - 新增 receiveTask(taskId) — 确认接收 - 新增 rejectTask(taskId, reason) — 品质驳回 - 新增 transferTask(taskId, assignees, name, note?) — 完工裂变转交
This commit is contained in:
@ -7,6 +7,7 @@ export interface ProductResponse {
|
||||
order_no?: string;
|
||||
material_id: string | null;
|
||||
parent_product_id: string | null;
|
||||
current_location_id: string | null;
|
||||
status: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@ -1,5 +1,19 @@
|
||||
/** 后端 API 响应类型 */
|
||||
|
||||
// ============================================================
|
||||
// 任务状态常量
|
||||
// ============================================================
|
||||
|
||||
export const TASK_STATUS = {
|
||||
PENDING: "PENDING",
|
||||
WIP: "WIP",
|
||||
COMPLETED: "COMPLETED",
|
||||
REJECTED: "REJECTED",
|
||||
ARCHIVED: "ARCHIVED",
|
||||
} as const;
|
||||
|
||||
export type TaskStatus = (typeof TASK_STATUS)[keyof typeof TASK_STATUS];
|
||||
|
||||
// ============================================================
|
||||
// 任务
|
||||
// ============================================================
|
||||
@ -10,8 +24,12 @@ export interface TaskSummary {
|
||||
parent_task_id: string | null;
|
||||
task_name: string;
|
||||
assignee_id: string | null;
|
||||
status: string;
|
||||
status: TaskStatus | string;
|
||||
notify_parent_on_complete: boolean;
|
||||
is_rework: boolean;
|
||||
reject_reason: string | null;
|
||||
received_at: string | null;
|
||||
completed_at: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@ -19,17 +37,37 @@ export interface TaskResponse extends TaskSummary {
|
||||
child_tasks: TaskResponse[];
|
||||
}
|
||||
|
||||
// ---- 操作响应 ----
|
||||
|
||||
export interface TaskCompleteResponse {
|
||||
completed_task: TaskResponse;
|
||||
next_task: TaskResponse | null;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface TaskTransferResponse {
|
||||
completed_task: TaskResponse;
|
||||
created_tasks: TaskResponse[];
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface TaskListResponse {
|
||||
tasks: TaskResponse[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
// ---- 请求体 ----
|
||||
|
||||
export interface TaskRejectPayload {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface TaskTransferPayload {
|
||||
next_assignees: string[];
|
||||
next_task_name: string;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 产品
|
||||
// ============================================================
|
||||
@ -41,7 +79,10 @@ export interface ProductScanResponse {
|
||||
order_no: string;
|
||||
material_id: string | null;
|
||||
parent_product_id: string | null;
|
||||
current_location_id: string | null;
|
||||
status: string;
|
||||
created_at: string;
|
||||
top_level_tasks: TaskSummary[];
|
||||
/** 完整递归任务树 — 供十字矩阵树状图渲染 */
|
||||
task_tree: TaskResponse[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user