refactor: 重构 API 层目录结构 & 样式模块化拆分

- API 层按业务域拆分(api/auth/, api/file/, api/system/*)
- 类型定义从 types/api/ 移入对应 api 模块内(就近原则)
- 公共类型统一为 api/common.ts,移除冗余类型重导出
- 样式文件按职责拆分(base/, layout/, vendors/),移除 common.scss
- 移除失效的单元测试文件
This commit is contained in:
Ray.Hao
2026-03-30 08:11:03 +08:00
parent 3a27da6607
commit 3fedf4943d
107 changed files with 464 additions and 8264 deletions

View File

@@ -1,5 +1,5 @@
import request from "@/utils/request";
import type { LoginRequest, LoginResponse, CaptchaInfo } from "@/types/api/auth";
import type { LoginRequest, LoginResponse, CaptchaInfo } from "./types";
const AUTH_BASE_URL = "/api/v1/auth";
@@ -13,7 +13,7 @@ const AuthAPI = {
captchaCode: data.captchaCode,
};
// tenantId is optional — include only when provided (multi-tenant feature)
// tenantId 可选,仅在提供时包含(多租户功能)
if (typeof data.tenantId !== "undefined") {
payload.tenantId = data.tenantId;
}
@@ -64,3 +64,6 @@ const AuthAPI = {
};
export default AuthAPI;
// 重导出类型
export * from "./types";

45
src/api/auth/types.ts Normal file
View File

@@ -0,0 +1,45 @@
/**
* 认证相关类型定义
*/
/**
* 登录请求参数
*/
export interface LoginRequest {
/** 用户名 */
username: string;
/** 密码 */
password: string;
/** 验证码缓存key */
captchaId?: string;
/** 验证码 */
captchaCode?: string;
/** 记住我 */
rememberMe?: boolean;
/** 租户ID */
tenantId?: number;
}
/**
* 登录响应
*/
export interface LoginResponse {
/** 访问令牌 */
accessToken: string;
/** 刷新令牌 */
refreshToken: string;
/** 令牌类型 */
tokenType: string;
/** 过期时间(单位:秒) */
expiresIn: number;
}
/**
* 验证码响应
*/
export interface CaptchaInfo {
/** 验证码缓存key */
captchaId: string;
/** 验证码图片Base64 */
captchaBase64: string;
}

View File

@@ -1,5 +1,5 @@
import request from "@/utils/request";
import type { GeneratorPreviewItem, TableQueryParams, TableItem, GenConfigForm } from "@/types/api";
import type { GeneratorPreviewItem, TableQueryParams, TableItem, GenConfigForm } from "./types";
const GENERATOR_BASE_URL = "/api/v1/codegen";
@@ -101,4 +101,5 @@ const GeneratorAPI = {
export default GeneratorAPI;
/** 代码生成预览对象 */
// 重导出类型
export * from "./types";

105
src/api/codegen/types.ts Normal file
View File

@@ -0,0 +1,105 @@
/**
* CodeGen 代码生成类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 代码生成预览对象 */
export interface GeneratorPreviewItem {
/** 文件生成路径 */
path: string;
/** 文件名称 */
fileName: string;
/** 文件内容 */
content: string;
/** 文件范围(frontend/backend) */
scope: "frontend" | "backend";
/** 文件语言(扩展名) */
language: string;
}
/** 数据表分页查询参数 */
export interface TableQueryParams extends BaseQueryParams {
/** 搜索关键字(表名) */
keywords?: string;
}
/** 数据表分页对象 */
export interface TableItem {
/** 表名称 */
tableName: string;
/** 表描述 */
tableComment: string;
/** 是否已配置(1:是;0:否) */
isConfigured?: number;
/** 存储引擎 */
engine: string;
/** 字符集排序规则 */
tableCollation: string;
/** 创建时间 */
createTime: string;
}
/** 代码生成配置表单 */
export interface GenConfigForm {
/** 主键 */
id?: string;
/** 表名 */
tableName?: string;
/** 业务名 */
businessName?: string;
/** 模块名 */
moduleName?: string;
/** 包名 */
packageName?: string;
/** 实体名 */
entityName?: string;
/** 作者 */
author?: string;
/** 上级菜单 */
parentMenuId?: string;
/** 后端应用名 */
backendAppName?: string;
/** 前端应用名 */
frontendAppName?: string;
/** 字段配置列表 */
fieldConfigs?: FieldConfig[];
/** 页面类型 classic|curd */
pageType?: "classic" | "curd";
/** 要移除的表前缀,如 sys_ */
removeTablePrefix?: string;
}
/** 字段配置 */
export interface FieldConfig {
/** 主键 */
id?: string;
/** 列名 */
columnName?: string;
/** 列类型 */
columnType?: string;
/** 字段名 */
fieldName?: string;
/** 字段类型 */
fieldType?: string;
/** 字段描述 */
fieldComment?: string;
/** 是否在列表显示 */
isShowInList?: number;
/** 是否在表单显示 */
isShowInForm?: number;
/** 是否在查询条件显示 */
isShowInQuery?: number;
/** 是否必填 */
isRequired?: number;
/** 表单类型 */
formType?: number;
/** 查询类型 */
queryType?: number;
/** 字段长度 */
maxLength?: number;
/** 字段排序 */
fieldSort?: number;
/** 字典类型 */
dictType?: string;
}

57
src/api/common.ts Normal file
View File

@@ -0,0 +1,57 @@
/**
* 通用 API 类型定义
*/
/** API 响应结构 */
export interface ApiResponse<T = any> {
/** 响应码 */
code: string;
/** 响应数据 */
data: T;
/** 响应消息 */
msg: string;
}
/** 基础查询参数 */
export interface BaseQueryParams {
/** 页码 */
pageNum: number;
/** 每页记录数 */
pageSize: number;
/** 排序字段 */
sortBy?: string;
/** 排序方式(正序:ASC反序:DESC */
order?: string;
}
/** 分页数据结构(仅分页接口) */
export interface PageResult<T> {
/** 数据列表 */
list: T[];
/** 总记录数 */
total: number;
}
/** 下拉选项 */
export interface OptionItem {
/** 选项值 */
value: string | number;
/** 选项标签 */
label: string;
/** 子选项 */
children?: OptionItem[];
}
/** Excel 导入结果 */
export interface ExcelResult {
/** 响应码 */
code: string;
/** 无效数据数量 */
invalidCount: number;
/** 有效数据数量 */
validCount: number;
/** 错误信息列表 */
messageList: string[];
}

View File

@@ -1,5 +1,5 @@
import request from "@/utils/request";
import type { FileInfo } from "@/types/api";
import type { FileInfo } from "./types";
const FileAPI = {
/** 上传文件 (传入 FormData上传进度回调 */
@@ -58,3 +58,6 @@ const FileAPI = {
};
export default FileAPI;
// 重导出类型
export * from "./types";

11
src/api/file/types.ts Normal file
View File

@@ -0,0 +1,11 @@
/**
* File 文件上传类型定义
*/
/** 文件信息 */
export interface FileInfo {
/** 文件名称 */
name: string;
/** 文件URL */
url: string;
}

View File

@@ -1,5 +1,5 @@
import request from "@/utils/request";
import type { ConfigQueryParams, ConfigForm, ConfigItem } from "@/types/api";
import type { ConfigQueryParams, ConfigForm, ConfigItem } from "./types";
const CONFIG_BASE_URL = "/api/v1/configs";
@@ -38,3 +38,6 @@ const ConfigAPI = {
};
export default ConfigAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,37 @@
/**
* Config 配置类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 配置分页查询参数 */
export interface ConfigQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
}
/** 配置表单对象 */
export interface ConfigForm {
/** 配置ID */
id?: string;
/** 配置名称 */
configName?: string;
/** 配置键 */
configKey?: string;
/** 配置值 */
configValue?: string;
/** 备注 */
remark?: string;
}
/** 配置分页对象 */
export interface ConfigItem {
/** 配置ID */
id?: string;
/** 配置名称 */
configName?: string;
/** 配置键 */
configKey?: string;
/** 配置值 */
configValue?: string;
}

View File

@@ -1,5 +1,6 @@
import request from "@/utils/request";
import type { DeptQueryParams, DeptItem, DeptForm, OptionItem } from "@/types/api";
import type { DeptQueryParams, DeptItem, DeptForm } from "./types";
import type { OptionItem } from "@/api/common";
const DEPT_BASE_URL = "/api/v1/depts";
@@ -35,3 +36,6 @@ const DeptAPI = {
};
export default DeptAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,49 @@
/**
* Dept 部门类型定义
*/
/** 部门查询参数 */
export interface DeptQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 状态 */
status?: number;
}
/** 部门视图对象 */
export interface DeptItem {
/** 子部门 */
children?: DeptItem[];
/** 创建时间 */
createTime?: Date;
/** 部门ID */
id?: string;
/** 部门名称 */
name?: string;
/** 父部门ID */
parentId?: string;
/** 排序 */
sort?: number;
/** 状态(1:启用0:禁用) */
status?: number;
/** 父节点ID路径 */
treePath?: string;
/** 修改时间 */
updateTime?: Date;
}
/** 部门表单对象 */
export interface DeptForm {
/** 部门ID */
id?: string;
/** 部门名称 */
name?: string;
/** 部门编号 */
code?: string;
/** 父部门ID */
parentId?: string;
/** 排序 */
sort?: number;
/** 状态(1:启用0:禁用) */
status?: number;
}

View File

@@ -7,8 +7,8 @@ import type {
DictItem,
DictItemForm,
DictItemOption,
OptionItem,
} from "@/types/api";
} from "./types";
import type { OptionItem } from "@/api/common";
const DICT_BASE_URL = "/api/v1/dicts";
@@ -96,9 +96,9 @@ const DictAPI = {
params: queryParams,
}).then((data) => ({
...data,
list: (data.list ?? []).map((item) => ({
list: (data.list ?? []).map((item: DictItem & { tagType?: string }) => ({
...item,
tagType: decodeDictTagType((item as any).tagType),
tagType: decodeDictTagType(item.tagType),
})),
}));
},
@@ -153,3 +153,6 @@ const DictAPI = {
};
export default DictAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,92 @@
/**
* Dict 字典类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 字典分页查询参数 */
export interface DictTypeQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 状态(1:启用;0:禁用) */
status?: number;
}
/** 字典分页对象 */
export interface DictTypeItem {
/** 字典ID */
id: string;
/** 字典名称 */
name: string;
/** 字典编码 */
dictCode: string;
/** 状态(1:启用;0:禁用) */
status: number;
}
/** 字典表单对象 */
export interface DictTypeForm {
/** 字典ID */
id?: string;
/** 字典名称 */
name?: string;
/** 字典编码 */
dictCode?: string;
/** 状态(1:启用;0:禁用) */
status?: number;
/** 备注 */
remark?: string;
}
/** 字典项分页查询参数 */
export interface DictItemQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 字典编码 */
dictCode?: string;
}
/** 字典项分页对象 */
export interface DictItem {
/** 字典项ID */
id: string;
/** 字典编码 */
dictCode: string;
/** 字典项标签 */
label: string;
/** 字典项值 */
value: string;
/** 状态(1:启用;0:禁用) */
status: number;
/** 排序 */
sort?: number;
}
/** 字典项表单对象 */
export interface DictItemForm {
/** 字典项ID */
id?: string;
/** 字典编码 */
dictCode?: string;
/** 字典项标签 */
label?: string;
/** 字典项值 */
value?: string;
/** 状态(1:启用;0:禁用) */
status?: number;
/** 排序 */
sort?: number;
/** 标签类型 */
tagType?: "success" | "warning" | "info" | "primary" | "danger" | "";
}
/** 字典项选项 */
export interface DictItemOption {
/** 字典项值 */
value: number | string;
/** 字典项标签 */
label: string;
/** 标签类型 */
tagType?: "success" | "warning" | "info" | "primary" | "danger" | "";
}

