Bläddra i källkod

fix(web): 补齐工单关联订单号并精简客户入口

sy 3 dagar sedan
förälder
incheckning
49c7976fab

+ 5 - 4
web-scaffold/src/pages/WorkOrderRecordPage.tsx

@@ -1649,10 +1649,7 @@ export function WorkOrderRecordPage() {
 
       <WorkOrderPanel tab="references" active={activeTab} className="work-order-refs">
         <section className="record-summary-panel">
-          <header className="work-order-content-heading">
-            <h2 className="work-order-panel-title">客户资料</h2>
-            {refCustomer?.customer_id && <button type="button" className="ops-card-link contract-ref-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>查看客户档案<ArrowRight size={15} /></button>}
-          </header>
+          <h2 className="work-order-panel-title">客户资料</h2>
           {refCustomer ? <dl className="ops-record-summary">
             <div>
               <dt>客户名称</dt>
@@ -1706,6 +1703,10 @@ export function WorkOrderRecordPage() {
           <dl className="ops-record-summary">
             <div><dt>本单来源</dt><dd>{t.source_message_id ? "运营商报文触发" : submitterLabel}</dd></div>
             {t.source_message_id && <div><dt>来源报文</dt><dd>{t.source_message_id}</dd></div>}
+            {refSubscriptionId && <div>
+              <dt>关联订单号</dt>
+              <dd><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refSubscriptionId, name: refOrder?.plan_name })}>{refOrder?.order_no || refSubscriptionId}</button></dd>
+            </div>}
             {t.ticket_type === "renewal" && (t.renew_from_contract_id || t.renew_from_contract_no) && <>
               <div><dt>续签来源合同</dt><dd>{t.renew_from_contract_no ?? t.renew_from_contract_id}</dd></div>
               {t.renew_from_end_date && <div><dt>原合同到期日</dt><dd>{fmtDate(t.renew_from_end_date)}</dd></div>}

+ 6 - 1
web-scaffold/src/pages/__tests__/work-order-record-tabs.test.tsx

@@ -119,7 +119,8 @@ it("客户与订阅页签显示客户和订阅字段,并保留对应档案入
   expect(customer.getByText("138****0000").tagName).toBe("DD");
   expect(customer.getByRole("button", { name: "资料缺失,需补充" })).toBeTruthy();
 
-  fireEvent.click(customer.getByRole("button", { name: "查看客户档案" }));
+  expect(customer.queryByRole("button", { name: "查看客户档案" })).toBeNull();
+  fireEvent.click(customer.getByRole("button", { name: "澄澜科技" }));
   expect(vi.mocked(ReferenceDrawer).mock.lastCall?.[0].stack.at(-1)).toMatchObject({ kind: "customer", id: "CUS-1" });
   const subscription = within(related.getByRole("heading", { name: "关联订阅" }).closest("section")!);
   expect(subscription.getByText("叠加于 SUB-1")).toBeTruthy();
@@ -130,6 +131,7 @@ it("客户与订阅页签显示客户和订阅字段,并保留对应档案入
 it("追溯与关联独立展示工单来源、续签合同和关联报文", () => {
   renderRecord({
     ticket: { ...detail.ticket, ticket_type: "renewal", renew_from_contract_no: "HT-OLD", renew_contract_no: "HT-NEW", source_message_id: "MSG-1" },
+    order: { subscription_id: "SUB-1", order_no: "ORDER-1" },
     messages: [{ message_id: "MSG-1", carrier_order_no: "CARRIER-1" }],
   });
   fireEvent.click(screen.getByRole("tab", { name: "追溯与关联" }));
@@ -139,4 +141,7 @@ it("追溯与关联独立展示工单来源、续签合同和关联报文", () =
   expect(trace.getByText("HT-OLD")).toBeTruthy();
   expect(trace.getByText("HT-NEW")).toBeTruthy();
   expect(trace.getByText("CARRIER-1")).toBeTruthy();
+  expect(trace.getByText("关联订单号")).toBeTruthy();
+  fireEvent.click(trace.getByRole("button", { name: "ORDER-1" }));
+  expect(vi.mocked(ReferenceDrawer).mock.lastCall?.[0].stack.at(-1)).toMatchObject({ kind: "order", id: "SUB-1" });
 });

+ 1 - 2
web-scaffold/src/styles/work-order-record.css

@@ -306,9 +306,8 @@
 /* ── 关联资料 ────────────────────────────────────────────────── */
 .work-order-refs { display: grid; gap: 24px; }
 .work-order-refs .record-summary-panel { min-width: 0; }
-.work-order-refs .work-order-content-heading { margin-bottom: 4px; }
 .work-order-refs .work-order-reference-wide { grid-column: 1 / -1; }
-.work-order-reference-empty { margin: 0; color: var(--muted-foreground); font-size: var(--type-support); }
+.work-order-reference-empty { margin: 4px 0 0; color: var(--muted-foreground); font-size: var(--type-support); }
 .work-order-trace { display: grid; grid-template-columns: minmax(84px, 35%) minmax(0, 1fr); align-items: baseline; gap: 4px 10px; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); }
 .work-order-trace:first-of-type { padding-top: 0; }
 .work-order-trace:last-child { padding-bottom: 0; border-bottom: 0; }