فهرست منبع

feat(web): 统一表格空态与加载失败提示,支持按列表重试

sy 1 روز پیش
والد
کامیت
3b1ef1b64f
39فایلهای تغییر یافته به همراه361 افزوده شده و 263 حذف شده
  1. 3 4
      klt-bos-web/src/components/CodeExportTable.tsx
  2. 2 1
      klt-bos-web/src/components/CustomerClaimExportDialog.tsx
  3. 6 7
      klt-bos-web/src/components/DeliveryStatusTable.tsx
  4. 6 1
      klt-bos-web/src/components/OperationsKit.tsx
  5. 1 4
      klt-bos-web/src/components/OrganizationTeamAccounts.tsx
  6. 23 0
      klt-bos-web/src/components/TableState.tsx
  7. 45 0
      klt-bos-web/src/components/table-state.css
  8. 5 1
      klt-bos-web/src/components/ticketState.tsx
  9. 2 1
      klt-bos-web/src/components/work-order/ConstructionGuidePanel.tsx
  10. 9 7
      klt-bos-web/src/components/work-order/MessageInboxPanel.tsx
  11. 4 3
      klt-bos-web/src/components/work-order/WorkOrderLedgerList.tsx
  12. 10 6
      klt-bos-web/src/lib/organization-demo.ts
  13. 2 2
      klt-bos-web/src/pages/ContractManagementPage.tsx
  14. 0 0
      klt-bos-web/src/pages/ContractRecordPage.tsx
  15. 11 18
      klt-bos-web/src/pages/CustomerManagementPages.tsx
  16. 5 7
      klt-bos-web/src/pages/CustomerOrdersPage.tsx
  17. 5 4
      klt-bos-web/src/pages/CustomerRecordsPages.tsx
  18. 6 7
      klt-bos-web/src/pages/CustomerSelfServicePages.tsx
  19. 13 12
      klt-bos-web/src/pages/CustomerTicketPages.tsx
  20. 11 11
      klt-bos-web/src/pages/CustomerWorkspacePage.tsx
  21. 10 16
      klt-bos-web/src/pages/FinanceReferencePages.tsx
  22. 5 15
      klt-bos-web/src/pages/JobRunsDialog.tsx
  23. 7 11
      klt-bos-web/src/pages/OrderManagementPage.tsx
  24. 8 7
      klt-bos-web/src/pages/OrderRecordPage.tsx
  25. 34 27
      klt-bos-web/src/pages/OrganizationPages.tsx
  26. 4 4
      klt-bos-web/src/pages/PackageManagementPage.tsx
  27. 5 4
      klt-bos-web/src/pages/PartyViewPages.tsx
  28. 3 8
      klt-bos-web/src/pages/ScheduledJobManagementPage.tsx
  29. 15 11
      klt-bos-web/src/pages/SettlementPages.tsx
  30. 14 19
      klt-bos-web/src/pages/SettlementRecordPages.tsx
  31. 4 3
      klt-bos-web/src/pages/TeamQueuePage.tsx
  32. 6 5
      klt-bos-web/src/pages/TeamWorkspacePages.tsx
  33. 4 3
      klt-bos-web/src/pages/WorkOrderDeliveryPage.tsx
  34. 5 6
      klt-bos-web/src/pages/WorkOrderManagementPage.tsx
  35. 13 15
      klt-bos-web/src/pages/WorkOrderMinePage.tsx
  36. 11 9
      klt-bos-web/src/pages/WorkOrderOverviewPage.tsx
  37. 2 1
      klt-bos-web/src/pages/WorkOrderRecordPage.tsx
  38. 36 0
      klt-bos-web/src/pages/__tests__/partner-list-feedback.test.tsx
  39. 6 3
      klt-bos-web/src/styles/operations.css

+ 3 - 4
klt-bos-web/src/components/CodeExportTable.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "./TableState";
 /**
  * 激活码明文清单(`/account/export_codes@v1` 与 `/import_batch/export_codes@v1` 共用结果区)。
  *
@@ -12,7 +13,7 @@
  * `tone` 只是两套页面皮肤(交付弹窗/批次详情),渲染逻辑与文案口径同一真源。
  */
 import { useState } from "react";
-import { Copy, Download, KeyRound } from "lucide-react";
+import { Copy, Download } from "lucide-react";
 import { Button } from "./ui/button";
 import type { ExportResult } from "../lib/api/types";
 import { codeExportCell, codeExportView, codeExportWorkbook, copyPlainText } from "../lib/customer-claim-export";