View File

@@ -1,11 +1,11 @@
import request from "@/utils/request";
import request from "@/utils/request";
import type {
LogQueryParams,
LogItem,
VisitTrendQueryParams,
VisitTrendDetail,
VisitStatsDetail,
} from "@/types/api";
} from "./types";
const LOG_BASE_URL = "/api/v1/logs";
@@ -38,3 +38,6 @@ const LogAPI = {
};
export default LogAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,89 @@
/**
* Log 日志类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 日志分页查询参数 */
export interface LogQueryParams extends BaseQueryParams {
/** 搜索关键字(IP/操作人) */
keywords?: string;
/** 操作时间 */
createTime?: [string, string];
}
/** 日志分页对象 */
export interface LogItem {
/** 日志ID */
id: number;
/** 模块 */
module?: string;
/** 操作类型 */
actionType?: string;
/** 操作标题 */
title?: string;
/** 自定义日志内容 */
content?: string;
/** 操作人ID */
operatorId?: number;
/** 操作人名称 */
operatorName?: string;
/** 请求路径 */
requestUri?: string;
/** 请求方法 */
requestMethod?: string;
/** IP地址 */
ip?: string;
/** 地区 */
region?: string;
/** 设备 */
device?: string;
/** 浏览器 */
browser?: string;
/** 操作系统 */
os?: string;
/** 状态0失败 1成功 */
status?: number;
/** 执行时间(毫秒) */
executionTime?: number;
/** 错误信息 */
errorMsg?: string;
/** 操作时间 */
createTime?: string;
}
/** 访问趋势查询参数 */
export interface VisitTrendQueryParams {
/** 开始日期 */
startDate: string;
/** 结束日期 */
endDate: string;
}
/** 访问趋势视图对象 */
export interface VisitTrendDetail {
/** 日期列表 */
dates: string[];
/** 浏览量(PV)列表 */
pvList: number[];
/** 访客数(UV)列表 */
uvList: number[];
/** IP数列表 */
ipList: number[];
}
/** 访问量统计视图对象 */
export interface VisitStatsDetail {
/** 今日独立访客数(UV) */
todayUvCount: number;
/** 累计独立访客数(UV) */
totalUvCount: number;
/** 独立访客增长率 */
uvGrowthRate: number;
/** 今日页面浏览量(PV) */
todayPvCount: number;
/** 累计页面浏览量(PV) */
totalPvCount: number;
/** 页面浏览量增长率 */
pvGrowthRate: number;
}

