Kaynağa Gözat

fix(web): 精简客户详情标题并统一占位样式

sy 1 gün önce
ebeveyn
işleme
f0101bff56

+ 42 - 42
web-scaffold/src/pages/CustomerWorkspacePage.tsx

@@ -54,6 +54,8 @@ import "../styles/operations.css";
 import "../styles/customer-onboarding.css";
 
 const MISSING = "后端未下发";
+const READING = "读取中…";
+const missingValue = (text: string, title?: string) => <Tri tone="missing" text={text} title={title} />;
 
 /**
  * 客户工作台的页签(讨论稿 §7.7:01–07 七个区块全部改为页签,并新增「交付现状」)。
@@ -95,7 +97,7 @@ function TextCell({ value, note }: { value: string | number | null | undefined;
 /** 可空资料单元格:读口已回该字段但值为空 ⇒「未登记」,⛔ 与「后端未下发」混为一谈。 */
 function OptionalCell({ value, note = "该字段未登记" }: { value: string | number | null | undefined; note?: string }) {
   const text = value === null || value === undefined ? "" : String(value).trim();
-  return text ? <>{text}</> : <span className="ops-muted" title={note}>未登记</span>;
+  return text ? <>{text}</> : missingValue("未登记", note);
 }
 
 /** 账号状态单元格:后端未回状态 ≠ 「未开通」,两者分列。 */
