Files
novalon-manage-system/novalon-manage-web/src/api/loginLog.ts
T
张翔 8163fc39c5 feat(web): Phase 5 - 业务页面迁移完成
完成所有业务页面从 Vue 3 到 React 19 的迁移:

页面迁移:
- Login: 表单验证 + 认证集成
- Dashboard: 统计卡片 + G2 图表占位
- UserManagement: 表格 + 分页 + CRUD + 权限控制
- RoleManagement: 表格 + 弹窗 + TreeSelect 权限分配
- MenuManagement: 树形表格 + 层级菜单管理
- ConfigManagement: 参数配置 CRUD
- DictManagement: 字典类型/数据双面板管理
- FileManagement: 文件上传 + 图片预览
- NoticeManagement: 通知公告 CRUD
- LoginLog/OpLog/ExLog: 审计日志只读查询
- 403: 权限拒绝页面

API 层补充:
- loginLog.ts: 新增 LoginLog/OpLog/ExLog 接口与 API
- status.ts: 新增 userStatusMap/roleStatusMap/menuStatusMap/noticeStatusMap

路由修正:
- routes.ts: 日志页面路径对齐实际目录结构

验证:tsc --noEmit 零错误,dev server 正常启动
2026-05-03 15:56:45 +08:00

121 lines
2.3 KiB
TypeScript

import request from '@/utils/request'
import type { PageResponse } from './user.api'
import { NoticeStatus } from '@/constants/status'
export interface LoginLog {
id: number
username: string
ip: string
location: string
browser: string
os: string
status: number
message: string
loginTime: string
}
export interface LoginLogPageRequest {
page: number
size: number
keyword?: string
username?: string
ip?: string
}
export interface OpLog {
id: number
operator: string
description: string
method: string
url: string
params: string
ip: string
status: number
createdAt: string
}
export interface OpLogPageRequest {
page: number
size: number
keyword?: string
operator?: string
}
export interface ExLog {
id: number
url: string
method: string
message: string
stackTrace: string
ip: string
operator: string
createdAt: string
}
export interface ExLogPageRequest {
page: number
size: number
keyword?: string
}
export interface Notice {
id: number
title: string
content: string
type: string
status: NoticeStatus
createdBy: string
createdAt: string
updatedAt: string
}
export interface CreateNoticeRequest {
title: string
content: string
type?: string
status?: NoticeStatus
}
export interface UpdateNoticeRequest {
title?: string
content?: string
type?: string
status?: NoticeStatus
}
export interface NoticePageRequest {
page: number
size: number
title?: string
type?: string
status?: string
}
export const loginLogApi = {
getLoginLogs: (params: LoginLogPageRequest) =>
request.get<PageResponse<LoginLog>>('/logs/login/page', { params }),
getOpLogs: (params: OpLogPageRequest) =>
request.get<PageResponse<OpLog>>('/logs/operation/page', { params }),
getExLogs: (params: ExLogPageRequest) =>
request.get<PageResponse<ExLog>>('/logs/exception/page', { params }),
}
export const noticeApi = {
getPage: (params: NoticePageRequest) =>
request.get<PageResponse<Notice>>('/notice/page', { params }),
getById: (id: number) =>
request.get<Notice>(`/notice/${id}`),
create: (data: CreateNoticeRequest) =>
request.post<Notice>('/notice', data),
update: (id: number, data: UpdateNoticeRequest) =>
request.put<Notice>(`/notice/${id}`, data),
delete: (id: number) =>
request.delete<void>(`/notice/${id}`),
}