刘光辉
9 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import { defHttp } from '#/api/request';
 
export type AuditEventId = number | string;
export type AuditEventType = 'BIZ_ACTION' | 'DATA_CHANGE' | 'E_SIGNATURE';
 
export interface AuditPageQuery {
  actionCode?: string;
  appName?: string;
  bizCode?: string;
  bizModule?: string;
  bizType?: string;
  currentPage: number;
  endTime?: string;
  eventType?: AuditEventType;
  keyword?: string;
  operatorName?: string;
  pageSize: number;
  startTime?: string;
  targetTable?: string;
}
 
export interface AuditEventListDTO {
  actionCode?: string;
  actionLabel?: string;
  appName?: string;
  bizCode?: string;
  bizModule?: string;
  bizType?: string;
  browser?: string;
  clientEventId?: string;
  createdAt?: string;
  diffCount?: number;
  entryId?: string;
  entryName?: string;
  entryType?: string;
  eventTime?: string;
  eventType?: AuditEventType | string;
  id: AuditEventId;
  ip?: string;
  ipRegion?: string;
  operationId?: null | string;
  operatorId?: string;
  operatorName?: string;
  operatorOrgId?: string;
  os?: string;
  reason?: string;
  recordTitle?: string;
  requestUri?: string;
  signatureRole?: 'PRIMARY' | 'REVIEW' | string;
  signed?: boolean;
  sourceLayer?: number;
  subEvents?: AuditEventListDTO[];
  subTitleCount?: number;
  subTitles?: string[];
  targetId?: string;
  targetTable?: string;
  tenantId?: string;
}
 
export interface AuditFieldDiffDTO {
  changeType?: string;
  chidData?: Array<Record<string, unknown>>;
  chidField?: Array<Record<string, unknown>>;
  componentType?: string;
  field?: string;
  fieldName?: string;
  jnpfKey?: string;
  masked?: boolean;
  nameModified?: boolean;
  newData?: unknown;
  newDisplay?: unknown;
  oldData?: unknown;
  oldDisplay?: unknown;
  technical?: boolean;
  type?: number | string;
  valueType?: string;
}
 
export interface AuditEventDetailDTO extends Omit<AuditEventListDTO, 'diffCount' | 'subEvents'> {
  dataSnapshot?: string;
  extra?: string;
  fieldDiffList?: AuditFieldDiffDTO[] | null;
  fieldDiffs?: string;
  prevHash?: string;
}
 
export interface AuditPagination {
  currentPage: number;
  pageSize: number;
  total: number;
}
 
export interface AuditEventPageDTO {
  list: AuditEventListDTO[];
  pagination: AuditPagination;
}
 
interface AuditApiResult<T> {
  code: number;
  data: T;
  msg?: string;
}
 
export const AUDIT_EVENT_API = {
  detail: '/api/audit/audit/events',
  page: '/api/audit/audit/events/page',
  timeline: '/api/audit/audit/events/timeline',
} as const;
 
const silentErrorOptions = { errorMessageMode: 'none' as const };
 
/** Query operation-deduplicated BUSINESS rows with related signature event summaries. */
export function getAuditEventPage(data: AuditPageQuery) {
  return defHttp.post<AuditApiResult<AuditEventPageDTO>>({ url: AUDIT_EVENT_API.page, data }, silentErrorOptions);
}
 
/** Query a single event detail. Callers must not log or cache this response. */
export function getAuditEventDetail(id: AuditEventId) {
  return defHttp.get<AuditApiResult<AuditEventDetailDTO>>({ url: `${AUDIT_EVENT_API.detail}/${id}` }, silentErrorOptions);
}
 
/** Query the operation-grouped event timeline for an exact target record. */
export function getAuditEventTimeline(targetId: string) {
  return defHttp.get<AuditApiResult<AuditEventListDTO[]>>({ url: AUDIT_EVENT_API.timeline, params: { targetId } }, silentErrorOptions);
}