@@ -106,7 +108,7 @@ function AcctCell({ raw }: { raw: string | null | undefined }) {
 
 function metricCount(value: number | undefined, loading: boolean, error: ApiError | null) {
   if (error) return <Tri tone="fail" text="取数失败" title={error.message} />;
-  if (loading) return <span className="customer-record-metric-loading">读取中</span>;
+  if (loading) return missingValue(READING);
   return <TextCell value={value} />;
 }
 
@@ -146,7 +148,7 @@ type InlineFieldProps = {
 };
 
 function InlineField({ id, label, value, editing, writable, busy = false, onStart, onChange, onDone, onCancel, type = "text", inputMode, placeholder, display, emptyText = MISSING, invalid, error, selectOptions, editor }: InlineFieldProps) {
-  const shown = display ?? (value ? value : emptyText);
+  const shown = display ?? (value || missingValue(emptyText));
   if (!writable) return <span className="customer-inline-readonly">{shown}</span>;
   if (!editing) return <span className="customer-inline-field">
     <span className="customer-inline-value">{shown}</span>
@@ -232,10 +234,10 @@ export function CustomerWorkspacePage() {
   }, [primaryAccountLoad.data]);
   /** 主账号读取失败/未查到时的统一说明(⛔ 把「无账号」当「后端未下发」)。 */
   const primaryAccountMissing = primaryAccountLoad.error
-    ? MISSING + ":/account/get_list@v1 取数失败(" + primaryAccountLoad.error.message + ")"
+    ? <Tri tone="fail" text="取数失败" title={primaryAccountLoad.error.message} />
     : primaryAccountLoad.loading
-      ? "主账号信息读取中…"
-      : NO_ACCOUNT_FOUND;
+      ? missingValue(READING)
+      : missingValue("未查到主账号", NO_ACCOUNT_FOUND);
   const mount = detail.data?.region_mounts?.[0];
   const teamIds = detail.data?.team_ids ?? [];
   const accountRows = accounts.data?.items ?? [];
@@ -395,10 +397,10 @@ export function CustomerWorkspacePage() {
   /** 运营团队=按挂载区域实时反查(⛔ 档案快照);身份命中候选时优先展示本队。 */
   const operationsTeamView = useMemo(() => {
     const regionId = form?.regionId || mount?.parent_node_id || "";
-    if (!regionId) return { text: "请先挂载所属区域", note: "运营团队按所挂区域实时反查,客户档案不存快照" as string | undefined };
+    if (!regionId) return { text: "请先挂载所属区域", note: "运营团队按所挂区域实时反查,客户档案不存快照", missing: true };
     const candidates = teamsCoveringRegion(organization.operationsTeams, regionAncestorChain(organization.regions, regionId));
     const lockedId = lockIfCandidate(view.identity?.operationsTeamId, candidates);
-    return operationsTeamDisplay(candidates, lockedId);
+    return { ...operationsTeamDisplay(candidates, lockedId), missing: !lockedId && candidates.length === 0 };
   }, [form?.regionId, mount?.parent_node_id, organization.operationsTeams, organization.regions, view.identity?.operationsTeamId]);
   /** 主体类型由企业改为其他:后端会同时撤销已留存的营业执照影像(非企业不采集证件影像)。 */
   const subjectRevokesLicense = Boolean(baseline && baseline.subject === "enterprise" && form && form.subject !== "enterprise");
@@ -674,7 +676,6 @@ export function CustomerWorkspacePage() {
         <div><dt>地址</dt><dd><InlineField id="customer-address" label="地址" value={form?.address ?? ""} editing={editingField === "address"} writable={writable} busy={busy} onStart={() => startField("address")} onChange={(value) => patch("address", value)} onDone={() => void commitField("address")} onCancel={() => cancelField("address")} emptyText="未登记" placeholder="完整地址,包括楼栋与房间号" /></dd></div>
         <div><dt>建档时间</dt><dd><TextCell value={customer?.created_at} /></dd></div>
       </dl>
-      <p className="customer-form-note">识别号只能更正、不能读取明文(后端只下发脱敏值):点铅笔后填入完整新号码并点对号才会提交,留空或未改动=不提交。{staleTeamHint && <>运维团队{staleTeamHint}。</>}</p>
       {subjectRevokesLicense && <p className="customer-form-note">提交后主体类型将改为「{label(SUBJECT_TYPE, form?.subject ?? "")}」,系统会同时撤销该客户已留存的营业执照影像(非企业不采集证件影像),之后如需恢复只能按企业主体重新上传。</p>}
     </section>
 
@@ -683,34 +684,34 @@ export function CustomerWorkspacePage() {
         <div><dt>所属区域</dt><dd><InlineField id="customer-region" label="所属区域" value={form?.regionId ?? ""} editing={editingField === "regionId"} writable={writable} busy={busy} onStart={() => startField("regionId")} onChange={(value) => patch("regionId", value)} onDone={() => void commitField("regionId")} onCancel={() => cancelField("regionId")} display={draftRegionDisplay || undefined} emptyText={MISSING} editor={<TreeSelect treeData={regionTree} value={form?.regionId ?? ""} onChange={(value) => patch("regionId", value)} ariaLabel="所属区域" placeholder="请选择区域节点" name="customer-region" />} invalid={invalidOf("regionId")} error={errorOf("regionId")} /></dd></div>
         <div><dt>运营商</dt><dd><InlineField id="customer-operator" label="运营商" value={form?.operatorId ?? ""} editing={editingField === "operatorId"} writable={writable} busy={busy} onStart={() => startField("operatorId")} onChange={(value) => patch("operatorId", value)} onDone={() => void commitField("operatorId")} onCancel={() => cancelField("operatorId")} display={draftOperatorName || undefined} emptyText={MISSING} selectOptions={[{ value: "", label: "请选择运营商" }, ...organization.operators.map((item) => ({ value: item.id, label: item.name }))]} invalid={invalidOf("operatorId")} error={errorOf("operatorId")} /></dd></div>
         {/* 合伙人选填(至多 1 个):`partner_id` 为空=业务上的「未绑定」,⛔ 与「后端未下发」混为一谈。 */}
-        <div><dt>合伙人</dt><dd><InlineField id="customer-partner" label="合伙人" value={form?.partnerId ?? ""} editing={editingField === "partnerId"} writable={writable} busy={busy} onStart={() => startField("partnerId")} onChange={(value) => patch("partnerId", value)} onDone={() => void commitField("partnerId")} onCancel={() => cancelField("partnerId")} display={form ? (form.partnerId ? draftPartnerName || form.partnerId : "未绑定合伙人") : undefined} emptyText="未绑定合伙人" selectOptions={[{ value: "", label: "不绑定" }, ...organization.partners.map((item) => ({ value: item.id, label: item.name }))]} /></dd></div>
-        <div><dt>运营团队</dt><dd><span className="customer-inline-readonly" title={operationsTeamView.note}>{operationsTeamView.text}{operationsTeamView.note ? <span className="ops-muted"> {operationsTeamView.note}</span> : null}</span></dd></div>
+        <div><dt>合伙人</dt><dd><InlineField id="customer-partner" label="合伙人" value={form?.partnerId ?? ""} editing={editingField === "partnerId"} writable={writable} busy={busy} onStart={() => startField("partnerId")} onChange={(value) => patch("partnerId", value)} onDone={() => void commitField("partnerId")} onCancel={() => cancelField("partnerId")} display={form?.partnerId ? draftPartnerName || form.partnerId : undefined} emptyText="未绑定合伙人" selectOptions={[{ value: "", label: "不绑定" }, ...organization.partners.map((item) => ({ value: item.id, label: item.name }))]} /></dd></div>
+        <div><dt>运营团队</dt><dd><span className="customer-inline-readonly" title={operationsTeamView.note}>{operationsTeamView.missing ? missingValue(operationsTeamView.text) : operationsTeamView.text}{operationsTeamView.note ? <span className="ops-muted"> {operationsTeamView.note}</span> : null}</span></dd></div>
         <div><dt>运维团队</dt><dd><InlineField id="customer-team" label="运维团队" value={form?.teamId ?? ""} editing={editingField === "teamId"} writable={writable} busy={busy} onStart={() => startField("teamId")} onChange={(value) => patch("teamId", value)} onDone={() => void commitField("teamId")} onCancel={() => cancelField("teamId")} display={draftTeamName || undefined} emptyText={MISSING} editor={<CustomerTeamSelect options={organization.maintenanceTeams.map((item) => ({ id: item.id, name: item.name, hint: (item.ticketTypes ?? []).map(typeLabel).join("、") }))} value={form?.teamId ?? ""} onChange={(id) => patch("teamId", id)} />} invalid={invalidOf("teamId")} error={errorOf("teamId")} /></dd></div>
       </dl>
-      <p className="customer-form-note">挂载区域、运营商、合伙人与运维团队(客户固定挂 1 支)的变更由后端留存记录;运营团队按所挂区域实时反查、不写入客户档案。区域与运营商省份不一致会被后端拦下。每项点对号即提交。{staleTeamHint && <>{staleTeamHint};改派前本次不提交运维团队。</>}</p>
+      <p className="customer-form-note">挂载区域、运营商、合伙人与运维团队(客户固定挂 1 支)的变更由后端留存记录;运营团队按所挂区域实时反查、不写入客户档案。区域与运营商省份不一致会被后端拦下。{staleTeamHint && <>{staleTeamHint};改派前本次不提交运维团队。</>}</p>
     </section>
 
 
     <section className="ops-record-card customer-workspace-panel" id="customer-panel-primary" role="tabpanel" aria-labelledby="customer-tab-primary" hidden={tab !== "primary"}>
       <div className="customer-panel-grid">
         <div className="customer-panel"><dl>
-          <div><dt>登录名</dt><dd>{primaryAccount ? <TextCell value={primaryAccount.username} /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>绑定手机号</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.mobile} note="该主账号未登记手机号" /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>账号状态</dt><dd>{primaryAccount ? <AcctCell raw={primaryAccount.status} /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>首次登录改密</dt><dd>{primaryAccount ? (primaryAccount.pwd_set_at ? <>已改密<br /><span className="ops-muted">{primaryAccount.pwd_set_at}</span></> : <span className="ops-muted">未改密</span>) : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
+          <div><dt>登录名</dt><dd>{primaryAccount ? <TextCell value={primaryAccount.username} /> : primaryAccountMissing}</dd></div>
+          <div><dt>绑定手机号</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.mobile} note="该主账号未登记手机号" /> : primaryAccountMissing}</dd></div>
+          <div><dt>账号状态</dt><dd>{primaryAccount ? <AcctCell raw={primaryAccount.status} /> : primaryAccountMissing}</dd></div>
+          <div><dt>首次登录改密</dt><dd>{primaryAccount ? (primaryAccount.pwd_set_at ? <>已改密<br /><span className="ops-muted">{primaryAccount.pwd_set_at}</span></> : missingValue("未改密")) : primaryAccountMissing}</dd></div>
         </dl></div>
-        <div className="customer-panel"><h3>当前激活信息</h3><dl>
+        <div className="customer-panel" role="group" aria-label="当前激活信息"><dl>
           <div><dt>激活状态</dt><dd>{primaryAccount ? (primaryAccount.activation_status
             ? <OpsStatus tone={activationTone(primaryAccount.activation_status)}>{label(ACTIVATION_STATUS, primaryAccount.activation_status)}</OpsStatus>
             /* 三态(巡检 P1-D2):非主账号(入口/分账号)本就不产生激活码,⛔ 写成「后端未下发」。 */
             : primaryAccount.account_kind !== "primary"
-              ? <span className="ops-muted" title={`account_kind=${primaryAccount.account_kind}:入口/分账号不产生激活码,bos_account_ext 不会为其建行`}>不适用(非主账号,不产生激活码)</span>
-              : <Tri tone="missing" text={MISSING} title="bos_account_ext 未生成该账号的激活码扩展行" />) : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>激活码发送日</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.delivered_at} note="尚未交付激活码" /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>激活截止日</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.expire_date} note="无未消费激活码(已激活或已过期)" /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
-          <div><dt>激活码</dt><dd>{freshCode ? <><code className="ops-code-plain">{freshCode.code}</code>{freshCode.expireDate ? <span className="ops-muted"> 有效期至 {freshCode.expireDate}</span> : null}</> : primaryActivated ? <span className="ops-muted" title={NO_ACTIVATION_CODE_READ}>已激活,不可查看</span> : <Tri tone="missing" text={MISSING} title={NO_ACTIVATION_CODE_READ} />}</dd></div>
+              ? missingValue("不适用(非主账号,不产生激活码)", `account_kind=${primaryAccount.account_kind}:入口/分账号不产生激活码`)
+              : <Tri tone="missing" text={MISSING} title="bos_account_ext 未生成该账号的激活码扩展行" />) : primaryAccountMissing}</dd></div>
+          <div><dt>激活码发送日</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.delivered_at} note="尚未交付激活码" /> : primaryAccountMissing}</dd></div>
+          <div><dt>激活截止日</dt><dd>{primaryAccount ? <OptionalCell value={primaryAccount.expire_date} note="无未消费激活码(已激活或已过期)" /> : primaryAccountMissing}</dd></div>
+          <div><dt>激活码</dt><dd>{freshCode ? <><code className="ops-code-plain">{freshCode.code}</code>{freshCode.expireDate ? <span className="ops-muted"> 有效期至 {freshCode.expireDate}</span> : null}</> : primaryActivated ? missingValue("已激活,不可查看", NO_ACTIVATION_CODE_READ) : <Tri tone="missing" text={MISSING} title={NO_ACTIVATION_CODE_READ} />}</dd></div>
           <div><dt>重置激活码</dt><dd><div className="ops-entity-actions">{primaryActivated
-            ? <span className="ops-muted" title={CODE_RESET_ACTIVATED_NOTE}>已激活,不提供重置入口</span>
+            ? missingValue("已激活,不提供重置入口", CODE_RESET_ACTIVATED_NOTE)
             : <Button type="button" variant="outline" disabled={resetBusy || !primaryAccount} onClick={resetPrimaryCode} title={!primaryAccount ? NO_ACCOUNT_FOUND : "作废旧码并发新码(仅未激活账号),新明文只回显一次"}>{resetBusy ? "正在重置…" : "重置激活码"}</Button>}</div></dd></div>
         </dl></div>
       </div>
