41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
|
|
import { get } from '../request'
|
|||
|
|
import request from '../request'
|
|||
|
|
|
|||
|
|
export interface AuditLog {
|
|||
|
|
id: string
|
|||
|
|
tenant_id?: string
|
|||
|
|
project_id?: string
|
|||
|
|
actor_id?: string
|
|||
|
|
action?: string
|
|||
|
|
target_type?: string
|
|||
|
|
target_id?: string
|
|||
|
|
detail?: string
|
|||
|
|
client_ip?: string
|
|||
|
|
time?: string
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface AuditQuery {
|
|||
|
|
tenant_id?: string
|
|||
|
|
project_id?: string
|
|||
|
|
actor_id?: string
|
|||
|
|
action?: string
|
|||
|
|
target_type?: string
|
|||
|
|
start_time?: string
|
|||
|
|
end_time?: string
|
|||
|
|
limit?: number
|
|||
|
|
offset?: number
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** 审计日志查询:使用 get 辅助函数,拦截器已解包,直接返回 { items, total } */
|
|||
|
|
export const getAuditLogs = (query: AuditQuery = {}) =>
|
|||
|
|
get<{ items: AuditLog[]; total: number }>('/system/audit-logs', query)
|
|||
|
|
|
|||
|
|
/** 审计日志导出 CSV:blob 响应走完整 axios response,需手动取 data */
|
|||
|
|
export const exportAuditLogs = (query: AuditQuery = {}) =>
|
|||
|
|
request<Blob>({
|
|||
|
|
url: '/system/audit-logs/export',
|
|||
|
|
method: 'get',
|
|||
|
|
params: query,
|
|||
|
|
responseType: 'blob',
|
|||
|
|
}).then((res) => res.data)
|