|
@@ -17,9 +17,9 @@
|
|
|
*/
|
|
*/
|
|
|
import { useEffect, useState } from "react";
|
|
import { useEffect, useState } from "react";
|
|
|
import { PageIntro } from "../components/PageIntro";
|
|
import { PageIntro } from "../components/PageIntro";
|
|
|
-import { ChevronDown, Download, Fingerprint, Search, UserRound } from "lucide-react";
|
|
|
|
|
|
|
+import { ArrowRight, CalendarDays, ChevronDown, Download, Fingerprint, Search, UserRound } from "lucide-react";
|
|
|
import { Button } from "../components/ui/button";
|
|
import { Button } from "../components/ui/button";
|
|
|
-import { Input } from "../components/ui/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, OpsTableColumns, OpsTableEmpty } from "../components/OperationsKit";
|
|
@@ -55,14 +55,18 @@ import {
|
|
|
import type { AuditItem } from "../lib/api/types";
|
|
import type { AuditItem } from "../lib/api/types";
|
|
|
import "../styles/operations.css";
|
|
import "../styles/operations.css";
|
|
|
import "../styles/party-audit.css";
|
|
import "../styles/party-audit.css";
|
|
|
|
|
+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 ⇒ 「—」(时刻未知,⛔ 猜) */
|
|
/** occurred_at → 东八区「日期+时刻」两行(总则§10.2,⚠️ 不显 UTC 串);null ⇒ 「—」(时刻未知,⛔ 猜) */
|
|
|
function TimeCell({ at }: { at: string | null }) {
|
|
function TimeCell({ at }: { at: string | null }) {
|
|
|
if (!at) return <>—</>;
|
|
if (!at) return <>—</>;
|
|
|
const date = new Date(at);
|
|
const date = new Date(at);
|
|
|
if (Number.isNaN(date.getTime())) return <>{at}</>;
|
|
if (Number.isNaN(date.getTime())) return <>{at}</>;
|
|
|
- const dateText = new Intl.DateTimeFormat("zh-CN", { timeZone: "Asia/Shanghai", year: "numeric", month: "2-digit", day: "2-digit" }).format(date);
|
|
|
|
|
- const timeText = new Intl.DateTimeFormat("zh-CN", { timeZone: "Asia/Shanghai", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false }).format(date);
|
|
|
|
|
|
|
+ const dateText = auditDayFormat.format(date);
|
|
|
|
|
+ const timeText = auditTimeFormat.format(date);
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<span className="audit-time-date">{dateText}</span>
|
|
<span className="audit-time-date">{dateText}</span>
|
|
@@ -91,18 +95,18 @@ function ActionCell({ action }: { action: string }) {
|
|
|
* (`detail_json.object`/前后值区的白名单名称键)→ 都取不到才 W32;三种形态都并列「类型 · 主键」小字。
|
|
* (`detail_json.object`/前后值区的白名单名称键)→ 都取不到才 W32;三种形态都并列「类型 · 主键」小字。
|
|
|
* ⛔ 拿当前库里的名字顶替历史行(I38:改名会伪造流水),⛔ 留空。
|
|
* ⛔ 拿当前库里的名字顶替历史行(I38:改名会伪造流水),⛔ 留空。
|
|
|
*/
|
|
*/
|
|
|
-function ObjectCell({ item, compact }: { item: AuditItem; compact: boolean }) {
|
|
|
|
|
|
|
+function ObjectCell({ item }: { item: AuditItem }) {
|
|
|
const typeText = AUDIT_OBJECT_TYPE_DISPLAY[normalizeAuditObjectType(item.object.type)] ?? item.object.type;
|
|
const typeText = AUDIT_OBJECT_TYPE_DISPLAY[normalizeAuditObjectType(item.object.type)] ?? item.object.type;
|
|
|
const snapshot = auditObjectSnapshot(item);
|
|
const snapshot = auditObjectSnapshot(item);
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
{snapshot ? (
|
|
{snapshot ? (
|
|
|
- <span className="audit-object-name" title={`${compact ? `${snapshot.text} · ` : ""}对象名取自${snapshot.source}(事件当时的快照,不随后续改名变化)`}>{snapshot.text}</span>
|
|
|
|
|
|
|
+ <span className="audit-object-name" title={`${snapshot.text} · 对象名取自${snapshot.source}(事件当时的快照,不随后续改名变化)`}>{snapshot.text}</span>
|
|
|
) : (
|
|
) : (
|
|
|
W32
|
|
W32
|
|
|
)}
|
|
)}
|
|
|
<br />
|
|
<br />
|
|
|
- <small title={compact ? `${typeText} · ${item.object.id}` : undefined}>
|
|
|
|
|
|
|
+ <small title={`${typeText} · ${item.object.id}`}>
|
|
|
{typeText} · {item.object.id}
|
|
{typeText} · {item.object.id}
|
|
|
</small>
|
|
</small>
|
|
|
</>
|
|
</>
|
|
@@ -154,35 +158,66 @@ function CompactAuditValue({ value, extra = [] }: {
|
|
|
* 「分账号:」一行⛔ 受前后值区是否为空影响(D-76):订阅类流水前后值都有值,而 D-41 的额度
|
|
* 「分账号:」一行⛔ 受前后值区是否为空影响(D-76):订阅类流水前后值都有值,而 D-41 的额度
|
|
|
* 对齐结果只落在 `detail_json.sub_accounts`,一并短路=审计页读不到补建了哪几个号。
|
|
* 对齐结果只落在 `detail_json.sub_accounts`,一并短路=审计页读不到补建了哪几个号。
|
|
|
*/
|
|
*/
|
|
|
-function AfterCell({ item, compact }: { item: AuditItem; compact: boolean }) {
|
|
|
|
|
- const detail = auditDetailLines(item);
|
|
|
|
|
- const seats = auditSeatLines(item);
|
|
|
|
|
- if (compact) {
|
|
|
|
|
- const extra = [
|
|
|
|
|
- { label: "明细", lines: detail },
|
|
|
|
|
- { label: "分账号", lines: seats },
|
|
|
|
|
- ].filter(({ lines }) => lines.length > 0);
|
|
|
|
|
- return <CompactAuditValue value={item.after} extra={extra} />;
|
|
|
|
|
|
|
+function AfterCell({ item }: { item: AuditItem }) {
|
|
|
|
|
+ const extra = [
|
|
|
|
|
+ { label: "明细", lines: auditDetailLines(item) },
|
|
|
|
|
+ { label: "分账号", lines: auditSeatLines(item) },
|
|
|
|
|
+ ].filter(({ lines }) => lines.length > 0);
|
|
|
|
|
+ return <CompactAuditValue value={item.after} extra={extra} />;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function AuditTimeline({ items }: { items: readonly AuditItem[] }) {
|
|
|
|
|
+ const groups: { day: string; entries: { item: AuditItem; clock: string; timestamp?: string }[] }[] = [];
|
|
|
|
|
+
|
|
|
|
|
+ for (const item of items) {
|
|
|
|
|
+ const date = item.occurred_at ? new Date(item.occurred_at) : null;
|
|
|
|
|
+ const validDate = date && !Number.isNaN(date.getTime()) ? date : null;
|
|
|
|
|
+ const day = validDate ? auditDayFormat.format(validDate) : "日期未记录";
|
|
|
|
|
+ const entry = {
|
|
|
|
|
+ item,
|
|
|
|
|
+ clock: validDate ? auditTimeFormat.format(validDate) : item.occurred_at || "—",
|
|
|
|
|
+ timestamp: validDate?.toISOString(),
|
|
|
|
|
+ };
|
|
|
|
|
+ const group = groups.at(-1);
|
|
|
|
|
+ if (group?.day === day) group.entries.push(entry);
|
|
|
|
|
+ else groups.push({ day, entries: [entry] });
|
|
|
}
|
|
}
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <AuditLines lines={formatAuditValue(item.after)} />
|
|
|
|
|
- {detail.length > 0 && (
|
|
|
|
|
- <>
|
|
|
|
|
- <br />
|
|
|
|
|
- <small>明细:</small>
|
|
|
|
|
- <AuditLines lines={detail} />
|
|
|
|
|
- </>
|
|
|
|
|
- )}
|
|
|
|
|
- {seats.length > 0 && (
|
|
|
|
|
- <>
|
|
|
|
|
- <br />
|
|
|
|
|
- <small>分账号:</small>
|
|
|
|
|
- <AuditLines lines={seats} />
|
|
|
|
|
- </>
|
|
|
|
|
- )}
|
|
|
|
|
- </>
|
|
|
|
|
- );
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return <div className="audit-timeline">
|
|
|
|
|
+ {groups.map(({ day, entries }, groupIndex) => (
|
|
|
|
|
+ <section className="audit-timeline-day" key={entries[0].item.cursor ?? `${day}-${groupIndex}`}>
|
|
|
|
|
+ <h2><CalendarDays size={16} aria-hidden="true" />{day}</h2>
|
|
|
|
|
+ <ol>
|
|
|
|
|
+ {entries.map(({ item, clock, timestamp }, index) => {
|
|
|
|
|
+ const actor = item.actor.username ?? item.actor.user_id;
|
|
|
|
|
+ return <li className="audit-timeline-row" key={item.cursor ?? index}>
|
|
|
|
|
+ <span className="audit-timeline-time">
|
|
|
|
|
+ {timestamp ? <time dateTime={timestamp}>{clock}</time> : clock}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span className="audit-timeline-marker" aria-hidden="true" />
|
|
|
|
|
+ <article className="audit-timeline-event">
|
|
|
|
|
+ <header>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <h3><ActionCell action={item.action} /></h3>
|
|
|
|
|
+ <div className="audit-timeline-object"><ObjectCell item={item} /></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span className="audit-timeline-actor">
|
|
|
|
|
+ <UserRound size={15} aria-hidden="true" />
|
|
|
|
|
+ <span><small>操作人</small>{actor ?? "—"}</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </header>
|
|
|
|
|
+ <div className="audit-timeline-values">
|
|
|
|
|
+ <dl><dt>变更前</dt><dd><CompactAuditValue value={item.before} /></dd></dl>
|
|
|
|
|
+ <ArrowRight size={15} className="audit-timeline-arrow" aria-hidden="true" />
|
|
|
|
|
+ <dl><dt>变更后</dt><dd><AfterCell item={item} /></dd></dl>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </article>
|
|
|
|
|
+ </li>;
|
|
|
|
|
+ })}
|
|
|
|
|
+ </ol>
|
|
|
|
|
+ </section>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </div>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** C88 横幅(契约 14.4.2):按身份逐字;⚠️ 四句不得合并为通用文案 */
|
|
/** C88 横幅(契约 14.4.2):按身份逐字;⚠️ 四句不得合并为通用文案 */
|
|
@@ -256,40 +291,29 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
const list = useAuditList();
|
|
const list = useAuditList();
|
|
|
const { applied, apply: applyFilter } = list;
|
|
const { applied, apply: applyFilter } = list;
|
|
|
const [draft, setDraft] = useState<AuditFilter>(EMPTY_AUDIT_FILTER);
|
|
const [draft, setDraft] = useState<AuditFilter>(EMPTY_AUDIT_FILTER);
|
|
|
- const [filterError, setFilterError] = useState<string | null>(null);
|
|
|
|
|
const [exporting, setExporting] = useState(false);
|
|
const [exporting, setExporting] = useState(false);
|
|
|
const [notice, setNotice] = useState<string | null>(null);
|
|
const [notice, setNotice] = useState<string | null>(null);
|
|
|
const hasFilter = Object.values(draft).some(Boolean) || Object.values(applied).some(Boolean);
|
|
const hasFilter = Object.values(draft).some(Boolean) || Object.values(applied).some(Boolean);
|
|
|
const needsObjectType = Boolean(draft.objectId && !draft.objectType);
|
|
const needsObjectType = Boolean(draft.objectId && !draft.objectType);
|
|
|
- const objectTypeError = "主体定位须先选择对象类型。";
|
|
|
|
|
- const visibleFilterError = partyView && needsObjectType ? objectTypeError : filterError;
|
|
|
|
|
- const intro = partyView ? "按时间、操作人或业务对象查找本方的变更记录。" : "需要追查一笔操作时,可按时间、账号或业务对象查找记录。";
|
|
|
|
|
|
|
+ const filtersPending = draft !== applied || list.phase.kind === "loading";
|
|
|
|
|
+ const intro = partyView
|
|
|
|
|
+ ? "按时间、操作人或业务对象查找本方的变更记录。"
|
|
|
|
|
+ : pageTitle === "归属变更"
|
|
|
|
|
+ ? "查看本公司的归属变动和变更前后的记录。"
|
|
|
|
|
+ : "按时间、操作人或业务对象追查历史操作。";
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (!partyView || draft === applied || needsObjectType) return;
|
|
|
|
|
- const timer = window.setTimeout(() => applyFilter(draft), 300);
|
|
|
|
|
- return () => window.clearTimeout(timer);
|
|
|
|
|
- }, [partyView, draft, applied, needsObjectType, applyFilter]);
|
|
|
|
|
|
|
+ // 对象 ID 与类型一起提交,避免筛选条件尚未填完整时返回其他记录。
|
|
|
|
|
+ if (draft !== applied && !needsObjectType) applyFilter(draft);
|
|
|
|
|
+ }, [draft, applied, needsObjectType, applyFilter]);
|
|
|
|
|
|
|
|
const change = (key: keyof AuditFilter, value: string) => {
|
|
const change = (key: keyof AuditFilter, value: string) => {
|
|
|
- setDraft((current) => ({ ...current, [key]: value }));
|
|
|
|
|
- setFilterError(null);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const apply = () => {
|
|
|
|
|
- // 主体定位只接受 ID 且须与对象类型成对(作业§5.4);缺类型 ⇒ 拒发并提示,⛔ 静默丢条件
|
|
|
|
|
- if (needsObjectType) {
|
|
|
|
|
- setFilterError(objectTypeError);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- setFilterError(null);
|
|
|
|
|
- list.apply(draft);
|
|
|
|
|
|
|
+ setDraft((current) => current[key] === value ? current : { ...current, [key]: value });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const reset = () => {
|
|
const reset = () => {
|
|
|
setDraft(EMPTY_AUDIT_FILTER);
|
|
setDraft(EMPTY_AUDIT_FILTER);
|
|
|
- setFilterError(null);
|
|
|
|
|
- list.apply(EMPTY_AUDIT_FILTER);
|
|
|
|
|
|
|
+ applyFilter(EMPTY_AUDIT_FILTER);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const objectTypeSelect = (
|
|
const objectTypeSelect = (
|
|
@@ -318,54 +342,45 @@ 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 page-fill"}>
|
|
|
|
|
|
|
+ <section className={partyView ? "ops-page ops-page--audit party-audit-page page-fill page-fill-window" : "ops-page ops-page--audit audit-timeline-page"}>
|
|
|
<header className="ops-heading">
|
|
<header className="ops-heading">
|
|
|
<div>
|
|
<div>
|
|
|
<h1>{pageTitle}</h1>
|
|
<h1>{pageTitle}</h1>
|
|
|
<PageIntro>{intro}</PageIntro>
|
|
<PageIntro>{intro}</PageIntro>
|
|
|
</div>
|
|
</div>
|
|
|
{canExport && (
|
|
{canExport && (
|
|
|
- <Button variant="outline" type="button" onClick={() => setExporting(true)}>
|
|
|
|
|
|
|
+ <Button variant="outline" type="button" disabled={filtersPending} onClick={() => setExporting(true)}>
|
|
|
<Download size={16} />
|
|
<Download size={16} />
|
|
|
{EXPORT_DIALOG_TITLE}
|
|
{EXPORT_DIALOG_TITLE}
|
|
|
</Button>
|
|
</Button>
|
|
|
)}
|
|
)}
|
|
|
</header>
|
|
</header>
|
|
|
|
|
|
|
|
- {partyView ? <aside className="party-audit-scope" aria-label="记录可见范围"><ScopeBanners role={role} /></aside> : <ScopeBanners role={role} />}
|
|
|
|
|
|
|
+ <aside className="party-audit-scope" aria-label="记录可见范围"><ScopeBanners role={role} /></aside>
|
|
|
|
|
|
|
|
- <section className="ops-list-shell list-shell-fill" aria-label="操作记录">
|
|
|
|
|
- {/* 检索区四件(契约 14.4.1):对象类型/主体定位(只接受 ID)/操作人(ID)/时间区间+关键字 */}
|
|
|
|
|
- <form className="ops-toolbar flex-wrap" aria-label="筛选操作记录" onSubmit={(event) => { event.preventDefault(); if (!partyView) apply(); }}>
|
|
|
|
|
- {partyView && <label className="ops-search party-audit-keyword">
|
|
|
|
|
|
|
+ <section className={partyView ? "ops-list-shell list-shell-fill" : "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"}>
|
|
|
<Search size={17} aria-hidden="true" />
|
|
<Search size={17} aria-hidden="true" />
|
|
|
- <Input aria-label="关键字" placeholder="搜索变更记录" value={draft.keyword} onChange={(event) => change("keyword", event.target.value)} />
|
|
|
|
|
- </label>}
|
|
|
|
|
- {!partyView && objectTypeSelect}
|
|
|
|
|
|
|
+ <SearchInput aria-label="关键字" placeholder={pageTitle === "审计日志" ? "搜索操作记录" : "搜索变更记录"} value={draft.keyword} onCommit={(value) => change("keyword", value)} />
|
|
|
|
|
+ </label>
|
|
|
<label className="ops-search">
|
|
<label className="ops-search">
|
|
|
- {partyView ? <Fingerprint size={17} aria-hidden="true" /> : <Search size={17} />}
|
|
|
|
|
- <Input aria-label="主体定位(对象 ID)" placeholder={partyView ? "对象 ID" : "主体定位:对象 ID"} value={draft.objectId} onChange={(event) => change("objectId", event.target.value)} />
|
|
|
|
|
|
|
+ <Fingerprint size={17} aria-hidden="true" />
|
|
|
|
|
+ <SearchInput aria-label="主体定位(对象 ID)" placeholder="对象 ID" value={draft.objectId} onCommit={(value) => change("objectId", value)} />
|
|
|
</label>
|
|
</label>
|
|
|
<label className="ops-search">
|
|
<label className="ops-search">
|
|
|
- {partyView ? <UserRound size={17} aria-hidden="true" /> : <Search size={17} />}
|
|
|
|
|
- <Input aria-label="操作人(账号 ID)" placeholder="操作人:账号 ID" value={draft.actorId} onChange={(event) => change("actorId", event.target.value)} />
|
|
|
|
|
|
|
+ <UserRound size={17} aria-hidden="true" />
|
|
|
|
|
+ <SearchInput aria-label="操作人(账号 ID)" placeholder="操作人 ID" value={draft.actorId} onCommit={(value) => change("actorId", value)} />
|
|
|
</label>
|
|
</label>
|
|
|
- {partyView && objectTypeSelect}
|
|
|
|
|
|
|
+ {objectTypeSelect}
|
|
|
<DateRangeFilter label="时间范围" from={draft.from} to={draft.to} onChange={change} constrainRange />
|
|
<DateRangeFilter label="时间范围" from={draft.from} to={draft.to} onChange={change} constrainRange />
|
|
|
- {!partyView && <label className="ops-search">
|
|
|
|
|
- <Search size={17} />
|
|
|
|
|
- <Input aria-label="关键字" placeholder="关键字" value={draft.keyword} onChange={(event) => change("keyword", event.target.value)} />
|
|
|
|
|
- </label>}
|
|
|
|
|
- {!partyView && <Button type="submit" size="sm">
|
|
|
|
|
- 查询
|
|
|
|
|
- </Button>}
|
|
|
|
|
- {(!partyView || hasFilter) && <Button type="button" size="sm" variant="ghost" onClick={reset}>
|
|
|
|
|
|
|
+ {hasFilter && <Button type="button" size="sm" variant="ghost" onClick={reset}>
|
|
|
重置筛选
|
|
重置筛选
|
|
|
</Button>}
|
|
</Button>}
|
|
|
- </form>
|
|
|
|
|
- {visibleFilterError && (
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {needsObjectType && (
|
|
|
<p className="ops-form-error" role="alert">
|
|
<p className="ops-form-error" role="alert">
|
|
|
- {visibleFilterError}
|
|
|
|
|
|
|
+ 请先选择对象类型,再按对象 ID 筛选。
|
|
|
</p>
|
|
</p>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
@@ -378,9 +393,9 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
</p>
|
|
</p>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
- <div className="measured-table-scroll ops-table-wrap" role="region" aria-label={`${pageTitle},可横向滚动查看字段`} tabIndex={0}>
|
|
|
|
|
- <table className={partyView ? "ops-table party-audit-table" : "ops-table"} aria-busy={partyView ? list.phase.kind === "loading" || list.loadingMore : undefined}>
|
|
|
|
|
- <OpsTableColumns widths={partyView ? [11, 13, 14, 18, 22, 22] : [11, 11, 13, 18, 22, 25]} />
|
|
|
|
|
|
|
+ {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>
|
|
<thead>
|
|
|
<tr>
|
|
<tr>
|
|
|
{W31_COLUMNS.map((column) => (
|
|
{W31_COLUMNS.map((column) => (
|
|
@@ -394,18 +409,18 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
<td>
|
|
<td>
|
|
|
<TimeCell at={item.occurred_at} />
|
|
<TimeCell at={item.occurred_at} />
|
|
|
</td>
|
|
</td>
|
|
|
- <td title={partyView ? item.actor.username ?? item.actor.user_id ?? undefined : undefined}>{item.actor.username ?? item.actor.user_id ?? <span className="table-placeholder">—</span>}</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>
|
|
<td>
|
|
|
<ActionCell action={item.action} />
|
|
<ActionCell action={item.action} />
|
|
|
</td>
|
|
</td>
|
|
|
<td>
|
|
<td>
|
|
|
- <ObjectCell item={item} compact={partyView} />
|
|
|
|
|
|
|
+ <ObjectCell item={item} />
|
|
|
</td>
|
|
</td>
|
|
|
<td>
|
|
<td>
|
|
|
- {partyView ? <CompactAuditValue value={item.before} /> : <AuditLines lines={formatAuditValue(item.before)} />}
|
|
|
|
|
|
|
+ <CompactAuditValue value={item.before} />
|
|
|
</td>
|
|
</td>
|
|
|
<td>
|
|
<td>
|
|
|
- <AfterCell item={item} compact={partyView} />
|
|
|
|
|
|
|
+ <AfterCell item={item} />
|
|
|
</td>
|
|
</td>
|
|
|
</tr>
|
|
</tr>
|
|
|
))}
|
|
))}
|
|
@@ -413,10 +428,14 @@ export function AuditLogPage({ pageTitle = "审计日志", partyView = false }:
|
|
|
{list.phase.kind === "ready" && list.items.length === 0 && <OpsTableEmpty colSpan={6}>{W15}</OpsTableEmpty>}
|
|
{list.phase.kind === "ready" && list.items.length === 0 && <OpsTableEmpty colSpan={6}>{W15}</OpsTableEmpty>}
|
|
|
</tbody>
|
|
</tbody>
|
|
|
</table>
|
|
</table>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </div> : <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>}
|
|
|
{list.nextCursor && (
|
|
{list.nextCursor && (
|
|
|
<footer className="ops-list-footer">
|
|
<footer className="ops-list-footer">
|
|
|
- <Button variant="outline" size="sm" type="button" disabled={list.loadingMore || (partyView && (draft !== applied || list.phase.kind === "loading"))} onClick={list.loadMore}>
|
|
|
|
|
|
|
+ <Button variant="outline" size="sm" type="button" disabled={list.loadingMore || filtersPending} onClick={list.loadMore}>
|
|
|
{list.loadingMore ? "加载中…" : "加载更多"}
|
|
{list.loadingMore ? "加载中…" : "加载更多"}
|
|
|
</Button>
|
|
</Button>
|
|
|
</footer>
|
|
</footer>
|