Procházet zdrojové kódy

fix(web): 对齐工单详情字段和表格样式

sy před 3 dny
rodič
revize
27e5a922b5

+ 20 - 14
web-scaffold/src/components/work-order/ConstructionGuidePanel.tsx

@@ -4,6 +4,8 @@
 import type { ConstructionGuide, PriorActivation, ConstructionPlanSummary } from "../../lib/api/ticket";
 import { PLAN_FAMILY, PLAN_KIND, label } from "../../lib/api/labels";
 
+const missingValue = <span className="table-placeholder">—</span>;
+
 function exitsText(v: ConstructionPlanSummary["line_exits"]): string {
   if (Array.isArray(v)) return v.filter(Boolean).join("、") || "—";
   if (typeof v === "string" && v.trim()) {
@@ -18,25 +20,29 @@ function exitsText(v: ConstructionPlanSummary["line_exits"]): string {
 
 function PlanCard({ title, plan }: { title: string; plan: ConstructionPlanSummary | null | undefined }) {
   if (!plan) return null;
+  const exits = exitsText(plan.line_exits);
+  const bandwidth = [
+    plan.bandwidth_down_mbps != null && `↓${plan.bandwidth_down_mbps}`,
+    plan.bandwidth_up_mbps != null && `↑${plan.bandwidth_up_mbps}`,
+  ].filter(Boolean).join(" / ");
   return (
     <div className="wo-guide-card">
       <h4 className="work-order-subhead">{title}</h4>
       {plan.summary ? <p className="wo-guide-summary">{plan.summary}</p> : null}
       <div className="work-order-summary-grid">
-        <div><span>套餐</span><strong>{plan.plan_name ?? "—"}</strong></div>
-        <div><span>交付形态</span><strong>{plan.plan_family ? label(PLAN_FAMILY, plan.plan_family) : "—"}</strong></div>
-        <div><span>档位类型</span><strong>{plan.plan_kind ? label(PLAN_KIND, plan.plan_kind) : "—"}</strong></div>
-        <div><span>份数</span><strong>{plan.quantity ?? "—"}</strong></div>
-        <div><span>分账号额度</span><strong>{plan.quota_slots ?? plan.sub_account_quota ?? "—"}</strong></div>
+        <div><span>套餐</span><strong>{plan.plan_name || missingValue}</strong></div>
+        <div><span>交付形态</span><strong>{label(PLAN_FAMILY, plan.plan_family) || missingValue}</strong></div>
+        <div><span>档位类型</span><strong>{label(PLAN_KIND, plan.plan_kind) || missingValue}</strong></div>
+        <div><span>份数</span><strong>{plan.quantity ?? missingValue}</strong></div>
+        <div><span>分账号额度</span><strong>{plan.quota_slots ?? plan.sub_account_quota ?? missingValue}</strong></div>
         <div><span>承诺带宽</span><strong>
           {plan.bandwidth_missing
             ? "资料缺失(档位未配上下行)"
-            : ([plan.bandwidth_down_mbps != null && `↓${plan.bandwidth_down_mbps}`, plan.bandwidth_up_mbps != null && `↑${plan.bandwidth_up_mbps}`]
-                .filter(Boolean).join(" / ") || "—")}
+            : bandwidth || missingValue}
           {plan.bandwidth_committed === false && !plan.bandwidth_missing ? "(不承诺)" : ""}
           {plan.bandwidth_from_prior ? "(取自历史开通)" : ""}
         </strong></div>
-        <div className="wide"><span>线路出口</span><strong>{exitsText(plan.line_exits)}</strong></div>
+        <div className="wide"><span>线路出口</span><strong>{exits === "—" ? missingValue : exits}</strong></div>
       </div>
     </div>
   );
@@ -52,7 +58,7 @@ function PriorBlock({ prior }: { prior: PriorActivation }) {
         (PIN/CPID 仅显示是否已登记)
       </p>
       {(prior.routes?.length ?? 0) > 0 && (
-        <div className="work-order-table-wrap compact">
+        <div className="work-order-table-wrap compact" role="region" aria-label="历史网络线路" tabIndex={0}>
           <table>
             <thead><tr>
               <th>分账号</th><th>网络账户</th><th>内网 IP</th><th>VLAN/VNI</th><th>出口 PoP</th><th>带宽</th>
@@ -61,7 +67,7 @@ function PriorBlock({ prior }: { prior: PriorActivation }) {
               {prior.routes!.map((r) => (
                 <tr key={r.id}>
                   <td>{r.sub_account_id ?? <span className="table-placeholder">—</span>}</td>
-                  <td>{r.network_account_name ?? <span className="table-placeholder">—</span>}</td>
+                  <td>{r.network_account_name ? <span className="table-cell-title">{r.network_account_name}</span> : missingValue}</td>
                   <td>{[r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / ") || <span className="table-placeholder">—</span>}</td>
                   <td>{[r.vlan, r.vni].filter(Boolean).join(" / ") || <span className="table-placeholder">—</span>}</td>
                   <td>{r.egress_pop ?? <span className="table-placeholder">—</span>}</td>
@@ -73,14 +79,14 @@ function PriorBlock({ prior }: { prior: PriorActivation }) {
         </div>
       )}
       {(prior.ips?.length ?? 0) > 0 && (
-        <div className="work-order-table-wrap compact">
+        <div className="work-order-table-wrap compact" role="region" aria-label="历史境外出口 IP" tabIndex={0}>
           <table>
             <thead><tr><th>出境口岸</th><th>境外 IP</th><th>类型</th><th>带宽档</th><th>凭据</th></tr></thead>
             <tbody>
               {prior.ips!.map((r) => (
                 <tr key={r.id}>
                   <td>{r.egress ?? <span className="table-placeholder">—</span>}</td>
-                  <td>{r.overseas_ip ?? <span className="table-placeholder">—</span>}</td>
+                  <td>{r.overseas_ip ? <span className="table-cell-title">{r.overseas_ip}</span> : missingValue}</td>
                   <td>{r.ip_type ?? <span className="table-placeholder">—</span>}</td>
                   <td>{r.bandwidth_mbps ?? <span className="table-placeholder">—</span>}</td>
                   <td>PIN {r.pin_registered === "true" ? "✓" : <span className="table-placeholder">—</span>} / CPID {r.cpid_registered === "true" ? "✓" : <span className="table-placeholder">—</span>}</td>
@@ -131,14 +137,14 @@ export function ConstructionGuidePanel({ guide }: { guide: ConstructionGuide | n
       {pending.length > 0 && (
         <div className="wo-guide-card">
           <h4 className="work-order-subhead">待开通账号({pending.length})</h4>
-          <div className="work-order-table-wrap compact">
+          <div className="work-order-table-wrap compact" role="region" aria-label="待开通账号" tabIndex={0}>
             <table>
               <thead><tr><th>分账号</th><th>显示名</th><th>网络账户</th><th>当前状态</th></tr></thead>
               <tbody>
                 {pending.map((a) => (
                   <tr key={a.sub_account_id ?? a.display_name ?? Math.random()}>
                     <td>{a.sub_account_id ?? <span className="table-placeholder">—</span>}</td>
-                    <td>{a.display_name ?? <span className="table-placeholder">—</span>}</td>
+                    <td>{a.display_name ? <span className="table-cell-title">{a.display_name}</span> : missingValue}</td>
                     <td>{a.net_account ?? <span className="table-placeholder">—</span>}</td>
                     <td>{a.before_status ?? <span className="table-placeholder">—</span>}</td>
                   </tr>

+ 110 - 21
web-scaffold/src/pages/WorkOrderRecordPage.tsx

@@ -19,7 +19,7 @@ import { ConstructionGuidePanel } from "../components/work-order/ConstructionGui
 import { ScanFieldButton } from "../components/work-order/ScanFieldButton";
 import { EvidencePhotoField, type EvidencePhoto } from "../components/work-order/EvidencePhotoField";
 import { ApprovedExitSelect, alignApprovedExit } from "../components/work-order/ApprovedExitSelect";
-import { OpsNotice } from "../components/OperationsKit";
+import { OpsNotice, OpsStatus } from "../components/OperationsKit";
 import { RecordTabs } from "../components/RecordTabs";
 import {
   completionGenerate, completionReceipt, completionReject, isYes, messageConfirmConflict, ticketAssign, ticketBackfill,
@@ -319,13 +319,17 @@ function FactSeg({ title, summary, badge, tone, open, children }: {
     <summary>
       <span className="work-order-seg-title">{title}</span>
       <span className="work-order-seg-summary">{summary}</span>
-      <span className={`work-order-seg-badge${tone ? ` ${tone}` : ""}`}>{badge}</span>
+      <span className="work-order-seg-badge"><OpsStatus tone={tone === "ok" ? "success" : tone === "warn" ? "warning" : "neutral"}>{badge}</OpsStatus></span>
       <ChevronDown className="work-order-seg-chev" size={16} />
     </summary>
     <div className="work-order-seg-body">{children}</div>
   </details>;
 }
 
+function recordValue(value: string | number | null | undefined, empty = "—") {
+  return value == null || value === "" || value === "-" ? <span className="table-placeholder">{empty}</span> : value;
+}
+
 /**
  * 一组已登记材料的清单(原型 v3:材料跟着产生它的流程段走,⛔ 再单开一张「过程材料」卡)。
  *
@@ -350,14 +354,14 @@ function MaterialList({ ticketId, items, empty, allowDownload = true }: {
     }
   };
   return <>
-    <div className="work-order-table-wrap compact"><table>
+    <div className="work-order-table-wrap compact" role="region" aria-label="工单材料清单" tabIndex={0}><table>
       <thead><tr><th>文件名</th><th>类型</th><th>大小</th><th>登记人</th><th>登记时间</th>{allowDownload && <th><span className="sr-only">操作</span></th>}</tr></thead>
       <tbody>{items.map((m) => <tr key={m.material_id}>
-        <td>{m.file_name ?? m.material_id}</td>
+        <td className="table-wrap-text"><span className="table-cell-title">{m.file_name ?? m.material_id}</span></td>
         <td>{materialKindName(m.kind)}</td>
-        <td>{numText(m.size_bytes, " B")}</td>
-        <td>{m.uploaded_by ?? "-"}</td>
-        <td>{fmtTime(m.uploaded_at)}</td>
+        <td>{recordValue(numText(m.size_bytes, " B"))}</td>
+        <td>{recordValue(m.uploaded_by)}</td>
+        <td>{recordValue(fmtTime(m.uploaded_at))}</td>
         {allowDownload && <td><Button variant="ghost" size="sm" type="button" disabled={busy === m.material_id} onClick={() => void download(m)}>下载</Button></td>}
       </tr>)}</tbody>
     </table></div>
@@ -1461,7 +1465,13 @@ export function WorkOrderRecordPage() {
       <section className="record-tab-panel work-order-record-panel work-order-overview-panel" id="work-order-panel-overview"
         role="tabpanel" aria-labelledby="work-order-tab-overview" hidden={activeTab !== "overview"} tabIndex={0}>
         <p className="work-order-ticket-lead" data-empty={!t.detail || undefined}>{t.detail || "建单时未填写详细描述。"}</p>
-        <div className="work-order-summary-grid"><div><span>建单来源</span><strong>{t.submitter_type === "customer" ? "客户侧提交" : t.submitter_type === "reporter" ? "报障人提交" : "运营侧代报"}</strong></div><div><span>外部单号</span><strong>{t.carrier_order_no ?? "无"}</strong></div><div><span>关联订阅</span><strong>{t.subscription_id ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: t.subscription_id!, name: refOrder?.plan_name })}>{t.subscription_id}</button> : "无"}{refOrder?.plan_name ? ` · ${refOrder.plan_name}` : ""}</strong></div>{t.deferred_until && <div><span>延期至</span><strong>{fmtDate(t.deferred_until)}</strong></div>}{t.confirm_deadline && <div><span>闭环确认期限</span><strong>{fmtDate(t.confirm_deadline)}</strong></div>}</div>
+        <div className="work-order-summary-grid">
+          <div><span>建单来源</span><strong>{t.submitter_type === "customer" ? "客户侧提交" : t.submitter_type === "reporter" ? "报障人提交" : "运营侧代报"}</strong></div>
+          <div><span>外部单号</span><strong>{recordValue(t.carrier_order_no, "无")}</strong></div>
+          <div><span>关联订阅</span><strong>{t.subscription_id ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: t.subscription_id!, name: refOrder?.plan_name })}>{t.subscription_id}</button> : recordValue(null, "无")}{refOrder?.plan_name ? ` · ${refOrder.plan_name}` : ""}</strong></div>
+          {t.deferred_until && <div><span>延期至</span><strong>{fmtDate(t.deferred_until)}</strong></div>}
+          {t.confirm_deadline && <div><span>闭环确认期限</span><strong>{fmtDate(t.confirm_deadline)}</strong></div>}
+        </div>
         {/* 客户建单时上传的图片/语音随建单同事务登记(`submit_evidence`),就放在建单来源这一屏。 */}
         {submitMaterials.length > 0 && <div className="work-order-submit-materials">
           <h4 className="work-order-subhead">客户提交材料</h4>
@@ -1482,10 +1492,41 @@ export function WorkOrderRecordPage() {
           summary={d.backfill?.backfill_id ? `${CONCLUSION_NAMES[d.backfill.exec_conclusion ?? ""] ?? d.backfill.exec_conclusion ?? "—"} · 实际开通 ${d.backfill.actual_opened_date ? fmtDate(d.backfill.actual_opened_date) : "—"} · 线路 ${d.backfill.routes?.length ?? 0} 条 / 境外 IP ${d.backfill.ips?.length ?? 0} 条` : "尚未回填 · 缺 线路与路由、执行结论与凭证"}
           badge={d.backfill?.backfill_id ? "已回填" : "待回填"} tone={d.backfill?.backfill_id ? "ok" : "warn"}>
           {d.backfill?.backfill_id ? <>
-            <div className="work-order-summary-grid"><div><span>执行结论</span><strong>{CONCLUSION_NAMES[d.backfill.exec_conclusion ?? ""] ?? d.backfill.exec_conclusion ?? "-"}</strong></div><div><span>实际开通日期</span><strong>{d.backfill.actual_opened_date ? fmtDate(d.backfill.actual_opened_date) : "-"}</strong></div><div><span>停机完成日期</span><strong>{d.backfill.stop_done_date ? fmtDate(d.backfill.stop_done_date) : "-"}</strong></div><div><span>回填次数</span><strong>{numText(d.backfill.attempt_count)} 次</strong></div><div className="wide"><span>结论说明</span><strong>{d.backfill.conclusion_note ?? "-"}</strong></div><div className="wide"><span>凭证与佐证</span><strong>{d.backfill.evidence_text ?? "-"}</strong></div></div>
+            <div className="work-order-summary-grid">
+              <div><span>执行结论</span><strong>{recordValue(CONCLUSION_NAMES[d.backfill.exec_conclusion ?? ""] ?? d.backfill.exec_conclusion)}</strong></div>
+              <div><span>实际开通日期</span><strong>{recordValue(fmtDate(d.backfill.actual_opened_date))}</strong></div>
+              <div><span>停机完成日期</span><strong>{recordValue(fmtDate(d.backfill.stop_done_date))}</strong></div>
+              <div><span>回填次数</span><strong>{recordValue(numText(d.backfill.attempt_count, " 次"))}</strong></div>
+              <div className="wide"><span>结论说明</span><strong>{recordValue(d.backfill.conclusion_note)}</strong></div>
+              <div className="wide"><span>凭证与佐证</span><strong>{recordValue(d.backfill.evidence_text)}</strong></div>
+            </div>
             <TicketExtForm ext={d.backfill.ext} readOnly />
-            {(d.backfill.routes?.length ?? 0) > 0 && <><h4 className="work-order-subhead">网络线路</h4><div className="work-order-table-wrap compact"><table><thead><tr><th>网络账户名</th><th>内网 IP / 掩码</th><th>端点(源 → 目的)</th><th>出口 PoP</th><th>带宽</th></tr></thead><tbody>{d.backfill.routes.map((r) => <tr key={r.id}><td>{r.network_account_name ?? "-"}</td><td>{[r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / ") || "-"}</td><td>{r.src_endpoint ?? "-"} → {r.dst_endpoint ?? "-"}</td><td>{r.egress_pop ?? "-"}</td><td>{[r.down_mbps && `↓${r.down_mbps}`, r.up_mbps && `↑${r.up_mbps}`].filter(Boolean).join(" / ") || "-"}</td></tr>)}</tbody></table></div></>}
-            {(d.backfill.ips?.length ?? 0) > 0 && <><h4 className="work-order-subhead">境外出口 IP</h4><div className="work-order-table-wrap compact"><table><thead><tr><th>出口</th><th>IP</th><th>类型</th><th>带宽</th><th>凭据</th></tr></thead><tbody>{d.backfill.ips.map((r) => <tr key={r.id}><td>{r.egress ?? "-"}</td><td>{r.overseas_ip ?? "-"}</td><td>{r.ip_type ?? "-"}</td><td>{numText(r.bandwidth_mbps, "M")}</td><td>PIN {isYes(r.pin_registered) ? "✓" : <span className="table-placeholder">—</span>} / CPID {isYes(r.cpid_registered) ? "✓" : <span className="table-placeholder">—</span>}</td></tr>)}</tbody></table></div></>}
+            {(d.backfill.routes?.length ?? 0) > 0 && <>
+              <h4 className="work-order-subhead">网络线路</h4>
+              <div className="work-order-table-wrap compact" role="region" aria-label="网络线路清单" tabIndex={0}><table>
+                <thead><tr><th>网络账户名</th><th>内网 IP / 掩码</th><th>端点(源 → 目的)</th><th>出口 PoP</th><th>带宽</th></tr></thead>
+                <tbody>{d.backfill.routes.map((r) => <tr key={r.id}>
+                  <td><span className="table-cell-title">{recordValue(r.network_account_name)}</span></td>
+                  <td>{recordValue([r.intranet_ip, r.subnet_mask].filter(Boolean).join(" / "))}</td>
+                  <td>{recordValue(r.src_endpoint)} → {recordValue(r.dst_endpoint)}</td>
+                  <td>{recordValue(r.egress_pop)}</td>
+                  <td>{recordValue([r.down_mbps && `↓${r.down_mbps}`, r.up_mbps && `↑${r.up_mbps}`].filter(Boolean).join(" / "))}</td>
+                </tr>)}</tbody>
+              </table></div>
+            </>}
+            {(d.backfill.ips?.length ?? 0) > 0 && <>
+              <h4 className="work-order-subhead">境外出口 IP</h4>
+              <div className="work-order-table-wrap compact" role="region" aria-label="境外出口 IP 清单" tabIndex={0}><table>
+                <thead><tr><th>出口</th><th>IP</th><th>类型</th><th>带宽</th><th>凭据</th></tr></thead>
+                <tbody>{d.backfill.ips.map((r) => <tr key={r.id}>
+                  <td>{recordValue(r.egress)}</td>
+                  <td><span className="table-cell-title">{recordValue(r.overseas_ip)}</span></td>
+                  <td>{recordValue(r.ip_type)}</td>
+                  <td>{recordValue(numText(r.bandwidth_mbps, "M"))}</td>
+                  <td>PIN {recordValue(isYes(r.pin_registered) ? "✓" : null)} / CPID {recordValue(isYes(r.cpid_registered) ? "✓" : null)}</td>
+                </tr>)}</tbody>
+              </table></div>
+            </>}
             <p className="work-order-seg-foot">库内仅存 PIN/CPID 密文,此处只显示「是否登记」;IP 规则 v{d.backfill.ip_rule_version}。</p>
           </> : <>
             <p className="work-order-seg-foot">登记执行结论、实际开通日期、线路与境外 IP;保存即推进工单。</p>
@@ -1504,19 +1545,48 @@ export function WorkOrderRecordPage() {
           tone={checklistGated ? (checklistAllDone ? "ok" : "warn") : undefined}>
           {/* 变更协议单的「原值 → 新值」并成一列(原型 v3),⛔ 再单独渲染一张参数对照表。
               核对两列只对门槛类型渲染:非门槛类型没有核对动作,`pending` 不是缺口。 */}
-          <div className="work-order-table-wrap compact"><table><thead><tr><th>序号</th><th>条目</th>{t.ticket_type === "updown" ? <th>原值 → 新值</th> : <th>规格</th>}<th>数量</th>{checklistGated && <><th>核对结果</th><th>核对时间</th></>}</tr></thead><tbody>{d.service_items.map((item) => <tr key={item.item_id}><td>{item.seq_no}</td><td><strong>{item.item_name ?? "-"}</strong></td>{t.ticket_type === "updown" ? <td>{item.spec_before ?? "-"} → {item.spec_after ?? "-"}</td> : <td>{item.spec_text ?? "-"}</td>}<td>{numText(item.expect_qty)}</td>{checklistGated && <><td>{item.check_result === "done" ? <span className="ops-state tone-valid">已核对</span> : item.check_result === "absent" ? <span className="ops-state tone-invalid">缺项</span> : <span className="ops-state tone-invalid">未核对</span>}</td><td>{fmtTime(item.checked_at)}</td></>}</tr>)}</tbody></table></div>
+          <div className="work-order-table-wrap compact" role="region" aria-label="服务清单" tabIndex={0}><table>
+            <thead><tr><th>序号</th><th>条目</th><th>{t.ticket_type === "updown" ? "原值 → 新值" : "规格"}</th><th>数量</th>{checklistGated && <><th>核对结果</th><th>核对时间</th></>}</tr></thead>
+            <tbody>{d.service_items.map((item) => <tr key={item.item_id}>
+              <td>{item.seq_no}</td>
+              <td><span className="table-cell-title">{recordValue(item.item_name)}</span></td>
+              <td className="table-wrap-text">{t.ticket_type === "updown" ? <>{recordValue(item.spec_before)} → {recordValue(item.spec_after)}</> : recordValue(item.spec_text)}</td>
+              <td>{item.expect_qty != null && item.expect_qty !== "" ? <span className="table-number">{numText(item.expect_qty)}</span> : recordValue(null)}</td>
+              {checklistGated && <>
+                <td><OpsStatus tone={item.check_result === "done" ? "success" : "neutral"}>{item.check_result === "done" ? "已核对" : item.check_result === "absent" ? "缺项" : "未核对"}</OpsStatus></td>
+                <td>{recordValue(fmtTime(item.checked_at))}</td>
+              </>}
+            </tr>)}</tbody>
+          </table></div>
           <p className="work-order-seg-foot">{checklistNote}</p>
         </FactSeg>}
         {(d.open_stop?.accounts.length ?? 0) > 0 && <FactSeg title="账号清单" open={openSeg === "accounts"}
           summary={`${d.open_stop!.accounts.length} 个账号 · ${d.open_stop!.preview ? "待停预览" : d.open_stop!.exec_status === "pending" ? "待生效" : "已生效"}`}
           badge={d.open_stop!.preview ? "预览" : d.open_stop!.exec_status === "pending" ? "待生效" : "已生效"} tone={d.open_stop!.preview || d.open_stop!.exec_status === "pending" ? "warn" : "ok"}>
-          <div className="work-order-table-wrap compact"><table><thead><tr><th>显示名</th><th>网络账户名</th><th>停机前 → 生效后</th><th>生效日</th><th>来源</th></tr></thead><tbody>{d.open_stop!.accounts.map((a) => <tr key={a.id ?? a.sub_account_id ?? `${a.display_name}-${a.net_account}`}><td>{a.display_name ?? "-"}</td><td>{a.net_account ?? "-"}</td><td>{label(ACCT_STATUS, a.before_status) || "-"} → {label(ACCT_STATUS, a.after_status) || (a.source === "preview" ? "待停" : "-")}</td><td>{a.effective_date ? fmtDate(a.effective_date) : "-"}</td><td>{a.source ?? "-"}</td></tr>)}</tbody></table></div>
+          <div className="work-order-table-wrap compact" role="region" aria-label="账号清单" tabIndex={0}><table>
+            <thead><tr><th>显示名</th><th>网络账户名</th><th>停机前 → 生效后</th><th>生效日</th><th>来源</th></tr></thead>
+            <tbody>{d.open_stop!.accounts.map((a) => <tr key={a.id ?? a.sub_account_id ?? `${a.display_name}-${a.net_account}`}>
+              <td><span className="table-cell-title">{recordValue(a.display_name)}</span></td>
+              <td>{recordValue(a.net_account)}</td>
+              <td>{recordValue(label(ACCT_STATUS, a.before_status))} → {recordValue(label(ACCT_STATUS, a.after_status) || (a.source === "preview" ? "待停" : null))}</td>
+              <td>{recordValue(fmtDate(a.effective_date))}</td>
+              <td>{recordValue(a.source)}</td>
+            </tr>)}</tbody>
+          </table></div>
           {d.open_stop && <p className="work-order-seg-foot">{d.open_stop.preview ? `待停账号预览 ${numText(d.open_stop.effective_account_count)} 个(回填前供现场核对)。` : <>开停记录:{d.open_stop.action ? (OPEN_STOP_ACTION_NAMES[d.open_stop.action] ?? d.open_stop.action) : "-"} / {d.open_stop.exec_status ? (EXEC_STATUS_NAMES[d.open_stop.exec_status] ?? d.open_stop.exec_status) : "-"} / 生效账号 {numText(d.open_stop.effective_account_count)} 个{d.open_stop.exec_status === "pending" ? "(待生效)" : ""}{isYes(d.open_stop.closed_flag) ? " · 已随工单关闭" : ""}。</>}</p>}
         </FactSeg>}
         {showCompletion && <FactSeg title="竣工与回执" open={openSeg === "completion"}
           summary={d.completion ? `${d.completion.completion_no ?? "—"} · ${receiptState.text}` : "未生成 · 缺口齐备后可生成"}
           badge={receiptState.text} tone={receiptState.tone}>
-          {d.completion ? <div className="work-order-summary-grid"><div><span>竣工单号</span><strong>{d.completion.completion_no ?? "-"}</strong></div><div><span>动作</span><strong>{d.completion.action ? (OPEN_STOP_ACTION_NAMES[d.completion.action] ?? d.completion.action) : "-"}</strong></div><div><span>执行结论</span><strong>{d.completion.exec_conclusion ? (CONCLUSION_NAMES[d.completion.exec_conclusion] ?? d.completion.exec_conclusion) : "-"}</strong></div><div><span>回传方式</span><strong>{d.completion.mode === "auto" ? "自动" : "手工"}</strong></div><div><span>回传时间</span><strong>{fmtTime(d.completion.pushed_at)}</strong></div><div><span>回执时间</span><strong>{fmtTime(d.completion.receipt_at)}</strong></div><div className="wide"><span>回执说明</span><strong>{d.completion.receipt_remark ?? "-"}</strong></div></div> : <p className="work-order-seg-foot">{d.gaps.length ? `缺口未清,竣工暂不可生成:${d.gaps.map(groupLabel).join(" / ")}` : conclusionBlocksCompletion(d.backfill?.exec_conclusion) ? "回填结论为失败,须重新回填成功/部分成功后才可生成竣工并回传。" : "缺口已齐,可生成竣工并回传。"}</p>}
+          {d.completion ? <div className="work-order-summary-grid">
+            <div><span>竣工单号</span><strong>{recordValue(d.completion.completion_no)}</strong></div>
+            <div><span>动作</span><strong>{recordValue(OPEN_STOP_ACTION_NAMES[d.completion.action ?? ""] ?? d.completion.action)}</strong></div>
+            <div><span>执行结论</span><strong>{recordValue(CONCLUSION_NAMES[d.completion.exec_conclusion ?? ""] ?? d.completion.exec_conclusion)}</strong></div>
+            <div><span>回传方式</span><strong>{d.completion.mode === "auto" ? "自动" : "手工"}</strong></div>
+            <div><span>回传时间</span><strong>{recordValue(fmtTime(d.completion.pushed_at))}</strong></div>
+            <div><span>回执时间</span><strong>{recordValue(fmtTime(d.completion.receipt_at))}</strong></div>
+            <div className="wide"><span>回执说明</span><strong>{recordValue(d.completion.receipt_remark)}</strong></div>
+          </div> : <p className="work-order-seg-foot">{d.gaps.length ? `缺口未清,竣工暂不可生成:${d.gaps.map(groupLabel).join(" / ")}` : conclusionBlocksCompletion(d.backfill?.exec_conclusion) ? "回填结论为失败,须重新回填成功/部分成功后才可生成竣工并回传。" : "缺口已齐,可生成竣工并回传。"}</p>}
           {/* 等待回执:出口是回执确认;权限不足时说明谁可执行——⛔ 给一个点了会被服务端拒的按钮。 */}
           {d.completion && !d.completion.receipt_at && t.status !== "rejected" && (viewerReadOnly || !can.confirm_receipt
             ? <p className="work-order-seg-foot"><ShieldAlert size={15} />回执确认仅总运营与该团队主账号可执行。</p>
@@ -1525,7 +1595,15 @@ export function WorkOrderRecordPage() {
               "待补充资料后重新提交"),且出参本身就没有 `external_reject_no` 这一列。 */}
           {!clientView && !!d.completion_rejects?.length && <>
             <h4 className="work-order-subhead">驳回历史({d.completion_rejects.length} 次{d.reject_pending ? " · 外部等待中" : ""})</h4>
-            <div className="work-order-table-wrap compact"><table><thead><tr><th>次数</th><th>件号</th><th>理由</th><th>时间</th></tr></thead><tbody>{d.completion_rejects.map((r) => <tr key={r.reject_seq}><td>第 {r.reject_seq} 次</td><td>{r.completion_no}</td><td>{rejectReasonNames(r.reason_codes)}{r.reason_text ? `:${r.reason_text}` : ""}</td><td>{fmtTime(r.rejected_at)} · {r.channel === "human" ? "人工登记" : r.channel}{r.pushed_at ? ` · 回传于 ${fmtDate(r.pushed_at)}` : ""}</td></tr>)}</tbody></table></div>
+            <div className="work-order-table-wrap compact" role="region" aria-label="驳回历史" tabIndex={0}><table>
+              <thead><tr><th>次数</th><th>件号</th><th>理由</th><th>时间</th></tr></thead>
+              <tbody>{d.completion_rejects.map((r) => <tr key={r.reject_seq}>
+                <td>第 {r.reject_seq} 次</td>
+                <td><span className="table-cell-title">{recordValue(r.completion_no)}</span></td>
+                <td className="table-wrap-text">{rejectReasonNames(r.reason_codes)}{r.reason_text ? `:${r.reason_text}` : ""}</td>
+                <td>{recordValue(fmtTime(r.rejected_at))}{r.channel ? ` · ${r.channel === "human" ? "人工登记" : r.channel}` : ""}{r.pushed_at && <small>回传于 {fmtDate(r.pushed_at)}</small>}</td>
+              </tr>)}</tbody>
+            </table></div>
             <p className="work-order-seg-foot">驳回期间期限日不重置,超期判定扣掉这段外部等待;出口=同号覆盖重推(驳回态即可执行)或退回重办(总运营/本团队主账号)后再改回填。</p>
           </>}
           <p className="work-order-seg-foot">回执确认后完成日改写为当天;开停记录的执行日不变。</p>
@@ -1536,7 +1614,18 @@ export function WorkOrderRecordPage() {
 
         {d.messages.length > 0 && <FactSeg title="关联报文" open={openSeg === "messages"}
           summary={`${d.messages.length} 条 · 运营商报文与处置状态`} badge={`${d.messages.length} 条`}>
-          <div className="work-order-table-wrap compact"><table><thead><tr><th>外部单号</th><th>动作</th><th>状态</th><th>接收时间</th><th>生效时间</th><th>说明</th><th><span className="sr-only">操作</span></th></tr></thead><tbody>{d.messages.map((m) => <tr key={m.message_id}><td>{m.carrier_order_no ?? "-"}</td><td>{m.action ?? "-"}</td><td>{m.status ?? "-"}</td><td>{fmtTime(m.received_at)}</td><td>{fmtTime(m.effective_at)}</td><td>{m.conflict_note ?? m.void_reason ?? "-"}</td><td>{m.status === "conflict" && !clientView && <Button variant="ghost" size="sm" onClick={() => void (async () => { const ok = await submit.run(() => messageConfirmConflict({ message_id: m.message_id, disposition: "as_is" })); if (ok) { setNotice("冲突已按现状归档。"); detail.reload(); } })()}>按现状归档</Button>}</td></tr>)}</tbody></table></div>
+          <div className="work-order-table-wrap compact" role="region" aria-label="关联报文列表" tabIndex={0}><table>
+            <thead><tr><th>外部单号</th><th>动作</th><th>状态</th><th>接收时间</th><th>生效时间</th><th>说明</th><th><span className="sr-only">操作</span></th></tr></thead>
+            <tbody>{d.messages.map((m) => <tr key={m.message_id}>
+              <td><span className="table-cell-title">{recordValue(m.carrier_order_no)}</span></td>
+              <td>{recordValue(m.action)}</td>
+              <td>{recordValue(m.status)}</td>
+              <td>{recordValue(fmtTime(m.received_at))}</td>
+              <td>{recordValue(fmtTime(m.effective_at))}</td>
+              <td className="table-wrap-text">{recordValue(m.conflict_note ?? m.void_reason)}</td>
+              <td>{m.status === "conflict" && !clientView && <Button variant="ghost" size="sm" onClick={() => void (async () => { const ok = await submit.run(() => messageConfirmConflict({ message_id: m.message_id, disposition: "as_is" })); if (ok) { setNotice("冲突已按现状归档。"); detail.reload(); } })()}>按现状归档</Button>}</td>
+            </tr>)}</tbody>
+          </table></div>
         </FactSeg>}
         {/* 非主线单(故障/售后)没有施工回填段 ⇒ 过程材料单独成段:这些单上它就是主证据,不是某段的补充。
             ⚠️ 空清单不给 warn 色调:照片明确定义为「不是完成门槛」(需求 §7.5),不能读成缺项。 */}
@@ -1557,23 +1646,23 @@ export function WorkOrderRecordPage() {
           {refCustomer ? <>
             <div className="work-order-trace"><span>客户名称</span><strong>{refCustomer.customer_name
               ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>{refCustomer.customer_name}</button>
-              : "-"}</strong></div>
+              : recordValue(null)}</strong></div>
             <div className="work-order-trace"><span>客户编号</span><strong>{refCustomer.customer_code || refCustomer.customer_id
               ? <button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>{refCustomer.customer_code ?? refCustomer.customer_id}</button>
-              : "-"}</strong></div>
+              : recordValue(null)}</strong></div>
             <div className="work-order-trace"><span>联系人 / 电话</span><strong>{
               refCustomer.contact_name_missing && refCustomer.contact_mobile_missing
                 ? "资料缺失"
-                : [
+                : recordValue([
                     refCustomer.contact_name_missing ? "联系人资料缺失" : refCustomer.contact_name,
                     refCustomer.contact_mobile_missing
                       ? "电话资料缺失"
                       : (refCustomer.contact_mobile_full || refCustomer.contact_mobile),
-                  ].filter(Boolean).join(" / ") || "-"
+                  ].filter(Boolean).join(" / "))
             }</strong></div>
             <div className="work-order-trace"><span>通信地址</span><strong>{refCustomer.address_missing
               ? <button type="button" className="work-order-trace-link work-order-trace-missing" onClick={() => openRef({ kind: "customer", id: refCustomer.customer_id, name: refCustomer.customer_name })}>资料缺失,需补充</button>
-              : (refCustomer.address ?? "-")}</strong></div>
+              : recordValue(refCustomer.address)}</strong></div>
           </> : <p className="work-order-reference-empty">该单未关联客户档案。</p>}
           {refOrder && <div className="work-order-trace"><span>关联订阅</span><strong><button type="button" className="work-order-trace-link" onClick={() => openRef({ kind: "order", id: refOrder.subscription_id, name: refOrder.plan_name })}>{refOrder.plan_name ?? refOrder.subscription_id}</button></strong><small>{[refOrder.subscription_id, label(PLAN_KIND, refOrder.plan_kind), label(PLAN_FAMILY, refOrder.plan_family), label(ORDER_STATUS, refOrder.status), refOrder.actual_opened_at ? `实际开通 ${fmtDate(refOrder.actual_opened_at)}` : null].filter(Boolean).join(" · ")}</small>{refOrder.parent_subscription_id && <small className="order-parent-mark">叠加于 {refOrder.parent_subscription_id}</small>}</div>}
           {/* P1(D-2/D-7):并单成员订阅**平铺**列出,附加成员只标「叠加于 SUB-xxx」,⛔ 折叠成树。 */}

+ 7 - 2
web-scaffold/src/pages/__tests__/work-order-record-tabs.test.tsx

@@ -23,7 +23,7 @@ const detail = {
   },
   construction_guide: { hint: "核对客户侧接入参数。" },
   actions: { check_done: true },
-  service_items: [{ item_id: "item-1", seq_no: "1", item_name: "办公专线", check_result: "pending" }],
+  service_items: [{ item_id: "item-1", seq_no: "1", item_name: "办公专线", expect_qty: "0", check_result: "pending" }],
   materials: [], messages: [], process_logs: [], gaps: [],
 };
 
@@ -61,7 +61,12 @@ it("无施工指导时省略对应页签,切换后保留交付明细的展开
   expect(within(tabs).queryByRole("tab", { name: "施工指导" })).toBeNull();
 
   fireEvent.click(delivery);
-  const checklist = within(screen.getByRole("tabpanel", { name: "交付与回执" })).getByText("服务清单").closest("details")!;
+  const panel = within(screen.getByRole("tabpanel", { name: "交付与回执" }));
+  const table = within(panel.getByRole("region", { name: "服务清单" }));
+  expect(table.getByText("办公专线").classList.contains("table-cell-title")).toBe(true);
+  expect(table.getByText("0").classList.contains("table-number")).toBe(true);
+  expect(table.getAllByText("—").every((cell) => cell.classList.contains("table-placeholder"))).toBe(true);
+  const checklist = panel.getByText("服务清单").closest("details")!;
   expect(checklist.open).toBe(true);
   checklist.open = false;
   fireEvent(checklist, new Event("toggle"));

+ 49 - 17
web-scaffold/src/styles/work-order-record.css

@@ -143,7 +143,7 @@
 .work-order-overview-panel { display: grid; gap: 18px; }
 .work-order-ticket-lead { margin: 0; padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-control); background: var(--surface-subtle); color: var(--foreground); font-size: var(--type-body); line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
 .work-order-ticket-lead[data-empty] { color: var(--muted-foreground); font-size: var(--type-support); }
-.work-order-submit-materials { display: grid; gap: 8px; padding-top: 15px; border-top: 1px solid var(--border-subtle); }
+.work-order-submit-materials { display: grid; gap: 8px; }
 .work-order-record-panel .wo-guide > .work-order-section-title { display: none; }
 .work-order-record-panel .wo-guide-hint { margin-top: 0; }
 
@@ -151,7 +151,7 @@
 .work-order-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 15px 20px; }
 .work-order-summary-grid > div { display: grid; align-content: start; gap: 4px; min-width: 0; }
 .work-order-summary-grid > div.wide { grid-column: 1 / -1; }
-.work-order-summary-grid span { color: var(--text-secondary); font-size: var(--type-support); }
+.work-order-summary-grid > div > span { color: var(--text-secondary); font-size: var(--type-support); }
 .work-order-summary-grid strong { overflow-wrap: anywhere; color: var(--foreground); font-size: var(--type-body); font-weight: 650; line-height: 1.45; }
 .work-order-summary-grid strong em { font-style: normal; }
 .work-order-subhead { margin: 2px 0 0; font-size: var(--type-support); font-weight: 650; }
@@ -162,8 +162,35 @@
   line-height: 1.4;
 }
 .work-order-layout .work-order-subhead { font-size: var(--type-body); font-weight: 600; }
-.work-order-layout .work-order-summary-grid > div > span { color: var(--muted-foreground); font-size: var(--type-meta); }
-.work-order-layout .work-order-summary-grid > div > strong { font-weight: 500; }
+.work-order-record-panel .work-order-summary-grid { gap: 0 24px; }
+.work-order-record-panel .work-order-summary-grid > div { padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
+.work-order-record-panel :is(.work-order-summary-grid > div, .work-order-trace) > span {
+  color: var(--muted-foreground);
+  font-size: var(--type-support);
+}
+.work-order-record-panel :is(.work-order-summary-grid > div, .work-order-trace) > strong {
+  color: var(--foreground);
+  font-size: var(--type-body);
+  font-weight: 600;
+  line-height: 1.45;
+}
+.work-order-record-panel :is(.table-placeholder, .oss-tri-missing) {
+  font: 400 var(--type-support)/1.5 var(--font-sans);
+}
+.work-order-record-panel :is(.table-placeholder, .oss-tri-missing):not(td *) { color: var(--muted-foreground); }
+.work-order-record-panel [data-gap-focus="ext"] .work-order-form-grid > label { min-width: 0; color: var(--muted-foreground); font-size: var(--type-support); }
+.work-order-record-panel [data-gap-focus="ext"] :is(input:not([type="checkbox"]), select, textarea):disabled {
+  display: block;
+  width: 100%;
+  margin-top: 4px;
+  padding: 7px 10px;
+  border: 1px solid var(--border-subtle);
+  border-radius: var(--radius-control);
+  background: var(--surface-subtle);
+  color: var(--foreground);
+  font-size: var(--type-body);
+  opacity: 1;
+}
 .work-order-layout .wo-guide-members { font-size: var(--type-support); line-height: 1.55; }
 :is(.work-order-layout, .work-order-todo) .work-order-detail-footnote { font-size: var(--type-meta); }
 
@@ -181,9 +208,7 @@
 .work-order-seg[open] > summary { border-bottom: 1px solid var(--border-subtle); border-end-start-radius: 0; border-end-end-radius: 0; background: var(--surface-subtle); }
 .work-order-seg-title { display: flex; align-items: center; gap: 8px; font-size: var(--type-body); font-weight: 600; }
 .work-order-seg-summary { grid-column: 2; justify-self: end; color: var(--text-secondary); font-size: var(--type-support); text-align: right; overflow-wrap: anywhere; }
-.work-order-seg-badge { grid-column: 3; justify-self: end; padding: 2px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-subtle); color: var(--text-secondary); font-size: var(--type-meta); white-space: nowrap; }
-.work-order-seg-badge.ok { border-color: var(--success-border); background: var(--success-soft); color: var(--success); }
-.work-order-seg-badge.warn { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning); }
+.work-order-seg-badge { grid-column: 3; justify-self: end; }
 .work-order-seg-chev { grid-column: 4; width: 16px; height: 16px; color: var(--icon); transition: transform .16s ease; }
 .work-order-seg[open] > summary .work-order-seg-chev { transform: rotate(180deg); }
 .work-order-seg-body { display: grid; gap: 12px; padding: 14px; }
@@ -202,12 +227,19 @@
 .work-order-table-wrap tbody tr:last-child td { border-bottom: 0; }
 .work-order-table-wrap td strong { display: block; overflow-wrap: anywhere; color: var(--foreground); font-size: var(--type-support); font-weight: 650; }
 .work-order-table-wrap td small { display: block; margin-top: 3px; color: var(--muted-foreground); font-size: var(--type-meta); }
-.work-order-layout .work-order-table-wrap :is(th, td strong) { color: var(--text-secondary); font-weight: 500; }
-
-/* 核对结果标签 */
-.ops-state { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid; border-radius: 5px; font-size: var(--type-support); font-weight: 650; line-height: 1.2; white-space: nowrap; }
-.ops-state.tone-valid { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
-.ops-state.tone-invalid { color: var(--text-secondary); border-color: var(--border); background: var(--surface-subtle); }
+.work-order-record-panel .work-order-table-wrap {
+  max-width: 100%;
+  border-color: var(--border-subtle);
+  border-radius: var(--radius-control);
+  background: var(--card);
+}
+.work-order-record-panel .work-order-table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
+.work-order-record-panel .work-order-table-wrap th { padding: 10px 12px; color: var(--muted-foreground); font-size: var(--type-meta); font-weight: 600; letter-spacing: .02em; }
+.work-order-record-panel .work-order-table-wrap td { padding: 12px; color: var(--text-secondary); line-height: 1.4; white-space: nowrap; }
+.work-order-record-panel .work-order-table-wrap :is(th, td):first-child { padding-inline-start: 24px; }
+.work-order-record-panel .work-order-table-wrap :is(th, td):last-child { padding-inline-end: 24px; }
+.work-order-record-panel .work-order-table-wrap tbody tr:hover { background: var(--surface-subtle); }
+.work-order-record-panel .work-order-table-wrap .table-wrap-text { min-width: 10rem; max-width: 24rem; white-space: normal; overflow-wrap: anywhere; }
 
 /* ── 右栏:处理记录面板(全部显示 + 面板内滚动 + 向上流动) ─────── */
 .work-order-logs-panel { display: flex; flex-direction: column; height: calc(100dvh - 92px); max-height: calc(100dvh - 92px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
@@ -276,16 +308,16 @@
 .work-order-refs { display: grid; gap: 12px; }
 .work-order-reference-group { min-width: 0; padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-control); background: var(--surface-subtle); }
 .work-order-refs h2 { margin: 0 0 8px; }
-.work-order-reference-empty { margin: 0; color: var(--muted-foreground); font-size: var(--type-meta); }
+.work-order-reference-empty { margin: 0; color: var(--muted-foreground); font-size: var(--type-support); }
 .work-order-trace { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: baseline; gap: 4px 14px; 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; }
-.work-order-trace > span { color: var(--muted-foreground); font-size: var(--type-meta); }
-.work-order-trace > strong, .work-order-trace .work-order-member-row { overflow-wrap: anywhere; font-size: var(--type-support); font-weight: 500; }
+.work-order-trace > strong, .work-order-trace .work-order-member-row { overflow-wrap: anywhere; }
+.work-order-trace .work-order-member-row { font-size: var(--type-support); }
 .work-order-trace > small { grid-column: 2; overflow-wrap: anywhere; color: var(--muted-foreground); font-size: var(--type-meta); line-height: 1.5; }
 .work-order-trace .work-order-member-row small { font-size: var(--type-meta); font-weight: 400; }
 /* 参考区的可点字段:外观仍是一行摘要,只把「能点开」显性化 */
-.work-order-trace-link { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 500; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
+.work-order-trace-link { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
 .work-order-trace-link:hover { text-decoration: underline; }
 .work-order-trace-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
 .work-order-trace-missing { color: var(--danger, #b42318); }