View File

@@ -1,5 +1,6 @@
import request from "@/utils/request";
import type { MenuQueryParams, MenuItem, MenuForm, RouteItem, OptionItem } from "@/types/api";
import type { MenuQueryParams, MenuItem, MenuForm, RouteItem } from "./types";
import type { OptionItem } from "@/api/common";
const MENU_BASE_URL = "/api/v1/menus";
@@ -43,3 +44,6 @@ const MenuAPI = {
};
export default MenuAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,117 @@
/**
* Menu 菜单类型定义
*/
/** 菜单查询参数 */
export interface MenuQueryParams {
/** 搜索关键字 */
keywords?: string;
}
/** 菜单视图对象 */
export interface MenuItem {
/** 子菜单 */
children?: MenuItem[];
/** 组件路径 */
component?: string;
/** ICON */
icon?: string;
/** 菜单ID */
id?: string;
/** 菜单名称 */
name?: string;
/** 父菜单ID */
parentId?: string;
/** 路由路径 */
path?: string;
/** 按钮权限标识 */
perm?: string;
/** 跳转路径 */
redirect?: string;
/** 菜单排序(数字越小排名越靠前) */
sort?: number;
/** 菜单类型C-目录 M-菜单 B-按钮) */
type?: string;
/** 菜单是否可见(1:显示;0:隐藏) */
visible?: number;
/** 菜单范围(1=平台 2=业务) */
scope?: number;
}
/** 菜单表单对象 */
export interface MenuForm {
/** 菜单ID */
id?: string;
/** 父菜单ID */
parentId?: string;
/** 菜单名称 */
name?: string;
/** 菜单类型C-目录 M-菜单 B-按钮) */
type?: string;
/** 路由路径 */
path?: string;
/** 路由名称(用于前端路由名) */
routeName?: string;
/** 路由路径(可用于自定义路由字段) */
routePath?: string;
/** 跳转路径 */
redirect?: string;
/** 组件路径 */
component?: string;
/** ICON */
icon?: string;
/** 排序 */
sort?: number;
/** 菜单是否可见 */
visible?: number;
/** 菜单范围(1=平台 2=业务) */
scope?: number;
/** 按钮权限标识 */
perm?: string;
/** 路由参数(用于表单编辑 params */
params?: { key?: string; value?: string }[];
/** 是否始终显示(仅对目录生效) */
alwaysShow?: number | boolean;
/** 是否缓存(用于 keepAlive */
keepAlive?: number | boolean;
}
/** 菜单选项 */
export interface MenuOption {
key: string;
value: string;
}
/** 路由对象 */
export interface RouteItem {
/** 子路由列表 */
children: RouteItem[];
/** 组件路径 */
component?: string;
/** 路由名称 */
name?: string;
/** 路由路径 */
path?: string;
/** 路由属性 */
meta?: Meta;
/** 跳转链接 */
redirect?: string;
}
/** 路由属性 */
export interface Meta {
/** 【目录】只有一个子路由是否始终显示 */
alwaysShow?: boolean;
/** 是否隐藏(true-是 false-否) */
hidden?: boolean;
/** ICON */
icon?: string;
/** 【菜单】是否开启页面缓存 */
keepAlive?: boolean;
/** 路由参数 */
params?: Record<string, any>;
/** 角色集合 */
roles?: string[];
/** 路由title */
title?: string;
}