@@ -725,6 +726,7 @@ export function CustomerWorkspacePage() {
         <tbody>{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;
         /** 只有生效中的订阅可替换(升降配)或叠加新建并存订阅;只读身份不挂入口。 */
         const orderMore: OpsMoreItem[] = writable && rowStatus === "生效中" ? [
           { label: "升降配", icon: <RefreshCw size={15} />, onSelect: () => setChangeTarget(row) },
@@ -733,20 +735,20 @@ export function CustomerWorkspacePage() {
         ] : [];
         return <tr key={sub.subscription_id}>
           <td><Link className="contract-ref-link" to={`/orders/${encodeURIComponent(sub.subscription_id)}`} state={outgoingState}>{sub.plan_name ?? sub.plan_id}</Link><small>{sub.subscription_id}</small></td>
-          <td>{sub.plan_kind ? label(PLAN_KIND, sub.plan_kind) : "-"}</td>
+          <td>{sub.plan_kind ? label(PLAN_KIND, sub.plan_kind) : missingValue("—")}</td>
           <td title="由替换关系派生:有 replaces_subscription_id=升降配,否则新签">{sub.replaces_subscription_id ? "升降配" : "新签"}</td>
-          <td title="由替换关系派生:有 replaces_subscription_id=升降配,否则新签">{sub.replaces_subscription_id ? <TextCell value={sub.replaces_subscription_id} /> : <span className="ops-muted">—(新签,无前序订阅)</span>}</td>
-          <td>{sub.contract_no ?? sub.contract_id ?? "-"}</td>
-          <td>{sub.start_date ?? "—"} 至 {sub.end_date ?? "—"}</td>
+          <td title="由替换关系派生:有 replaces_subscription_id=升降配,否则新签">{sub.replaces_subscription_id ? <TextCell value={sub.replaces_subscription_id} /> : missingValue("—(新签,无前序订阅)")}</td>
+          <td>{sub.contract_no ?? sub.contract_id ?? missingValue("—")}</td>
+          <td>{sub.start_date ?? missingValue("—")} 至 {sub.end_date ?? missingValue("—")}</td>
           <td className="table-number">{sub.quota_slots ?? 0} 个</td>
           <td>{sub.monthly_settle_cents ? <span className="table-number">{money(String(sub.monthly_settle_cents / 100))}</span> : <Tri tone="missing" text={MISSING} title={MISSING + ":monthly_settle_cents 未下发"} />}</td>
-          <td><OpsStatus tone={statusTone(sub.status_display?.label ?? sub.status)}>{sub.status_display?.label ?? sub.status ?? MISSING}</OpsStatus>{sub.editable === false && sub.reason ? `(${sub.reason.replace(/([^()]*)$/, "").replace(/[,。;]$/, "")})` : ""}</td>
+          <td>{statusText ? <OpsStatus tone={statusTone(statusText)}>{statusText}</OpsStatus> : missingValue(MISSING)}{sub.editable === false && sub.reason ? `(${sub.reason.replace(/([^()]*)$/, "").replace(/[,。;]$/, "")})` : ""}</td>
           <td><div className="ops-inline-actions">
             {writable && rowStatus === "生效中" ? <CustomerServiceStopAction customerId={no || ""} customerName={displayName} orderId={sub.subscription_id} orderLabel={rowStatus} /> : null}
             <OpsMore items={orderMore} placeholder />
           </div></td>
         </tr>;
-      }) : <OpsTableEmpty colSpan={10}>该客户暂无套餐订阅记录</OpsTableEmpty>}</tbody>
+      }) : <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="条" />
     </section>
