feat: 建立前端 TS 类型系统与 API 请求服务层
This commit is contained in:
12
frontend/src/types/admin.ts
Normal file
12
frontend/src/types/admin.ts
Normal 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
47
frontend/src/types/api.ts
Normal 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user