refactor(workbench): simplify appointment tasks

This commit is contained in:
2026-09-24 12:01:11 +08:00
parent 436d5500f1
commit ddf953b641
28 changed files with 443 additions and 1384 deletions
@@ -3,7 +3,7 @@ import { mockWorkbenchContext } from "./mock-workbench-context";
type WorkOrderPhase = "execution" | "reply";
export async function mockHierarchicalWorkOrder(page: Page, phase: WorkOrderPhase) {
export async function mockFlatWorkOrder(page: Page, phase: WorkOrderPhase) {
const parentTitle = phase === "execution"
? "演示工单:北辰分区阀门开度调整"
: "演示工单:泵站边界复核复令";
@@ -11,7 +11,6 @@ export async function mockHierarchicalWorkOrder(page: Page, phase: WorkOrderPhas
const subtaskTitles = phase === "execution"
? ["上传阀门操作前后照片", "记录最终开度", "复核北辰末端压力不低于 0.22MPa"]
: ["上传泵站运行截图", "填写出水压力复核结果", "确认模型边界已同步更新"];
const activeIndex = phase === "execution" ? 1 : 2;
const scheduledAt = shanghaiTimestamp(10, 30);
const workOrderId = `mock-${phase}-work-order`;
@@ -40,39 +39,16 @@ export async function mockHierarchicalWorkOrder(page: Page, phase: WorkOrderPhas
risk_level: phase === "execution" ? "attention" : "normal",
updated_at: scheduledAt,
detail: "浏览器测试使用的后端工单投影。",
recommendation: "按子任务逐项完成并回传。",
recommendation: "按回执要求完成并回传。",
duration_minutes: 45,
source: "生产工单系统",
dispatcher: "调度中心",
priority: phase === "execution" ? "urgent" : "normal",
subtasks: subtaskTitles.map((title, index) => {
const position = index < activeIndex ? "before" : index > activeIndex ? "after" : "active";
const stageStatuses = phase === "execution" && position === "active"
? ["done", "current", "pending"]
: phase === "reply" && position === "active"
? ["done", "done", "current"]
: position === "before"
? ["done", "done", "done"]
: ["pending", "pending", "pending"];
return {
id: `${workOrderId}-subtask-${index + 1}`,
title,
summary: `完成“${title}”并保留阶段记录。`,
status: position === "before" ? "completed" : position === "active" ? "running" : "pending",
scheduled_at: shanghaiTimestamp(10, 30 + index * 15),
location: phase === "execution" ? "北辰分区边界阀门 BV-07" : "北辰二级泵站 P-02",
assignee: phase === "execution" ? "北辰抢修二组" : "泵站运行班组",
duration_minutes: 15,
reply_window_minutes: 20,
stages: [
{ id: "dispatch", sequence: 1, title: "派发", status: stageStatuses[0], owner: "调度中心", time_label: "10:20", description: "确认范围并派发。" },
{ id: "execution", sequence: 2, title: "执行中", status: stageStatuses[1], owner: "现场班组", time_label: "10:30-10:45", description: "现场执行本项任务。" },
{ id: "reply", sequence: 3, title: "待复令", status: stageStatuses[2], owner: "现场班组", time_label: "10:45-11:05", description: "回传结果并等待复令。" }
],
reply_requirements: [`回传“${title}”的执行结果`]
};
})
location: phase === "execution" ? "北辰分区边界阀门 BV-07" : "北辰二级泵站 P-02",
assignee: phase === "execution" ? "北辰抢修二组" : "泵站运行班组",
feedback_requirements: subtaskTitles,
activity: [{ sequence: 1, occurred_at: scheduledAt, actor: "调度中心", kind: "created",
title: "演示工单创建", detail: "预约任务已创建。" }]
}]
});
}