Ver Fonte

突出套餐数量并统一操作列样式

sy há 17 horas atrás
pai
commit
d58894e7a5

+ 10 - 9
web-scaffold/src/pages/PackageManagementPage.tsx

@@ -27,11 +27,11 @@ import "../styles/packages.css";
 type CatalogTab = "fixed" | "custom" | "exits";
 
 
-/** 整数格三态:字段缺失=取数失败,null=未配置,⛔ 显示 0;不给单位时与原型一样只出数字。 */
-function intCell(value: number | null | undefined, unit?: string) {
+/** 计数列显示数量和单位,保留缺失与取数失败的提示。 */
+function intCell(value: number | null | undefined, unit: "个" | "份") {
   if (value === undefined) return <Tri tone="fail" text={WORD_FETCH_FAILED} />;
   if (value === null) return <Tri tone="missing" text={WORD_UNCONFIGURED} />;
-  return <><span className="table-number">{value}</span>{unit && <span className="catalog-value-unit">/{unit}</span>}</>;
+  return <><span className="table-number catalog-count-value">{value}</span><span className="catalog-value-unit">/{unit}</span></>;
 }
 
 /** 价格按年或按月标明单位,成本金额沿用千分位和两位小数。 */
@@ -135,9 +135,10 @@ function PlanDescNote({ name, desc }: { name: string; desc: string }) {
 
 /** 台账列宽:序号/操作列固定,其余按阅读需求分配(同合同台账口径)。
  *  套餐说明已收进名称旁问号图标,不再单列;用途分类改由表体内分组行承载,两 Tab 同列(2026-11-15)。 */
-const PLAN_COLUMNS = [58, 246, 132, 124, 96, 86, 150, 78, 100] as const;
+const PLAN_ACTIONS_WIDTH = 164;
+const PLAN_COLUMNS = [58, 246, 132, 124, 96, 86, 150, 78, PLAN_ACTIONS_WIDTH] as const;
 /** 自定义档台账多两列:建档人/建档团队(固定档不加)。 */
-const CUSTOM_PLAN_COLUMNS = [...PLAN_COLUMNS.slice(0, -1), 106, 112, 100] as const;
+const CUSTOM_PLAN_COLUMNS = [...PLAN_COLUMNS.slice(0, -1), 106, 112, PLAN_ACTIONS_WIDTH] as const;
 
 /** 小屏将同一行的数据排成卡片,使用独立的可见字段名。 */
 function CatalogField({ label, children, title }: {
@@ -169,16 +170,16 @@ function PlanRow({ plan, index, custom, writable, readOnlyNote, onEdit, onDelete
     <CatalogField label="月成本">{ledgerCostCell(plan)}</CatalogField>
     <CatalogField label="分账号额度">{intCell(plan.sub_account_quota, "个")}</CatalogField>
     <CatalogField label="总带宽">{ledgerBandwidth(plan)}</CatalogField>
-    <CatalogField label="订阅量" title="被合同条目或订阅引用的数量">{intCell(plan.referred_count)}</CatalogField>
+    <CatalogField label="订阅量" title="被合同条目或订阅引用的数量">{intCell(plan.referred_count, "份")}</CatalogField>
     {custom && <>
       <CatalogField label="建档人" title={plan.created_by ?? undefined}>{plan.created_by_name || <Tri tone="missing" text={WORD_UNCONFIGURED} />}</CatalogField>
       <CatalogField label="建档团队" title={plan.created_team_id ?? undefined}>{plan.created_team_name || <Tri tone="missing" text={WORD_UNCONFIGURED} />}</CatalogField>
     </>}
     <td role="cell" className="catalog-actions-cell">
       {writable ? (
-        <div className="catalog-row-actions">
-          <button type="button" aria-label="编辑套餐" onClick={onEdit} title="编辑套餐"><PencilLine size={15} /></button>
-          <button type="button" className="is-danger" aria-label="删除套餐" onClick={onDelete} title="删除套餐(引用拦截由服务端判定)"><Trash2 size={15} /></button>
+        <div className="ops-inline-actions catalog-row-actions">
+          <button type="button" aria-label="编辑套餐" onClick={onEdit}><PencilLine size={15} aria-hidden="true" />编辑</button>
+          <button type="button" className="is-danger" aria-label="删除套餐" onClick={onDelete} title="删除套餐(引用拦截由服务端判定)"><Trash2 size={15} aria-hidden="true" />删除</button>
         </div>
       ) : <span className="catalog-readonly-note" title={readOnlyNote}>只读</span>}
     </td>

+ 5 - 5
web-scaffold/src/styles/packages.css

@@ -95,10 +95,12 @@
 .catalog-price-annual { color: var(--primary-soft-foreground); font-weight: 700; }
 .catalog-price-currency, .catalog-value-unit { font-size: var(--type-meta); }
 .catalog-value-unit { margin-inline-start: 2px; color: var(--muted-foreground); font-weight: 500; }
+.catalog-count-value { color: var(--primary-soft-foreground); font-weight: 650; }
 .catalog-ledger .catalog-plan-row td { overflow: hidden; text-overflow: ellipsis; }
 .catalog-ledger th:last-child, .catalog-ledger .catalog-actions-cell {
   position: sticky;
   inset-inline-end: 0;
+  padding-inline: 8px;
   border-inline-start: 1px solid var(--border-subtle);
   text-align: center;
 }
@@ -130,10 +132,7 @@
 }
 .catalog-group-label strong { color: var(--primary-soft-foreground); font-size: var(--type-support); }
 .catalog-group-label > span { color: var(--text-secondary); font-size: var(--type-meta); }
-.catalog-row-actions { display: flex; justify-content: center; gap: 6px; }
-.catalog-row-actions button { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text-secondary); }
-.catalog-row-actions button:hover { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary-soft-foreground); }
-.catalog-row-actions button.is-danger:hover { border-color: var(--destructive-border); background: var(--destructive-soft); color: var(--destructive); }
+.catalog-actions-cell .catalog-row-actions { display: flex; flex-wrap: wrap; justify-content: center; }
 .catalog-ledger td .catalog-plan-owner { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
 .catalog-readonly-note { color: var(--muted-foreground); font-size: var(--type-support); }
 .catalog-empty { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; }
@@ -175,7 +174,8 @@
   .catalog-ledger .catalog-actions-cell { justify-content: end; background: transparent; }
   .catalog-ledger .catalog-plan-row:hover .catalog-actions-cell { background: transparent; }
   .catalog-ledger .catalog-sequence::before { content: "序号"; margin-inline-end: 6px; font-size: var(--type-meta); }
-  .catalog-row-actions button { width: 36px; height: 36px; }
+  .catalog-actions-cell .catalog-row-actions { justify-content: end; }
+  .catalog-actions-cell .catalog-row-actions button { min-height: 36px; padding-inline: 5px; }
   .catalog-ledger .ops-table-empty-cell { display: block; }
 }
 @container package-catalog (max-width: 780px) {