View File

@@ -1,5 +1,5 @@
import request from "@/utils/request";
import type { NoticeQueryParams, NoticeForm, NoticeItem, NoticeDetail } from "@/types/api";
import type { NoticeQueryParams, NoticeForm, NoticeItem, NoticeDetail } from "./types";
const NOTICE_BASE_URL = "/api/v1/notices";
@@ -55,3 +55,6 @@ const NoticeAPI = {
};
export default NoticeAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,79 @@
/**
* Notice 通知类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 通知分页查询参数 */
export interface NoticeQueryParams extends BaseQueryParams {
/** 通知标题 */
title?: string;
/** 发布状态(0:草稿;1:已发布;2:已撤回) */
publishStatus?: number;
/** 是否已读(1:是;0:否) */
isRead?: number;
}
/** 通知表单对象 */
export interface NoticeForm {
/** 通知ID */
id?: string;
/** 通知标题 */
title?: string;
/** 通知内容 */
content?: string;
/** 通知类型 */
type?: number;
/** 通知等级 */
level?: string;
/** 发布状态(0:草稿;1:已发布;-1:已撤回) */
status?: number;
/** 目标用户ID列表 */
targetUsers?: number[];
/** 目标类型 (1:全部,2:指定用户等) */
targetType?: number;
}
/** 通知分页对象 */
export interface NoticeItem {
/** 通知ID */
id: string;
/** 通知标题 */
title: string;
/** 通知内容 */
content: string;
/** 通知类型 */
type: number;
/** 通知等级 */
level: string;
/** 发布状态 */
publishStatus: number;
/** 是否已读 */
isRead: number;
/** 发布时间 */
publishTime?: Date;
/** 撤回时间 */
revokeTime?: Date;
}
/** 通知详情对象 */
export interface NoticeDetail {
/** 通知ID */
id?: string;
/** 通知标题 */
title?: string;
/** 通知内容 */
content?: string;
/** 通知类型 */
type?: number;
/** 通知等级 */
level?: string;
/** 发布状态 */
publishStatus?: number;
/** 目标用户ID */
targetUserIds?: string;
/** 发布人名称 */
publisherName?: string;
/** 发布时间 */
publishTime?: Date;
}

