chore: 清理冗余代码与配置,优化项目结构

1.  删除无用文件与废弃代码:移除locale枚举、element-plus插件、sse路由、api token模块等
2.  简化类型导入与依赖:移除大量未使用的类型导入,统一echarts导入方式
3.  优化配置与样式:调整gitignore、样式引入顺序,新增列表动画样式
4.  修复接口与模型:修正接口返回类型、查询参数配置,更新部门模型字段
5.  优化性能与体验:添加图片懒加载,优化加载逻辑与表格渲染
6.  调整环境配置:新增并更新开发/生产环境配置文件
This commit is contained in:
zhangtao
2026-07-23 20:49:52 +08:00
parent 096e2216d6
commit 0ce31936aa
360 changed files with 8072 additions and 22122 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ const DemoAPI = {
batchDemo(body: BatchType) {
return request<ApiResponse>({
url: `${API_PATH}/available/setting`,
url: `${API_PATH}/status/batch`,
method: "patch",
data: body,
});
@@ -60,7 +60,7 @@ const DemoAPI = {
},
downloadTemplateDemo() {
return request<ApiResponse>({
return request<Blob>({
url: `${API_PATH}/download/template`,
method: "post",
responseType: "blob",
@@ -13,11 +13,9 @@ export interface RecentLoginItem {
export interface DashboardStats {
online_users: number;
total_users: number;
total_orders: number;
today_login_count: number;
today_unique_users: number;
week_user_created: number;
paid_orders: number;
recent_logins: RecentLoginItem[];
}
@@ -21,6 +21,14 @@ const OnlineAPI = {
});
},
// 获取当前用户自己的在线会话
listCurrentOnline() {
return request<ApiResponse<OnlineUserTable[]>>({
url: `${API_PATH}/current`,
method: "get",
});
},
// 强退用户
clearOnline() {
return request<ApiResponse>({
+11 -11
View File
@@ -109,7 +109,7 @@ export const ResourceAPI = {
return request<Blob>({
url: `${API_PATH}/export`,
method: "post",
data: body,
params: body,
responseType: "blob",
});
},
@@ -169,14 +169,14 @@ export interface ResourcePageQuery extends PageQuery {
* 资源上传响应模型
*/
export interface ResourceUploadSchema {
/** 文件路径 */
file_path?: string;
/** 文件名 */
filename: string;
/** 访问URL */
file_url: string;
/** 文件大小 */
file_size: number;
/** 上传时间 */
upload_time: string;
file_name?: string;
/** 原始文件名 */
origin_name?: string;
/** 文件URL */
file_url?: string;
}
/**
@@ -188,11 +188,11 @@ export interface ResourceItem {
/** 文件URL路径 */
file_url: string;
/** 相对路径 */
relative_path?: string;
relative_path: string;
/** 是否为文件 */
is_file?: boolean;
is_file: boolean;
/** 是否为目录 */
is_dir?: boolean;
is_dir: boolean;
/** 文件大小(字节) */
size?: number | null;
/** 创建时间 */
@@ -1,112 +0,0 @@
import { request } from "@utils";
const API_PATH = "/system/api_token";
const ApiTokenAPI = {
/** 创建 API Token */
createToken(body: ApiTokenCreateForm) {
return request<ApiResponse<ApiTokenCreatedSchema>>({
url: `${API_PATH}/create`,
method: "post",
data: body,
});
},
/** 分页列表 */
listToken(query: ApiTokenPageQuery) {
return request<ApiResponse<PageResult<ApiTokenTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: query,
});
},
/** 详情 */
detailToken(id: number) {
return request<ApiResponse<ApiTokenTable>>({
url: `${API_PATH}/detail/${id}`,
method: "get",
});
},
/** 重置 token */
resetToken(id: number, body: { name?: string; description?: string }) {
return request<ApiResponse<ApiTokenCreatedSchema>>({
url: `${API_PATH}/${id}/reset`,
method: "post",
data: body,
});
},
/** 启用/禁用 */
setTokenStatus(id: number, body: { status: number }) {
return request<ApiResponse>({
url: `${API_PATH}/${id}/status`,
method: "patch",
data: body,
});
},
/** 删除 */
deleteToken(id: number) {
return request<ApiResponse>({
url: `${API_PATH}/${id}`,
method: "delete",
});
},
/** 查看明文(二次验证) */
revealToken(id: number, body: { password: string }) {
return request<ApiResponse<ApiTokenRevealSchema>>({
url: `${API_PATH}/${id}/reveal`,
method: "post",
data: body,
});
},
};
export default ApiTokenAPI;
export interface ApiTokenPageQuery extends PageQuery {
name?: string;
status?: number;
}
export interface ApiTokenTable extends BaseType {
name?: string;
token_prefix?: string;
token_mask?: string;
owner_user_id?: number;
scopes?: string;
expires_at?: string;
rate_limit?: number;
status?: number;
last_used_at?: string;
last_used_ip?: string;
used_count?: number;
description?: string;
}
export interface ApiTokenCreateForm extends BaseFormType {
name: string;
scopes?: string[];
expires_at?: string;
rate_limit?: number;
status?: number;
description?: string;
}
export interface ApiTokenCreatedSchema {
id: number;
name: string;
token_prefix: string;
/** 创建时完整返回,请立即保存 */
token_plain: string;
expires_at?: string;
}
export interface ApiTokenRevealSchema {
id: number;
token_plain: string;
expires_at?: string;
}
+3 -7
View File
@@ -26,7 +26,7 @@ const AuthAPI = {
return request<ApiResponse<JWTOut>>({
url: `${API_PATH}/token/refresh`,
method: "post",
data: refreshToken,
data: { refresh_token: refreshToken },
});
},
@@ -37,7 +37,7 @@ const AuthAPI = {
});
},
logout(body: LogoutBody) {
logout(body: string) {
return request<ApiResponse>({
url: `${API_PATH}/logout`,
method: "post",
@@ -64,6 +64,7 @@ export interface LoginFormData {
username: string;
password: string;
captcha_key?: string;
captcha?: string;
remember?: boolean;
login_type?: string;
}
@@ -79,11 +80,6 @@ export interface JWTOut {
/** 登录成功返回 */
export type LoginResult = JWTOut;
/** 退出登录请求体 */
export interface LogoutBody {
token: string;
}
/** 验证码信息 */
export interface CaptchaInfo {
enable: boolean;
@@ -62,9 +62,6 @@ export interface DeptTable extends BaseType {
name?: string;
order?: number;
code: string;
leader?: string;
phone?: string;
email?: string;
parent_id?: number;
parent_name?: string;
children?: DeptTable[];
@@ -75,9 +72,6 @@ export interface DeptTable extends BaseType {
export interface DeptForm extends BaseFormType {
name?: string;
code: string;
leader?: string;
phone?: string;
email?: string;
parent_id?: number;
order?: number;
status?: number;
+3 -3
View File
@@ -12,7 +12,7 @@ const DictAPI = {
},
optionDictType() {
return request<ApiResponse>({
return request<ApiResponse<DictTable[]>>({
url: `${API_PATH}/type/optionselect`,
method: "get",
});
@@ -132,13 +132,13 @@ const DictAPI = {
export default DictAPI;
export interface DictPageQuery extends PageQuery, UserByQueryParams {
export interface DictPageQuery extends PageQuery {
dict_name?: string;
dict_type?: string;
status?: number;
}
export interface DictDataPageQuery extends PageQuery, UserByQueryParams {
export interface DictDataPageQuery extends PageQuery {
dict_label?: string;
dict_type?: string;
dict_type_id?: number;
+7 -3
View File
@@ -42,6 +42,7 @@ export default OperationLogAPI;
export interface OperationLogPageQuery extends PageQuery, UserByQueryParams {
request_path?: string;
request_method?: string;
username?: string;
status?: number;
request_ip?: string;
@@ -49,10 +50,13 @@ export interface OperationLogPageQuery extends PageQuery, UserByQueryParams {
export interface OperationLogTable {
id: number;
request_path?: string;
request_method?: string;
username: string;
status?: number;
description?: string;
request_path: string;
request_method: string;
request_payload?: Record<string, unknown> | string;
response_code?: number;
response_code: number;
response_json?: Record<string, unknown> | string;
process_time?: string;
created_time?: string;
+1 -1
View File
@@ -12,7 +12,7 @@ const NoticeAPI = {
},
listNoticeAvailable() {
return request<ApiResponse<PageResult<NoticeTable>>>({
return request<ApiResponse<NoticeTable[]>>({
url: `${API_PATH}/available`,
method: "get",
});
@@ -23,29 +23,6 @@ const ParamsAPI = {
});
},
listParams(query: ConfigPageQuery) {
return request<ApiResponse<PageResult<ConfigTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: query,
});
},
detailParams(query: number) {
return request<ApiResponse<ConfigTable>>({
url: `${API_PATH}/detail/${query}`,
method: "get",
});
},
createParams(body: ConfigForm) {
return request<ApiResponse>({
url: `${API_PATH}/create`,
method: "post",
data: body,
});
},
updateParams(id: number, body: ConfigForm) {
return request<ApiResponse>({
url: `${API_PATH}/update/${id}`,
@@ -53,42 +30,10 @@ const ParamsAPI = {
data: body,
});
},
deleteParams(body: number[]) {
return request<ApiResponse>({
url: `${API_PATH}/delete`,
method: "delete",
data: body,
});
},
batchParams(body: BatchType) {
return request<ApiResponse>({
url: `${API_PATH}/status/batch`,
method: "patch",
data: body,
});
},
exportParams(query: ConfigPageQuery) {
return request<Blob>({
url: `${API_PATH}/export`,
method: "post",
data: query,
responseType: "blob",
});
},
};
export default ParamsAPI;
export interface ConfigPageQuery extends PageQuery, UserByQueryParams {
config_name?: string;
config_key?: string;
config_type?: boolean;
status?: number;
}
export interface ConfigTable extends BaseType {
config_name?: string;
config_key?: string;
+12 -7
View File
@@ -11,7 +11,7 @@ export const UserAPI = {
});
},
uploadCurrentUserAvatar(body: any) {
uploadCurrentUserAvatar(body: FormData) {
return request<ApiResponse<UploadFilePath>>({
url: `/common/file/upload?upload_type=avatar`,
method: "post",
@@ -117,14 +117,14 @@ export const UserAPI = {
},
downloadTemplateUser() {
return request<ApiResponse>({
return request<Blob>({
url: `${API_PATH}/import/template`,
method: "get",
responseType: "blob",
});
},
importUser(body: any) {
importUser(body: FormData) {
return request<ApiResponse>({
url: `${API_PATH}/import/data`,
method: "post",
@@ -143,6 +143,8 @@ export interface ForgetPasswordForm {
new_password: string;
mobile?: string;
confirmPassword: string;
captcha_key?: string;
captcha?: string;
}
export interface RegisterForm {
@@ -150,6 +152,9 @@ export interface RegisterForm {
password: string;
confirmPassword: string;
email?: string;
name?: string;
captcha_key?: string;
captcha?: string;
}
export interface UserPageQuery extends PageQuery, UserByQueryParams {
@@ -185,7 +190,7 @@ export interface UserInfo extends BaseType {
position_names?: positionSelectorType["name"][];
position_ids?: positionSelectorType["id"][];
is_superuser?: boolean;
is_impersonate?: boolean;
last_login?: string;
created_by?: CommonType;
updated_by?: CommonType;
@@ -224,7 +229,7 @@ export interface positionSelectorType {
export interface InfoFormState {
id?: number;
name?: string;
gender?: number;
gender?: string;
mobile?: string;
email?: string;
username?: string;
@@ -263,7 +268,7 @@ export interface UserForm extends BaseFormType {
position_ids?: number[];
position_names?: string[];
password?: string;
gender?: number;
gender?: string;
email?: string;
mobile?: string;
is_superuser?: boolean;
@@ -274,7 +279,7 @@ export interface UserForm extends BaseFormType {
export interface CurrentUserFormState {
name?: string;
gender?: number;
gender?: string;
mobile?: string;
email?: string;
avatar?: string;
@@ -94,6 +94,14 @@ const JobAPI = {
});
},
modifyJob(jobId: string, body: Record<string, any>) {
return request<ApiResponse>({
url: `${API_PATH}/task/modify/${jobId}`,
method: "put",
data: body,
});
},
getJobLogList(query: JobLogPageQuery) {
return request<ApiResponse<PageResult<JobLogTable>>>({
url: `${API_PATH}/log/list`,