Jelajahi Sumber

fix(web): 支持点击整行切换待办工单预览

sy 2 hari lalu
induk
melakukan
d6f5ce3763

+ 4 - 1
web-scaffold/src/pages/WorkOrderMinePage.tsx

@@ -205,7 +205,10 @@ function MineQueueRow({ row, today, selected, onSelect, linkState, onUrged }: {
   const deadline = mineDeadline(row, today);
   const ticketPath = `/work-orders/${encodeURIComponent(row.ticket_id)}`;
 
-  return <tr className="work-order-mine-row" data-selected={selected || undefined}>
+  return <tr className="work-order-mine-row" data-selected={selected || undefined} onClick={(event) => {
+    if (event.target instanceof Element && event.target.closest("a, button")) return;
+    onSelect();
+  }}>
     <td>
       <button type="button" className="work-order-mine-ticket-button" onClick={onSelect} title={summary.title}
         aria-controls="mine-preview" aria-pressed={selected}>{summary.title}</button>

+ 5 - 4
web-scaffold/src/pages/__tests__/work-order-mine.test.tsx

@@ -71,13 +71,13 @@ it("切换优先队列后可直接办理,返回时恢复队列筛选", async (
   expect(screen.queryByRole("button", { name: "核对接入配置" })).toBeNull();
 });
 
-it("在列表选中工单后更新预览,从详情返回时保留选中项", async () => {
+it("点击工单行的期限列可更新预览,从详情返回时保留选中项", async () => {
   vi.mocked(ticketList).mockResolvedValue(results([fault, planned]));
   renderMine();
   const other = await screen.findByRole("button", { name: "安排专线开通" });
   const preview = within(screen.getByRole("complementary", { name: "工单预览" }));
   expect(preview.getByText("已超 1 天").closest("[data-late]")).toBeTruthy();
-  fireEvent.click(other);
+  fireEvent.click(within(other.closest("tr")!).getByText("2026.12.02"));
   expect(other.getAttribute("aria-pressed")).toBe("true");
   expect(preview.getByRole("heading", { name: "安排专线开通" })).toBeTruthy();
   expect(preview.getByText("未到执行日")).toBeTruthy();
@@ -95,9 +95,10 @@ it("待确认队列保留对家与催办,并在发送后刷新状态", async (
   vi.mocked(ticketUrge).mockResolvedValue({ ticket_id: "W-3", created: true, reason: null, business_date: "2026-11-30", waiting: urged, next_step: "等待客户确认" });
   const queues = renderMine();
   await screen.findByRole("table", { name: "我的待办工单" });
-  fireEvent.click(queues.getByRole("link", { name: /待对方确认/ }));
-  expect(within(screen.getByRole("table", { name: "我的待办工单" })).getByText("李经理")).toBeTruthy();
   fireEvent.click(screen.getByRole("button", { name: "催办" }));
   expect(await screen.findByText("今日已催")).toBeTruthy();
   expect(ticketUrge).toHaveBeenCalledWith({ ticket_id: "W-3" });
+  expect(screen.getByRole("button", { name: "排查线路掉包" }).getAttribute("aria-pressed")).toBe("true");
+  fireEvent.click(queues.getByRole("link", { name: /待对方确认/ }));
+  expect(within(screen.getByRole("table", { name: "我的待办工单" })).getByText("李经理")).toBeTruthy();
 });

+ 1 - 0
web-scaffold/src/styles/work-order-mine.css

@@ -123,6 +123,7 @@
 .work-order-mine-page .work-order-mine-passive .work-order-waiting-name { display: inline; color: var(--foreground); font-size: inherit; font-weight: 650; line-height: inherit; }
 .work-order-mine-next .work-order-next-step > svg { flex: none; }
 .work-order-mine-next .is-error { flex-basis: 100%; color: var(--destructive); white-space: normal; }
+.work-order-mine-row { cursor: pointer; }
 .work-order-mine-row[data-selected] td { background: var(--primary-soft); }
 .work-order-mine-row[data-selected] td:first-child { box-shadow: inset 3px 0 var(--primary); }
 .work-order-mine-row[data-selected] .work-order-mine-ticket-button { color: var(--primary-soft-foreground); }