View File

@@ -1,5 +1,6 @@
import request from "@/utils/request";
import type { RoleQueryParams, RoleItem, RoleForm, OptionItem } from "@/types/api";
import type { RoleQueryParams, RoleItem, RoleForm } from "./types";
import type { OptionItem } from "@/api/common";
const ROLE_BASE_URL = "/api/v1/roles";
@@ -47,3 +48,6 @@ const RoleAPI = {
};
export default RoleAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,51 @@
/**
* Role 角色类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 角色分页查询参数 */
export interface RoleQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
}
/** 角色分页对象 */
export interface RoleItem {
/** 角色ID */
id?: string;
/** 角色编码 */
code?: string;
/** 角色名称 */
name?: string;
/** 排序 */
sort?: number;
/** 角色状态 */
status?: number;
/** 数据权限(1-所有数据 2-部门及子部门数据 3-本部门数据 4-本人数据 5-自定义部门数据) */
dataScope?: number;
/** 数据权限标签 */
dataScopeLabel?: string;
/** 修改时间 */
updateTime?: Date;
}
/** 角色表单对象 */
export interface RoleForm {
/** 角色ID */
id?: string;
/** 角色编码 */
code?: string;
/** 角色名称 */
name?: string;
/** 排序 */
sort?: number;
/** 数据权限(1-所有数据 2-部门及子部门数据 3-本部门数据 4-本人数据 5-自定义部门数据) */
dataScope?: number;
/** 自定义数据权限部门ID列表(当dataScope=5时有效) */
deptIds?: string[];
/** 角色状态 */
status?: number;
/** 备注 */
remark?: string;
}