@@ -60,9 +61,7 @@ export function CodeExportTable({ result, owners, tone }: { result: ExportResult
       {view.warnings.map((text) => <p key={text} className={skin.warning}>{text}</p>)}
       {copyFailed && <p className={skin.warning} role="alert">{COPY_FAILED_NOTE}</p>}
       {fileNote && <p className={skin.note} role="status">{fileNote}</p>}
-      {view.empty ? (tone === "dialog"
-        ? <div className="claim-preview-empty"><KeyRound size={27} /><strong>本次无可导出明文</strong><p>后端 <code>items</code> 为空:本轮账号在平台侧没有符合 validity 口径的激活码。</p></div>
-        : <p className="ops-import-note">本次无可导出明文:后端 <code>items</code> 为空,本批次账号在平台侧没有符合该有效性口径的激活码。</p>)
+      {view.empty ? <TableState>本次无可导出明文<p>当前账号范围内没有符合有效期条件的激活码。</p></TableState>
         : <>
           <p className={skin.note}><Button type="button" variant="outline" size="sm" onClick={downloadFile}><Download size={13} />下载 .xlsx({view.total} 条明文)</Button><span style={{ marginLeft: 8 }}>在线表格供逐行复制,文件供线下分发;两者内容=本次应答,后端不保留副本。</span></p>
           <div className={skin.wrap}><table className={skin.table} style={tone === "ops" ? { minWidth: 640 } : undefined}><thead><tr><th>{skin.account}</th><th>用途</th><th>截止日</th><th>激活码明文</th></tr></thead><tbody>

+ 2 - 1
klt-bos-web/src/components/CustomerClaimExportDialog.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "./TableState";
 /**
  * 导出客户激活码 —— 范围选择与账号候选都用真实接口,明文导出受后端能力限制。
  *
@@ -327,7 +328,7 @@ export function CustomerClaimExportDialog({ onClose, onExport }: { onClose: () =
       const state = activationMap.get(customer.id);
       const account = state?.accounts[0];
       return <tr key={customer.id}><td><strong>{customer.name ?? customer.id}</strong><small>{customer.id}{account ? ` · ${account.username}` : ""}{state && state.accounts.length > 1 ? ` +${state.accounts.length - 1} 个账号` : ""}</small></td><td>{activationCell(customer.id)}</td><td><Tri tone="missing" text={MISSING} title={NO_CODE_COLUMN} /></td></tr>;
-    })}</tbody></table>{filteredHit.length > 5 && <p>预览前 5 家,本口径共 {filteredHit.length} 家。</p>}</div> : <div className="claim-preview-empty"><KeyRound size={27} /><strong>{mode === "batch" ? (batchId ? (batchCustomers.length ? (scoped.hit.length ? "当前筛选口径下无可导出客户" : "批次客户不在当前可见账号范围内") : "该批次暂无建档成功的客户") : "请选择导入批次") : selected.length ? (regionCustomersLoading ? "正在读取勾选区域客户…" : (scoped.hit.length ? "当前筛选口径下无可导出客户" : "当前范围未匹配到客户")) : "请选择交付范围"}</strong><p>{scoped.note || (mode === "region" ? "客户按勾选区域根节点经 /customer/get_list@v1(region_node_id)分页取回,⛔ 预拉全量台账。" : `客户区域路径来自列表口 region_path;取不到时计入区域路径缺失(${scoped.regionUnknown} 家)。`)}</p></div>}
+    })}</tbody></table>{filteredHit.length > 5 && <p>预览前 5 家,本口径共 {filteredHit.length} 家。</p>}</div> : <TableState kind={regionCustomersLoading ? "loading" : "empty"}>{mode === "batch" ? (batchId ? (batchCustomers.length ? (scoped.hit.length ? "当前筛选口径下无可导出客户" : "批次客户不在当前可见账号范围内") : "该批次暂无建档成功的客户") : "请选择导入批次") : selected.length ? (regionCustomersLoading ? "正在读取勾选区域客户…" : (scoped.hit.length ? "当前筛选口径下无可导出客户" : "当前范围未匹配到客户")) : "请选择交付范围"}<p>{scoped.note || (mode === "region" ? "客户按勾选区域根节点经 /customer/get_list@v1(region_node_id)分页取回,⛔ 预拉全量台账。" : `客户区域路径来自列表口 region_path;取不到时计入区域路径缺失(${scoped.regionUnknown} 家)。`)}</p></TableState>}
       <p className="claim-skip-note">{mode === "batch" ? <>批次行明细:可选 {scoped.hit.length} 家{scoped.outOfScope ? ` · 另有 ${scoped.outOfScope} 家客户不在您的账号可见范围内,不导出` : ""}{scoped.unlinkedRows ? ` · ${scoped.unlinkedRows} 行未建档成功(未回 business_id),不导出` : ""}</> : <>按勾选区域已取回 {scoped.hit.length} 家{scoped.regionUnknown ? ` · 其中区域路径缺失 ${scoped.regionUnknown} 家` : ""}</>}{scoped.truncated ? " · 分页取数触达上限,家数可能不完整" : ""} · 本轮进入导出:客户 {accountsState.data ? filteredHouseholds.deliverable : MISSING} 家 · 账号 {accountsState.data ? userIds.length : MISSING} 个。</p>
       <p className="claim-skip-note">家数=客户主体号去重,账号数=<code>/account/get_list</code> 成员账号数;一主体多账号时账号数>家数,两个数不得互相代替。</p>
       <p className="claim-skip-note">审计是否留痕以本次导出应答 <code>audit_written</code> 为准,未留痕时在结果区如实提示。</p>

+ 6 - 7
klt-bos-web/src/components/DeliveryStatusTable.tsx

@@ -20,7 +20,6 @@ import { Input } from "./ui/input";
 import { FilterSelect } from "./ui/filter-select";
 import { OpsStatus, OpsTableEmpty, OpsTableColumns, type OpsTone } from "./OperationsKit";
 import { Tri } from "./triState";
-import { FetchError } from "./fetchError";
 import { deliveryExport, deliveryList } from "../lib/api/bos";
 import type { ApiError } from "../lib/api/http";
 import type { DeliveryRow } from "../lib/api/types";
@@ -153,17 +152,17 @@ export function DeliveryStatusTable({ customerId, subscriptionId, compact = fals
         <option value="all">全部(含已回收)</option>
       </FilterSelect>
       <Button variant="outline" onClick={load.reload}><RefreshCcw size={15} />刷新</Button>
-      <span className="ops-muted">共 {total} 条</span>
+      {!load.error && !load.loading && <span className="ops-muted">共 {total} 条</span>}
     </div>}
     {exportNotice && <p className="ops-form-note">{exportNotice}</p>}
     {exportError && <p className="ops-form-error" role="alert">{exportError}</p>}
-    {load.error ? <div className="ops-empty"><FetchError message={load.error.message} onRetry={load.reload} /></div>
-      : <div className="ops-table-wrap record-table-scroll" role="region" aria-label="交付现状列表" tabIndex={0}>
+    <div className="ops-table-wrap record-table-scroll" role="region" aria-label="交付现状列表" tabIndex={0}>
         <table className="ops-table">
           <OpsTableColumns widths={compact ? [110, 120, 90, 100, 100, 110, 110, 120, 110, 140, 120, 100, 90, 120, 110] : [110, 120, 140, 90, 100, 100, 110, 110, 120, 110, 140, 120, 100, 90, 120, 110]} />
           <thead><tr>{columns.map((title, index) => <th key={`${title}-${index}`}>{title}{title === "实测带宽" && measuredOn ? <span className="ops-muted">({measuredOn} 测值)</span> : null}</th>)}</tr></thead>
           <tbody>
-            {load.loading && !rows.length ? <tr><td colSpan={colSpan} className="ops-muted">读取中…</td></tr>
+            {load.error ? <OpsTableEmpty colSpan={colSpan} kind="error" onRetry={load.reload} details={load.error.message}>交付资源加载失败</OpsTableEmpty>
+              : load.loading && !rows.length ? <OpsTableEmpty colSpan={colSpan} kind="loading">正在读取交付资源…</OpsTableEmpty>
               : rows.length ? rows.map((row) => {
                 const mismatch = row.exit_mismatch === true;
                 const account = accountText(row);
@@ -197,8 +196,8 @@ export function DeliveryStatusTable({ customerId, subscriptionId, compact = fals
               }) : <OpsTableEmpty colSpan={colSpan}>没有符合筛选条件的在册资源(默认只显示在用与已到期待回收;已回收需在筛选里选)</OpsTableEmpty>}
           </tbody>
         </table>
-      </div>}
-    <ListPager total={total} page={page} pageSize={PAGE_SIZE} onPageChange={setPage} unit="行" />
+      </div>
+    {!load.error && !load.loading && <ListPager total={total} page={page} pageSize={PAGE_SIZE} onPageChange={setPage} unit="行" />}
     <p className="customer-form-note">
       在册资源只认交付台账({`released_at IS NULL`});实测参数取该账号**最近一次成功开通回填**的测值(列头带测值日期),
       与「现在的带宽」不是一回事。合同出口与实测出口两列并排,不一致的行整行标红并两值同显。本表**不含端口段**(D-6 端口本轮不启用)。默认每页 {PAGE_SIZE} 行,由前端请求下推。

+ 6 - 1
klt-bos-web/src/components/OperationsKit.tsx

@@ -1,3 +1,4 @@
+import { TableState, type TableStateProps } from "./TableState";
 import { useEffect, useId, useRef, useState, type ReactNode } from "react";
 import { createPortal } from "react-dom";
 import { Check, ChevronDown, ChevronUp, X } from "lucide-react";
@@ -78,12 +79,16 @@ export function OpsTag({ tone, children }: { tone: OpsTone; children: ReactNode
   return <span className={`ops-tag tone-${tone}`} data-expired={children === expiredLabel || undefined}>{children}</span>;
 }
 
-export function OpsTableEmpty({ colSpan, children }: { colSpan: number; children: ReactNode }) {
+export function TableStateRow({ colSpan, children }: { colSpan: number; children: ReactNode }) {
   return <tr><td className="ops-table-empty-cell" colSpan={colSpan}>
     <div className="ops-table-empty-message">{children}</div>
   </td></tr>;
 }
 
+export function OpsTableEmpty({ colSpan, ...state }: { colSpan: number } & TableStateProps) {
+  return <TableStateRow colSpan={colSpan}><TableState {...state} /></TableStateRow>;
+}
+
 /** 保留分配比例,由浏览器按表格的实际宽度处理小数像素。 */
 export function OpsTableColumns({ widths }: { widths: readonly number[] }) {
   const total = widths.reduce((sum, width) => sum + width, 0);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 4
klt-bos-web/src/components/OrganizationTeamAccounts.tsx


+ 23 - 0
klt-bos-web/src/components/TableState.tsx

@@ -0,0 +1,23 @@
+import type { ReactNode } from "react";
+import { FileSearch, FileWarning, LoaderCircle, RotateCw } from "lucide-react";
+import "./table-state.css";
+
+export type TableStateProps = {
+  kind?: "empty" | "loading" | "error";
+  children: ReactNode;
+  details?: string;
+  onRetry?: () => void;
+  busy?: boolean;
+};
+
+export function TableState({ kind = "empty", children, details, onRetry, busy }: TableStateProps) {
+  const Icon = kind === "error" ? FileWarning : kind === "loading" ? LoaderCircle : FileSearch;
+  return <div className="table-feedback" data-kind={kind}>
+    <span className="table-feedback-art" aria-hidden="true"><Icon size={28} strokeWidth={1.5} /></span>
+    <div className="table-feedback-copy" role={kind === "error" ? "alert" : "status"}>{children}</div>
+    {onRetry && <button type="button" className="table-feedback-retry" disabled={busy} onClick={onRetry}>
+      <RotateCw size={14} aria-hidden="true" />{busy ? "正在重试…" : "重新加载"}
+    </button>}
+    {details && <details className="table-feedback-details"><summary>错误详情</summary><p>{details}</p></details>}
+  </div>;
+}

+ 45 - 0
klt-bos-web/src/components/table-state.css

@@ -0,0 +1,45 @@
+.table-feedback {
+  display: grid;
+  justify-items: center;
+  align-content: center;
+  gap: 10px;
+  padding: clamp(24px, 5vh, 48px) 16px;
+  color: var(--text-secondary);
+  text-align: center;
+  white-space: normal;
+}
+.table-feedback-art {
+  position: relative;
+  display: grid;
+  place-items: center;
+  inline-size: 68px;
+  block-size: 46px;
+  color: var(--primary-soft-foreground);
+  background: var(--primary-soft);
+  border-radius: 48% 54% 45% 52%;
+}
+.table-feedback-art::before, .table-feedback-art::after {
+  content: "";
+  position: absolute;
+  width: 5px;
+  height: 5px;
+  border: 1px solid currentColor;
+  border-radius: 50%;
+  opacity: .45;
+}
+.table-feedback-art::before { left: 4px; top: 4px; }
+.table-feedback-art::after { right: 3px; bottom: 0; width: 3px; height: 3px; }
+.table-feedback[data-kind="error"] .table-feedback-art { color: var(--warning); background: var(--warning-soft); }
+.table-feedback-copy { display: grid; justify-items: center; gap: 4px; max-inline-size: 42em; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; line-height: 1.6; }
+.table-feedback-copy p { font-size: 13px; font-weight: 400; color: var(--muted-foreground); }
+.table-feedback-retry { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary-soft); color: var(--primary-soft-foreground); font: 500 13px/1.5 var(--font-sans); cursor: pointer; }
+.table-feedback-retry:disabled { opacity: .65; cursor: wait; }
+.table-feedback-details { max-inline-size: min(100%, 40em); font: 400 12px/1.6 var(--font-sans); color: var(--muted-foreground); }
+.table-feedback-details summary { cursor: pointer; }
+.table-feedback-details p { margin-block-start: 6px; overflow-wrap: anywhere; white-space: normal; }
+.table-feedback-retry:hover:enabled { border-color: var(--primary); }
+.table-feedback :is(button, summary):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
+@media (prefers-reduced-motion: no-preference) {
+  .table-feedback[data-kind="loading"] .table-feedback-art svg { animation: table-feedback-spin 1.2s linear infinite; }
+  @keyframes table-feedback-spin { to { transform: rotate(1turn); } }
+}

+ 5 - 1
klt-bos-web/src/components/ticketState.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "./TableState";
 import { Info, Lock, PlugZap, Search } from "lucide-react";
 import { Button } from "./ui/button";
 import type { TicketFail } from "../lib/ticket";
@@ -12,12 +13,15 @@ import type { TicketFail } from "../lib/ticket";
  *
  * 成功但空集⛔ 走本件(那是业务空态,由页面渲染"没有匹配的工单")。
  */
-export function TicketState({ fail, onRetry }: { fail: TicketFail; onRetry?: () => void }) {
+export function TicketState({ fail, onRetry, listTitle }: { fail: TicketFail; onRetry?: () => void; listTitle?: string }) {
   const canRetry = fail.kind === "other" && Boolean(onRetry);
   const icon =
     fail.kind === "wiring" ? <PlugZap size={27} /> : fail.kind === "permission" ? <Lock size={27} /> : <Search size={27} />;
   const title =
     fail.kind === "wiring" ? "该接口尚未在网关声明" : fail.kind === "permission" ? "当前身份无权查看" : "取数失败";
+  if (listTitle) return <TableState kind="error" details={fail.message} onRetry={canRetry ? onRetry : undefined}>
+    {fail.kind === "other" ? `${listTitle}加载失败` : title}
+  </TableState>;
   return (
     <div className="work-order-empty" role="alert">
       {icon}

+ 2 - 1
klt-bos-web/src/components/work-order/ConstructionGuidePanel.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../TableState";
 /**
  * 施工指导只读区:开户见套餐权益;停机见开机施工参数;变更见前后对照+原施工参数。
  */
@@ -96,7 +97,7 @@ function PriorBlock({ prior }: { prior: PriorActivation }) {
           </table>
         </div>
       )}
-      {!prior.routes?.length && !prior.ips?.length && <p className="work-order-detail-footnote">暂无历史开通明细。</p>}
+      {!prior.routes?.length && !prior.ips?.length && <TableState>暂无历史开通明细</TableState>}
     </div>
   );
 }

+ 9 - 7
klt-bos-web/src/components/work-order/MessageInboxPanel.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../TableState";
 /**
  * 待处置报文面板(册 5 §6.6 四把处置键)。
  *
@@ -12,11 +13,11 @@
  * ⛔ 让运维成员点一下才吃一个 `60058`,也⛔ 把"能看见"当成"能处置"(服务端仍是唯一控制)。
  */
 import { useState } from "react";
-import { Check, Inbox, X } from "lucide-react";
+import { Check, X } from "lucide-react";
 import { Button } from "../ui/button";
 import { Input } from "../ui/input";
 import { ListPager } from "../ListPager";
-import { OpsStatus, OpsTableColumns } from "../OperationsKit";
+import { OpsStatus, TableStateRow, OpsTableColumns } from "../OperationsKit";
 import { TicketState } from "../ticketState";
 import {
   messageAttach, messageConfirmConflict, messageRematch, messageVoid, ticketTrace,
@@ -81,10 +82,10 @@ export function MessageInboxPanel({ canDispose, onChanged }: { canDispose: boole
   const total = inbox.data?.total ?? 0;
 
   const fallback = inbox.loading
-    ? <div className="order-empty" role="status">正在读取待处置报文…</div>
+    ? <TableState kind="loading">正在读取待处置报文…</TableState>
     : fail
-      ? <TicketState fail={fail} onRetry={inbox.reload} />
-      : !rows.length ? <div className="order-empty"><Inbox size={26} aria-hidden="true" /><h3>暂无待处置报文</h3></div> : null;
+      ? <TicketState listTitle="待处置报文" fail={fail} onRetry={inbox.reload} />
+      : !rows.length ? <TableState>暂无待处置报文</TableState> : null;
   const minWidth = canDispose ? 980 : 880;
   const bodyWidth = Math.max(tableOverflow.width, minWidth) - (canDispose ? 96 : 0);
   const columnWidths = [.28, .22, .13, .19, .18].map((weight) => bodyWidth * weight);
@@ -100,11 +101,12 @@ export function MessageInboxPanel({ canDispose, onChanged }: { canDispose: boole
       aria-label="待处置报文,可横向滚动查看字段"
       tabIndex={0}
     >
-      {fallback}
-      <table className="order-table order-ledger" hidden={Boolean(fallback)} style={{ minWidth }}>
+
+      <table className="order-table order-ledger" style={{ minWidth }}>
         <OpsTableColumns widths={columnWidths} />
         <thead><tr><th scope="col">客户 / 报文要素</th><th scope="col">运营商单号</th><th scope="col">动作</th><th scope="col">状态</th><th scope="col">接收时间</th>{canDispose && <th scope="col">操作</th>}</tr></thead>
         <tbody>
+            {fallback && <TableStateRow colSpan={columnWidths.length}>{fallback}</TableStateRow>}
           {!fallback && rows.map((m) => {
             const elements = [m.contact_name, m.contact_phone, m.network_account_name].filter(Boolean).join(" · ");
             return (

+ 4 - 3
klt-bos-web/src/components/work-order/WorkOrderLedgerList.tsx

@@ -2,7 +2,7 @@ import { useDetailLinkState, type DetailLinkState } from "../../lib/detail-navig
 import type { ReactNode } from "react";
 import { ArrowRight } from "lucide-react";
 import { Link } from "react-router";
-import { OpsTableColumns } from "../OperationsKit";
+import { TableStateRow, OpsTableColumns } from "../OperationsKit";
 import { TicketStatusTag, TicketTypeTag } from "./TicketBadges";
 import type { TicketListItem } from "../../lib/api/ticket";
 import { fmtTime } from "../../lib/ticket";
@@ -137,11 +137,12 @@ export function WorkOrderLedgerList<T extends LedgerItem>({
         aria-label={`${label},可横向滚动查看字段`}
         tabIndex={0}
       >
-        {fallback}
-        <table hidden={Boolean(fallback)} className="order-table order-ledger" style={{ minWidth }}>
+
+        <table className="order-table order-ledger" style={{ minWidth }}>
           <OpsTableColumns widths={columnWidths} />
           <thead><tr>{columns.map((column) => <th key={column} scope="col">{column}</th>)}</tr></thead>
           <tbody>
+            {fallback && <TableStateRow colSpan={columns.length}>{fallback}</TableStateRow>}
             {!fallback && rows.map((item) => <TicketLedgerRow key={item.ticket_id} item={item} {...rowOptions} extraAction={renderRowAction?.(item)} />)}
           </tbody>
         </table>

+ 10 - 6
klt-bos-web/src/lib/organization-demo.ts

@@ -374,7 +374,8 @@ function currentDemand(): Set<OrgCollection> {
  * 避免从「区域管理」切到「运营商管理」时把其它页已取到的数据清空。
  */
 async function fetchAll(need: ReadonlySet<OrgCollection>): Promise<void> {
-  const partial: OrganizationStatus["partial"] = {};
+  const partial = { ...status.partial };
+  for (const key of need) if (key !== "regions") delete partial[key];
   // 本轮未重取的集合,其降级说明沿用上一份(⛔ 把「这次没取」显示成「后端没这个口径」)。
   let loadPending = need.has("maintenanceTeams") ? undefined : status.loadPending;
   let regionNameNote = need.has("regions") ? undefined : status.regionNameNote;
@@ -386,10 +387,12 @@ async function fetchAll(need: ReadonlySet<OrgCollection>): Promise<void> {
     need.has("operationsTeams") ? pagedAll((page) => entTeamGetList({ page, page_size: PAGE_SIZE })) : Promise.resolve(null),
     need.has("maintenanceTeams") ? opsTeamGetList({ page: 0, page_size: PAGE_SIZE }) : Promise.resolve(null),
   ]);
-  if (regionResult.status === "rejected") throw regionResult.reason as ApiError;
+  const regionError = need.has("regions")
+    ? regionResult.status === "rejected" ? regionResult.reason as ApiError : null
+    : status.error;
 
   let regions = snapshot.regions;
-  if (need.has("regions")) {
+  if (need.has("regions") && regionResult.status === "fulfilled") {
     const nodes = regionResult.value?.nodes ?? [];
     const mapped = nodes.map((node) => ({
       id: node.node_id,
@@ -444,7 +447,7 @@ async function fetchAll(need: ReadonlySet<OrgCollection>): Promise<void> {
   }
 
   const ready: OrgCollection[] = [];
-  if (need.has("regions")) ready.push("regions");
+  if (need.has("regions") && regionResult.status === "fulfilled") ready.push("regions");
   if (need.has("enterprises")) ready.push("enterprises");
   if (need.has("operators") && operatorsResult.status === "fulfilled") ready.push("operators");
   if (need.has("partners") && partnersResult.status === "fulfilled") ready.push("partners");
@@ -453,7 +456,7 @@ async function fetchAll(need: ReadonlySet<OrgCollection>): Promise<void> {
   markLoaded(ready);
 
   snapshot = { regions, operators, partners, operationsTeams, maintenanceTeams, enterprises };
-  status = { loading: false, error: null, partial, regionNameNote, loadPending };
+  status = { loading: false, error: regionError, partial, regionNameNote, loadPending };
   notify();
 }
 
@@ -474,7 +477,8 @@ export function reloadOrganizationData(next?: readonly OrgCollection[], options?
     if (options?.force) return inflight.then(() => reloadOrganizationData([...need], options));
     const covers = inflightCovers ?? new Set<OrgCollection>();
     if ([...need].every((key) => covers.has(key))) return inflight;
-    return inflight.then(() => reloadOrganizationData([...need]));
+    const remaining = [...need].filter((key) => !covers.has(key));
+    return inflight.then(() => reloadOrganizationData(remaining));
   }
   status = { ...status, loading: true };
   notify();

+ 2 - 2
klt-bos-web/src/pages/ContractManagementPage.tsx

@@ -167,8 +167,8 @@ export function ContractManagementPage() {
             { label: "删除合同", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, title: "引用拦截由服务端判定,删除后不可恢复", onSelect: () => setDeleteId(item.contractId ?? item.no) },
           ]} />}</div></td>
         </tr>;
-      })}{!pageRows.length && <OpsTableEmpty colSpan={7}>{contracts.error ? <>合同台账取数失败:{contracts.error.message}</> : contracts.loading ? "正在从合同接口读取台账…" : expiring ? `没有 ${EXPIRING_SOON_DAYS} 天内到期的合同。` : "没有符合筛选条件的合同。"}</OpsTableEmpty>}</tbody></table></div>
-      <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="条" />
+      })}{(contracts.error || !pageRows.length) && <OpsTableEmpty colSpan={7} kind={contracts.error ? "error" : contracts.loading ? "loading" : "empty"} details={contracts.error?.message} onRetry={contracts.error ? contracts.reload : undefined} busy={contracts.loading}>{contracts.error ? "合同台账加载失败" : contracts.loading ? "正在从合同接口读取台账…" : expiring ? `没有 ${EXPIRING_SOON_DAYS} 天内到期的合同。`  : hasFilter ? "没有符合筛选条件的合同。" : "暂无合同"}</OpsTableEmpty>}</tbody></table></div>
+      {!contracts.error && !contracts.loading && <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="条" />}
     </div>
     {deleteTarget && <div className="ops-confirm-backdrop" role="presentation"><div className="ops-confirm" role="alertdialog" aria-modal="true" aria-labelledby="contract-delete-title"><h2 id="contract-delete-title">删除合同 {deleteTarget.no}?</h2><p>删除请求提交服务端判定:被订阅或工单引用的合同不会被删除。此操作无法撤销。</p><div><Button variant="outline" onClick={() => setDeleteId(null)}>取消</Button><Button variant="destructive" disabled={deleting} onClick={removeContract}>{deleting ? "正在删除…" : "确认删除"}</Button></div></div></div>}
     {failure && <p className="ops-form-error" role="alert">{failure}</p>}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
klt-bos-web/src/pages/ContractRecordPage.tsx


+ 11 - 18
klt-bos-web/src/pages/CustomerManagementPages.tsx

@@ -23,7 +23,6 @@ import { Input } from "../components/ui/input";
 import { TreeSelect } from "../components/ui/tree-select";
 import { OpsDrawer, OpsNotice, OpsStatus, OpsTag, OpsTableEmpty, OpsTableColumns } from "../components/OperationsKit";
 import { Tri } from "../components/triState";
-import { FetchError } from "../components/fetchError";
 import { matchesRegionPath, regionPathTree } from "../lib/region-tree";
 import { useLoad } from "../lib/useLoad";
 import { ApiError } from "../lib/api/http";
@@ -80,14 +79,7 @@ function Toolbar({ search, onSearch, children }: { search: string; onSearch: (va
   </div>;
 }
 
-function Empty({ reset }: { reset: () => void }) {
-  return <div className="ops-empty"><Search size={27} /><h3>没有匹配的记录</h3><p>调整筛选条件或搜索关键词后再试。</p><Button variant="ghost" size="sm" onClick={reset}>重置筛选</Button></div>;
-}
 
-function LoadFail({ error, onRetry }: { error: ApiError | null; onRetry?: () => void }) {
-  if (!error) return null;
-  return <FetchError message={error.message} onRetry={onRetry} />;
-}
 
 /** 导出回执落盘:优先 `content_base64`,其次 `download_url`;两者都⛔ 下发时返回 false。 */
 function saveExport(result: ExportResult | null): boolean {
@@ -159,7 +151,7 @@ export function CustomerManagementPage() {
       <div><KeyRound size={18} /><p>系统不保存初始密码:建档后生成一次性激活码,由运营导出后线下交付客户,客户凭码自设密码。</p></div>
     </div></details>
     <div className="ops-list-shell">
-      <LoadFail error={list.error} onRetry={directory.reload} />
+
       <Toolbar search={search} onSearch={setSearch}>
         <TreeSelect icon={<FilterIcon kind="region" />} ariaLabel="区域筛选" treeData={regionTree} value={region} onChange={setRegion} clearable placeholder="全部区域" />
         <FilterSelect icon="operator" aria-label="运营商筛选" value={operator} onChange={(event) => setOperator(event.target.value)}><option value="">全部运营商</option>{operators.map((item) => <option key={item}>{item}</option>)}</FilterSelect>
@@ -174,8 +166,9 @@ export function CustomerManagementPage() {
         <td><span className="ops-money">{item.activatedAt ? d(item.activatedAt) : <Tri tone="missing" text={MISSING} />}</span></td>
         <td><StatusCell status={item.status} tone="missing" /></td>
         <td><button type="button" className="ops-table-action" aria-label={`查看${item.name ?? item.id}详情`} onClick={() => setSelectedId(item.id)}>详情</button></td>
-      </tr>)}</tbody></table></div>
-      {!filtered.length && !directory.loading && <Empty reset={reset} />}
+      </tr>)}{(list.error || !filtered.length) && <OpsTableEmpty colSpan={7} kind={list.error ? "error" : directory.loading ? "loading" : "empty"} details={list.error?.message} onRetry={list.error ? directory.reload : undefined}>
+        {list.error ? "客户档案加载失败" : directory.loading ? "正在加载客户档案…" : hasFilter ? "没有符合筛选条件的客户档案" : "暂无客户档案"}
+      </OpsTableEmpty>}</tbody></table></div>
     </div>
     {selected && <CustomerDetail item={selected} onClose={() => setSelectedId(null)} />}
   </section>;
@@ -361,7 +354,7 @@ export function ImportBatchPage() {
   return <section className="ops-page ops-page--imports page-fill">
     <header className="ops-heading"><div><p className="ops-eyebrow"><span /> IMPORT BATCHES / 客户与订阅</p><h1>批量导入</h1><PageIntro>用模板一次录入多家客户,导入后按批次核对成功和失败记录。</PageIntro></div><div className="ops-head-actions"><Button variant="outline" onClick={() => void downloadTemplate()}><Download size={16} />下载导入模板</Button>{canImportWrite ? <Button onClick={() => setFlow({ mode: "new" })}><Upload size={16} />批量导入客户</Button> : <p className="ops-import-note" role="status">{IMPORT_DENY}</p>}</div></header>
     <div className="ops-list-shell list-shell-fill">
-      <LoadFail error={list.error} onRetry={list.reload} />
+
       <Toolbar search={search} onSearch={(value) => { setSearch(value); paging.resetPage(); }}>
         <FilterSelect icon="status" aria-label="批次状态筛选" value={status} onChange={(event) => { setStatus(event.target.value); paging.resetPage(); }}><option value="">全部状态</option>{statusOptions.map((item) => <option key={item}>{item}</option>)}</FilterSelect>
         {hasFilter && <Button variant="ghost" size="sm" onClick={reset}>重置筛选</Button>}
@@ -373,9 +366,10 @@ export function ImportBatchPage() {
         <td><div className="ops-import-count"><strong>{item.ok ?? <Tri tone="missing" text={MISSING} />} 成功</strong><span>{item.fail ?? <Tri tone="missing" text={MISSING} />} 失败</span></div><div className="ops-import-meter" role="img" aria-label={`成功 ${item.ok ?? 0} 行,失败 ${item.fail ?? 0} 行`}><i style={{ width: `${item.total && item.ok !== null ? item.ok / item.total * 100 : 0}%` }} /></div></td>
         <td>{item.status ? <OpsStatus tone={importBatchToneOf(item.status)}>{item.status}</OpsStatus> : <Tri tone="missing" text={MISSING} />}</td>
         <td><div className="ops-inline-actions"><button type="button" onClick={() => setSelectedId(item.id)}>详情</button></div></td>
-      </tr>)}</tbody></table></div>
-      <ListPager total={filtered.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="条" />
-      {!filtered.length && !list.loading && <Empty reset={reset} />}
+      </tr>)}{(list.error || !filtered.length) && <OpsTableEmpty colSpan={6} kind={list.error ? "error" : list.loading ? "loading" : "empty"} details={list.error?.message} onRetry={list.error ? list.reload : undefined}>
+        {list.error ? "导入批次加载失败" : list.loading ? "正在加载导入批次…" : hasFilter ? "没有符合筛选条件的导入批次" : "暂无导入批次"}
+      </OpsTableEmpty>}</tbody></table></div>
+      {!list.error && !list.loading && <ListPager total={filtered.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="条" />}
     </div>
     {selected && <BatchDetailDialog item={selected} canWrite={canImportWrite} onClose={() => setSelectedId(null)} onResume={() => { const batch = selected; setSelectedId(null); setFlow({ mode: "resume", batch }); }} onReload={refreshLedger} />}
     {flow && canImportWrite && <ImportBatchFlow resume={flow.mode === "resume" ? flow.batch : null} onClose={() => { refreshLedger(); setFlow(null); }} onDone={() => { refreshLedger(); setFlow(null); }} onTemplate={() => void downloadTemplate()} />}
@@ -670,17 +664,16 @@ function BatchDetailDialog({ item, canWrite, onClose, onResume, onReload }: {
   return <div className="ops-confirm-backdrop" role="presentation" onMouseDown={onClose}>
     <div className="ops-batch-dialog" role="dialog" aria-modal="true" aria-labelledby="batch-detail-title" onMouseDown={(event) => event.stopPropagation()}>
       <header><div><p>导入批次 / 批次详情</p><h2 id="batch-detail-title">{view.batchNo ?? view.id}</h2></div><Button variant="ghost" size="icon" aria-label="关闭" onClick={onClose}><X size={18} /></Button></header>
-      <div className="ops-batch-dialog-body">{error && <p role="alert" className="ops-form-error">{error}</p>}
+      <div className="ops-batch-dialog-body">
         {exportHint && <p role="status" className="ops-form-error">{exportHint}</p>}
         <p className="ops-import-note">批次 id <code>{view.id}</code> · 文件 {view.file ?? <Tri tone="missing" text={MISSING} title={`${MISSING}:本批次未回 file_name(历史批次或提交时未传)`} />} · 导入人 {view.importer ?? <Tri tone="missing" text={MISSING} />} · {view.createdAt ? d(view.createdAt) : <Tri tone="missing" text={MISSING} />} · 总 {view.total ?? <Tri tone="missing" text={MISSING} />} 行,成功 {view.ok ?? <Tri tone="missing" text={MISSING} />} 行、失败 {view.fail ?? <Tri tone="missing" text={MISSING} />} 行 · 状态 {view.status ? <OpsStatus tone={importBatchToneOf(view.status)}>{view.status}</OpsStatus> : <Tri tone="missing" text={MISSING} />}</p>
         {statusCounts.length > 0 && <p className="ops-import-note">校验态分布:{statusCounts.map((s) => `${s.validate_status} ${s.count}`).join(" / ")}</p>}
-        {!polls && !shownRows && <p className="ops-import-note">行级明细加载中…</p>}
         <div className="ops-table-wrap"><table className="ops-table" style={{ minWidth: 560 }}><thead><tr><th>行编号</th><th>校验态</th><th>业务号</th><th>说明</th></tr></thead><tbody>{(shownRows ?? []).map((row) => <tr key={row.no}>
           <td><span className="ops-mono">{row.no}</span></td>
           <td>{row.status ? <OpsStatus tone={row.ok ? "success" : "danger"}>{row.status}</OpsStatus> : <Tri tone="missing" text={MISSING} />}</td>
           <td>{row.businessId ? <span className="ops-mono" title="行明细 business_id(建档后的客户主体号),用于收窄导出账号范围">{row.businessId}</span> : <Tri tone="missing" text={MISSING} title={row.ok ? "该行已导入但未下发 business_id" : "未建档成功的行无客户主体号"} />}</td>
           <td className="ops-detail-note-cell">{row.reason ?? (row.ok ? (row.status === "已导入" ? "已导入" : "校验通过") : "无失败原因")}</td>
-        </tr>)}{!shownRows?.length && <OpsTableEmpty colSpan={4}>{error ? "行级明细取数失败。" : "后端未回行级明细。"}</OpsTableEmpty>}</tbody></table></div>
+        </tr>)}{(error || !shownRows?.length) && <OpsTableEmpty colSpan={4} kind={error ? "error" : !detail ? "loading" : "empty"} details={error || undefined} onRetry={error ? () => { setError(""); setPolls((n) => n + 1); } : undefined}>{error ? "导入批次行明细加载失败" : !detail ? "正在读取导入明细…" : "该批次暂无行明细"}</OpsTableEmpty>}</tbody></table></div>
         <p className="ops-import-note">行级明细来自 <code>POST /import_batch/get@v1</code>(不回传原始 14 列,只给校验态与错误清单)。续传按原行编号覆盖重导;批次不删除、不撤销。激活码清单按行明细下发的客户主体号,经 <code>/account/get_list@v1</code> 收窄账号范围后由 <code>/import_batch/export_codes@v1</code> 导出。</p>
         {codesDone && <p className="ops-import-note" role="status">{codesDone}</p>}
         {codes && <>

+ 5 - 7
klt-bos-web/src/pages/CustomerOrdersPage.tsx

@@ -1,3 +1,4 @@
+import { OpsTableEmpty } from "../components/OperationsKit";
 import { useBusinessView } from "../lib/use-business-view";
 import { useState, type ReactNode } from "react";
 import { ArrowLeft, ArrowRight, CalendarPlus, PencilLine, Plus, RefreshCw, Trash2 } from "lucide-react";
@@ -71,8 +72,6 @@ export function CustomerOrdersPage() {
   const [notice, setNotice] = useState("");
   const paging = useLocalPage(listTotal, LIST_PAGE_SIZE, listPage);
   const pageRows = rows;
-  if (orders.loading) return <section className="ops-page"><Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link><div className="ops-empty"><h1>正在从订阅接口读取该客户的订阅…</h1></div></section>;
-  if (orders.error) return <section className="ops-page"><Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link><div className="ops-empty"><h1>订阅取数失败</h1><p role="alert">{orders.error.message}</p><Button variant="ghost" size="sm" onClick={() => orders.reload()}>重试</Button></div></section>;
   const active = Number(activeProbe.data?.total ?? 0);
   /** 「分账号额度」汇总=本页订阅行 `quota_slots` 之和(全量汇总需另口;本页如实标本页)。 */
   const quotaRows = rows.filter((item) => typeof item.quotaSlots === "number");
@@ -97,14 +96,14 @@ export function CustomerOrdersPage() {
 
   return <section className="ops-page customer-sub-page page-fill">
     <Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link>
-    <header className="ops-heading"><div><h1>套餐订阅管理</h1><p>{customerName ?? cell(rows[0]?.customer)} · {customerId}</p></div>{!view.readOnly && <Button onClick={() => setContext({ mode: "new" })}><Plus size={16} />新增订阅</Button>}</header>
+    <header className="ops-heading"><div><h1>套餐订阅管理</h1><p>{customerName ?? cell(rows[0]?.customer)} · {customerId}</p></div>{!view.readOnly && !orders.error && !orders.loading && <Button onClick={() => setContext({ mode: "new" })}><Plus size={16} />新增订阅</Button>}</header>
     <div className="customer-sub-overview"><div><span>客户账户</span>{profile
       ? <OpsStatus tone={profile.acct_status === "in_use" || profile.acct_status === "normal" ? "success" : profile.acct_status === "stopped" || profile.acct_status === "disabled" ? "danger" : "warning"}>{label(ACCT_STATUS, profile.acct_status)}</OpsStatus>
       : account.error
         ? <Tri tone="fail" text={WORD_FETCH_FAILED} title={`/customer/get@v1 取数失败:${account.error.message}`} />
         : account.loading
           ? <span className="ops-muted">读取中…</span>
-          : <Tri tone="missing" text={WORD_UNCONFIGURED} title="客户档案未关联到该客户主键(后端回 null)" />}</div><div><span>全部订阅</span><strong>{listTotal}</strong></div><div><span>生效中</span><strong>{active}</strong></div><div><span>分账号额度</span><strong title="本页订阅 quota_slots 之和">{quotaSummary}</strong></div>{profile && <Link className="ops-card-link" to={`/customers/${profile.customer_id}`} state={outgoingState}>查看客户档案 <ArrowRight size={15} /></Link>}</div>
+          : <Tri tone="missing" text={WORD_UNCONFIGURED} title="客户档案未关联到该客户主键(后端回 null)" />}</div><div><span>全部订阅</span><strong>{orders.data ? listTotal : "—"}</strong></div><div><span>生效中</span><strong>{activeProbe.data ? active : "—"}</strong></div><div><span>分账号额度</span><strong title="本页订阅 quota_slots 之和">{quotaSummary}</strong></div>{profile && <Link className="ops-card-link" to={`/customers/${profile.customer_id}`} state={outgoingState}>查看客户档案 <ArrowRight size={15} /></Link>}</div>
     <div className="ops-list-shell list-shell-fill">
 <div ref={tableOverflow.ref} className={`measured-table-scroll ops-table-wrap${tableOverflow.overflow ? " has-horizontal-overflow" : ""}`}><table className="ops-table customer-sub-table"><colgroup>{Array.from({ length: 9 }, (_, index) => <col key={index} />)}</colgroup><thead><tr><th>套餐 / 合同 / 订单号</th><th>线路出口</th><th>方式</th><th>状态</th><th>合同期间</th><th>订阅价格</th><th>月结算标准</th><th>实际开通日</th><th>操作</th></tr></thead><tbody>{pageRows.map((item) => {
         const canUpdown = item.statusLabel === "生效中";
@@ -124,9 +123,8 @@ export function CustomerOrdersPage() {
         const visible = shown.filter((action) => action.key === "view");
         const moreItems: OpsMoreItem[] = shown.filter((action) => action.key !== "view").map(({ key, label, icon, onSelect, danger }) => ({ key, label, icon, onSelect, ...(danger ? { title: "删除订阅(服务端按引用关系判定)" } : {}) }));
         return <tr key={item.no}><td title={`${item.planName ?? WORD_UNCONFIGURED} · ${item.contractNo ?? WORD_UNCONFIGURED} · ${item.orderNo ?? "无订单号"}`}><strong>{cell(item.planName)}</strong><small>{cell(item.contractNo)} · {cell(item.orderNo, "无订单号")}</small></td><td title={item.exits?.join("、") ?? ""}>{exitsView(item.exits)}</td><td>{cell(item.modeLabel)}</td><td>{item.statusLabel ? <OpsStatus tone={statusTone(item.statusLabel)}>{item.statusLabel}</OpsStatus> : <Tri tone="fail" text={WORD_FETCH_FAILED} title="订阅状态编码未下发" />}{item.replacedBy && <small>已被 {item.replacedBy.subscription_id} 替换</small>}</td><td title={`${item.start ?? WORD_UNCONFIGURED} 至 ${item.end ?? WORD_UNCONFIGURED}`}><strong className="customer-sub-date">{cell(item.start)}</strong><small>至 {cell(item.end)}</small></td><td><strong>{moneyView(item.annual, true)}</strong></td><td>{moneyView(item.settle)}</td><td title={item.openedOn ?? WORD_NOT_OPENED}><span className="customer-sub-date">{item.openedOn === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : item.openedOn || <Tri tone="missing" text={WORD_NOT_OPENED} />}</span></td><td><div className="ops-inline-actions">{visible.map((action) => <button key={action.key} type="button" className={[action.danger && "is-danger", action.info && "is-info"].filter(Boolean).join(" ") || undefined} onClick={(event) => { event.stopPropagation(); action.onSelect(); }}>{action.key === "view" ? action.label : <>{action.icon}{action.label}</>}</button>)}<OpsMore items={moreItems} placeholder /></div></td></tr>;
-      })}</tbody></table></div>
-      <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setListPage} unit="条" className="list-pager" />
-      {!rows.length && !orders.loading && <div className="ops-empty"><h3>还没有订阅</h3><p>先为客户登记一份合同,再新增套餐订阅。</p></div>}
+      })}{(orders.error || !rows.length) && <OpsTableEmpty colSpan={9} kind={orders.error ? "error" : orders.loading ? "loading" : "empty"} onRetry={orders.error ? orders.reload : undefined} details={orders.error?.message}>{orders.error ? "客户订阅加载失败" : orders.loading ? "正在读取客户订阅…" : "该客户暂无套餐订阅"}</OpsTableEmpty>}</tbody></table></div>
+      {!orders.error && !orders.loading && <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setListPage} unit="条" className="list-pager" />}
     </div>
     {context && <OrderEditor key={`${context.mode}-${context.record?.no ?? "new"}`} customerId={customerId} customerName={customerName ?? rows[0]?.customer ?? customerId} context={context} onClose={() => setContext(null)} onSaved={(message) => { setContext(null); setNotice(message); setListPage(0); orders.reload(); }} />}
     {confirm && <div className="ops-confirm-backdrop"><div className="ops-confirm" role="alertdialog" aria-modal="true" aria-labelledby="customer-sub-confirm-title"><h2 id="customer-sub-confirm-title">删除订阅?</h2><p>{confirm.planName ?? WORD_UNCONFIGURED} · {confirm.no}。是否可删除由服务端按引用关系判定,页面不自行放行。</p>{deleteBlocked && <p className="ops-form-error" role="alert">{deleteBlocked}</p>}<div><Button variant="outline" onClick={() => { setConfirm(null); setDeleteBlocked(""); }}>取消</Button><Button variant="destructive" disabled={pendingDelete} onClick={removeOrder}>{pendingDelete ? "提交中…" : "确认删除"}</Button></div></div></div>}

+ 5 - 4
klt-bos-web/src/pages/CustomerRecordsPages.tsx

@@ -10,7 +10,6 @@
  */
 import { FilterIcon, FilterSelect } from "../components/ui/filter-select";
 import { PageIntro } from "../components/PageIntro";
-import { FetchError } from "../components/fetchError";
 import { useCallback, useEffect, useMemo, useRef, useState } from "react";
 import { ArrowLeft, Download, Plus, Search, Trash2 } from "lucide-react";
 import { Link, Navigate, useLocation, useNavigate, useParams, useSearchParams } from "react-router";
@@ -245,7 +244,6 @@ export function CustomerListPage() {
   const missingCount = records.filter((item) => !item.name).length;
   const listFailed = Boolean(directory.error);
   return <section className="ops-page ops-page--customers page-fill page-fill-window">{back.to !== "/customers" && <Link className="ops-back-link self-start" to={back.to} state={back.state}><ArrowLeft size={16} aria-hidden="true" />{back.label}</Link>}<header className="ops-heading"><div><h1>{view.customerListTitle}</h1><PageIntro>{view.readOnly ? "从客户归属入手,查清负责范围内每家客户的服务情况。" : "登记客户主体和业务归属,后续可从客户档案追查合同和订阅。"}</PageIntro></div>{!view.readOnly && <div className="customer-list-actions"><Button variant="outline" onClick={() => setClaimExport(true)}><Download size={16} />导出激活码</Button><Button onClick={() => navigate("/customers/new", { state: listState })}><Plus size={16} />新增客户</Button></div>}</header>
-    {listFailed && <FetchError message={directory.error?.message ?? FAILED} onRetry={directory.reload} />}
     {missingCount > 0 && <p className="ops-import-note">其中 {missingCount} 家客户在 <code>POST /customer/get_list@v1</code> 回执里客户名称为空,对应单元格标「{MISSING}」(本页不逐行补调 <code>/customer/get@v1</code>)。</p>}
     <div className="ops-list-shell list-shell-fill">
       <div className="ops-toolbar customer-list-filters">
@@ -275,8 +273,11 @@ export function CustomerListPage() {
           <td>{item.status ? <OpsStatus tone={tone}>{item.status}</OpsStatus> : <Tri tone="missing" text={MISSING} />}</td>
           <td><div className="ops-inline-actions"><button type="button" onClick={() => navigate(`/customers/${encodeURIComponent(item.id)}`, { state: listState })}>详情</button>{canDeleteCustomer && <button type="button" className="is-danger" disabled={!item.name} title={item.name ? "删除客户(仅总运营/运营主账号;引用拦截由服务端前置检查判定)" : `${MISSING}:未取到客户名称`} onClick={() => { setDeleteId(item.id); setDeleteName(""); }}><Trash2 size={14} />删除</button>}</div></td>
         </tr>;
-      })}{!pageRows.length && directory.loading && <OpsTableEmpty colSpan={8}>客户档案加载中…</OpsTableEmpty>}{!pageRows.length && !directory.loading && <OpsTableEmpty colSpan={8}>{listFailed ? "客户档案取数失败。" : hasFilters ? "没有符合筛选条件的数据" : "暂无数据"}</OpsTableEmpty>}</tbody></table></div>
-      <ListPager total={listTotal} page={safePage} pageSize={LIST_PAGE_SIZE} onPageChange={setPage} unit="家" />
+      })}{(listFailed || !pageRows.length) && <OpsTableEmpty colSpan={8} kind={listFailed ? "error" : directory.loading ? "loading" : "empty"}
+        details={directory.error?.message} onRetry={listFailed ? directory.reload : undefined} busy={directory.loading}>
+        {listFailed ? "客户档案加载失败" : directory.loading ? "正在加载客户档案…" : hasFilters ? "没有符合筛选条件的客户" : "暂无客户档案"}
+      </OpsTableEmpty>}</tbody></table></div>
+      {!listFailed && !directory.loading && <ListPager total={listTotal} page={safePage} pageSize={LIST_PAGE_SIZE} onPageChange={setPage} unit="家" />}
     </div>
     {/* D-86:⛔ 导出成功即卸载弹窗——明文只随应答回显一次,弹窗一关就永久丢失,
         用户连清单(与下载入口)都看不到。清单留在弹窗内,关闭只由用户点「取消/关闭」触发。 */}

+ 6 - 7
klt-bos-web/src/pages/CustomerSelfServicePages.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 /**
  * 客户自助侧页面(第 3 册 6.13 / 6.14)—— 真源=klt-bos。
  *
@@ -95,10 +96,9 @@ export function CustomerPlanPage() {
       </nav>}
     </header>
 
-    {board.error ? <FetchError message={board.error.message} onRetry={board.reload} />
-      : !data || !sections ? <div className="ops-list-shell portal-plan-state" role="status">
-        {board.loading ? "正在读取套餐…" : "暂未取到套餐数据,请稍后重试或联系运营对接人。"}
-        {!board.loading && <Button type="button" size="sm" variant="outline" onClick={board.reload}>重试</Button>}
+    {board.error || !data || !sections ? <div className="ops-list-shell portal-plan-state">
+        <TableState kind={board.loading && !board.error ? "loading" : "error"} details={board.error?.message}
+          onRetry={board.loading ? undefined : board.reload}>{board.loading ? "正在读取套餐…" : "套餐明细加载失败"}</TableState>
       </div> : <div className="portal-plan-sheet">
         {sections.map(({ id, title, rows, empty, icon: Icon }) => (
           <section key={id} id={id} className="portal-plan-ledger" aria-labelledby={`${id}-title`}>
@@ -234,7 +234,6 @@ export function CustomerAccountsPage() {
         {query && <Button variant="ghost" size="sm" onClick={() => search("")}>重置筛选</Button>}
         <Link className="ops-table-action portal-accounts-plan-link" to="/workspace/plan">查看我的套餐<ArrowRight size={15} /></Link>
       </div>
-      {state.error && <FetchError message={state.error.message} onRetry={state.reload} />}
       <div
         ref={tableOverflow.ref}
         tabIndex={0}
@@ -265,11 +264,11 @@ export function CustomerAccountsPage() {
                 </div></td>
               </tr>
             ))}
-            {!rows.length && <OpsTableEmpty colSpan={6}>{state.loading ? "正在读取分账号…" : state.error ? "分账号读取失败,请重试。" : query ? "没有找到匹配的分账号,请调整搜索条件。" : "暂无下属分账号"}</OpsTableEmpty>}
+            {(state.error || !rows.length) && <OpsTableEmpty colSpan={6} kind={state.error ? "error" : state.loading ? "loading" : "empty"} onRetry={state.error ? state.reload : undefined} details={state.error?.message} busy={state.loading}>{state.loading ? "正在读取分账号…" : state.error ? "分账号读取失败,请重试。" : query ? "没有找到匹配的分账号,请调整搜索条件。" : "暂无下属分账号"}</OpsTableEmpty>}
           </tbody>
         </table>
       </div>
-      <ListPager total={total} page={safePage} pageSize={pageSize} onPageChange={setPage} onPageSizeChange={(size) => { setPageSize(size); setPage(0); }} unit="个" />
+      {!state.error && !state.loading && <ListPager total={total} page={safePage} pageSize={pageSize} onPageChange={setPage} onPageSizeChange={(size) => { setPageSize(size); setPage(0); }} unit="个" />}
     </section>
 
     {editing && <OpsDialog title="修改使用人姓名" onClose={() => { if (!busy) setEditing(null); }} className="portal-account-dialog">

+ 13 - 12
klt-bos-web/src/pages/CustomerTicketPages.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 /**
  * 门户提交工单(册 5 §6.2;enterprise 主账号/sub 下属分账号)。
  *
@@ -23,7 +24,7 @@ import { TicketState } from "../components/ticketState";
 import { TicketStatusTag, TicketTypeTag } from "../components/work-order/TicketBadges";
 import { PageIntro } from "../components/PageIntro";
 import { WorkspaceEmpty } from "../components/RoleWorkspaceKit";
-import { OpsDialog, OpsNotice, OpsTableColumns } from "../components/OperationsKit";
+import { OpsDialog, OpsNotice, TableStateRow, OpsTableColumns } from "../components/OperationsKit";
 import { useDemoIdentity } from "../lib/demo-session";
 import { detailLinkState } from "../lib/detail-navigation";
 import { classifyTicketError, fmtTime, TICKET_PAGE_SIZE, useTicketDetail, useTicketList } from "../lib/ticket";
@@ -277,6 +278,14 @@ function CustomerTicketProgressLedger() {
     counts.reload();
   }
 
+  const listState = list.loading ? <TableState kind="loading">正在读取工单…</TableState>
+          : fail ? <TicketState listTitle="客户工单" fail={fail} onRetry={list.reload} />
+          : !rows.length ? <TableState>
+            {filtered ? "没有匹配的工单" : "暂无工单"}
+            {filtered
+              ? <Button variant="ghost" size="sm" onClick={() => setSearchParams(new URLSearchParams())}>重置筛选</Button>
+              : <Link className="ops-table-action" to="/workspace/submit">提交故障或售后<ArrowRight size={14} aria-hidden="true" /></Link>}
+          </TableState> : null;
   return <section className="order-page work-order-ledger customer-ticket-progress page-fill page-fill-window">
     <header className="order-heading">
       <div>
@@ -328,18 +337,10 @@ function CustomerTicketProgressLedger() {
         aria-label="我的工单列表,可横向滚动查看字段"
         tabIndex={0}
       >
-        {list.loading ? <div className="order-empty" role="status">正在读取工单…</div>
-          : fail ? <TicketState fail={fail} onRetry={reloadProgress} />
-          : !rows.length ? <div className="order-empty">
-            {filtered ? <Search size={26} aria-hidden="true" /> : <ClipboardList size={26} aria-hidden="true" />}
-            <h3>{filtered ? "没有匹配的工单" : "暂无工单"}</h3>
-            {filtered
-              ? <Button variant="ghost" size="sm" onClick={() => setSearchParams(new URLSearchParams())}>重置筛选</Button>
-              : <Link className="ops-table-action" to="/workspace/submit">提交故障或售后<ArrowRight size={14} aria-hidden="true" /></Link>}
-          </div> : <table className="order-table order-ledger customer-progress-table">
+        <table className="order-table order-ledger customer-progress-table">
             <OpsTableColumns widths={[250, 112, 122, 100, 115, 132, 132, 155]} />
             <thead><tr>{["事项 / 工单号", "类型", "状态", "提交方", "要求完成", "竣工时间", "提交时间", "操作"].map((column) => <th key={column} scope="col">{column}</th>)}</tr></thead>
-            <tbody>{rows.map((item) => {
+            <tbody>{listState ? <TableStateRow colSpan={8}>{listState}</TableStateRow> : rows.map((item) => {
               const submitterType = item.submitter_type ?? submitterById[item.ticket_id] ?? null;
               const gate = customerLiveTicketActions({ status: item.status, ticket_type: item.ticket_type, submitter_type: submitterType });
               const actionLabel = gate.confirmClose ? "确认关闭" : gate.withdraw ? "撤回" : "办理";
@@ -365,7 +366,7 @@ function CustomerTicketProgressLedger() {
                 </div></td>
               </tr>;
             })}</tbody>
-          </table>}
+          </table>
       </div>
       {!list.loading && !fail && <ServerListPager total={total} page={currentPage} pageSize={TICKET_PAGE_SIZE} unit="张" onPageChange={(next) => patchParams({ page: next > 1 ? String(next) : "" })} />}
     </section>

+ 11 - 11
klt-bos-web/src/pages/CustomerWorkspacePage.tsx

@@ -669,9 +669,9 @@ export function CustomerWorkspacePage() {
     </section>
 
     <section className="ops-record-card customer-workspace-panel" id="workspace-service" role="tabpanel" aria-labelledby="customer-tab-subscriptions" hidden={tab !== "subscriptions"}>
-      <div className="ops-table-wrap record-table-scroll" role="region" aria-label="全部订阅列表" tabIndex={0}>{ordersLoad.error ? <div className="ops-empty"><FetchError message={ordersLoad.error.message} onRetry={ordersLoad.reload} /></div> :
+      <div className="ops-table-wrap record-table-scroll" role="region" aria-label="全部订阅列表" tabIndex={0}>
       <table className="ops-table record-subscriptions-table"><OpsTableColumns widths={[170, 90, 90, 110, 130, 170, 80, 110, 90, 80]} /><OpsTableHead columns={["套餐", "类型", "变更类型", "关联订阅", "合同", "服务期限", "分账号", "月缴金额", "状态", "操作"]} />
-        <tbody>{orders.length ? orders.map((sub: any) => {
+        <tbody>{ordersLoad.error ? <OpsTableEmpty colSpan={10} kind="error" details={ordersLoad.error.message} onRetry={ordersLoad.reload}>客户订阅加载失败</OpsTableEmpty> : orders.length ? orders.map((sub: any) => {
         const row = orderView(sub);
         const rowStatus = sub.status_display?.label ?? row.statusLabel;
         const statusText = sub.status_display?.label ?? sub.status;
@@ -697,14 +697,14 @@ export function CustomerWorkspacePage() {
             <OpsMore items={orderMore} placeholder />
           </div></td>
         </tr>;
-      }) : <OpsTableEmpty colSpan={10}>{ordersLoad.loading ? missingValue(READING) : missingValue("该客户暂无套餐订阅记录")}</OpsTableEmpty>}</tbody>
-      </table>}</div>
-      <ListPager total={ordersTotal} page={safeOrdersPage} pageSize={ordersPageSize} onPageChange={setOrdersPage} onPageSizeChange={(size) => { setOrdersPageSize(size); setOrdersPage(0); }} unit="条" />
+      }) : <OpsTableEmpty colSpan={10} kind={ordersLoad.loading ? "loading" : "empty"}>{ordersLoad.loading ? READING : "该客户暂无套餐订阅记录"}</OpsTableEmpty>}</tbody>
+      </table></div>
+      {!ordersLoad.error && !ordersLoad.loading && <ListPager total={ordersTotal} page={safeOrdersPage} pageSize={ordersPageSize} onPageChange={setOrdersPage} onPageSizeChange={(size) => { setOrdersPageSize(size); setOrdersPage(0); }} unit="条" />}
     </section>
 
     <section className="ops-record-card customer-workspace-panel" id="customer-panel-subaccounts" role="tabpanel" aria-labelledby="customer-tab-subaccounts" hidden={tab !== "subaccounts"}>
       <div className="ops-table-wrap record-table-scroll" role="region" aria-label="分账号列表" tabIndex={0}><table className="ops-table record-accounts-table"><OpsTableColumns widths={[60, 130, 110, 170, 90, 110, 110, 80]} /><OpsTableHead columns={["序号", "账号名", "姓名", "网络侧账号名", "账号状态", "开通日", "停用日", "操作"]} />
-        <tbody>{accounts.error ? <tr><td colSpan={8}><Tri tone="fail" text="取数失败" title={accounts.error.message} /></td></tr>
+        <tbody>{accounts.error ? <OpsTableEmpty colSpan={8} kind="error" details={accounts.error.message} onRetry={accounts.reload}>客户分账号加载失败</OpsTableEmpty>
           : accountRows.length ? accountRows.map((row, index) => <tr key={row.sub_account_id}>
             <td className="table-number">{safeAccountsPage * accountsPageSize + index + 1}</td>
             {/* 三态(巡检 P1-D2):未开通/已停用的席位没有账号名属正常态,⛔ 标「后端未下发」。 */}
@@ -730,10 +730,10 @@ export function CustomerWorkspacePage() {
             <td><TextCell value={row.created_at} /></td>
             <td>{row.stopped_at ? <TextCell value={row.stopped_at} /> : missingValue("—(未停用)")}</td>
             <td><Button variant="ghost" onClick={() => openSub(row)}>编辑</Button></td>
-          </tr>) : <OpsTableEmpty colSpan={8}>{accounts.loading ? missingValue(READING) : missingValue("该客户暂无分账号")}</OpsTableEmpty>}
+          </tr>) : <OpsTableEmpty colSpan={8} kind={accounts.loading ? "loading" : "empty"}>{accounts.loading ? READING : "该客户暂无分账号"}</OpsTableEmpty>}
         </tbody>
       </table></div>
-      <ListPager total={accountsTotal} page={safeAccountsPage} pageSize={accountsPageSize} onPageChange={setAccountsPage} onPageSizeChange={(size) => { setAccountsPageSize(size); setAccountsPage(0); }} unit="个" />
+      {!accounts.error && !accounts.loading && <ListPager total={accountsTotal} page={safeAccountsPage} pageSize={accountsPageSize} onPageChange={setAccountsPage} onPageSizeChange={(size) => { setAccountsPageSize(size); setAccountsPage(0); }} unit="个" />}
       <p className="customer-form-note">网络侧账号名由客户提供,仅用于与本系统账号对照,系统不为其做唯一性或格式校验。分账号的开通与停发:{MISSING} —— <code>/sub_account/*</code> 只有读列表与改姓名两个口,无新增与删除路由。</p>
     </section>
 
@@ -803,16 +803,16 @@ export function CustomerWorkspacePage() {
 
     <section className="ops-record-card customer-workspace-panel" id="customer-panel-history" role="tabpanel" aria-labelledby="customer-tab-history" hidden={tab !== "history"}>
       <div className="ops-table-wrap record-table-scroll" role="region" aria-label="客户历史记录列表" tabIndex={0}><table className="ops-table record-history-table"><OpsTableColumns widths={[150, 140, 320, 150]} /><OpsTableHead columns={["时间", "变更项", "变化前 → 变化后", "操作人"]} />
-        <tbody>{changes.error ? <tr><td colSpan={4}><Tri tone="fail" text="取数失败" title={changes.error.message} /></td></tr>
+        <tbody>{changes.error ? <OpsTableEmpty colSpan={4} kind="error" details={changes.error.message} onRetry={changes.reload}>客户变更记录加载失败</OpsTableEmpty>
           : changeRows.length ? changeRows.map((row, index) => <tr key={`${row.changed_at ?? "h"}-${safeHistoryPage}-${index}`}>
             <td><TextCell value={row.changed_at} /></td>
             <td><TextCell value={row.field_key} /></td>
             <td>{row.old_value || row.new_value ? <div className="ops-change-diff"><span>{row.old_value?.trim() || "(空)"}</span><span>{row.new_value?.trim() || "(已清空)"}</span></div> : <Tri tone="missing" text={MISSING} title={MISSING + ":/customer/history@v1 未回该项的新旧值"} />}</td>
             <td><TextCell value={row.operator} />{row.source ? <><br /><span className="ops-muted">{row.source}</span></> : null}</td>
-          </tr>) : <OpsTableEmpty colSpan={4}>{changes.loading ? missingValue(READING) : missingValue("后端未返回该客户的变更记录")}</OpsTableEmpty>}
+          </tr>) : <OpsTableEmpty colSpan={4} kind={changes.loading ? "loading" : "empty"}>{changes.loading ? READING : "该客户暂无变更记录"}</OpsTableEmpty>}
         </tbody>
       </table></div>
-      <ListPager total={historyTotal} page={safeHistoryPage} pageSize={historyPageSize} onPageChange={setHistoryPage} onPageSizeChange={(size) => { setHistoryPageSize(size); setHistoryPage(0); }} unit="条" />
+      {!changes.error && !changes.loading && <ListPager total={historyTotal} page={safeHistoryPage} pageSize={historyPageSize} onPageChange={setHistoryPage} onPageSizeChange={(size) => { setHistoryPageSize(size); setHistoryPage(0); }} unit="条" />}
     </section>
 
     {/* 交付现状(讨论稿 §7.7):按需挂载——不进该页签就不发 `/delivery/list@v1`。 */}

+ 10 - 16
klt-bos-web/src/pages/FinanceReferencePages.tsx

@@ -47,7 +47,6 @@ import {
   COST_UNSAVED_DISCARD_NOTE,
   costRefBlocked,
 } from "../lib/copy-cost";
-import { FetchError } from "../components/fetchError";
 import { WORD_FETCH_FAILED, WORD_NOT_PROVIDED } from "../lib/api/lockedCopy";
 import { COST_BILLING_UNIT, COST_CATEGORY, COST_CYCLE } from "../lib/api/labels";
 import { boolView, costCellKey, useCostAmounts, useCostItems, type CostComboView, type CostItemView } from "../lib/cost-demo";
@@ -586,13 +585,7 @@ export function CostManagementPage() {
   return <section className="ops-page ops-page--costs page-fill page-fill-window"><header className="ops-heading"><div><h1>成本管理</h1><PageIntro>为不同区域和运营商设定适用的成本金额,作为出账核算的依据。</PageIntro></div></header>
     <div className="ops-list-shell list-shell-fill">
       <div className="ops-tabs" role="tablist" aria-label="成本管理视图"><button role="tab" aria-selected={tab === "definitions"} className={tab === "definitions" ? "active" : ""} onClick={() => setTab("definitions")}>成本项定义 <span>{costItemTotal}</span></button><button role="tab" aria-selected={tab === "amounts"} className={tab === "amounts" ? "active" : ""} onClick={() => setTab("amounts")}>成本金额定义 <span>{allCombos.length}</span></button></div>
-      {tab === "amounts" && amounts.error && <div className="ops-list-heading">
-        <FetchError message={`金额一览取数失败:${amounts.error.message}(失败关闭,下表不回退演示金额)`} onRetry={amounts.reload} className="oss-tri-fail" />
-      </div>}
       {tab === "definitions" ? <>
-        {items.error && <div className="ops-list-heading">
-          <FetchError message={`成本项定义取数失败:${items.error.message}(失败关闭,下表不回退演示定义)`} onRetry={items.reload} className="oss-tri-fail" />
-        </div>}
         <div className="ops-toolbar">
           <label className="ops-search"><Search size={17} /><Input aria-label="搜索成本项" placeholder="输入关键字,例如 带宽" value={query} onChange={(event) => setQuery(event.target.value)} />{query && <button type="button" aria-label="清空搜索" onClick={() => setQuery("")}><X size={15} /></button>}</label>
           <FilterSelect icon="type" aria-label="成本类别筛选" value={kindFilter} onChange={(event) => setKindFilter(event.target.value)}><option value="">全部成本类别</option>{CATEGORY_OPTIONS.map((item) => <option key={item.value} value={item.value}>{item.text}</option>)}</FilterSelect>
@@ -621,8 +614,10 @@ export function CostManagementPage() {
               ? item.referringPlans.map((plan) => <small className="ops-stacked" title={`档位 ID:${plan.id}(按 plan_cost_item.cost_item_id 强引用,改成本项名不断引用)`} key={plan.id}>{plan.name}</small>)
               : <span className="ops-mono table-number" title="后端现算:plan_cost_item 里没有 cost_item_id 指向该成本项的引用行(未被引用 ⇒ 可删除)">0</span>}</td>
           <td>{canEdit ? <div className="ops-inline-actions"><button type="button" onClick={() => startEdit(item)}><PencilLine size={15} />编辑定义</button><OpsResponsiveActions expanded={expanded} items={[{ label: "删除成本项", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, disabled: (item.referringPlans?.length ?? 1) !== 0, title: item.referringPlans === null ? "后端未下发「被套餐档引用」概况,判不了能否删除" : item.referringPlans.length ? `被 ${item.referringPlans.length} 个套餐档引用,先在档位上解除引用` : "未被任何套餐档引用,可删除", onSelect: () => startDelete(item) }]} /></div> : <small className="ops-muted">只读(全局成本项定义由总运营维护)</small>}</td>
-        </tr>; })}{!filtered.length && <OpsTableEmpty colSpan={11}>{items.error ? `成本项定义取数失败:${items.error.message}——失败关闭,下表不回退内置演示定义` : items.loading && !items.data ? "成本项定义取数中…" : !costItemTotal ? "后端未返回任何成本项(cost_item/get_list@v1 total:0)——真实空态,可点上方「新增成本项」落库验证" : "没有符合筛选条件的成本项,可点上方「新增成本项」或重置筛选"}</OpsTableEmpty>}</tbody></>}</CostLedger>
-        <ListPager total={costItemTotal} page={defPage} pageSize={LIST_PAGE_SIZE} onPageChange={setDefPage} />
+        </tr>; })}{(items.error || !filtered.length) && <OpsTableEmpty colSpan={11} kind={items.error ? "error" : items.loading ? "loading" : "empty"} details={items.error?.message} onRetry={items.error ? items.reload : undefined}>
+          {items.error ? "成本项加载失败" : items.loading ? "正在读取成本项…" : query || kindFilter ? "没有符合筛选条件的成本项" : "暂无成本项"}
+        </OpsTableEmpty>}</tbody></>}</CostLedger>
+        {!items.error && !items.loading && <ListPager total={costItemTotal} page={defPage} pageSize={LIST_PAGE_SIZE} onPageChange={setDefPage} />}
       </> : panelBlocked ? <div className="ops-empty" role="alert"><h1>成本金额暂不可用</h1><p>{panelBlocked}(KLT-E004 · no_province)</p></div> : <>
         <div className="ops-toolbar">
           <FilterSelect icon="region" aria-label="一览表省份筛选" value={matrixProvince} onChange={(event) => changeMatrixProvince(event.target.value)}><option value="">全部省份</option>{provinceNodes.map((region) => <option key={region.id} value={region.id}>{region.name}</option>)}</FilterSelect>
