|
@@ -22,7 +22,7 @@ import { Button } from "../components/ui/button";
|
|
|
import { SearchInput } from "../components/ui/search-input";
|
|
import { SearchInput } from "../components/ui/search-input";
|
|
|
import { FilterSelect } from "../components/ui/filter-select";
|
|
import { FilterSelect } from "../components/ui/filter-select";
|
|
|
import { DateRangeFilter } from "../components/ui/date-range-filter";
|
|
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 { useDemoIdentity } from "../lib/demo-session";
|
|
|
import { EMPTY_AUDIT_FILTER, auditDetailLines, auditObjectSnapshot, auditSeatLines, formatAuditValue, submitAuditExport, useAuditList, type AuditFilter } from "../lib/audit-logs";
|
|
import { EMPTY_AUDIT_FILTER, auditDetailLines, auditObjectSnapshot, auditSeatLines, formatAuditValue, submitAuditExport, useAuditList, type AuditFilter } from "../lib/audit-logs";
|
|
|
import {
|
|
import {
|
|
@@ -38,7 +38,6 @@ import {
|
|
|
BTN_CONFIRM_EXPORT,
|
|
BTN_CONFIRM_EXPORT,
|
|
|
EXPORT_DIALOG_TITLE,
|
|
EXPORT_DIALOG_TITLE,
|
|
|
W15,
|
|
W15,
|
|
|
- W31_COLUMNS,
|
|
|
|
|
W32,
|
|
W32,
|
|
|
W33A,
|
|
W33A,
|
|
|
W33B,
|
|
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 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 });
|
|
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②) */
|
|
/** 第 3 列:中文动作名(注册表命中)/原样+未登记小字(作业§9.4②) */
|
|
|
function ActionCell({ action }: { action: string }) {
|
|
function ActionCell({ action }: { action: string }) {
|
|
|
// D-59:写侧同一动作有三种形态(`bos.` 前缀/点分变体/中文串)⇒ 先归一再查表,查不到才判未登记
|
|
// D-59:写侧同一动作有三种形态(`bos.` 前缀/点分变体/中文串)⇒ 先归一再查表,查不到才判未登记
|
|
@@ -340,7 +323,7 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
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">
|
|
<header className="ops-heading">
|
|
|
<div>
|
|
<div>
|
|
|
<h1>{pageTitle}</h1>
|
|
<h1>{pageTitle}</h1>
|
|
@@ -356,9 +339,9 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
|
|
|
|
|
<aside className="party-audit-scope" aria-label="记录可见范围"><ScopeBanners role={role} /></aside>
|
|
<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="筛选操作记录">
|
|
<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" />
|
|
<Search size={17} aria-hidden="true" />
|
|
|
<SearchInput aria-label="关键字" placeholder={pageTitle === "审计日志" ? "搜索操作记录" : "搜索变更记录"} value={draft.keyword} onCommit={(value) => change("keyword", value)} />
|
|
<SearchInput aria-label="关键字" placeholder={pageTitle === "审计日志" ? "搜索操作记录" : "搜索变更记录"} value={draft.keyword} onCommit={(value) => change("keyword", value)} />
|
|
|
</label>
|
|
</label>
|
|
@@ -391,46 +374,11 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
</p>
|
|
</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.phase.kind === "loading" ? <p className="audit-timeline-empty" role="status">正在加载…</p>
|
|
|
: list.items.length ? <AuditTimeline items={list.items} />
|
|
: 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>}
|
|
: list.phase.kind === "ready" && <div className="audit-timeline-empty" role="status"><CalendarDays size={23} aria-hidden="true" />{W15}</div>}
|
|
|
- </div>}
|
|
|
|
|
|
|
+ </div>
|
|
|
{list.nextCursor && (
|
|
{list.nextCursor && (
|
|
|
<footer className="ops-list-footer">
|
|
<footer className="ops-list-footer">
|
|
|
<Button variant="outline" size="sm" type="button" disabled={list.loadingMore || filtersPending} onClick={list.loadMore}>
|
|
<Button variant="outline" size="sm" type="button" disabled={list.loadingMore || filtersPending} onClick={list.loadMore}>
|