View File

@@ -1,10 +1,6 @@
import request from "@/utils/request";
import type { OptionItem, PageResult } from "@/types/api";
import type {
TenantPlanForm,
TenantPlanItem,
TenantPlanQueryParams,
} from "@/types/api/tenant-plan";
import type { TenantPlanForm, TenantPlanItem, TenantPlanQueryParams } from "./types";
import type { OptionItem } from "@/api/common";
const TENANT_PLAN_BASE_URL = "/api/v1/tenant-plans";
@@ -68,3 +64,6 @@ const TenantPlanAPI = {
};
export default TenantPlanAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,35 @@
/**
* Tenant Plan 租户套餐类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 租户套餐分页查询参数 */
export interface TenantPlanQueryParams extends BaseQueryParams {
/** 关键字(套餐名称/套餐编码) */
keywords?: string;
/** 状态(1-启用 0-停用) */
status?: number;
}
/** 租户套餐分页对象 */
export interface TenantPlanItem {
id?: number;
name?: string;
code?: string;
status?: number;
sort?: number;
remark?: string;
createTime?: string;
updateTime?: string;
}
/** 租户套餐表单对象 */
export interface TenantPlanForm {
id?: number;
name?: string;
code?: string;
status?: number;
sort?: number;
remark?: string;
}

View File

@@ -6,7 +6,7 @@ import type {
TenantCreateResult,
TenantQueryParams,
TenantItem,
} from "@/types/api";
} from "./types";
const TENANT_BASE_URL = "/api/v1/tenants";
@@ -118,3 +118,6 @@ const TenantAPI = {
};
export default TenantAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,82 @@
/**
* Tenant 租户类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 租户信息 */
export interface TenantInfo {
/** 租户ID */
id: number;
/** 租户名称 */
name: string;
/** 租户域名 */
domain?: string;
}
/** 租户分页查询参数 */
export interface TenantQueryParams extends BaseQueryParams {
/** 关键字(租户名称/租户编码/域名) */
keywords?: string;
/** 租户状态(1-正常 0-禁用) */
status?: number;
}
/** 租户分页对象 */
export interface TenantItem {
id?: string;
name?: string;
code?: string;
contactName?: string;
contactPhone?: string;
contactEmail?: string;
domain?: string;
logo?: string;
planId?: number;
status?: number;
remark?: string;
expireTime?: string;
createTime?: string;
updateTime?: string;
}
/** 租户表单对象(编辑) */
export interface TenantForm {
id?: string;
name?: string;
code?: string;
contactName?: string;
contactPhone?: string;
contactEmail?: string;
domain?: string;
logo?: string;
planId?: number;
status?: number;
remark?: string;
expireTime?: string;
}
/** 新增租户表单对象 */
export interface TenantCreateForm {
name?: string;
code?: string;
contactName?: string;
contactPhone?: string;
contactEmail?: string;
domain?: string;
logo?: string;
planId?: number;
remark?: string;
expireTime?: string;
adminUsername?: string;
}
/** 新增租户结果 */
export interface TenantCreateResult {
tenantId?: string;
tenantCode?: string;
tenantName?: string;
adminUsername?: string;
adminInitialPassword?: string;
adminRoleCode?: string;
}

