系统管理员:新增日志管理(全系统操作审计)
- system_logs 表 + 持久化(查询/筛选/分页/动作枚举) - 全局审计中间件:记录全部写操作(POST/PUT/DELETE)+登录,含操作人(JWT)/角色/中文动作/方法/路径/目标/状态/成功/耗时/IP/查询参数 - 中文动作标签按路由推导,目标ID从路径提取 - GET /api/system-logs(仅系统管理员)支持按动作/关键词/时间/成功失败筛选 - 前端「日志管理」页:筛选+分页+明细展开;导航与路由接入
This commit is contained in:
@@ -982,6 +982,48 @@ export async function fetchDashboardStats(): Promise<DashboardStats> {
|
||||
return request<DashboardStats>('GET', '/api/dashboard/stats');
|
||||
}
|
||||
|
||||
/** 系统操作审计日志项。 */
|
||||
export interface SystemLogItem {
|
||||
id: number;
|
||||
ts: string;
|
||||
actorId: string | null;
|
||||
actorName: string | null;
|
||||
role: string | null;
|
||||
action: string;
|
||||
method: string;
|
||||
path: string;
|
||||
targetId: string | null;
|
||||
status: number | null;
|
||||
success: boolean | null;
|
||||
durationMs: number | null;
|
||||
ip: string | null;
|
||||
query: string | null;
|
||||
detail: unknown;
|
||||
}
|
||||
|
||||
export interface SystemLogPage {
|
||||
items: SystemLogItem[];
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
actions: string[];
|
||||
}
|
||||
|
||||
/** 查询系统操作审计日志(系统管理员)。 */
|
||||
export async function fetchSystemLogs(params: {
|
||||
page: number; pageSize: number; actorId?: string; action?: string; q?: string; from?: string; to?: string; success?: 'true' | 'false';
|
||||
}): Promise<SystemLogPage> {
|
||||
const sp = new URLSearchParams();
|
||||
sp.set('page', String(params.page));
|
||||
sp.set('pageSize', String(params.pageSize));
|
||||
if (params.action) sp.set('action', params.action);
|
||||
if (params.q) sp.set('q', params.q);
|
||||
if (params.from) sp.set('from', params.from);
|
||||
if (params.to) sp.set('to', params.to);
|
||||
if (params.success) sp.set('success', params.success);
|
||||
return request<SystemLogPage>('GET', `/api/system-logs?${sp.toString()}`);
|
||||
}
|
||||
|
||||
/** 经验库。 */
|
||||
export interface ExperienceItem {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user