feat: 添加登陆日志页面
parent
e7e6c93236
commit
4eab238712
14
.env
14
.env
|
|
@ -2,13 +2,11 @@
|
|||
# 应用配置
|
||||
# =====================================================================================
|
||||
# 网站标题
|
||||
VITE_TITLE = Appnify
|
||||
VITE_TITLE = 绝弹管理后台
|
||||
# 网站副标题
|
||||
VITE_SUBTITLE = 快速开发web应用的模板工具
|
||||
# API接口前缀:参见 axios 的 baseURL
|
||||
# 接口前缀 说明:参见 axios 的 baseURL
|
||||
VITE_API = http://127.0.0.1:3030/
|
||||
# API文档地址:需返回符合 OPENAPI 规范的json内容
|
||||
VITE_OPENAPI = http://127.0.0.1:3030/openapi.json
|
||||
|
||||
# =====================================================================================
|
||||
# 开发设置
|
||||
|
|
@ -17,11 +15,13 @@ VITE_OPENAPI = http://127.0.0.1:3030/openapi.json
|
|||
VITE_HOST = 0.0.0.0
|
||||
# 端口
|
||||
VITE_PORT = 3020
|
||||
# API代理地址
|
||||
# 代理地址
|
||||
VITE_PROXY = /api
|
||||
# API文档 说明:需返回符合 OPENAPI 规范的json内容
|
||||
VITE_OPENAPI = http://127.0.0.1:3030/openapi.json
|
||||
|
||||
# =====================================================================================
|
||||
# 构建设置
|
||||
# =====================================================================================
|
||||
# 构建时加载的文件后缀: 设为mp时会优先加载index.mp.vue文件,否则回退至index.vue文件
|
||||
VITE_EXTENSION = todo
|
||||
# 文件后缀 说明:设为dev时会优先加载index.dev.vue文件,否则回退至index.vue文件
|
||||
VITE_EXTENSION = dev
|
||||
|
|
@ -6,9 +6,11 @@ import { fileURLToPath } from "url";
|
|||
const __dirname = path.join(fileURLToPath(new URL(import.meta.url)), "..");
|
||||
const env = loadEnv("development", process.cwd());
|
||||
|
||||
console.log(env.VITE_OPENAPI);
|
||||
|
||||
const run = async () => {
|
||||
const output = await generateApi({
|
||||
url: env.VITE_API_OPENAPI,
|
||||
url: env.VITE_OPENAPI,
|
||||
templates: path.resolve(__dirname, "./template"),
|
||||
output: path.resolve(process.cwd(), "src/api/service"),
|
||||
name: "Api.ts",
|
||||
|
|
|
|||
|
|
@ -9,27 +9,32 @@
|
|||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
export interface Permission {
|
||||
export interface CreateUserDto {
|
||||
/**
|
||||
* 权限名称
|
||||
* @example "文章列表"
|
||||
* 登录账号
|
||||
* @example "juetan"
|
||||
*/
|
||||
name: string;
|
||||
username: string;
|
||||
/**
|
||||
* 权限标识
|
||||
* @example "post:list"
|
||||
* 用户昵称
|
||||
* @example "绝弹"
|
||||
*/
|
||||
slug: string;
|
||||
nickname: string;
|
||||
/**
|
||||
* 权限描述
|
||||
* @example "文章列表"
|
||||
* 用户密码
|
||||
* @example "password"
|
||||
*/
|
||||
description: string;
|
||||
password?: string;
|
||||
/**
|
||||
* 权限角色
|
||||
* @example "文章列表"
|
||||
* 头像ID
|
||||
* @example 1
|
||||
*/
|
||||
roles: Role[];
|
||||
avatarId?: number;
|
||||
/**
|
||||
* 角色ID列表
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
roleIds?: number[];
|
||||
}
|
||||
|
||||
export interface User {
|
||||
|
|
@ -67,88 +72,32 @@ export interface User {
|
|||
roleIds: number[];
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
/**
|
||||
* 角色名称
|
||||
* @example "管理员"
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 角色标识
|
||||
* @example "admin"
|
||||
*/
|
||||
slug: string;
|
||||
/**
|
||||
* 角色描述
|
||||
* @example "拥有所有权限"
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* 角色权限
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
permissions: Permission[];
|
||||
/**
|
||||
* 角色用户
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
user: User;
|
||||
}
|
||||
|
||||
export interface CreateUserDto {
|
||||
/**
|
||||
* 登录账号
|
||||
* @example "juetan"
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* 用户密码
|
||||
* @example "password"
|
||||
*/
|
||||
password: string;
|
||||
/**
|
||||
* 用户昵称
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname: string;
|
||||
/**
|
||||
* 用户头像
|
||||
* @example "./assets/222421415123.png "
|
||||
*/
|
||||
avatar: string;
|
||||
/**
|
||||
* 用户角色
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
roles: Role[];
|
||||
}
|
||||
|
||||
export interface UpdateUserDto {
|
||||
/**
|
||||
* 登录账号
|
||||
* @example "juetan"
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* 用户密码
|
||||
* @example "password"
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* 用户昵称
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 用户头像
|
||||
* @example "./assets/222421415123.png "
|
||||
* 用户密码
|
||||
* @example "password"
|
||||
*/
|
||||
avatar?: string;
|
||||
password?: string;
|
||||
/**
|
||||
* 用户角色
|
||||
* 头像ID
|
||||
* @example 1
|
||||
*/
|
||||
avatarId?: number;
|
||||
/**
|
||||
* 角色ID列表
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
roles?: Role[];
|
||||
roleIds?: number[];
|
||||
}
|
||||
|
||||
export interface AuthUserDto {
|
||||
|
|
@ -201,6 +150,111 @@ export interface LoginedUserVo {
|
|||
roleIds: number[];
|
||||
}
|
||||
|
||||
export interface CreateLogDto {
|
||||
/**
|
||||
* 字段描述(Swagger用途)
|
||||
* @example "demo"
|
||||
*/
|
||||
demo: string;
|
||||
}
|
||||
|
||||
export interface LoginLog {
|
||||
/**
|
||||
* 用户昵称
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname: string;
|
||||
/**
|
||||
* 操作描述
|
||||
* @example "1"
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* 登陆IP
|
||||
* @example "127.0.0.1"
|
||||
*/
|
||||
ip: string;
|
||||
/**
|
||||
* 登陆地址
|
||||
* @example "广东省深圳市"
|
||||
*/
|
||||
addr: string;
|
||||
/**
|
||||
* 浏览器
|
||||
* @example "chrome"
|
||||
*/
|
||||
browser: string;
|
||||
/**
|
||||
* 操作系统
|
||||
* @example "windows 10"
|
||||
*/
|
||||
os: string;
|
||||
}
|
||||
|
||||
export interface UpdateLogDto {
|
||||
/**
|
||||
* 字段描述(Swagger用途)
|
||||
* @example "demo"
|
||||
*/
|
||||
demo?: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
/**
|
||||
* 角色名称
|
||||
* @example "管理员"
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 角色标识
|
||||
* @example "admin"
|
||||
*/
|
||||
slug: string;
|
||||
/**
|
||||
* 角色描述
|
||||
* @example "拥有所有权限"
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* 角色权限
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
permissions: Permission[];
|
||||
/**
|
||||
* 角色权限ID
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
permissionIds: number[];
|
||||
/**
|
||||
* 角色用户
|
||||
* @example [1,2,3]
|
||||
*/
|
||||
user: User;
|
||||
}
|
||||
|
||||
export interface Permission {
|
||||
/**
|
||||
* 权限名称
|
||||
* @example "文章列表"
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 权限标识
|
||||
* @example "post:list"
|
||||
*/
|
||||
slug: string;
|
||||
/**
|
||||
* 权限描述
|
||||
* @example "文章列表"
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* 权限角色
|
||||
* @example "文章列表"
|
||||
*/
|
||||
roles: Role[];
|
||||
}
|
||||
|
||||
export interface CreateRoleDto {
|
||||
name: string;
|
||||
slug: string;
|
||||
|
|
@ -209,6 +263,7 @@ export interface CreateRoleDto {
|
|||
}
|
||||
|
||||
export interface UpdateRoleDto {
|
||||
permissionIds?: number[];
|
||||
name?: string;
|
||||
slug?: string;
|
||||
description?: string;
|
||||
|
|
@ -344,6 +399,67 @@ export interface GetUsersParams {
|
|||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
* @example 1
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* 每页条数
|
||||
* @min 0
|
||||
* @example 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GetLogsParams {
|
||||
/**
|
||||
* 用户名
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
* @example 1
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* 每页条数
|
||||
* @min 0
|
||||
* @example 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GetLoginLogsParams {
|
||||
/**
|
||||
* 用户名
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
|
|
@ -359,6 +475,13 @@ export interface GetUsersParams {
|
|||
}
|
||||
|
||||
export interface GetPostsParams {
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
|
|
@ -403,6 +526,13 @@ export namespace User {
|
|||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
|
|
@ -489,6 +619,151 @@ export namespace Auth {
|
|||
}
|
||||
}
|
||||
|
||||
export namespace Log {
|
||||
/**
|
||||
* @description 新增日志管理
|
||||
* @tags log
|
||||
* @name AddLog
|
||||
* @request POST:/api/v1/logs
|
||||
*/
|
||||
export namespace AddLog {
|
||||
export type RequestParams = {};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = CreateLogDto;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response & {
|
||||
data: number;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @description 根据分页/过滤参数查询日志管理
|
||||
* @tags log
|
||||
* @name GetLogs
|
||||
* @request GET:/api/v1/logs
|
||||
*/
|
||||
export namespace GetLogs {
|
||||
export type RequestParams = {};
|
||||
export type RequestQuery = {
|
||||
/**
|
||||
* 用户名
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
* @example 1
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* 每页条数
|
||||
* @min 0
|
||||
* @example 10
|
||||
*/
|
||||
size?: number;
|
||||
};
|
||||
export type RequestBody = never;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response & {
|
||||
data: LoginLog[];
|
||||
};
|
||||
}
|
||||
/**
|
||||
* No description
|
||||
* @tags log
|
||||
* @name GetLoginLogs
|
||||
* @request GET:/api/v1/logs/login
|
||||
*/
|
||||
export namespace GetLoginLogs {
|
||||
export type RequestParams = {};
|
||||
export type RequestQuery = {
|
||||
/**
|
||||
* 用户名
|
||||
* @example "绝弹"
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
* @example 1
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* 每页条数
|
||||
* @min 0
|
||||
* @example 10
|
||||
*/
|
||||
size?: number;
|
||||
};
|
||||
export type RequestBody = never;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response & {
|
||||
data: LoginLog[];
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @description 根据ID查询日志管理
|
||||
* @tags log
|
||||
* @name GetLog
|
||||
* @request GET:/api/v1/logs/{id}
|
||||
*/
|
||||
export namespace GetLog {
|
||||
export type RequestParams = {
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response & {
|
||||
data: LoginLog;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @description 根据ID更新日志管理
|
||||
* @tags log
|
||||
* @name UpdateLog
|
||||
* @request PATCH:/api/v1/logs/{id}
|
||||
*/
|
||||
export namespace UpdateLog {
|
||||
export type RequestParams = {
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = UpdateLogDto;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response;
|
||||
}
|
||||
/**
|
||||
* @description 根据ID删除日志管理
|
||||
* @tags log
|
||||
* @name DelLog
|
||||
* @request DELETE:/api/v1/logs/{id}
|
||||
*/
|
||||
export namespace DelLog {
|
||||
export type RequestParams = {
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
export type RequestHeaders = {};
|
||||
export type ResponseBody = Response;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Role {
|
||||
/**
|
||||
* @description 创建角色
|
||||
|
|
@ -526,7 +801,7 @@ export namespace Role {
|
|||
*/
|
||||
export namespace GetRole {
|
||||
export type RequestParams = {
|
||||
id: string;
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
|
|
@ -543,7 +818,7 @@ export namespace Role {
|
|||
*/
|
||||
export namespace UpdateRole {
|
||||
export type RequestParams = {
|
||||
id: string;
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = UpdateRoleDto;
|
||||
|
|
@ -558,7 +833,7 @@ export namespace Role {
|
|||
*/
|
||||
export namespace DelRole {
|
||||
export type RequestParams = {
|
||||
id: string;
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
|
|
@ -686,7 +961,7 @@ export namespace Upload {
|
|||
*/
|
||||
export namespace GetFile {
|
||||
export type RequestParams = {
|
||||
id: string;
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
|
|
@ -720,7 +995,7 @@ export namespace Upload {
|
|||
*/
|
||||
export namespace DelFile {
|
||||
export type RequestParams = {
|
||||
id: string;
|
||||
id: number;
|
||||
};
|
||||
export type RequestQuery = {};
|
||||
export type RequestBody = never;
|
||||
|
|
@ -754,6 +1029,13 @@ export namespace Post {
|
|||
export namespace GetPosts {
|
||||
export type RequestParams = {};
|
||||
export type RequestQuery = {
|
||||
/**
|
||||
* 排序规则
|
||||
* @default "id:desc"
|
||||
* @pattern /^(\w+:\w+,)*\w+:\w+$/
|
||||
* @example "id:desc"
|
||||
*/
|
||||
sort?: string;
|
||||
/**
|
||||
* 页码
|
||||
* @min 1
|
||||
|
|
@ -1097,6 +1379,129 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
});
|
||||
},
|
||||
};
|
||||
log = {
|
||||
/**
|
||||
* 新增日志管理
|
||||
*
|
||||
* @tags log
|
||||
* @name AddLog
|
||||
* @request POST:/api/v1/logs
|
||||
*/
|
||||
addLog: (data: CreateLogDto, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: number;
|
||||
},
|
||||
any
|
||||
>({
|
||||
path: `/api/v1/logs`,
|
||||
method: "POST",
|
||||
body: data,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据分页/过滤参数查询日志管理
|
||||
*
|
||||
* @tags log
|
||||
* @name GetLogs
|
||||
* @request GET:/api/v1/logs
|
||||
*/
|
||||
getLogs: (query: GetLogsParams, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: LoginLog[];
|
||||
},
|
||||
any
|
||||
>({
|
||||
path: `/api/v1/logs`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
* @tags log
|
||||
* @name GetLoginLogs
|
||||
* @request GET:/api/v1/logs/login
|
||||
*/
|
||||
getLoginLogs: (query: GetLoginLogsParams, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: LoginLog[];
|
||||
},
|
||||
any
|
||||
>({
|
||||
path: `/api/v1/logs/login`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID查询日志管理
|
||||
*
|
||||
* @tags log
|
||||
* @name GetLog
|
||||
* @request GET:/api/v1/logs/{id}
|
||||
*/
|
||||
getLog: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: LoginLog;
|
||||
},
|
||||
any
|
||||
>({
|
||||
path: `/api/v1/logs/${id}`,
|
||||
method: "GET",
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID更新日志管理
|
||||
*
|
||||
* @tags log
|
||||
* @name UpdateLog
|
||||
* @request PATCH:/api/v1/logs/{id}
|
||||
*/
|
||||
updateLog: (id: number, data: UpdateLogDto, params: RequestParams = {}) => {
|
||||
return this.request<Response, any>({
|
||||
path: `/api/v1/logs/${id}`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据ID删除日志管理
|
||||
*
|
||||
* @tags log
|
||||
* @name DelLog
|
||||
* @request DELETE:/api/v1/logs/{id}
|
||||
*/
|
||||
delLog: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<Response, any>({
|
||||
path: `/api/v1/logs/${id}`,
|
||||
method: "DELETE",
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
},
|
||||
};
|
||||
role = {
|
||||
/**
|
||||
* 创建角色
|
||||
|
|
@ -1144,7 +1549,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
* @name GetRole
|
||||
* @request GET:/api/v1/roles/{id}
|
||||
*/
|
||||
getRole: (id: string, params: RequestParams = {}) => {
|
||||
getRole: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: string;
|
||||
|
|
@ -1165,7 +1570,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
* @name UpdateRole
|
||||
* @request PATCH:/api/v1/roles/{id}
|
||||
*/
|
||||
updateRole: (id: string, data: UpdateRoleDto, params: RequestParams = {}) => {
|
||||
updateRole: (id: number, data: UpdateRoleDto, params: RequestParams = {}) => {
|
||||
return this.request<Response, any>({
|
||||
path: `/api/v1/roles/${id}`,
|
||||
method: "PATCH",
|
||||
|
|
@ -1183,7 +1588,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
* @name DelRole
|
||||
* @request DELETE:/api/v1/roles/{id}
|
||||
*/
|
||||
delRole: (id: string, params: RequestParams = {}) => {
|
||||
delRole: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: string;
|
||||
|
|
@ -1344,7 +1749,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
* @name GetFile
|
||||
* @request GET:/api/v1/upload/{id}
|
||||
*/
|
||||
getFile: (id: string, params: RequestParams = {}) => {
|
||||
getFile: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<
|
||||
Response & {
|
||||
data: Upload;
|
||||
|
|
@ -1386,7 +1791,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
|
|||
* @name DelFile
|
||||
* @request DELETE:/api/v1/upload/{id}
|
||||
*/
|
||||
delFile: (id: string, params: RequestParams = {}) => {
|
||||
delFile: (id: number, params: RequestParams = {}) => {
|
||||
return this.request<Response, any>({
|
||||
path: `/api/v1/upload/${id}`,
|
||||
method: "DELETE",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ export const config = {
|
|||
const tableRef = inject<any>("ref:table");
|
||||
return (
|
||||
<div class="w-full flex gap-x-2 justify-end">
|
||||
{/* <Link>收起 <i class="icon-park-outline-up"></i> </Link> */}
|
||||
{(tableRef.search?.items?.length || 0) > config.searchInlineCount && (
|
||||
<Button disabled={tableRef?.loading.value} onClick={() => tableRef?.reloadData()}>
|
||||
{{ icon: () => <IconRefresh></IconRefresh>, default: () => "重置" }}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
<template>
|
||||
<BreadPage>
|
||||
<Table v-bind="table"></Table>
|
||||
</BreadPage>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { api } from "@/api";
|
||||
import { Table, useTable } from "@/components";
|
||||
import { dayjs } from "@/libs/dayjs";
|
||||
import { Tag } from "@arco-design/web-vue";
|
||||
|
||||
const table = useTable({
|
||||
data: async (model, paging) => {
|
||||
return api.log.getLoginLogs({ ...model, ...paging });
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: "登陆账号",
|
||||
dataIndex: "nickname",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "操作描述",
|
||||
dataIndex: "description",
|
||||
render: ({ record: { status, description } }) => {
|
||||
return (
|
||||
<span>
|
||||
<Tag color={status === null || status ? "green" : "red"} class="mr-2">
|
||||
{ status === null || status ? "成功" : "失败" }
|
||||
</Tag>
|
||||
{description}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "登陆地址",
|
||||
dataIndex: "ip",
|
||||
render: ({ record }) => `${record.addr || "未知"}(${record.ip})`,
|
||||
},
|
||||
{
|
||||
title: "操作系统",
|
||||
dataIndex: "os",
|
||||
},
|
||||
{
|
||||
title: "浏览器",
|
||||
dataIndex: "browser",
|
||||
},
|
||||
{
|
||||
title: "登陆时间",
|
||||
dataIndex: "createdAt",
|
||||
width: 200,
|
||||
render: ({ record }) => dayjs(record.createdAt).fromNow(),
|
||||
},
|
||||
],
|
||||
search: {
|
||||
items: [
|
||||
{
|
||||
field: "nickname",
|
||||
label: "登陆账号",
|
||||
type: "input",
|
||||
required: false,
|
||||
nodeProps: {
|
||||
placeholder: '请输入登陆账号',
|
||||
hideLabel: true,
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<route lang="json">
|
||||
{
|
||||
"meta": {
|
||||
"sort": 10303,
|
||||
"title": "登陆日志",
|
||||
"icon": "icon-park-outline-log"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
Loading…
Reference in New Issue