feat: 建立前端 TS 类型系统与 API 请求服务层

This commit is contained in:
2026-08-04 17:09:55 +08:00
parent daae052878
commit d18d9dbaac
6 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,12 @@
/** 管理端 API 响应类型 */
export interface ProductResponse {
id: string;
serial_number: string;
order_id: string;
order_no?: string;
material_id: string | null;
parent_product_id: string | null;
status: string;
created_at: string;
}

47
frontend/src/types/api.ts Normal file
View File

@ -0,0 +1,47 @@
/** 后端 API 响应类型 */
// ============================================================
// 任务
// ============================================================
export interface TaskSummary {
id: string;
product_id: string;
parent_task_id: string | null;
task_name: string;
assignee_id: string | null;
status: string;
notify_parent_on_complete: boolean;
created_at: string;
}
export interface TaskResponse extends TaskSummary {
child_tasks: TaskResponse[];
}
export interface TaskCompleteResponse {
completed_task: TaskResponse;
next_task: TaskResponse | null;
message: string;
}
export interface TaskListResponse {
tasks: TaskResponse[];
total: number;
}
// ============================================================
// 产品
// ============================================================
export interface ProductScanResponse {
id: string;
serial_number: string;
order_id: string;
order_no: string;
material_id: string | null;
parent_product_id: string | null;
status: string;
created_at: string;
top_level_tasks: TaskSummary[];
}