@@ -631,14 +626,14 @@ export function CostManagementPage() {
           {amounts.data && !amounts.error && !amounts.data.available && <p className="ops-form-error" role="alert">后端金额一览 available:false:{AMOUNT_UNAVAILABLE_NOTE}(明细 {amounts.data.rowsTotal} 行、其中 {amounts.data.unattributedTotal} 行缺省份/运营商轴)⇒ 下表金额格一律标「后端未下发」,不得写成「空数据」或 0。</p>}
           <div className="ops-toolbar-end">{canEdit ? <Button onClick={() => openAmountForm("new")}><Plus size={16} />新增运营商成本</Button> : <span className="ops-muted">只读(金额由总运营维护)</span>}</div>
         </div>
-        <CostLedger key="matrix" kind="matrix" count={costItems.length}><thead><tr><th>省份</th><th>运营商</th>{costItems.map((item) => <th key={item.id}>{item.name}<small>({item.calc.pending ? WORD_NOT_PROVIDED : item.calc.text})</small></th>)}<th>命中客户</th><th>摊销额合计(元 / 月)</th><th>操作</th></tr></thead><tbody>{matrixPageRows.map((row) => { const pivotRow = amounts.data?.combos.find((cell) => cell.provinceNodeId === row.provinceId && cell.operatorId === row.operatorId); const configured = isComboConfigured(row.provinceId, row.operatorId); return <tr key={row.key}>
+        <CostLedger key="matrix" kind="matrix" count={costItems.length}><thead><tr><th>省份</th><th>运营商</th>{costItems.map((item) => <th key={item.id}>{item.name}<small>({item.calc.pending ? WORD_NOT_PROVIDED : item.calc.text})</small></th>)}<th>命中客户</th><th>摊销额合计(元 / 月)</th><th>操作</th></tr></thead><tbody>{amounts.error && <OpsTableEmpty colSpan={costItems.length + 5} kind="error" details={amounts.error.message} onRetry={amounts.reload}>成本金额加载失败</OpsTableEmpty>}{matrixPageRows.map((row) => { const pivotRow = amounts.data?.combos.find((cell) => cell.provinceNodeId === row.provinceId && cell.operatorId === row.operatorId); const configured = isComboConfigured(row.provinceId, row.operatorId); return <tr key={row.key}>
           <td><strong>{provinceNameOf(row.provinceId)}</strong></td>
           <td>{operatorNameOf(row.operatorId)}</td>
           {costItems.map((item) => <td key={item.id}>{amountCell(item.id, pivotRow)}</td>)}
           <td title="该省(含下级)归属该运营商的客户数,由后端 customer/get_list 按可见范围现算">{hitCountCell(row.key)}</td>
           <td>{rowTotal(pivotRow)}</td>
           <td>{!canEdit ? <small className="ops-muted">只读</small> : <div className="ops-inline-actions"><button type="button" onClick={() => openAmountForm(configured ? "edit" : "new", { regionId: row.provinceId, operatorId: row.operatorId })}><PencilLine size={15} />{configured ? "编辑金额" : "录入金额"}</button></div>}</td>
-        </tr>; })}{!matrixRows.length && <OpsTableEmpty colSpan={costItems.length + 5}>{!allCombos.length ? "第 1 册档案里没有「可见省份下的在册运营商」,可配组合为空——不造组合行" : "没有符合当前筛选的「省份 × 运营商」组合,把上方下拉改回「全部省份 / 全部运营商」即可"}</OpsTableEmpty>}</tbody></CostLedger>
+        </tr>; })}{!amounts.error && !matrixRows.length && <OpsTableEmpty colSpan={costItems.length + 5}>{!allCombos.length ? "暂无可配置成本金额的运营商" : "没有符合筛选条件的区域与运营商组合"}</OpsTableEmpty>}</tbody></CostLedger>
         <ListPager total={matrixRows.length} page={matrixPaging.safePage} pageSize={matrixPaging.pageSize} onPageChange={matrixPaging.setPage} unit="个" />
         {pivotExtras.length > 0 && <p className="ops-muted">后端透视另返回 {pivotExtras.length} 个「省份节点 × 运营商」组合不在当前可见档案范围内(区域/运营商口径不一致),未列入上表。</p>}
       </>}