View File

@@ -10,8 +10,8 @@ import type {
PasswordVerifyForm,
MobileUpdateForm,
EmailUpdateForm,
OptionItem,
} from "@/types/api";
} from "./types";
import type { OptionItem, ExcelResult } from "@/api/common";
const USER_BASE_URL = "/api/v1/users";
@@ -240,3 +240,6 @@ const UserAPI = {
};
export default UserAPI;
// 重导出类型
export * from "./types";

View File

@@ -0,0 +1,155 @@
/**
* User 用户类型定义
*/
import type { BaseQueryParams } from "@/api/common";
/** 登录用户信息 */
export interface UserInfo {
/** 用户ID */
userId?: string;
/** 用户名 */
username?: string;
/** 用户昵称 */
nickname?: string;
/** 头像URL */
avatar?: string;
/** 租户切换权限true 可切换租户) */
canSwitchTenant?: boolean;
/** 角色集合 */
roles: string[];
/** 权限集合 */
perms: string[];
}
/** 用户分页查询参数 */
export interface UserQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 用户状态 */
status?: number;
/** 部门ID */
deptId?: string;
/** 创建时间 */
createTime?: [string, string];
}
/** 用户分页对象 */
export interface UserItem {
/** 用户ID */
id: string;
/** 用户头像地址 */
avatar?: string;
/** 创建时间 */
createTime?: Date;
/** 部门名称 */
deptName?: string;
/** 用户邮箱 */
email?: string;
/** 性别 */
gender?: number;
/** 手机号 */
mobile?: string;
/** 用户昵称 */
nickname?: string;
/** 角色名称,多个使用英文逗号(,)分割 */
roleNames?: string;
/** 用户状态(1:启用;0:禁用) */
status?: number;
/** 用户名 */
username?: string;
}
/** 用户表单对象 */
export interface UserForm {
/** 用户ID */
id?: string;
/** 用户头像 */
avatar?: string;
/** 部门ID */
deptId?: string;
/** 用户邮箱 */
email?: string;
/** 性别 */
gender?: number;
/** 手机号 */
mobile?: string;
/** 用户昵称 */
nickname?: string;
/** 角色ID集合 */
roleIds?: number[];
/** 用户状态(1:正常;0:禁用) */
status?: number;
/** 用户名 */
username?: string;
}
/** 个人中心用户信息 */
export interface UserProfileDetail {
/** 用户ID */
id?: string;
/** 用户名 */
username?: string;
/** 用户昵称 */
nickname?: string;
/** 头像URL */
avatar?: string;
/** 性别 */
gender?: number;
/** 手机号 */
mobile?: string;
/** 邮箱 */
email?: string;
/** 部门名称 */
deptName?: string;
/** 角色名称 */
roleNames?: string;
/** 创建时间 */
createTime?: Date;
}
/** 个人中心用户信息表单 */
export interface UserProfileForm {
/** 用户昵称 */
nickname?: string;
/** 头像URL */
avatar?: string;
/** 性别 */
gender?: number;
}
/** 修改密码表单 */
export interface PasswordChangeForm {
/** 原密码 */
oldPassword?: string;
/** 新密码 */
newPassword?: string;
/** 确认新密码 */
confirmPassword?: string;
}
/** 密码校验表单 */
export interface PasswordVerifyForm {
/** 当前密码 */
password?: string;
}
/** 修改手机表单 */
export interface MobileUpdateForm {
/** 手机号 */
mobile?: string;
/** 验证码 */
code?: string;
/** 当前密码 */
password?: string;
}
/** 修改邮箱表单 */
export interface EmailUpdateForm {
/** 邮箱 */
email?: string;
/** 验证码 */
code?: string;
/** 当前密码 */
password?: string;
}

View File

@@ -1 +0,0 @@
export * from "@/types/api";