@@ -762,7 +764,7 @@ export function CustomerWorkspacePage() {
               : row.status === "not_opened"
                 ? <span className="ops-muted table-placeholder" title="该席位尚未开通,账号名在开通后登记">未开通</span>
                 : row.status === "stopped"
-                  ? <span className="ops-muted" title="该席位已停用,账号名随停用不再展示">已停用</span>
+                  ? missingValue("已停用", "该席位已停用,账号名随停用不再展示")
                   : <OptionalCell value={row.username} note="后端未登记该席位的账号名(sub_account.username 已下发、值为空)" />}</td>
             <td><TextCell value={seatDisplayName(row)} note={isSeatPlaceholder(row) ? "系统按套餐额度自动补建的席位(需求§4.2):姓名留空,此处按登录名尾号「席位 n」占位显示,不作为真实姓名落库" : undefined} /></td>
             {/*
@@ -777,9 +779,9 @@ export function CustomerWorkspacePage() {
                 : <OptionalCell value={row.net_account} note="开户回填未登记该席位的网络侧账号名(sub_account.net_account 已下发、值为空)" />}</td>
             <td><AcctCell raw={row.status} /></td>
             <td><TextCell value={row.created_at} /></td>
-            <td>{row.stopped_at ? <TextCell value={row.stopped_at} /> : <span className="ops-muted">—(未停用)</span>}</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}>该客户暂无分账号</OpsTableEmpty>}
+          </tr>) : <OpsTableEmpty colSpan={8}>{accounts.loading ? missingValue(READING) : missingValue("该客户暂无分账号")}</OpsTableEmpty>}
         </tbody>
       </table></div>
       <ListPager total={accountsTotal} page={safeAccountsPage} pageSize={accountsPageSize} onPageChange={setAccountsPage} onPageSizeChange={(size) => { setAccountsPageSize(size); setAccountsPage(0); }} unit="个" />
@@ -787,11 +789,10 @@ export function CustomerWorkspacePage() {
     </section>
 
     <section className="ops-record-card customer-workspace-panel" id="customer-panel-materials" role="tabpanel" aria-labelledby="customer-tab-materials" hidden={tab !== "materials"}>
-      <div className="customer-panel customer-material-panel">
-        <h3>登记材料 · 营业执照影像</h3>
+      <div className="customer-panel customer-material-panel" role="group" aria-label="营业执照影像">
         <CustomerMaterialCard>
           {!licenseApplicable ? <>
-            <strong>不适用</strong>
+            {missingValue("不适用")}
             <p>个人和个体工商户无需登记营业执照影像。</p>
           </> : license?.status === "viewable" ? <>
             <div className="customer-license-filename"><strong>{license.file_name ?? "营业执照影像"}</strong><OpsStatus tone="success">已登记</OpsStatus></div>
@@ -804,7 +805,7 @@ export function CustomerWorkspacePage() {
             <strong>已超期</strong>
             <p>影像留存期已满,无法查看或下载。</p>
           </> : <>
-            <strong>{license ? "未登记影像" : MISSING}</strong>
+            {missingValue(license ? "未登记营业执照影像" : MISSING)}
             <p>{license ? "营业执照影像为选填材料,可在此补传。" : "暂未获取影像登记状态。"}</p>
           </>}
           {licenseApplicable && license?.status !== "expired" && <div className="customer-license-upload">
@@ -828,13 +829,12 @@ export function CustomerWorkspacePage() {
         </CustomerMaterialCard>
         {licenseError && <p className="ops-form-error" role="alert">{licenseError}</p>}
       </div>
-      <div className="customer-panel customer-material-panel">
-        <h3>合同文档</h3>
+      <div className="customer-panel customer-material-panel" role="group" aria-label="合同文档">
         {contractsLoad.error ? <CustomerMaterialCard>
-          <strong>合同文档读取失败</strong>
+          <Tri tone="fail" text="合同文档读取失败" />
           <FetchError message={contractsLoad.error.message} onRetry={contractsLoad.reload} />
         </CustomerMaterialCard> : contractsLoad.loading ? <CustomerMaterialCard>
-          <strong>正在读取合同文档…</strong>
+          <span role="status">{missingValue(READING)}</span>
         </CustomerMaterialCard> : contractFiles.length ? <div className="customer-material-list">
           {contractFiles.map((document) => <CustomerMaterialCard key={`${document.contractNo}-${document.name}`}>
             <strong>{document.name}</strong>
@@ -844,7 +844,7 @@ export function CustomerWorkspacePage() {
             </div>
           </CustomerMaterialCard>)}
         </div> : <CustomerMaterialCard>
-          <strong>暂无合同文档</strong>
+          {missingValue("暂无合同文档")}
           <p>文档随合同登记上传。</p>
         </CustomerMaterialCard>}
         <ListPager total={contractsTotal} page={safeContractsPage} pageSize={contractsPageSize} onPageChange={setContractsPage} onPageSizeChange={(size) => { setContractsPageSize(size); setContractsPage(0); }} unit="份" />
@@ -860,7 +860,7 @@ export function CustomerWorkspacePage() {
             <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}>后端未返回该客户的变更记录</OpsTableEmpty>}
+          </tr>) : <OpsTableEmpty colSpan={4}>{changes.loading ? missingValue(READING) : missingValue("后端未返回该客户的变更记录")}</OpsTableEmpty>}
         </tbody>
       </table></div>
       <ListPager total={historyTotal} page={safeHistoryPage} pageSize={historyPageSize} onPageChange={setHistoryPage} onPageSizeChange={(size) => { setHistoryPageSize(size); setHistoryPage(0); }} unit="条" />

+ 4 - 5
web-scaffold/src/styles/record-detail.css

@@ -111,8 +111,7 @@
   overflow-wrap: anywhere;
 }
 
-.customer-record-metrics small,
-.customer-record-metric-loading {
+.customer-record-metrics small {
   color: var(--text-secondary);
   font-family: var(--font-sans);
   font-size: var(--type-meta);
@@ -211,12 +210,12 @@
 }
 
 .contract-record-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
-.contract-record :is(.oss-tri-missing, .oss-tri-fail, .table-placeholder) {
+:is(.contract-record, .customer-workspace) :is(.oss-tri-missing, .oss-tri-fail, .table-placeholder) {
   font: 400 var(--type-support)/1.5 var(--font-sans);
   letter-spacing: normal;
 }
-.contract-record :is(.oss-tri-missing, .table-placeholder) { color: var(--muted-foreground); }
-.contract-record td .table-placeholder { color: var(--border-hover); }
+:is(.contract-record, .customer-workspace) :is(.oss-tri-missing, .table-placeholder) { color: var(--muted-foreground); }
+:is(.contract-record, .customer-workspace) td .table-placeholder { color: var(--border-hover); }
 .contract-profile-actions { display: flex; justify-content: flex-end; }
 .contract-summary-panel .contract-facts-row-full { grid-column: 1 / -1; }
 .contract-summary-panel .contract-amount-field[aria-invalid="true"] dd { color: var(--destructive); }