@@ -801,8 +796,6 @@ export function CorrectionNotesPage() {
       <div><h1>出账更正记录</h1><PageIntro>发现已出账的差错时,在这里登记问题、关联账单,便于日后核查。</PageIntro></div>
       <Button onClick={() => setCreating(true)}><FilePenLine size={15} aria-hidden="true" />登记更正</Button>
     </header>
-    {wiring && <p className="ops-import-note" role="status">{CORRECTION_WIRING_NOTE}</p>}
-    {list.fail && !wiring && <p className="ops-form-error" role="alert">{list.fail.message} <Button variant="ghost" size="sm" onClick={list.reload}>重试</Button></p>}
     <div className="ops-list-shell correction-notes-ledger list-shell-fill">
       <div className="ops-toolbar flex-wrap">
         <label className="ops-search"><Search size={17} /><Input aria-label="搜索错误内容" placeholder="搜索错误内容" value={keyword} onChange={(event) => { setKeyword(event.target.value); setPage(1); }} /></label>
@@ -833,11 +826,12 @@ export function CorrectionNotesPage() {
             <td><span title={item.error_excerpt} className="correction-notes-excerpt">{item.error_excerpt}</span></td>
             <td>{item.operator_name}</td>
             <td><button className="ops-table-action" type="button" onClick={() => setDetailId(item.correction_id)}>详情</button></td>
-          </tr>)}</tbody>
+          </tr>)}{(list.fail || !list.data?.items?.length) && <OpsTableEmpty colSpan={7} kind={list.fail ? "error" : list.loading ? "loading" : "empty"} details={list.fail?.message} onRetry={list.fail && !wiring ? list.reload : undefined}>
+            {wiring ? CORRECTION_WIRING_NOTE : list.fail ? "更正记录加载失败" : list.loading ? "正在读取更正记录…" : hasFilter ? "没有符合条件的更正记录。" : "暂无出账更正记录"}
+          </OpsTableEmpty>}</tbody>
         </table>
