469 lines
7.7 KiB
TypeScript
469 lines
7.7 KiB
TypeScript
/**
|
|
* 系统管理 API 类型定义
|
|
* 与 GVA 保持一致
|
|
*/
|
|
declare namespace API {
|
|
// 基础响应
|
|
type BaseResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: any;
|
|
};
|
|
|
|
// 分页参数
|
|
type PageParams = {
|
|
page?: number;
|
|
pageSize?: number;
|
|
};
|
|
|
|
// 登录参数
|
|
type LoginParams = {
|
|
username: string;
|
|
password: string;
|
|
captcha?: string;
|
|
captchaId?: string;
|
|
};
|
|
|
|
// 登录结果
|
|
type LoginResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
user: UserInfo;
|
|
token: string;
|
|
expiresAt: number;
|
|
};
|
|
};
|
|
|
|
// 验证码结果
|
|
type CaptchaResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
captchaId: string;
|
|
picPath: string;
|
|
captchaLength: number;
|
|
openCaptcha: boolean;
|
|
};
|
|
};
|
|
|
|
// 注册参数
|
|
type RegisterParams = {
|
|
username: string;
|
|
password: string;
|
|
nickName?: string;
|
|
headerImg?: string;
|
|
authorityId?: number;
|
|
authorityIds?: number[];
|
|
};
|
|
|
|
// 修改密码参数
|
|
type ChangePasswordParams = {
|
|
password: string;
|
|
newPassword: string;
|
|
};
|
|
|
|
// 用户信息
|
|
type UserInfo = {
|
|
ID?: number;
|
|
uuid?: string;
|
|
userName?: string;
|
|
nickName?: string;
|
|
sideMode?: string;
|
|
headerImg?: string;
|
|
baseColor?: string;
|
|
activeColor?: string;
|
|
authorityId?: number;
|
|
authority?: Authority;
|
|
authorities?: Authority[];
|
|
phone?: string;
|
|
email?: string;
|
|
enable?: number;
|
|
};
|
|
|
|
// 用户信息结果
|
|
type UserInfoResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
userInfo: UserInfo;
|
|
};
|
|
};
|
|
|
|
// 用户列表结果
|
|
type UserListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: UserInfo[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
|
|
// 角色
|
|
type Authority = {
|
|
authorityId?: number;
|
|
authorityName?: string;
|
|
parentId?: number;
|
|
dataAuthorityId?: Authority[];
|
|
children?: Authority[];
|
|
menus?: Menu[];
|
|
defaultRouter?: string;
|
|
};
|
|
|
|
// 角色结果
|
|
type AuthorityResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
authority: Authority;
|
|
};
|
|
};
|
|
|
|
// 角色列表结果
|
|
type AuthorityListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: Authority[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 菜单
|
|
type Menu = {
|
|
ID?: number;
|
|
parentId?: number;
|
|
path?: string;
|
|
name?: string;
|
|
hidden?: boolean;
|
|
component?: string;
|
|
sort?: number;
|
|
meta?: MenuMeta;
|
|
children?: Menu[];
|
|
parameters?: MenuParameter[];
|
|
menuBtn?: MenuButton[];
|
|
};
|
|
|
|
// 菜单元信息
|
|
type MenuMeta = {
|
|
activeName?: string;
|
|
keepAlive?: boolean;
|
|
defaultMenu?: boolean;
|
|
title?: string;
|
|
icon?: string;
|
|
closeTab?: boolean;
|
|
};
|
|
|
|
// 菜单参数
|
|
type MenuParameter = {
|
|
ID?: number;
|
|
type?: string;
|
|
key?: string;
|
|
value?: string;
|
|
};
|
|
|
|
// 菜单按钮
|
|
type MenuButton = {
|
|
ID?: number;
|
|
name?: string;
|
|
desc?: string;
|
|
};
|
|
|
|
// 菜单结果
|
|
type MenuResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
menu?: Menu;
|
|
menus?: Menu[];
|
|
};
|
|
};
|
|
|
|
// 菜单列表结果
|
|
type MenuListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: Menu[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 菜单树结果
|
|
type MenuTreeResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
menus: Menu[];
|
|
};
|
|
};
|
|
|
|
// 菜单权限结果
|
|
type MenuAuthorityResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
menus: Menu[];
|
|
};
|
|
};
|
|
|
|
|
|
// API项
|
|
type ApiItem = {
|
|
ID?: number;
|
|
path?: string;
|
|
description?: string;
|
|
apiGroup?: string;
|
|
method?: string;
|
|
};
|
|
|
|
// API结果
|
|
type ApiResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
api: ApiItem;
|
|
};
|
|
};
|
|
|
|
// API列表结果
|
|
type ApiListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: ApiItem[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 所有API结果
|
|
type AllApisResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
apis: ApiItem[];
|
|
};
|
|
};
|
|
|
|
// API分组结果
|
|
type ApiGroupsResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
groups: string[];
|
|
};
|
|
};
|
|
|
|
// 字典
|
|
type Dictionary = {
|
|
ID?: number;
|
|
name?: string;
|
|
type?: string;
|
|
status?: boolean;
|
|
desc?: string;
|
|
sysDictionaryDetails?: DictionaryDetail[];
|
|
};
|
|
|
|
// 字典结果
|
|
type DictionaryResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
sysDictionary: Dictionary;
|
|
};
|
|
};
|
|
|
|
// 字典列表结果
|
|
type DictionaryListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: Dictionary[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 字典导出结果
|
|
type DictionaryExportResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: Dictionary;
|
|
};
|
|
|
|
// 字典详情
|
|
type DictionaryDetail = {
|
|
ID?: number;
|
|
sysDictionaryID?: number;
|
|
parentID?: number;
|
|
label?: string;
|
|
value?: string;
|
|
extend?: string;
|
|
status?: boolean;
|
|
sort?: number;
|
|
children?: DictionaryDetail[];
|
|
};
|
|
|
|
// 字典详情结果
|
|
type DictionaryDetailResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
sysDictionaryDetail: DictionaryDetail;
|
|
};
|
|
};
|
|
|
|
// 字典详情列表结果
|
|
type DictionaryDetailListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: DictionaryDetail[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 字典树结果
|
|
type DictionaryTreeResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: DictionaryDetail[];
|
|
};
|
|
};
|
|
|
|
// 字典路径结果
|
|
type DictionaryPathResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
path: DictionaryDetail[];
|
|
};
|
|
};
|
|
|
|
// 操作记录
|
|
type OperationRecord = {
|
|
ID?: number;
|
|
ip?: string;
|
|
method?: string;
|
|
path?: string;
|
|
status?: number;
|
|
latency?: string;
|
|
agent?: string;
|
|
error_message?: string;
|
|
body?: string;
|
|
resp?: string;
|
|
user_id?: number;
|
|
user?: UserInfo;
|
|
CreatedAt?: string;
|
|
};
|
|
|
|
// 操作记录列表结果
|
|
type OperationRecordListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: OperationRecord[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// Casbin信息
|
|
type CasbinInfo = {
|
|
path: string;
|
|
method: string;
|
|
};
|
|
|
|
// Casbin策略结果
|
|
type CasbinPolicyResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
paths: CasbinInfo[];
|
|
};
|
|
};
|
|
}
|
|
|
|
|
|
// 系统参数
|
|
type SysParams = {
|
|
ID?: number;
|
|
name?: string;
|
|
key?: string;
|
|
value?: string;
|
|
desc?: string;
|
|
createdAt?: string;
|
|
updatedAt?: string;
|
|
};
|
|
|
|
// 系统参数结果
|
|
type SysParamsResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: SysParams;
|
|
};
|
|
|
|
// 系统参数列表结果
|
|
type SysParamsListResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
list: SysParams[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
};
|
|
};
|
|
|
|
// 服务器信息
|
|
type ServerInfo = {
|
|
os: {
|
|
goos: string;
|
|
numCpu: number;
|
|
compiler: string;
|
|
goVersion: string;
|
|
numGoroutine: number;
|
|
};
|
|
cpu: {
|
|
cpus: number[];
|
|
cores: number;
|
|
};
|
|
ram: {
|
|
usedMb: number;
|
|
totalMb: number;
|
|
usedPercent: number;
|
|
};
|
|
disk: {
|
|
mountPoint: string;
|
|
usedMb: number;
|
|
usedGb: number;
|
|
totalMb: number;
|
|
totalGb: number;
|
|
usedPercent: number;
|
|
}[];
|
|
};
|
|
|
|
// 服务器信息结果
|
|
type ServerInfoResult = {
|
|
code: number;
|
|
msg: string;
|
|
data?: {
|
|
server: ServerInfo;
|
|
};
|
|
};
|