Prechádzať zdrojové kódy

feat(web): 本方变更记录复用审计时间线

sy 3 dní pred
rodič
commit
2afdda6162

+ 6 - 58
web-scaffold/src/pages/AuditLogPage.tsx

@@ -22,7 +22,7 @@ import { Button } from "../components/ui/button";
 import { SearchInput } from "../components/ui/search-input";
 import { FilterSelect } from "../components/ui/filter-select";
 import { DateRangeFilter } from "../components/ui/date-range-filter";
-import { OpsNotice, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
+import { OpsNotice } from "../components/OperationsKit";
 import { useDemoIdentity } from "../lib/demo-session";
 import { EMPTY_AUDIT_FILTER, auditDetailLines, auditObjectSnapshot, auditSeatLines, formatAuditValue, submitAuditExport, useAuditList, type AuditFilter } from "../lib/audit-logs";
 import {
@@ -38,7 +38,6 @@ import {
   BTN_CONFIRM_EXPORT,
   EXPORT_DIALOG_TITLE,
   W15,
-  W31_COLUMNS,
   W32,
   W33A,
   W33B,
@@ -59,22 +58,6 @@ import "../styles/audit-timeline.css";
 const auditDayFormat = new Intl.DateTimeFormat("zh-CN", { timeZone: "Asia/Shanghai", year: "numeric", month: "2-digit", day: "2-digit" });
 const auditTimeFormat = new Intl.DateTimeFormat("zh-CN", { timeZone: "Asia/Shanghai", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false });
 
-/** occurred_at → 东八区「日期+时刻」两行(总则§10.2,⚠️ 不显 UTC 串);null ⇒ 「—」(时刻未知,⛔ 猜) */
-function TimeCell({ at }: { at: string | null }) {
-  if (!at) return <>—</>;
-  const date = new Date(at);
-  if (Number.isNaN(date.getTime())) return <>{at}</>;
-  const dateText = auditDayFormat.format(date);
-  const timeText = auditTimeFormat.format(date);
-  return (
-    <>
-      <span className="audit-time-date">{dateText}</span>
-      <br />
-      <small>{timeText}</small>
-    </>
-  );
-}
-
 /** 第 3 列:中文动作名(注册表命中)/原样+未登记小字(作业§9.4②) */
 function ActionCell({ action }: { action: string }) {
   // D-59:写侧同一动作有三种形态(`bos.` 前缀/点分变体/中文串)⇒ 先归一再查表,查不到才判未登记
@@ -340,7 +323,7 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
   }
 
   return (
-    <section className={partyView ? "ops-page ops-page--audit party-audit-page page-fill page-fill-window" : "ops-page ops-page--audit audit-timeline-page"}>
+    <section className="ops-page ops-page--audit audit-timeline-page">
       <header className="ops-heading">
         <div>
           <h1>{pageTitle}</h1>
@@ -356,9 +339,9 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
 
       <aside className="party-audit-scope" aria-label="记录可见范围"><ScopeBanners role={role} /></aside>
 
-      <section className={partyView ? "ops-list-shell list-shell-fill" : "ops-list-shell audit-timeline-shell"} aria-label="操作记录">
+      <section className="ops-list-shell audit-timeline-shell" aria-label="操作记录">
         <div className="ops-toolbar audit-record-filters" role="group" aria-label="筛选操作记录">
-          <label className={partyView ? "ops-search party-audit-keyword" : "ops-search"}>
+          <label className="ops-search">
             <Search size={17} aria-hidden="true" />
             <SearchInput aria-label="关键字" placeholder={pageTitle === "审计日志" ? "搜索操作记录" : "搜索变更记录"} value={draft.keyword} onCommit={(value) => change("keyword", value)} />
           </label>
@@ -391,46 +374,11 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
           </p>
         )}
 
-        {partyView ? <div className="measured-table-scroll ops-table-wrap" role="region" aria-label={`${pageTitle},可横向滚动查看字段`} tabIndex={0}>
-          <table className="ops-table party-audit-table" aria-busy={list.phase.kind === "loading" || list.loadingMore}>
-            <OpsTableColumns widths={[11, 13, 14, 18, 22, 22]} />
-            <thead>
-              <tr>
-                {W31_COLUMNS.map((column) => (
-                  <th key={column} scope="col">{column}</th>
-                ))}
-              </tr>
-            </thead>
-            <tbody>
-              {list.items.map((item) => (
-                <tr key={item.cursor ?? `${item.object.type}-${item.object.id}-${item.action}`}>
-                  <td>
-                    <TimeCell at={item.occurred_at} />
-                  </td>
-                  <td title={item.actor.username ?? item.actor.user_id ?? undefined}>{item.actor.username ?? item.actor.user_id ?? <span className="table-placeholder">—</span>}</td>
-                  <td>
-                    <ActionCell action={item.action} />
-                  </td>
-                  <td>
-                    <ObjectCell item={item} />
-                  </td>
-                  <td>
-                    <CompactAuditValue value={item.before} />
-                  </td>
-                  <td>
-                    <AfterCell item={item} />
-                  </td>
-                </tr>
-              ))}
-              {list.phase.kind === "loading" && <OpsTableEmpty colSpan={6}>正在加载…</OpsTableEmpty>}
-              {list.phase.kind === "ready" && list.items.length === 0 && <OpsTableEmpty colSpan={6}>{W15}</OpsTableEmpty>}
-            </tbody>
-          </table>
-        </div> : <div className="audit-timeline-content" aria-busy={list.phase.kind === "loading" || list.loadingMore}>
+        <div className="audit-timeline-content" aria-busy={list.phase.kind === "loading" || list.loadingMore}>
           {list.phase.kind === "loading" ? <p className="audit-timeline-empty" role="status">正在加载…</p>
             : list.items.length ? <AuditTimeline items={list.items} />
               : list.phase.kind === "ready" && <div className="audit-timeline-empty" role="status"><CalendarDays size={23} aria-hidden="true" />{W15}</div>}
-        </div>}
+        </div>
         {list.nextCursor && (
           <footer className="ops-list-footer">
             <Button variant="outline" size="sm" type="button" disabled={list.loadingMore || filtersPending} onClick={list.loadMore}>

+ 1 - 2
web-scaffold/src/styles/operations.css

@@ -993,8 +993,7 @@ body:has(:is(.ops-content-dialog, .header-logout-dialog)[open]) { overflow: hidd
   width: auto;
   max-width: min(240px, 100%);
 }
-.ops-page--customers .customer-list-filters .customer-id-search,
-.party-audit-page .ops-toolbar > .ops-search:not(.party-audit-keyword) {
+.ops-page--customers .customer-list-filters .customer-id-search {
   flex: 1 1 148px;
   min-width: 0;
   width: auto;

+ 0 - 47
web-scaffold/src/styles/party-audit.css

@@ -1,5 +1,3 @@
-.party-audit-page.ops-page--audit .ops-heading { margin-bottom: 12px; }
-
 .party-audit-scope {
   display: flex;
   flex-wrap: wrap;
@@ -15,46 +13,11 @@
 .party-audit-scope .ops-import-note { font-size: var(--type-meta); }
 .party-audit-scope .ops-import-note:first-child { color: var(--text-secondary); font-weight: 500; }
 
-.party-audit-page .ops-toolbar { flex: none; }
-.party-audit-page .ops-list-shell > .ops-form-error { margin: 0 24px 12px; }
-.party-audit-page .ops-table-wrap:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
-.party-audit-page .ops-list-footer { justify-content: flex-end; }
-
-.party-audit-table.ops-table {
-  min-width: 950px;
-  table-layout: fixed;
-  border-collapse: separate;
-  border-spacing: 0;
-}
-.party-audit-table.ops-table td { padding-block: 11px; vertical-align: top; }
-.party-audit-table tbody tr:is(:hover, :focus-within) td { background: var(--surface-subtle); }
-.party-audit-table td:nth-child(2),
-.party-audit-table td:nth-child(3) > span,
-.party-audit-table .audit-object-name,
-.party-audit-table td:nth-child(4) > small,
 .party-audit-preview {
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
 }
-.party-audit-table td:nth-child(3) > span,
-.party-audit-table .audit-object-name,
-.party-audit-table td > small { display: block; }
-.party-audit-table td > br { display: none; }
-.party-audit-table td > small {
-  margin-top: 3px;
-  color: var(--muted-foreground);
-  font-size: var(--type-meta);
-}
-.party-audit-table td:nth-child(3),
-.party-audit-table .audit-object-name { color: var(--text-secondary); font-weight: 500; }
-.party-audit-table .audit-time-date { font-variant-numeric: tabular-nums; }
-.party-audit-table .party-audit-value {
-  color: var(--text-secondary);
-  line-height: 1.5;
-  overflow-wrap: anywhere;
-  white-space: pre-wrap;
-}
 .party-audit-value-group + .party-audit-value-group { margin-top: 6px; }
 .party-audit-value-group > small { color: var(--muted-foreground); font-size: var(--type-meta); }
 .party-audit-disclosure > summary {
@@ -80,13 +43,3 @@
 .party-audit-disclosure[open] :is(.party-audit-preview, .party-audit-expand) { display: none; }
 .party-audit-disclosure[open] .party-audit-toggle svg { transform: rotate(180deg); }
 .party-audit-disclosure[open] > .party-audit-value { margin-top: 5px; }
-
-@media (min-width: 701px) {
-  .party-audit-page .date-range-filter {
-    grid-template-columns: auto minmax(0, 102px) auto minmax(0, 102px);
-  }
-}
-
-@media (max-width: 599px) {
-  .party-audit-page .ops-list-shell > .ops-form-error { margin-inline: 18px; }
-}