-        {!(list.data?.items ?? []).length && <div className="correction-notes-empty">{list.loading ? "更正记录取数中…" : wiring ? `出账更正待后端接线,记录暂不可读(${BACKEND_NOT_WIRED})。` : "没有符合条件的更正记录。"}</div>}
       </div>
-      {!wiring && (
+      {!list.fail && !list.loading && (
         <ServerListPager total={total} page={page} pageSize={pageSize} onPageChange={setPage} />
       )}
     </div>

+ 5 - 15
klt-bos-web/src/pages/JobRunsDialog.tsx

@@ -7,7 +7,7 @@
  */
 import { useMemo, useState, type ReactNode } from "react";
 import { Check, Search, X } from "lucide-react";
-import { OpsDialog, OpsStatus, OpsTableColumns } from "../components/OperationsKit";
+import { OpsDialog, OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
 import { Button } from "../components/ui/button";
 import { FilterSelect } from "../components/ui/filter-select";
 import { Input } from "../components/ui/input";
@@ -32,7 +32,6 @@ import {
   W18E_FROM,
   W18E_TO,
   W19,
-  W20,
   W21_ABNORMAL,
   W21_LAST7,
   W21_RESET,
@@ -149,18 +148,7 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
         </div>
         {/* 平台 R-1(object_keyword 入参)未交付 ⇒ W22 常驻(契约 作业§4.4.6) */}
         <p className="ops-import-note">{W22}</p>
-        {state.error ? (
-          <p className="ops-form-error" role="alert">
-            {W20}:{state.error} <Button size="sm" type="button" variant="outline" onClick={state.reload}>重试</Button>
-          </p>
-        ) : state.annotationMessage ? (
-          <div className="ops-empty">{state.annotationMessage}</div>
-        ) : state.loading && state.runs.length === 0 ? (
-          <p className="ops-empty">正在加载…</p>
-        ) : state.runs.length === 0 ? (
-          <div className="ops-empty">{RUNS_EMPTY}</div>
-        ) : (
-          <div className="ops-list-shell job-runs-list">
+        <div className="ops-list-shell job-runs-list">
             <div className="job-runs-table" role="region" aria-label="执行记录表格" tabIndex={0}>
               <table className="ops-table" role="table" aria-label="执行流水">
                 <OpsTableColumns widths={[17, 16, 11, 17, 17, 13, 9]} />
@@ -176,6 +164,9 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
                   </tr>
                 </thead>
                 <tbody role="rowgroup">
+                  {(state.error || state.annotationMessage || !state.runs.length) && <OpsTableEmpty colSpan={7} kind={state.error ? "error" : state.loading ? "loading" : "empty"} details={state.error ?? undefined} onRetry={state.error ? state.reload : undefined}>
+                    {state.error ? "执行记录加载失败" : state.annotationMessage || (state.loading ? "正在读取执行记录…" : RUNS_EMPTY)}
+                  </OpsTableEmpty>}
                   {state.runs.map((run) => (
                     <RunRow key={run.run_id} run={run} rows={rows} onDetail={() => setDetail(run)} onGoto={(page) => { onClose(); navigate(page, { state: linkState }); }} />
                   ))}
@@ -190,7 +181,6 @@ export function JobRunsDialog({ preset, rows, onClose }: { preset: JobRunsPreset
               </div>
             )}
           </div>
-        )}
       </div>
       {detail && <RoundDialog run={detail} rows={rows} onClose={() => setDetail(null)} />}
     </OpsDialog>

+ 7 - 11
klt-bos-web/src/pages/OrderManagementPage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
 import { PageIntro } from "../components/PageIntro";
 import { OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
@@ -152,14 +153,9 @@ export function OrderManagementPage() {
     : hasCriteria ? "没有符合筛选条件的订阅"
     : expiringOnly ? `没有 ${EXPIRING_SOON_DAYS} 天内到期的订阅`
     : "暂无订阅";
-  const listState = ledger.loading ? <span role="status">正在读取订阅…</span>
-    : ledger.error ? <div role="alert" className="flex flex-col items-center gap-2">
-      <p className="font-medium text-foreground">全部订阅取数失败</p>
-      <p>{ledger.error.message}</p>
-      <Button variant="ghost" size="sm" onClick={() => ledger.reload()}>重试</Button>
-    </div>
-    : !records.length ? <span role="status">{emptyMessage}</span>
-    : null;
+  const kind = ledger.error ? "error" : ledger.loading ? "loading" : "empty";
+  const listState = ledger.error ? "全部订阅取数失败" : ledger.loading ? "正在读取订阅…" : !records.length ? emptyMessage : null;
+  const feedback = { kind, details: ledger.error?.message, onRetry: ledger.error ? ledger.reload : undefined, busy: ledger.loading } as const;
   return <section className="order-page page-fill page-fill-window">
     {back.to !== "/orders" && <Link className="ops-back-link self-start" to={back.to} state={back.state}><ArrowLeft size={16} aria-hidden="true" />{back.label}</Link>}
     <header className="order-heading">
@@ -178,7 +174,7 @@ export function OrderManagementPage() {
         {hasFilter && <Button variant="ghost" size="sm" onClick={resetFilters}>重置筛选</Button>}
       </div>
       <div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="全部订阅,可横向滚动查看字段" className={`measured-table-scroll ops-table-wrap order-table-wrap order-ledger-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="order-table order-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th>企业 / 订阅编号</th><th>套餐与合同</th><th title="运营商订单号=保存时冻结合同外部单号;合同未填或未冻结时显示「—」">运营商订单号</th><th>线路出口</th><th>年订阅价格</th><th>合同周期</th><th>实际开通</th><th>状态</th><th>操作</th></tr></thead><tbody>
-        {listState ? <OpsTableEmpty colSpan={columnWidths.length}>{listState}</OpsTableEmpty> : records.map((item) => {
+        {listState ? <OpsTableEmpty colSpan={columnWidths.length} {...feedback}>{listState}</OpsTableEmpty> : records.map((item) => {
           return <tr key={item.no}>
           <td><strong className="table-cell-title" title={item.customer}>{cell(item.customer)}</strong><small title={item.no}>{cell(item.no)}</small>{item.parentSubscriptionId && <small className="order-parent-mark">叠加于 {item.parentSubscriptionId}</small>}</td>
           <td><div className="order-plan-line"><strong className="table-cell-title" title={item.planName ?? ""}>{cell(item.planName)}</strong>{item.planKindLabel && <OpsStatus tone={item.planKindLabel === "自定义套餐" ? "brand" : "neutral"} title={`套餐类型:${item.planKindLabel}(「套餐类型筛选」的行内依据)`}>{item.planKindLabel}</OpsStatus>}</div><small title={`${item.contractNo ?? ""} · ${item.modeLabel}`}>{item.contractNo === undefined ? <Tri tone="missing" text={WORD_NOT_PROVIDED} title="全部订阅接口不下发 contract_no 口径" /> : cell(item.contractNo)}{item.modeLabel ? ` · ${item.modeLabel}` : ""}</small></td>
@@ -194,8 +190,8 @@ export function OrderManagementPage() {
         </tr>;
         })}
       </tbody></table></div>
-      <div className="order-mobile-list">{listState ? <div className="order-mobile-state">{listState}</div> : records.map((item) => <article key={item.no} className="order-mobile-card"><div><small>{item.no}</small><StatusPill record={item} /></div><h3>{item.customer}</h3><p>{item.planName ?? WORD_UNCONFIGURED} <span>·</span> {item.termLabel || WORD_UNCONFIGURED}</p><dl><div><dt>年订阅价格</dt><dd>{moneyCell(item.annual)}</dd></div><div><dt>合同周期</dt><dd>{dateCell(item.start)} — {dateCell(item.end)}</dd></div></dl><button type="button" onClick={() => openOrder(item.no)}>查看订阅详情</button></article>)}</div>
-      <ListPager total={serverTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="条" className="list-pager" />
+      <div className="order-mobile-list">{listState ? <TableState {...feedback}>{listState}</TableState> : records.map((item) => <article key={item.no} className="order-mobile-card"><div><small>{item.no}</small><StatusPill record={item} /></div><h3>{item.customer}</h3><p>{item.planName ?? WORD_UNCONFIGURED} <span>·</span> {item.termLabel || WORD_UNCONFIGURED}</p><dl><div><dt>年订阅价格</dt><dd>{moneyCell(item.annual)}</dd></div><div><dt>合同周期</dt><dd>{dateCell(item.start)} — {dateCell(item.end)}</dd></div></dl><button type="button" onClick={() => openOrder(item.no)}>查看订阅详情</button></article>)}</div>
+      {!ledger.error && !ledger.loading && <ListPager total={serverTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="条" className="list-pager" />}
       <details className="order-rule-strip is-footer"><summary><CalendarDays size={16} />订阅计费规则<span>合同生效 → 实际开通 → 自然月核算</span><ChevronRight size={16} /></summary><div className="order-rule-content">
         <div><CalendarDays size={18} /><span><strong>合同生效</strong><small>确定年度订阅周期</small></span></div><ChevronRight size={15} />
         <div><Signal size={18} /><span><strong>实际开通</strong><small>未开通不计应收</small></span></div><ChevronRight size={15} />

+ 8 - 7
klt-bos-web/src/pages/OrderRecordPage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 import { useBusinessView } from "../lib/use-business-view";
 import { useState } from "react";
 import { FetchError } from "../components/fetchError";
@@ -237,10 +238,10 @@ export function OrderRecordPage() {
 
     {(contractSubTotal > 1 || siblings.length > 0 || siblingList.loading) && <section className="order-record-section" aria-labelledby="order-related-title">
       <div className="order-record-section-title"><h2 id="order-related-title">关联订阅(同一合同共 {siblingList.loading ? "…" : contractSubTotal} 份)</h2></div>
-      {siblingList.error ? <p className="order-record-empty-note"><Tri tone="fail" text={WORD_FETCH_FAILED} title={siblingList.error.message} /> 同合同订阅取数失败。</p>
+      {siblingList.error ? <TableState kind="error" details={siblingList.error.message} onRetry={siblingList.reload}>同合同订阅加载失败</TableState>
         : siblings.length ? <div className="order-record-table-wrap"><table><thead><tr><th>序号</th><th>套餐 / 用途</th><th>方式</th><th>订阅状态</th><th>期间</th><th>订阅价格</th><th>月标准</th><th>实际开通日</th></tr></thead><tbody>{siblings.map((sibling, index) => <tr key={sibling.no}><td><Link to={`/orders/${encodeURIComponent(sibling.no)}`} state={outgoingState}>{safeSiblingPage * siblingPageSize + index + 1}<ArrowRight size={14} /></Link></td><td>{cell(sibling.planName)}</td><td>{sibling.row.plan_family === "addon" ? "叠加" : "正式"}</td><td>{sibling.statusLabel ? <OpsStatus tone={statusTone(sibling.statusLabel)}>{sibling.statusLabel}</OpsStatus> : <Tri tone="fail" text={WORD_FETCH_FAILED} />}</td><td>{cell(sibling.start)} 至 {cell(sibling.end)}</td><td>{sibling.annual.tone === "val" ? <span className="table-annual-price">{sibling.annual.text}</span> : <Tri tone={sibling.annual.tone} text={sibling.annual.text} />}</td><td>{sibling.settle.tone === "val" ? <span className="table-number">{sibling.settle.text}</span> : <Tri tone={sibling.settle.tone} text={sibling.settle.text} />}</td><td>{sibling.openedOn === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : sibling.openedOn || <Tri tone="missing" text="未开通" />}</td></tr>)}</tbody></table></div>
-          : <p className="order-record-empty-note">{siblingList.loading ? "正在读取同合同订阅…" : "本页除本条外暂无其他同合同订阅。"}</p>}
-      <ListPager total={contractSubTotal} page={safeSiblingPage} pageSize={siblingPageSize} onPageChange={setSiblingPage} onPageSizeChange={(size) => { setSiblingPageSize(size); setSiblingPage(0); }} unit="份" />
+          : <TableState kind={siblingList.loading ? "loading" : "empty"}>{siblingList.loading ? "正在读取同合同订阅…" : "本页暂无其他同合同订阅"}</TableState>}
+      {!siblingList.loading && !siblingList.error && <ListPager total={contractSubTotal} page={safeSiblingPage} pageSize={siblingPageSize} onPageChange={setSiblingPage} onPageSizeChange={(size) => { setSiblingPageSize(size); setSiblingPage(0); }} unit="份" />}
       <p className="order-record-note">这些订阅与本条引用同一份合同{item.orderNo ? `(订单号 ${item.orderNo})` : ""}。合同中每条服务构成条目分别形成订阅,各自冻结价格、计费与开通;点击序号查看详情。列表按服务端分页(默认每页 {LIST_PAGE_SIZE}),本条若落在当前页会从行中剔除。</p>
     </section>}
 
@@ -288,10 +289,10 @@ export function OrderRecordPage() {
           >{reissueBusy ? "补发中…" : "补发交付工单"}</Button>
         ) : null}
       </div>
-      {relatedTickets.loading ? <p className="order-record-empty-note">正在按订单号读取工单台账…</p>
-        : relatedTickets.error ? <p className="order-record-empty-note"><Tri tone="fail" text={WORD_FETCH_FAILED} title={relatedTickets.error.message} /> 工单台账取数失败,不得把「查不了」渲染成「0 张」。</p>
-        : ticketRows.length ? <div className="order-record-table-wrap"><table><thead><tr><th>我方工单号</th><th>类型</th><th>状态</th><th>创建日</th><th>完成日</th></tr></thead><tbody>{ticketRows.map((ticket) => <tr key={ticket.ticket_id}><td><Link to={`/work-orders/${encodeURIComponent(ticket.ticket_id)}`} state={outgoingState}>{ticket.ticket_no ?? ticket.ticket_id}<ArrowRight size={14} /></Link></td><td>{typeLabel(ticket.ticket_type)}</td><td><OpsStatus tone={ticket.status === "completed" || ticket.status === "settled" ? "success" : ticket.status === "processing" || ticket.status === "pending" ? "warning" : "neutral"}>{statusLabel(ticket.status, ticket.ticket_type)}</OpsStatus></td><td>{fmtDate(ticket.created_at)}</td><td>{fmtDate(ticket.completed_at)}</td></tr>)}</tbody></table></div> : <p className="order-record-empty-note">本条订阅暂无关联工单(按订单号现查 <code>/ticket/list@v1</code>,服务端可见范围内为空)。历史漏单可点「补发交付工单」。</p>}
-      <ListPager total={ticketTotal} page={ticketPage} pageSize={LIST_PAGE_SIZE} onPageChange={setTicketPage} unit="张" />
+      {relatedTickets.loading ? <TableState kind="loading">正在读取关联工单…</TableState>
+        : relatedTickets.error ? <TableState kind="error" details={relatedTickets.error.message} onRetry={relatedTickets.reload}>关联工单加载失败</TableState>
+        : ticketRows.length ? <div className="order-record-table-wrap"><table><thead><tr><th>我方工单号</th><th>类型</th><th>状态</th><th>创建日</th><th>完成日</th></tr></thead><tbody>{ticketRows.map((ticket) => <tr key={ticket.ticket_id}><td><Link to={`/work-orders/${encodeURIComponent(ticket.ticket_id)}`} state={outgoingState}>{ticket.ticket_no ?? ticket.ticket_id}<ArrowRight size={14} /></Link></td><td>{typeLabel(ticket.ticket_type)}</td><td><OpsStatus tone={ticket.status === "completed" || ticket.status === "settled" ? "success" : ticket.status === "processing" || ticket.status === "pending" ? "warning" : "neutral"}>{statusLabel(ticket.status, ticket.ticket_type)}</OpsStatus></td><td>{fmtDate(ticket.created_at)}</td><td>{fmtDate(ticket.completed_at)}</td></tr>)}</tbody></table></div> : <TableState>本条订阅暂无关联工单</TableState>}
+      {!relatedTickets.loading && !relatedTickets.error && <ListPager total={ticketTotal} page={ticketPage} pageSize={LIST_PAGE_SIZE} onPageChange={setTicketPage} unit="张" />}
       <p className="order-record-note">订阅保存后,未开户走开户工单,已在用走服务开通工单;运维回填的实际开通日写回本条订阅。点击工单号查看详情。工单列表服务端分页(默认每页 {LIST_PAGE_SIZE},页码 1 基)。</p>
     </section>}
 

+ 34 - 27
klt-bos-web/src/pages/OrganizationPages.tsx

@@ -2,7 +2,7 @@ import { MultiTreeSelect } from "../components/ui/multi-tree-select";
 import { PageIntro } from "../components/PageIntro";
 import { TeamTicketTypes } from "../components/TeamTicketTypes";
 import { ListPager } from "../components/ListPager";
-import { OpsDialog, OpsNotice, OpsResponsiveActions, OpsStatus, OpsTag, OpsTableColumns } from "../components/OperationsKit";
+import { OpsDialog, OpsNotice, OpsResponsiveActions, OpsStatus, OpsTag, OpsTableEmpty, OpsTableColumns } from "../components/OperationsKit";
 import { compareNum, compareText, nextSort, slicePage, useLocalPage, type SortDir } from "../lib/list-paging";
 import { downloadCsv } from "../lib/csv-download";
 import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
@@ -124,7 +124,7 @@ function OrgFetchState({ status, collections }: { status: OrganizationStatus; co
   const notes = [status.regionNameNote, status.loadPending].filter(Boolean) as string[];
   if (!status.error && !fails.length && !notes.length) return null;
   return <>
-    {status.error && <p className="org-form-error">组织档案读取失败:{status.error.message}<button className="org-inline-link" type="button" onClick={() => void reloadOrganizationData()}>重试</button></p>}
+    {status.error && <p className="org-form-error">区域信息读取失败:{status.error.message}<button className="org-inline-link" type="button" onClick={() => void reloadOrganizationData(["regions"])}>重试</button></p>}
     {notes.map((msg) => <p key={msg} className="org-helper">{msg}</p>)}
     {fails.map((msg) => <p key={msg} className="org-form-error">部分数据未取得:{msg}</p>)}
   </>;
@@ -141,11 +141,18 @@ const countText = (v?: number | null) => v === undefined ? FIELD_UNAVAILABLE : v
 const countTitle = (v?: number | null, note?: string) =>
   v === undefined ? "后端接口未返回该字段" : v === null ? (note || "后端回空(无计数/未覆盖),不是接口未实现") : undefined;
 
-/** 某集合整体失败时,表格位置显示失败原文+重试,⛔ 用空表冒充「0 条」。 */
-function CollectionFailed({ status, collection, title }: { status: OrganizationStatus; collection: keyof OrganizationStatus["partial"]; title: string }) {
-  const msg = status.partial[collection];
-  if (!msg) return null;
-  return <div className="org-empty"><p className="org-form-error">{title}列表未能取得:{msg}</p><p className="org-helper">为避免把接口失败显示成 0 条,此处不展示列表。</p><button className="org-inline-link" type="button" onClick={() => void reloadOrganizationData()}>重试</button></div>;
+function OrganizationListState({ collection, title, status, ready, hasRows, filtered, colSpan }: {
+  collection: keyof OrganizationStatus["partial"]; title: string; status: OrganizationStatus;
+  ready: boolean; hasRows: boolean; filtered: boolean; colSpan: number;
+}) {
+  const error = status.partial[collection];
+  if (error) return <OpsTableEmpty colSpan={colSpan} kind="error" details={error}
+    busy={status.loading} onRetry={() => void reloadOrganizationData([collection])}>
+    {ready && hasRows ? `${title}列表刷新失败,以下为上次加载的结果` : `${title}列表加载失败`}
+  </OpsTableEmpty>;
+  if (hasRows) return null;
+  if (!ready) return <OpsTableEmpty colSpan={colSpan} kind="loading">正在加载{title}列表…</OpsTableEmpty>;
+  return <OpsTableEmpty colSpan={colSpan}>{filtered ? `没有符合筛选条件的${title}` : `暂无${title}`}</OpsTableEmpty>;
 }
 
 function Button({ children, onClick, quiet = false, tone, disabled = false, title }: { children: ReactNode; onClick?: () => void; quiet?: boolean; tone?: "info" | "scope"; disabled?: boolean; title?: string }) {
@@ -1096,6 +1103,7 @@ export function OperatorManagementPage() {
       .catch(() => { if (live) setDefaultDay(null); });
     return () => { live = false; };
   }, []);
+  const listReady = useOrganizationLoaded().has("operators");
   const status = useOrganizationStatus();
   const filtered = data.operators.filter((o) => (!region || descendants(data, region).includes(o.region)) && (!cycle || o.payCycle === cycle) && o.name.toLowerCase().includes(query.trim().toLowerCase()));
   type OpSort = "name" | "region" | "customers";
@@ -1130,8 +1138,7 @@ export function OperatorManagementPage() {
   return <div className="org-page org-operator-page page-fill">
     <OrganizationEntryBack fallback="/organization/operators" />
     <PageHead eyebrow="组织与区域 / 02" title="运营商管理" exportCsv={{ onClick: exportRows, disabled: !rows.length }} description="按所属区域建立结算对手方档案,集中核对对账口径。" action={<Button onClick={() => setEditor({ kind: "operator" })}><Plus size={16} /> 新增运营商</Button>} />
-    <OrgFetchState status={status} collections={["operators"]} />
-    <CollectionFailed status={status} collection="operators" title="运营商" />
+    <OrgFetchState status={status} />
     {invalidRegion && <p className="org-form-error" role="status">区域参数无效({invalidRegion}),已回落为全部区域。</p>}
     <div className="org-ledger list-shell-fill"><section className="org-ledger-main list-shell-fill">
       <div className="org-filterbar">
@@ -1158,7 +1165,7 @@ export function OperatorManagementPage() {
               <th scope="col" className="org-table-actions-heading">操作</th>
             </tr>
           </thead>
-          <tbody>{!status.partial.operators && pageRows.map((o) => {
+          <tbody><OrganizationListState collection="operators" title="运营商" status={status} ready={listReady} hasRows={Boolean(rows.length)} filtered={Boolean(query || region || cycle)} colSpan={columnWidths.length} />{!status.partial.operators && pageRows.map((o) => {
             const shareLabel = o.sharePending ? "未配置" : `${shareText(o)} · ${o.shareMode}`;
             const accountOpened = o.account !== "未开通";
             return <tr className={selected === o.id ? "selected" : ""} key={o.id} tabIndex={0} aria-label={`查看${regionPath(data, o.region)}${o.name}档案`} onKeyDown={(event) => { if (event.key === "Enter" && event.target === event.currentTarget) setSelected(o.id); }} onClick={() => setSelected(o.id)}>
@@ -1190,9 +1197,9 @@ export function OperatorManagementPage() {
             </tr>;
           })}</tbody>
         </table>
-        {!rows.length && <Empty filtered={Boolean(query || region || cycle)} />}
+
       </div>
-      <ListPager total={rows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="家" className="org-list-pager" />
+      {listReady && <ListPager total={rows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="家" className="org-list-pager" />}
     </section></div>
     {saveNotice.node}
     {editor && <OrgEditor key={editor.id ?? "new"} editor={editor} onClose={() => setEditor(null)} onSaved={saveNotice.show} />}
@@ -1220,6 +1227,7 @@ export function PartnerManagementPage() {
   const [selected, setSelected] = useState<string | null>(data.partners[0]?.id ?? null);
   const [deleteId, setDeleteId] = useState<string | null>(null);
   const [accountTarget, setAccountTarget] = useState<AccountTarget | null>(null);
+  const listReady = useOrganizationLoaded().has("partners");
   const status = useOrganizationStatus();
   const filtered = data.partners.filter((p) => (!region || descendants(data, region).includes(p.region)) && `${p.name} ${p.title} ${p.notify}`.toLowerCase().includes(query.trim().toLowerCase()));
   type PtSort = "name" | "region" | "coverage";
@@ -1251,8 +1259,7 @@ export function PartnerManagementPage() {
     return <DirectorySortHeader label={label} direction={sortKey === key ? sortDir : undefined} onSort={() => toggleSort(key)} />;
   }
   return <div className="org-page org-partner-page page-fill"><OrganizationEntryBack fallback="/organization/partners" /><PageHead eyebrow="组织与区域 / 03" title="合伙人管理" exportCsv={{ onClick: exportRows, disabled: !rows.length }} description="为渠道合伙人建档,明确客户覆盖范围和分成约定。" action={<Button onClick={() => setEditor({ kind: "partner" })}><Plus size={16} /> 新建合伙人</Button>} />
-    <OrgFetchState status={status} collections={["partners"]} />
-    <CollectionFailed status={status} collection="partners" title="合伙人" />
+    <OrgFetchState status={status} />
     {invalidRegion && <p className="org-form-error" role="status">区域参数无效({invalidRegion}),已回落为全部区域。</p>}
     <div className="org-ledger list-shell-fill"><section className="org-ledger-main list-shell-fill">
       <div className="org-filterbar"><SearchBox onChange={(value) => { setQuery(value); paging.resetPage(); }} placeholder="搜索合伙人名称、渠道说明或通知地址" value={query} /><RegionSelect all data={data} onChange={(value) => { setRegion(value); paging.resetPage(); }} value={region} />{(query || region) && <UiButton variant="ghost" size="sm" onClick={() => { setQuery(""); setRegion(""); paging.resetPage(); }}>重置筛选</UiButton>}</div>
@@ -1271,7 +1278,7 @@ export function PartnerManagementPage() {
               <th scope="col" className="org-table-actions-heading">操作</th>
             </tr>
           </thead>
-          <tbody>
+          <tbody><OrganizationListState collection="partners" title="合伙人" status={status} ready={listReady} hasRows={Boolean(rows.length)} filtered={Boolean(query || region)} colSpan={columnWidths.length} />
             {!status.partial.partners && pageRows.map((p) => {
               const regionName = regionPath(data, p.region);
               const scopeLabel = scopeSummary(data, p.scope, p.scopeCustomerIds);
@@ -1315,9 +1322,9 @@ export function PartnerManagementPage() {
             })}
           </tbody>
         </table>
-        {!rows.length && <Empty filtered={Boolean(query || region)} />}
+
       </div>
-      <ListPager total={rows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="位" className="org-list-pager" />
+      {listReady && <ListPager total={rows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="位" className="org-list-pager" />}
     </section></div>
     {saveNotice.node}{editor && <OrgEditor key={editor.id ?? "new"} editor={editor} onClose={() => setEditor(null)} onSaved={saveNotice.show} />}
     {accountTarget && <OrganizationAccountDialog target={accountTarget} onClose={() => setAccountTarget(null)} />}
@@ -1340,6 +1347,7 @@ export function OperationsTeamManagementPage() {
   const [editor, setEditor] = useState<Editor | null>(null);
   const saveNotice = useSaveNotice();
   const [deleteId, setDeleteId] = useState<string | null>(null);
+  const listReady = useOrganizationLoaded().has("operationsTeams");
   const status = useOrganizationStatus();
   // 运营账号(regAdmin):团队档案只读(后端只下本团队),成员账号仍可管理
   // (第 1 册 TC-OR-16 步骤 3/步骤 5)。
@@ -1380,18 +1388,17 @@ export function OperationsTeamManagementPage() {
   return <div className="org-page org-operations-ledger-page page-fill">
     <OrganizationEntryBack fallback="/organization/operations-teams" />
     <PageHead eyebrow="组织与区域 / 04" title="运营团队" exportCsv={{ onClick: exportRows, disabled: !teams.length }} description="理清各运营团队负责的区域、客户和成员。" action={teamReadOnly ? <span className="org-helper">档案只读,不能新建团队;本团队成员账号可管理</span> : <Button onClick={() => setEditor({ kind: "operations" })}><Plus size={16} /> 新建运营团队</Button>} />
-    <OrgFetchState status={status} collections={["operationsTeams"]} />
-    <CollectionFailed status={status} collection="operationsTeams" title="运营团队" />
+    <OrgFetchState status={status} />
     {invalidRegion && <p className="org-form-error" role="status">区域参数无效({invalidRegion}),已回落为全部区域。</p>}
     <div className="org-maintenance-ledger-shell list-shell-fill">
       <div className="ops-toolbar"><SearchBox onChange={(value) => { setQuery(value); paging.resetPage(); }} placeholder="搜索团队名称、说明或负责范围" value={query} /><RegionSelect all data={data} onChange={(value) => { setRegionFilter(value); paging.resetPage(); }} value={regionFilter} />{(query || regionFilter) && <UiButton variant="ghost" size="sm" onClick={() => { setQuery(""); setRegionFilter(""); paging.resetPage(); }}>重置筛选</UiButton>}</div>
-      <div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="运营团队台账,可横向滚动查看字段" className={`measured-table-scroll org-table-wrap org-team-table-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="org-table org-operations-ledger-table org-team-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th className="sortable" aria-sort={sortAria("name")} onClick={() => toggleSort("name")}>团队 / 说明</th><th className="sortable" aria-sort={sortAria("region")} onClick={() => toggleSort("region")}>所属区域</th><th>分成规则</th><th>负责范围</th><th className="sortable" aria-sort={sortAria("coverage")} onClick={() => toggleSort("coverage")}>覆盖客户</th><th className="sortable" aria-sort={sortAria("members")} onClick={() => toggleSort("members")}>成员账号</th><th className="org-table-actions-heading">操作</th></tr></thead><tbody>{pageTeams.map((team) => {
+      <div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="运营团队台账,可横向滚动查看字段" className={`measured-table-scroll org-table-wrap org-team-table-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="org-table org-operations-ledger-table org-team-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th className="sortable" aria-sort={sortAria("name")} onClick={() => toggleSort("name")}>团队 / 说明</th><th className="sortable" aria-sort={sortAria("region")} onClick={() => toggleSort("region")}>所属区域</th><th>分成规则</th><th>负责范围</th><th className="sortable" aria-sort={sortAria("coverage")} onClick={() => toggleSort("coverage")}>覆盖客户</th><th className="sortable" aria-sort={sortAria("members")} onClick={() => toggleSort("members")}>成员账号</th><th className="org-table-actions-heading">操作</th></tr></thead><tbody><OrganizationListState collection="operationsTeams" title="运营团队" status={status} ready={listReady} hasRows={Boolean(teams.length)} filtered={Boolean(query || regionFilter)} colSpan={columnWidths.length} />{pageTeams.map((team) => {
         return <tr key={team.id}><td><div className="org-operations-team-name"><strong className="table-cell-title" title={team.name}>{team.name}</strong>{team.hq && <OpsTag tone="brand">总部内置</OpsTag>}</div><small title={team.desc || "尚未填写团队说明"}>{team.desc || <span className="table-placeholder">尚未填写团队说明</span>}</small></td><td>{team.hq ? "总部 · 不限区域" : operationsRegionLabel(data, team.region)}</td><td className="org-maintenance-share"><strong>{shareText(team)}</strong><small>{team.shareMode}</small></td><td className="org-maintenance-scope-cell" title={scopeSummary(data, team.scope)}><TableValueText>{scopeSummary(data, team.scope)}</TableValueText></td><td className="org-directory-customer-count"><Count v={team.coverageCustomers} />{typeof team.coverageCustomers === "number" ? " 家" : null}</td><td className="org-directory-customer-count">{team.members.length || (team.memberCount ?? 0) > 0 ? <span className="org-member-count" title={team.membersPending || undefined}><span><Count v={team.memberCount} />{typeof team.memberCount === "number" ? " 个" : null}</span>{team.membersPending ? <span aria-label={team.membersPending} className="org-member-count-hint" role="img" title={team.membersPending}><Info aria-hidden="true" size={13} /></span> : null}</span> : <OrganizationAccountStatus status="未开通" />}</td><td className="org-table-actions-cell"><div className="org-table-actions is-icons"><Link className="org-maintenance-account-link" to={`/organization/operations-teams/${encodeURIComponent(team.id)}/accounts`} state={linkState}><UserRound size={15} />账号</Link>{!teamReadOnly && <OpsResponsiveActions expanded={expandedActions} items={[
           { label: "编辑团队", shortLabel: "编辑", icon: <PencilLine size={15} />, onSelect: () => setEditor({ kind: "operations", id: team.id }) },
           ...(!team.hq ? [{ label: "删除团队", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, onSelect: () => setDeleteId(team.id) }] : []),
         ]} />}</div></td></tr>;
-      })}</tbody></table>{!teams.length && <Empty filtered={Boolean(query || regionFilter)}>{data.operationsTeams.length ? undefined : "暂无运营团队"}</Empty>}</div>
-      <ListPager total={teams.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="个" className="org-list-pager" />
+      })}</tbody></table></div>
+      {listReady && <ListPager total={teams.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="个" className="org-list-pager" />}
     </div>
     {saveNotice.node}{editor && <OrgEditor key={editor.id ?? "new"} editor={editor} onClose={() => setEditor(null)} onSaved={saveNotice.show} />}
     {deleteId && <DeleteDialog data={data} id={deleteId} kind="operations" name={data.operationsTeams.find((team) => team.id === deleteId)?.name ?? ""} onClose={() => setDeleteId(null)} onDeleted={() => setDeleteId(null)} />}
@@ -1485,6 +1492,7 @@ export function MaintenanceTeamLedgerPage() {
   useEditorDeepLink("maintenance", (id) => data.maintenanceTeams.some((item) => item.id === id), editor, setEditor);
   const saveNotice = useSaveNotice();
   const [deleteId, setDeleteId] = useState<string | null>(null);
+  const listReady = useOrganizationLoaded().has("maintenanceTeams");
   const status = useOrganizationStatus();
   const filtered = data.maintenanceTeams.filter((team) => (!regionFilter || descendants(data, regionFilter).includes(team.region)) && (!modeFilter || team.mode === modeFilter) && `${team.name} ${regionPath(data, team.region)} ${scopeSummary(data, team.scope)} ${team.mode} ${team.shareMode} ${team.lead} ${teamTicketTypes(team).map(typeLabel).join(" ")} ${team.members.map((member) => member.name).join(" ")}`.toLowerCase().includes(query.trim().toLowerCase()));
   type OpsSort = "name" | "region" | "coverage" | "open" | "members";
@@ -1539,20 +1547,19 @@ export function MaintenanceTeamLedgerPage() {
   }, [tableRef, data, query, regionFilter, modeFilter, paging.safePage]);
   return <div className="org-page org-maintenance-ledger-page page-fill">
     <OrganizationEntryBack fallback="/organization/maintenance-teams" />
-    <OrgFetchState status={status} collections={["maintenanceTeams"]} />
-    <CollectionFailed status={status} collection="maintenanceTeams" title="运维团队" />
+    <OrgFetchState status={status} />
     {invalidRegion && <p className="org-form-error" role="status">区域参数无效({invalidRegion}),已回落为全部区域。</p>}
     <PageHead eyebrow="组织与区域 / 05" title="运维团队" exportCsv={{ onClick: exportRows, disabled: !teams.length }} description="明确哪支团队服务哪些客户,以及能承接哪些工单。" action={<Button onClick={() => setEditor({ kind: "maintenance" })}><Plus size={16} /> 开通运维团队</Button>} />
     <div className="org-maintenance-ledger-shell list-shell-fill">
       <div className="ops-toolbar"><SearchBox onChange={(value) => { setQuery(value); paging.resetPage(); }} placeholder="搜索团队名称、区域路径、说明或成员" value={query} /><RegionSelect all data={data} onChange={(value) => { setRegionFilter(value); paging.resetPage(); }} value={regionFilter} /><FilterSelect icon="assignment" aria-label="分派方式" onChange={(event) => { setModeFilter(event.target.value); paging.resetPage(); }} value={modeFilter}><option value="">全部分派方式</option><option value="手工">手工</option><option value="自动平均">自动平均</option></FilterSelect>{(query || regionFilter || modeFilter) && <UiButton variant="ghost" size="sm" onClick={() => { setQuery(""); setRegionFilter(""); setModeFilter(""); paging.resetPage(); }}>重置筛选</UiButton>}</div>
-      <div ref={tableRef} tabIndex={0} role="region" aria-label="运维团队台账,可横向滚动查看字段" className={`measured-table-scroll org-table-wrap org-team-table-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="org-table org-maintenance-ledger-table org-team-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th className="sortable" aria-sort={sortAria("name")} onClick={() => toggleSort("name")}>团队 / 分派</th><th className="sortable" aria-sort={sortAria("region")} onClick={() => toggleSort("region")}>所属区域</th><th className="org-maintenance-ticket-types"><span>可分配工单类型</span></th><th>分成规则</th><th>负责范围</th><th className="sortable" aria-sort={sortAria("coverage")} onClick={() => toggleSort("coverage")}>覆盖客户</th><th className="sortable" aria-sort={sortAria("open")} onClick={() => toggleSort("open")}>未完成</th><th>超期未完成</th><th className="sortable" aria-sort={sortAria("members")} onClick={() => toggleSort("members")}>成员账号</th><th className="org-table-actions-heading">操作</th></tr></thead><tbody>{pageTeams.map((team) => {
+      <div ref={tableRef} tabIndex={0} role="region" aria-label="运维团队台账,可横向滚动查看字段" className={`measured-table-scroll org-table-wrap org-team-table-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="org-table org-maintenance-ledger-table org-team-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th className="sortable" aria-sort={sortAria("name")} onClick={() => toggleSort("name")}>团队 / 分派</th><th className="sortable" aria-sort={sortAria("region")} onClick={() => toggleSort("region")}>所属区域</th><th className="org-maintenance-ticket-types"><span>可分配工单类型</span></th><th>分成规则</th><th>负责范围</th><th className="sortable" aria-sort={sortAria("coverage")} onClick={() => toggleSort("coverage")}>覆盖客户</th><th className="sortable" aria-sort={sortAria("open")} onClick={() => toggleSort("open")}>未完成</th><th>超期未完成</th><th className="sortable" aria-sort={sortAria("members")} onClick={() => toggleSort("members")}>成员账号</th><th className="org-table-actions-heading">操作</th></tr></thead><tbody><OrganizationListState collection="maintenanceTeams" title="运维团队" status={status} ready={listReady} hasRows={Boolean(teams.length)} filtered={Boolean(query || regionFilter || modeFilter)} colSpan={columnWidths.length} />{pageTeams.map((team) => {
         return <tr key={team.id}><td><strong className="table-cell-title" title={team.name}>{team.name}</strong><small>{team.mode}分派</small></td><td title={regionPath(data, team.region)}>{regionPath(data, team.region)}</td><td className="org-maintenance-ticket-types"><TeamTicketTypes types={teamTicketTypes(team)} /></td><td className="org-maintenance-share"><strong>{shareText(team)}</strong><small>{team.shareMode}</small></td><td className="org-maintenance-scope-cell" title={scopeSummary(data, team.scope)}><TableValueText>{scopeSummary(data, team.scope)}</TableValueText></td><td className="org-number"><Count v={team.coverageCustomers} /></td><td className="org-number"><Count v={team.openTickets} /></td><td>{team.overdueOpenTickets === undefined || team.overdueOpenTickets === null ? <Tri tone="missing" text={FIELD_UNAVAILABLE} title={team.loadPending} /> : team.overdueOpenTickets > 0 ? <OpsStatus tone="danger">超期 {team.overdueOpenTickets}</OpsStatus> : <OpsStatus tone="brand">正常</OpsStatus>}</td><td><strong><Count v={team.memberCount} /></strong><small>{team.membersPending ?? `成员 ${team.members.length} 人`}</small></td><td className="org-table-actions-cell"><div className="org-table-actions is-icons"><Link className="org-maintenance-account-link" to={`/organization/maintenance-teams/${encodeURIComponent(team.id)}/accounts`} state={linkState}><UserRound size={15} />账号</Link><OpsResponsiveActions expanded={expandedActions} items={[
           // 负责范围已并入「编辑团队」弹窗(2026-11-16 业主指示),⛔ 再单列一条动作。
           { label: "编辑团队", shortLabel: "编辑", icon: <PencilLine size={15} />, onSelect: () => setEditor({ kind: "maintenance", id: team.id }) },
           { label: "删除团队", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, onSelect: () => setDeleteId(team.id) },
         ]} /></div></td></tr>;
-      })}</tbody></table>{!teams.length && <Empty filtered={Boolean(query || regionFilter || modeFilter)}>{data.maintenanceTeams.length ? undefined : "暂无运维团队"}</Empty>}</div>
-      <ListPager total={teams.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="个" className="org-list-pager" />
+      })}</tbody></table></div>
+      {listReady && <ListPager total={teams.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="个" className="org-list-pager" />}
     </div>
     {saveNotice.node}{editor && <OrgEditor key={editor.id ?? "new-maintenance"} editor={editor} onClose={() => setEditor(null)} onSaved={saveNotice.show} />}
     {deleteId && <DeleteDialog data={data} id={deleteId} kind="maintenance" name={data.maintenanceTeams.find((team) => team.id === deleteId)?.name ?? ""} onClose={() => setDeleteId(null)} onDeleted={() => setDeleteId(null)} />}

+ 4 - 4
klt-bos-web/src/pages/PackageManagementPage.tsx

@@ -733,7 +733,7 @@ export function PackageManagementPage() {
     { id: "exits", title: "线路出口", description: "出口清单与带宽预设", icon: Globe2, count: !exits.error && exits.data ? exits.data.items.length : "—" },
   ] as const;
   const emptyMessage = catalog.error
-    ? `无法加载套餐:${catalog.error.message}`
+    ? "套餐目录加载失败"
     : awaitingTab
       ? "正在加载套餐…"
       : hasFilters
@@ -799,13 +799,13 @@ export function PackageManagementPage() {
               {tab === "fixed"
                 ? fixedGroups.map((group) => <Fragment key={group.name}><PlanGroupRow title={group.name} hint={group.hint} colSpan={ledgerColSpan} />{group.entries.map(({ plan, position }) => planRow(plan, position))}</Fragment>)
                 : pageRows.map((plan, index) => planRow(plan, index))}
-              {(catalog.error || visible.length === 0) && <OpsTableEmpty colSpan={ledgerColSpan}>
-                <div className="catalog-empty"><span>{emptyMessage}</span>{catalog.error && <Button variant="outline" size="sm" onClick={catalog.reload}>重试</Button>}</div>
+              {(catalog.error || visible.length === 0) && <OpsTableEmpty colSpan={ledgerColSpan} kind={catalog.error ? "error" : awaitingTab ? "loading" : "empty"} details={catalog.error?.message} onRetry={catalog.error ? catalog.reload : undefined}>
+                {emptyMessage}
               </OpsTableEmpty>}
             </tbody>
           </table>
         </div>
-        <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="档" />
+        {!awaitingTab && !catalog.error && <ListPager total={listTotal} page={paging.safePage} pageSize={paging.pageSize} onPageChange={setPage} unit="档" />}
       </div>}
     {notice && <div className="catalog-toast" role="status"><span>{notice}</span><button aria-label="关闭提示" onClick={() => setNotice("")}><X size={16} /></button></div>}
     {failure && <div className="catalog-toast" role="alert"><span>{failure}</span><button aria-label="关闭提示" onClick={() => setFailure("")}><X size={16} /></button></div>}

+ 5 - 4
klt-bos-web/src/pages/PartyViewPages.tsx

@@ -354,14 +354,15 @@ function PartyLedger({ title, columns, actionWidth = 88, filters, dataState, tot
         <OpsTableColumns widths={table.widths} />
         <SettlementLedgerHead columns={columns} />
         <tbody>
-          {fail ? <OpsTableEmpty colSpan={table.widths.length}><span role="alert">{errorMessage}</span>
-            {(fail.kind === "fail" || fail.kind === "snapshot") && <Button variant="ghost" size="sm" onClick={reload}>重试</Button>}
+          {fail ? <OpsTableEmpty colSpan={table.widths.length} kind="error" details={fail.kind === "fail" ? fail.message : undefined}
+            onRetry={fail.kind === "fail" || fail.kind === "snapshot" ? reload : undefined} busy={loading}>
+            {fail.kind === "fail" ? `${title}加载失败` : errorMessage}
           </OpsTableEmpty> : children}
-          {!fail && Children.count(children) === 0 && <OpsTableEmpty colSpan={table.widths.length}>{loading ? <span role="status">正在读取…</span> : empty}</OpsTableEmpty>}
+          {!fail && Children.count(children) === 0 && <OpsTableEmpty colSpan={table.widths.length} kind={loading ? "loading" : "empty"}>{loading ? "正在读取…" : empty}</OpsTableEmpty>}
         </tbody>
       </table>
     </div>
-    <ListPager total={total} page={page - 1} pageSize={PARTY_PAGE_SIZE} onPageChange={(next) => setPage(next + 1)} unit={unit} />
+    {!fail && !loading && <ListPager total={total} page={page - 1} pageSize={PARTY_PAGE_SIZE} onPageChange={(next) => setPage(next + 1)} unit={unit} />}
   </div>;
 }
 

+ 3 - 8
klt-bos-web/src/pages/ScheduledJobManagementPage.tsx

@@ -521,12 +521,6 @@ export function ScheduledJobManagementPage() {
       )}
 
       <section className="ops-list-shell scheduled-jobs-panel" aria-label="业务任务">
-        {center.error && (
-          <div className="scheduled-jobs-load-error" role="alert">
-            <p>{W20}:{center.error}</p>
-            <Button size="sm" type="button" variant="outline" onClick={center.reload}>重试</Button>
-          </div>
-        )}
         <div
           ref={scroll.ref}
           className={scroll.overflow ? "measured-table-scroll ops-table-wrap has-horizontal-overflow" : "measured-table-scroll ops-table-wrap"}
@@ -549,9 +543,10 @@ export function ScheduledJobManagementPage() {
             </thead>
             <tbody>
               {pageRows.map(renderRow)}
-              {center.loading && <OpsTableEmpty colSpan={7}>正在加载…</OpsTableEmpty>}
+              {center.error && <OpsTableEmpty colSpan={7} kind="error" details={center.error} busy={center.loading} onRetry={center.reload}>{W20}</OpsTableEmpty>}
+              {!center.error && center.loading && <OpsTableEmpty colSpan={7} kind="loading">正在加载…</OpsTableEmpty>}
               {!center.loading && businessRows.length === 0 && !center.error && (
-                <OpsTableEmpty colSpan={7}>调度平台注册位为空。</OpsTableEmpty>
+                <OpsTableEmpty colSpan={7}>暂无定时任务</OpsTableEmpty>
               )}
             </tbody>
           </table>

+ 15 - 11
klt-bos-web/src/pages/SettlementPages.tsx

@@ -8,7 +8,7 @@ import { detailLinkState, type DetailLinkState } from "../lib/detail-navigation"
 import { ArrowRight, CalendarDays, Check, Info, RotateCcw, Search, X } from "lucide-react";
 import { Button } from "../components/ui/button";
 import { Input } from "../components/ui/input";
-import { ALL_ORG_COLLECTIONS, descendants, payCycleOptions } from "../lib/organization-demo";
+import { ALL_ORG_COLLECTIONS, useOrganizationStatus, useOrganizationLoaded, reloadOrganizationData, descendants, payCycleOptions } from "../lib/organization-demo";
 import { regionTreeNodes } from "../lib/region-tree";
 import { currentSharePartyTypes, hasShareTerms, sharePartiesFromOrganization, type CurrentSharePartyType } from "../lib/share-party-view";
 import { Tri } from "../components/triState";
@@ -80,6 +80,11 @@ export function ShareRulePage() {
    */
   const columnWidths = [64, 244, 252, 96, 200, 92, 80, 154];
   const { identity, organization } = useBusinessView(ALL_ORG_COLLECTIONS);
+  const orgStatus = useOrganizationStatus();
+  const loaded = useOrganizationLoaded();
+  const sources = ["operators", "partners", "maintenanceTeams"] as const;
+  const failed = sources.filter((key) => orgStatus.partial[key]);
+  const ready = sources.every((key) => loaded.has(key));
   const allowedRegions = useMemo(() => new Set(onboardingRegions(organization, identity)), [organization, identity]);
   /** 系统默认对账日唯一真源=`billing/config_get`(仅 admin 可读);读不到 ⇒ 只写「跟随系统默认」,⛔ 用原型常量兜底。 */
   const [defaultDay, setDefaultDay] = useState<number | null>(null);
@@ -170,8 +175,11 @@ export function ShareRulePage() {
           <td>{rowConfigured(row) ? <OpsStatus tone="success">已配分成</OpsStatus> : <small className="table-placeholder">未配分成</small>}</td>
           <td><span className="ops-money">{row.customerCount}</span></td>
           <td><button type="button" className="ops-table-action" onClick={() => setDetailKey(shareSummaryKey(PARTY_HOLDER_TYPE[row.type], row.id))} title="契约 14.2:弹窗出四卡+取值摘要(只读),配置分成请点弹窗里的「去档案里配置分成」">分成金额 <ArrowRight size={14} /></button></td>
-        </tr>)}{!filtered.length && <OpsTableEmpty colSpan={8}>{rows.length ? "没有符合筛选条件的分成方,可重置四组筛选" : "第 1 册档案里还没有运营商/合伙人/运维团队(分成方行源为空)"}</OpsTableEmpty>}</tbody></table></div>
-      <ListPager total={filtered.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} unit="条" />
+        </tr>)}{(failed.length > 0 || !filtered.length) && <OpsTableEmpty colSpan={8} kind={failed.length ? "error" : !ready ? "loading" : "empty"}
+            details={failed.map((key) => orgStatus.partial[key]).join(";")} busy={orgStatus.loading} onRetry={failed.length ? () => void reloadOrganizationData(failed) : undefined}>
+            {failed.length ? "分成方档案加载不完整" : !ready ? "正在读取分成方档案…" : hasFilter ? "没有符合筛选条件的分成方" : "暂无分成方档案"}
+          </OpsTableEmpty>}</tbody></table></div>
+      {ready && !failed.length && <ListPager total={filtered.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} unit="条" />}
     </div>
     {detail && <ShareAmountDialog row={detail} linkState={linkState} summary={summary} canConfigure={canConfigureShare(identity?.role, detail.type)} onClose={() => setDetailKey(null)} />}
   </section>;
@@ -376,10 +384,6 @@ export function ReconciliationSettingsPage() {
         </div>
       </header>
 
-      {wiring && <p className="ops-import-note" role="status">{BILLING_CONFIG_WIRING_NOTE}</p>}
-      {config.fail && !wiring && (
-        <p className="ops-form-error" role="alert">{config.fail.message} <Button variant="ghost" size="sm" onClick={config.reload}>重试</Button></p>
-      )}
 
       <section className="billing-default-card" aria-labelledby="billing-default-title">
         <header className="billing-default-heading">
@@ -442,15 +446,15 @@ export function ReconciliationSettingsPage() {
                 <BillingOperatorRow key={row.operator_id} row={row} defaultDay={data?.default_recon_day ?? draftDay}
                   canSave={editable} onSave={(nextDay, nextCycle) => setPending({ kind: "operator", row, nextDay, nextCycle })} />
               ))}
-              {!operators.length && (
-                <OpsTableEmpty colSpan={4}>
-                  {config.loading ? "加载中…" : wiring ? `出账配置待后端接线,运营商对账日暂不可读(${BACKEND_NOT_WIRED})。` : "暂无可配置出账的运营商。"}
+              {(config.fail || !operators.length) && (
+                <OpsTableEmpty colSpan={4} kind={config.fail ? "error" : config.loading ? "loading" : "empty"} details={config.fail?.message} onRetry={config.fail && !wiring ? config.reload : undefined}>
+                  {wiring ? BILLING_CONFIG_WIRING_NOTE : config.fail ? "出账配置加载失败" : config.loading ? "正在读取出账配置…" : "暂无可配置出账的运营商。"}
                 </OpsTableEmpty>
               )}
             </tbody>
           </table>
         </div>
-        <ListPager total={operators.length} page={operatorPaging.safePage} pageSize={operatorPaging.pageSize} onPageChange={operatorPaging.setPage} unit="家" />
+        {!config.fail && !config.loading && <ListPager total={operators.length} page={operatorPaging.safePage} pageSize={operatorPaging.pageSize} onPageChange={operatorPaging.setPage} unit="家" />}
       </section>
 
       <aside className="billing-guidance">

+ 14 - 19
klt-bos-web/src/pages/SettlementRecordPages.tsx

@@ -361,7 +361,6 @@ export function SettlementStatementListPage() {
       {runOpen && <RerunDialog onClose={() => setRunOpen(false)} />}
 
       {/* 接线占位横幅(klt-bos recon/* 未交付;交付后本分支自然失效) */}
-      {wiring && <p className="ops-import-note" role="status">{RECON_WIRING_NOTE}</p>}
 
       {/* ② 三统计卡:与列表同一响应同一行集;S404 ⇒ 整体不渲染(不是显示 0);单格 null ⇒「取数失败」。 */}
       {!s404 && (wiring || data) && (
@@ -462,7 +461,7 @@ export function SettlementStatementListPage() {
 
         {/* S404 触顶 ⇒ 不渲染三卡与列表(⚠️ 禁止静默截断)。 */}
         <div className={table.className} ref={table.ref} role="region" aria-label="对账批次,可横向滚动查看字段" tabIndex={0}>
-          {s404 ? <p className="ops-import-note" role="alert">{S404_EMPTY_NOTE}</p> : (
+
             <table className="ops-table settlement-ledger statement-ledger" style={{ minWidth: table.minWidth }}>
               <OpsTableColumns widths={table.widths} />
               <SettlementLedgerHead columns={statementColumns} />
@@ -494,16 +493,17 @@ export function SettlementStatementListPage() {
                     </td>
                   </tr>
                 ))}
-                {!rows.length && (
-                  <OpsTableEmpty colSpan={table.widths.length}>
-                    {list.loading ? "加载中…" : wiring ? "对账接口待后端接线,批次数据暂不可读。" : "没有符合筛选条件的对账清单。"}
+                {(list.fail || !rows.length) && (
+                  <OpsTableEmpty colSpan={table.widths.length} kind={list.fail ? "error" : list.loading ? "loading" : "empty"}
+                    details={list.fail?.message} onRetry={list.fail && !s404 && !wiring ? list.reload : undefined} busy={list.loading}>
+                    {s404 ? S404_EMPTY_NOTE : wiring ? RECON_WIRING_NOTE : list.fail ? "对账清单加载失败" : list.loading ? "正在加载…"
+                      : hasFilter ? "没有符合筛选条件的对账清单。" : "暂无对账清单"}
                   </OpsTableEmpty>
                 )}
               </tbody>
             </table>
-          )}
         </div>
-        {!s404 && (
+        {!s404 && !list.fail && !list.loading && (
           <ServerListPager
             total={total}
             page={page}
@@ -512,9 +512,6 @@ export function SettlementStatementListPage() {
           />
         )}
       </div>
-      {list.fail && !wiring && !s404 && (
-        <p className="ops-form-error" role="alert">{list.fail.message} <Button variant="ghost" size="sm" onClick={list.reload}>重试</Button></p>
-      )}
       {notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
     </section>
   );
@@ -808,7 +805,6 @@ export function SettlementBillListPage() {
         </div>
       </header>
 
-      {wiring && <p className="ops-import-note" role="status">{BILL_WIRING_NOTE}</p>}
 
       <div className="reconcile-ledger list-shell-fill">
         <div className="reconcile-filters">
@@ -854,24 +850,23 @@ export function SettlementBillListPage() {
                   </td>
                 </tr>
               ))}
-              {!rows.length && (
-                <OpsTableEmpty colSpan={table.widths.length}>
-                  {list.loading ? "加载中…" : wiring ? "账单明细接口待后端接线,数据暂不可读。" : "没有符合筛选条件的账单明细。"}
+              {(list.fail || !rows.length) && (
+                  <OpsTableEmpty colSpan={table.widths.length} kind={list.fail ? "error" : list.loading ? "loading" : "empty"}
+                    details={list.fail?.message} onRetry={list.fail && !wiring ? list.reload : undefined} busy={list.loading}>
+                    {wiring ? BILL_WIRING_NOTE : list.fail ? "账单明细加载失败" : list.loading ? "正在加载…"
+                      : hasFilter ? "没有符合筛选条件的账单明细。" : "暂无账单明细"}
                 </OpsTableEmpty>
               )}
             </tbody>
           </table>
         </div>
-        <ServerListPager
+        {!list.fail && !list.loading && <ServerListPager
           total={total}
           page={page}
           pageSize={pageSize}
           onPageChange={(next) => filters.set("page", String(next))}
-        />
+        />}
       </div>
-      {list.fail && !wiring && (
-        <p className="ops-form-error" role="alert">{list.fail.message} <Button variant="ghost" size="sm" onClick={list.reload}>重试</Button></p>
-      )}
     </section>
   );
 }

+ 4 - 3
klt-bos-web/src/pages/TeamQueuePage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 /**
  * 待分派工单队列(册 5 工单域)。
  *
@@ -120,10 +121,10 @@ export function QueueBoard({ teamId, teamName, showTeamColumn = false, canAutoDi
     ...(showTeamColumn ? [{ title: "涉及团队", value: teams, description: "当前页 · 已归属团队", icon: UsersRound }] : []),
   ];
   const fallback = queue.loading
-    ? <div className="order-empty" role="status">正在读取待分派队列…</div>
+    ? <TableState kind="loading">正在读取待分派队列…</TableState>
     : fail
-      ? <TicketState fail={fail} onRetry={queue.reload} />
-      : !rows.length ? <div className="order-empty"><h3>{q || type ? "没有匹配的待分派工单" : "暂无待分派工单"}</h3></div> : null;
+      ? <TicketState listTitle="待分派工单" fail={fail} onRetry={queue.reload} />
+      : !rows.length ? <TableState>{q || type ? "没有匹配的待分派工单" : "暂无待分派工单"}</TableState> : null;
 
   return <>
     <div className="work-order-ledger-summary work-order-queue-summary" role="group" aria-label="待分派队列统计" data-count={metrics.length}>

+ 6 - 5
klt-bos-web/src/pages/TeamWorkspacePages.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 import { useMemo, useState } from "react";
 import { ArrowRight, Building2, Check, ClipboardList, Hand, Info, PencilLine, Search, Shuffle, UsersRound } from "lucide-react";
 import { Link } from "react-router";
@@ -12,7 +13,7 @@ import { WorkspaceEmpty, WorkspaceHeading, WorkspacePanel } from "../components/
 import { Tri } from "../components/triState";
 import { slicePage, useLocalPage } from "../lib/list-paging";
 import { useDemoIdentity } from "../lib/demo-session";
-import { memberCoveredIndexes, scopeEnterpriseIndexes, scopeSummary, useOrganizationData, useOrganizationLoaded, useOrganizationStatus, type MaintenanceTeam, type OrganizationData } from "../lib/organization-demo";
+import { memberCoveredIndexes, reloadOrganizationData, scopeEnterpriseIndexes, scopeSummary, useOrganizationData, useOrganizationLoaded, useOrganizationStatus, type MaintenanceTeam, type OrganizationData } from "../lib/organization-demo";
 import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
 import { typeLabel } from "../lib/api/ticket";
 import { useLoad } from "../lib/useLoad";
@@ -31,9 +32,9 @@ export function TeamMembersPage() {
   const team = organization.maintenanceTeams.find((item) => item.id === identity?.maintenanceTeamId);
   if (identity?.role !== "teamLead") return <WorkspaceEmpty title="请切换到运维团队主账号" />;
 
-  const teamError = status.error || status.partial.maintenanceTeams;
+  const teamError = status.partial.maintenanceTeams;
   const teamLoading = status.loading || (!teamError && !loaded.has("maintenanceTeams"));
-  const emptyTitle = teamLoading ? "正在读取团队信息…" : teamError ? "暂时无法读取团队信息" : "当前账号未关联运维团队";
+  const emptyTitle = teamError ? "暂时无法读取团队信息" : teamLoading ? "正在读取团队信息…" : "当前账号未关联运维团队";
 
   return <section className="ops-page team-members-page page-fill page-fill-window">
     <header className="ops-heading">
@@ -43,7 +44,7 @@ export function TeamMembersPage() {
       </div>
     </header>
     {team ? <TeamMembersLedger key={team.id} organization={organization} team={team} />
-      : <div className="ops-list-shell"><WorkspaceEmpty title={emptyTitle} description="" /></div>}
+      : <div className="ops-list-shell"><TableState kind={teamError ? "error" : teamLoading ? "loading" : "empty"} details={teamError} busy={status.loading} onRetry={teamError ? () => void reloadOrganizationData(["maintenanceTeams"]) : undefined}>{emptyTitle}</TableState></div>}
   </section>;
 }
 
@@ -140,7 +141,7 @@ function TeamMembersLedger({ organization, team }: { organization: OrganizationD
                 </tr>
               );
             })}
-            {!pageRows.length && <OpsTableEmpty colSpan={5}>{team.membersPending || (needle ? "没有符合筛选条件的成员" : "暂无团队成员")}</OpsTableEmpty>}
+            {!pageRows.length && <OpsTableEmpty colSpan={5} kind={team.membersPending ? "error" : "empty"} details={team.membersPending ?? undefined}>{team.membersPending ? "团队成员明细暂不可用" : (needle ? "没有符合筛选条件的成员" : "暂无团队成员")}</OpsTableEmpty>}
           </tbody>
         </table>
       </div>

+ 4 - 3
klt-bos-web/src/pages/WorkOrderDeliveryPage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 /**
  * 交付与回执(册 5,「工单与任务」菜单入口;对应参考界面的「验收中心」位置)。
  *
@@ -109,10 +110,10 @@ function DeliveryList({ tab, page, onPageChange }: { tab: Exclude<DeliveryTab, "
   const rows = list.data?.rows ?? [];
   const total = list.data?.total ?? 0;
   const fallback = list.loading
-    ? <div className="order-empty" role="status">正在读取工单…</div>
+    ? <TableState kind="loading">正在读取工单…</TableState>
     : fail
-      ? <TicketState fail={fail} onRetry={list.reload} />
-      : !rows.length ? <div className="order-empty"><h3>{receipt ? "暂无待回执工单" : "暂无已驳回工单"}</h3></div> : null;
+      ? <TicketState listTitle="交付工单" fail={fail} onRetry={list.reload} />
+      : !rows.length ? <TableState>{receipt ? "暂无待回执工单" : "暂无已驳回工单"}</TableState> : null;
 
   return <>
     <div className="work-order-delivery-note">

+ 5 - 6
klt-bos-web/src/pages/WorkOrderManagementPage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 import { detailLinkState } from "../lib/detail-navigation";
 import { isImeComposing } from "../lib/ime";
 import { PageIntro } from "../components/PageIntro";
@@ -395,15 +396,13 @@ export function WorkOrderLedgerPage() {
       : loading ? "…" : "—";
   const allCount = numberOf(visibleCounts?.total, statusCounts.loading);
   const listState = list.loading ? (
-    <div className="order-empty" role="status">正在读取工单台账…</div>
+    <TableState kind="loading">正在读取工单台账…</TableState>
   ) : fail ? (
-    <TicketState fail={fail} onRetry={list.reload} />
+    <TicketState listTitle="工单列表" fail={fail} onRetry={list.reload} />
   ) : !rows.length ? (
-    <div className="order-empty">
-      <Search size={26} aria-hidden="true" />
-      <h3>{filtered ? "没有匹配的工单" : "暂无工单"}</h3>
+    <TableState>{filtered ? "没有匹配的工单" : "暂无工单"}
       {filtered && <Button variant="ghost" size="sm" onClick={() => setParams(new URLSearchParams())}>重置筛选</Button>}
-    </div>
+    </TableState>
   ) : null;
 
   return <section className="order-page work-order-ledger page-fill page-fill-window">

+ 13 - 15
klt-bos-web/src/pages/WorkOrderMinePage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 /**
  * 我的待办(册 5,2026-11-17 界面重构;2026-11-17 扩到运营侧与运维团队主账号)。
  *
@@ -16,8 +17,8 @@
 import { useDetailLinkState, type DetailLinkState } from "../lib/detail-navigation";
 import { Link, Navigate, useLocation, useNavigate } from "react-router";
 import { useState } from "react";
-import { ArrowRight, CalendarDays, ClipboardCheck, ClipboardList, Hourglass, LoaderCircle, TriangleAlert, Wrench } from "lucide-react";
-import { OpsTableColumns } from "../components/OperationsKit";
+import { ArrowRight, CalendarDays, ClipboardList, Hourglass, TriangleAlert, Wrench } from "lucide-react";
+import { TableStateRow, OpsTableColumns } from "../components/OperationsKit";
 import { TicketState } from "../components/ticketState";
 import { TicketStatusTag, TicketTypeTag } from "../components/work-order/TicketBadges";
 import { ticketUrge, type TicketListItem, type TicketWaiting } from "../lib/api/ticket";
@@ -100,6 +101,13 @@ function WorkOrderMineInner() {
     navigate(locationWith(next), { replace: true, state: location.state, preventScrollReset: true });
   }
 
+  const listState = list.loading ? <TableState kind="loading">正在读取待办…</TableState>
+        : fail ? <TicketState listTitle="待办工单" fail={fail} onRetry={list.reload} />
+        : !displayedGroups.length ? <TableState>
+          {rows.length ? "当前分组暂无工单" : "暂无待办工单"}
+          {!rows.length && <p>有工单分派给你时,会显示在这里。</p>}
+          {rows.length > 0 && <Link className="ops-table-action" to={queueUrl("all")} replace state={location.state}>查看全部待办<ArrowRight size={14} aria-hidden="true" /></Link>}
+        </TableState> : null;
   return <section className="order-page work-order-mine-page page-fill page-fill-window">
     <header className="work-order-mine-hero">
       <img className="work-order-mine-hero-image" src="/images/work-order-mine-network.webp" alt="" />
@@ -126,17 +134,7 @@ function WorkOrderMineInner() {
     </div>
 
     <section className="order-list-shell list-shell-fill" aria-label={activeQueue.label}>
-      {list.loading ? <div className="order-empty work-order-mine-empty" role="status">
-        <LoaderCircle size={23} className="work-order-mine-loading" aria-hidden="true" />正在读取待办…
-      </div> : fail ? <TicketState fail={fail} onRetry={list.reload} />
-        : !displayedGroups.length ? <div className="work-order-mine-blank">
-          <span className="work-order-mine-blank-icon"><ClipboardCheck size={28} aria-hidden="true" /></span>
-          <div>
-            <h2>{rows.length ? "当前分组暂无工单" : "暂无待办工单"}</h2>
-            {!rows.length && <p>有工单分派给你时,会显示在这里。</p>}
-          </div>
-          {rows.length > 0 && <Link className="ops-table-action" to={queueUrl("all")} replace state={location.state}>查看全部待办<ArrowRight size={14} aria-hidden="true" /></Link>}
-        </div> : <div className="ops-table-wrap work-order-mine-scroll" role="region" aria-label="待办工单清单" tabIndex={0}>
+      <div className="ops-table-wrap work-order-mine-scroll" role="region" aria-label="待办工单清单" tabIndex={0}>
           <table className="ops-table work-order-mine-table" aria-label="我的待办工单">
             <OpsTableColumns widths={[330, 190, 150, 190, 140]} />
             <thead><tr>
@@ -146,7 +144,7 @@ function WorkOrderMineInner() {
               <th scope="col">办理</th>
               <th scope="col">操作</th>
             </tr></thead>
-            {displayedGroups.map((group) => <tbody key={group.id}>
+            {listState ? <tbody><TableStateRow colSpan={5}>{listState}</TableStateRow></tbody> : displayedGroups.map((group) => <tbody key={group.id}>
               {activeQueue.id === "all" && <tr className="work-order-mine-group" data-tone={group.tone}>
                 <th colSpan={5} scope="rowgroup" title={group.hint}>
                   <span className="work-order-mine-group-label">
@@ -159,7 +157,7 @@ function WorkOrderMineInner() {
                 selected={selected?.ticket_id === row.ticket_id} onSelect={() => selectTicket(row.ticket_id)} onUrged={list.reload} />)}
             </tbody>)}
           </table>
-        </div>}
+        </div>
       {loaded && total > rows.length && <footer className="work-order-mine-footer">
         <span>展示前 {rows.length} 张待办,共 {total.toLocaleString("zh-CN")} 张。各分组按当前展示的工单统计。</span>
         <Link className="ops-table-action" to="/work-orders">去全部工单<ArrowRight size={14} aria-hidden="true" /></Link>

+ 11 - 9
klt-bos-web/src/pages/WorkOrderOverviewPage.tsx

@@ -1,3 +1,5 @@
+import { TableStateRow } from "../components/OperationsKit";
+import { TableState } from "../components/TableState";
 import { useDetailLinkState } from "../lib/detail-navigation";
 import { useEffect, useRef, useState, type MouseEvent } from "react";
 import { PageIntro } from "../components/PageIntro";
@@ -76,11 +78,15 @@ function WorkOrderOverviewInner() {
   ];
   const recentRows = recent.data?.rows ?? [];
   const recentState = recent.loading
-    ? <div className="order-empty" role="status">正在读取最近工单…</div>
+    ? <TableState kind="loading">正在读取最近工单…</TableState>
     : recentFail
-      ? <TicketState fail={recentFail} onRetry={recent.reload} />
-      : !recentRows.length ? <div className="order-empty">当前范围内暂无工单</div> : null;
+      ? <TicketState listTitle="最近工单" fail={recentFail} onRetry={recent.reload} />
+      : !recentRows.length ? <TableState>当前范围内暂无工单</TableState> : null;
 
+  const listState = queue.loading ? <TableState kind="loading">正在读取待分派队列…</TableState>
+          : queueFail ? <TicketState listTitle="待分派工单" fail={queueFail} onRetry={queue.reload} />
+          : !queueRows.length ? <TableState>暂无待分派工单</TableState>
+          : null;
   return (
     <section className="order-page work-order-ledger work-order-overview-page">
       <header className="order-heading">
@@ -128,14 +134,11 @@ function WorkOrderOverviewInner() {
           <div><h2 id="pending-work-orders">待分派队列</h2><p>优先查看服务端排序靠前的 5 张待分派工单。</p></div>
           <Link className="ops-table-action" to="/work-orders/queue">查看待分派队列<ArrowRight size={14} aria-hidden="true" /></Link>
         </header>
-        {queue.loading ? <div className="order-empty" role="status">正在读取待分派队列…</div>
-          : queueFail ? <TicketState fail={queueFail} onRetry={queue.reload} />
-          : !queueRows.length ? <div className="order-empty">暂无待分派工单</div>
-          : (
+
             <div className="work-order-overview-queue-scroll" role="region" aria-label="待分派工单,可横向滚动查看字段" tabIndex={0}>
               <table className="order-table work-order-overview-queue-table">
                 <thead><tr><th scope="col">客户 / 工单编号</th><th scope="col">类型</th><th scope="col">创建时间</th><th scope="col">操作</th></tr></thead>
-                <tbody>{queueRows.map((row) => {
+                <tbody>{listState ? <TableStateRow colSpan={4}>{listState}</TableStateRow> : queueRows.map((row) => {
                   const number = row.ticket_no || row.ticket_id;
                   return (
                     <tr key={row.ticket_id}>
@@ -148,7 +151,6 @@ function WorkOrderOverviewInner() {
                 })}</tbody>
               </table>
             </div>
-          )}
       </section>
     </section>
   );

+ 2 - 1
klt-bos-web/src/pages/WorkOrderRecordPage.tsx

@@ -1,3 +1,4 @@
+import { TableState } from "../components/TableState";
 import { Fragment, useEffect, useRef, useState, type FormEvent, type ReactNode } from "react";
 import {
   ArrowLeft, ArrowRight, Check, ChevronDown, CircleAlert, ClipboardCheck, FolderOpen,
@@ -1729,7 +1730,7 @@ export function WorkOrderRecordPage({ mobile = false }: { mobile?: boolean }) {
             </header>
             {group.items.length > 0
               ? <MaterialList ticketId={t.ticket_id} items={group.items} label={group.label} allowDownload={canDownloadMaterial} />
-              : <p className="work-order-empty-panel">暂无过程材料,可上传现场照片或处理截图。</p>}
+              : <TableState>暂无过程材料<p>可上传现场照片或处理截图。</p></TableState>}
           </section>;
         })}
       </WorkOrderPanel>}

+ 36 - 0
klt-bos-web/src/pages/__tests__/partner-list-feedback.test.tsx

@@ -0,0 +1,36 @@
+import { StrictMode } from "react";
+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { MemoryRouter } from "react-router";
+import { afterEach, expect, it, vi } from "vitest";
+import { PartnerManagementPage } from "../OrganizationPages";
+
+const { partners, regions } = vi.hoisted(() => ({ partners: vi.fn(), regions: vi.fn() }));
+vi.mock("../../lib/api/bos", async (load) => ({
+  ...await load<typeof import("../../lib/api/bos")>(),
+  partnerGetList: partners,
+  regionTree: regions,
+}));
+vi.mock("../../auth/session", () => ({ useSession: () => ({ ctx: { role_code: "admin" } }) }));
+vi.mock("../../lib/use-horizontal-overflow", () => ({ useHorizontalOverflow: () => ({ ref: null, width: 1160 }) }));
+
+afterEach(cleanup);
+
+it("合伙人首次加载失败时在表内显示一次错误,重试只读取合伙人列表", async () => {
+  regions.mockResolvedValue({ nodes: [], name_ready: true });
+  partners.mockRejectedValueOnce(new Error("KLT-S20006")).mockResolvedValueOnce({ items: [], total: 0 });
+  render(<StrictMode><MemoryRouter><PartnerManagementPage /></MemoryRouter></StrictMode>);
+  const table = within(screen.getByRole("table"));
+  await table.findByText("合伙人列表加载失败");
+  expect(screen.getAllByRole("alert")).toHaveLength(1);
+  expect(screen.queryByText("暂无合伙人")).toBeNull();
+  expect(screen.queryByText(/共 0 位/)).toBeNull();
+  expect(partners).toHaveBeenCalledTimes(1);
+  expect(regions).toHaveBeenCalledTimes(1);
+  fireEvent.click(table.getByText("错误详情"));
+  expect(table.getByText("KLT-S20006")).toBeTruthy();
+  fireEvent.click(table.getByRole("button", { name: "重新加载" }));
+  await table.findByText("暂无合伙人");
+  expect(partners).toHaveBeenCalledTimes(2);
+  expect(regions).toHaveBeenCalledTimes(1);
+  await waitFor(() => expect(screen.queryByRole("alert")).toBeNull());
+});

+ 6 - 3
klt-bos-web/src/styles/operations.css

@@ -62,14 +62,17 @@
 .ops-select { display: flex; align-items: center; gap: 8px; flex: none; height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--icon); }
 .ops-select select { min-width: 96px; padding-right: 26px; background: transparent; color: var(--foreground); outline: 0; cursor: pointer; font-size: var(--type-body); appearance: none; -webkit-appearance: none; background-image: var(--select-chevron); background-repeat: no-repeat; background-size: 16px 16px; background-position: right 3px center; }
 .ops-table-wrap { overflow-x: auto; }
-.ops-table-wrap:has(> table .ops-table-empty-cell) { container-type: inline-size; }
+:is(.ops-table-wrap, .org-table-wrap, .order-ledger-scroll, .job-runs-table, .work-order-overview-queue-scroll):has(> table .ops-table-empty-cell) { container-type: inline-size; }
 .ops-table { width: 100%; min-width: 860px; border-collapse: collapse; }
 .ops-table th { padding: 10px 12px; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); background: var(--surface-subtle); color: var(--muted-foreground); font-size: var(--type-meta); font-weight: 600; letter-spacing: .02em; text-align: left; white-space: nowrap; }
 .ops-table th:first-child, .ops-table td:first-child { padding-left: 24px; }
 .ops-table th:last-child, .ops-table td:last-child { padding-right: 24px; }
 .ops-table td { padding: 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; font-size: var(--type-support); color: var(--text-secondary); white-space: nowrap; }
-.ops-table-wrap td.ops-table-empty-cell:only-child { padding: 0; }
-.ops-table-empty-message { position: sticky; inset-inline-start: 0; inline-size: 100cqi; max-inline-size: 100%; padding: 34px 18px; color: var(--muted-foreground); text-align: center; white-space: normal; }
+:is(.ops-table-wrap, .org-table-wrap, .order-ledger-scroll, .job-runs-table, .work-order-overview-queue-scroll) td.ops-table-empty-cell:only-child { padding: 0; }
+/* Keep a single feedback row centered in the available ledger body, including wide scrollable tables. */
+.list-shell-fill > :is(.measured-table-scroll, .ops-table-wrap, .org-table-wrap) > table:has(> tbody:only-of-type > tr:only-child > .ops-table-empty-cell) { height: 100%; }
+.list-shell-fill > :is(.measured-table-scroll, .ops-table-wrap, .org-table-wrap) > table:has(.ops-table-empty-cell) > thead { height: 1px; }
+.ops-table-empty-message { position: sticky; inset-inline-start: 0; inline-size: 100cqi; max-inline-size: 100%; padding: 0; color: var(--muted-foreground); text-align: center; white-space: normal; }
 /* 台账表格:列不自动换行,宽度不足时横向滚动;带操作列的表格将其钉在最右。 */
 .ops-table-sticky-action { border-collapse: separate; border-spacing: 0; }
 .ops-table-sticky-action th:last-child, .ops-table-sticky-action td:last-child { text-align: right; }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است