chore: cleanup old frontend code and update project configs

This commit removes the deprecated frontend/web-old directory, updates various project configuration files including tsconfig, vite config, environment variables, and backend data models. It also fixes several API paths, adds tenant awareness to multiple models, and makes minor UI adjustments.
This commit is contained in:
zhangtao
2026-05-27 01:12:03 +08:00
parent eb18d85327
commit 53d2a9d13e
581 changed files with 14751 additions and 55305 deletions
@@ -70,6 +70,23 @@ const AuthAPI = {
params: { token },
});
},
/** 获取当前用户的可选租户列表 */
getTenants() {
return request<ApiResponse<TenantOption[]>>({
url: `${API_PATH}/tenants`,
method: "get",
});
},
/** 选择租户,返回含 tenant_id 的新 JWT */
selectTenant(tenantId: number) {
return request<ApiResponse<SelectTenantResult>>({
url: `${API_PATH}/select-tenant`,
method: "post",
data: { tenant_id: tenantId },
});
},
};
export default AuthAPI;
@@ -95,6 +112,31 @@ export interface LoginResult {
refresh_token: string;
token_type: string;
expires_in: number;
tenants?: TenantOption[];
user_info?: UserInfoBrief;
}
/** 租户选项 */
export interface TenantOption {
id: number;
name: string;
code: string;
}
/** 用户简要信息 */
export interface UserInfoBrief {
id: number;
username: string;
name: string;
avatar?: string;
is_super_admin?: boolean;
}
/** 选择租户响应 */
export interface SelectTenantResult {
access_token: string;
token_type: string;
expires_in: number;
}
/** 验证码信息 */
@@ -68,6 +68,8 @@ export interface DeptTable extends BaseType {
email?: string;
parent_id?: number;
parent_name?: string;
status?: string;
description?: string;
children?: DeptTable[];
}
@@ -79,4 +81,6 @@ export interface DeptForm extends BaseFormType {
phone?: string;
email?: string;
parent_id?: number;
status?: string;
description?: string;
}
@@ -152,6 +152,8 @@ export interface DictDataPageQuery extends PageQuery {
export interface DictTable extends BaseType {
dict_name?: string;
dict_type?: string;
status?: string;
description?: string;
}
export interface DictForm extends BaseFormType {
@@ -168,6 +170,7 @@ export interface DictDataTable extends BaseType {
css_class?: string;
list_class?: string;
is_default?: boolean;
status?: string;
}
export interface DictDataForm extends BaseFormType {
@@ -60,6 +60,8 @@ export interface LogTable extends BaseType {
request_payload?: string;
response_json?: string;
process_time?: string;
status?: string;
description?: string;
created_by?: CommonType;
updated_by?: CommonType;
deleted_by?: CommonType;
@@ -80,6 +80,8 @@ export interface MenuTable extends BaseType {
title?: string;
params?: { key: string; value: string }[];
affix?: boolean;
status?: string;
description?: string;
children?: MenuTable[];
client?: "pc" | "app";
}
@@ -65,6 +65,20 @@ const NoticeAPI = {
responseType: "blob",
});
},
getLatestNotices() {
return request<ApiResponse<NoticeTable[]>>({
url: `${API_PATH}/latest`,
method: "get",
});
},
getNotificationPanel() {
return request<ApiResponse<NotificationPanel>>({
url: `${API_PATH}/panel`,
method: "get",
});
},
};
export default NoticeAPI;
@@ -93,3 +107,17 @@ export interface NoticeForm extends BaseFormType {
notice_type?: string;
notice_content?: string;
}
export interface NotificationPanelMessage {
id?: number;
title: string;
content?: string;
time: string;
type?: string;
}
export interface NotificationPanel {
notices: NoticeTable[];
messages: NotificationPanelMessage[];
pendings: NotificationPanelMessage[];
}
+5 -1
View File
@@ -5,7 +5,7 @@ const API_PATH = "/system/param";
const ParamsAPI = {
uploadFile(body: any) {
return request<ApiResponse<UploadFilePath>>({
url: `${API_PATH}/upload`,
url: `/common/file/upload?upload_type=param`,
method: "post",
data: body,
headers: { "Content-Type": "multipart/form-data" },
@@ -87,6 +87,8 @@ export interface ConfigTable extends BaseType {
config_key?: string;
config_value?: string;
config_type?: boolean;
status?: string;
description?: string;
}
export interface ConfigForm extends BaseFormType {
@@ -94,4 +96,6 @@ export interface ConfigForm extends BaseFormType {
config_key?: string;
config_value?: string;
config_type?: boolean;
status?: string;
description?: string;
}
@@ -0,0 +1,130 @@
import { request } from "@utils";
const API_PATH = "/system/plugin";
const PluginAPI = {
// 超管:插件列表
list(page: PageQuery, search?: PluginQueryParam) {
return request<ApiResponse<PageResult<PluginTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: { ...page, ...search },
});
},
// 超管:插件详情
detail(id: number) {
return request<ApiResponse<PluginTable>>({
url: `${API_PATH}/detail/${id}`,
method: "get",
});
},
// 超管:创建插件
create(body: PluginForm) {
return request<ApiResponse<PluginTable>>({
url: `${API_PATH}/create`,
method: "post",
data: body,
});
},
// 超管:更新插件
update(id: number, body: PluginForm) {
return request<ApiResponse<PluginTable>>({
url: `${API_PATH}/update/${id}`,
method: "put",
data: body,
});
},
// 超管:删除插件
delete(ids: number[]) {
return request<ApiResponse>({
url: `${API_PATH}/delete`,
method: "delete",
data: ids,
});
},
// 租户:插件市场
marketplace(page: PageQuery, category?: string) {
return request<ApiResponse<PageResult<PluginTable>>>({
url: `${API_PATH}/marketplace`,
method: "get",
params: { ...page, category },
});
},
// 租户:安装插件
install(pluginId: number) {
return request<ApiResponse>({
url: `${API_PATH}/install`,
method: "post",
data: { plugin_id: pluginId },
});
},
// 租户:卸载插件
uninstall(pluginId: number) {
return request<ApiResponse>({
url: `${API_PATH}/uninstall`,
method: "post",
data: { plugin_id: pluginId },
});
},
// 租户:启用/禁用插件
toggle(pluginId: number) {
return request<ApiResponse>({
url: `${API_PATH}/toggle`,
method: "post",
data: { plugin_id: pluginId },
});
},
// 租户:我的插件
myPlugins() {
return request<ApiResponse<PluginTable[]>>({
url: `${API_PATH}/my`,
method: "get",
});
},
};
export default PluginAPI;
export interface PluginQueryParam {
name?: string;
category?: string;
status?: string;
}
export interface PluginTable extends BaseType {
name: string;
code: string;
category?: string;
icon?: string;
version?: string;
description?: string;
price?: number;
status?: string;
installed?: boolean;
install_time?: string;
}
export interface PluginForm extends BaseFormType {
name?: string;
code?: string;
category?: string;
icon?: string;
version?: string;
description?: string;
price?: number;
status?: string;
sort?: number;
author?: string;
menu_path?: string;
permission_prefix?: string;
dependencies?: string;
}
@@ -83,6 +83,8 @@ export interface RoleTable extends BaseType {
order?: number;
code: string;
data_scope?: number;
status?: string;
description?: string;
menus?: permissionMenuType[];
depts?: permissionDeptType[];
}
@@ -91,6 +93,8 @@ export interface RoleForm extends BaseFormType {
name?: string;
order?: number;
code: string;
status?: string;
description?: string;
}
export interface permissionDataType {
+158 -1
View File
@@ -1,4 +1,4 @@
import { request } from "@utils";
import { request, NO_AUTH_FLAG } from "@utils";
const API_PATH = "/system/tenant";
@@ -49,6 +49,91 @@ const TenantAPI = {
data: body,
});
},
toggleTenantStatus(id: number) {
return request<ApiResponse>({
url: `${API_PATH}/status/${id}`,
method: "put",
});
},
getTenantUsers(tenantId: number) {
return request<ApiResponse<TenantUser[]>>({
url: `${API_PATH}/${tenantId}/users`,
method: "get",
});
},
addTenantUser(tenantId: number, body: TenantUserAddForm) {
return request<ApiResponse>({
url: `${API_PATH}/${tenantId}/users`,
method: "post",
data: body,
});
},
removeTenantUser(tenantId: number, userId: number) {
return request<ApiResponse>({
url: `${API_PATH}/${tenantId}/users/${userId}`,
method: "delete",
});
},
// P1: 配额管理
getTenantQuota(tenantId: number) {
return request<ApiResponse<TenantQuota>>({
url: `${API_PATH}/${tenantId}/quota`,
method: "get",
});
},
updateTenantQuota(tenantId: number, body: TenantQuotaUpdate) {
return request<ApiResponse<TenantQuota>>({
url: `${API_PATH}/${tenantId}/quota`,
method: "put",
data: body,
});
},
/** 公开接口:无需登录即可获取租户配置(用于登录页等场景) */
getTenantConfigInfo(tenantId: number) {
return request<ApiResponse<TenantConfigItem[]>>({
url: `${API_PATH}/${tenantId}/config/info`,
method: "get",
headers: {
Authorization: NO_AUTH_FLAG,
},
});
},
// P1: 个性化配置
getTenantConfig(tenantId: number) {
return request<ApiResponse<TenantConfigItem[]>>({
url: `${API_PATH}/${tenantId}/config`,
method: "get",
});
},
updateTenantConfig(tenantId: number, body: TenantConfigItem[]) {
return request<ApiResponse<TenantConfigItem[]>>({
url: `${API_PATH}/${tenantId}/config`,
method: "put",
data: body,
});
},
// P1: 菜单权限
getTenantMenus(tenantId: number) {
return request<ApiResponse<number[]>>({
url: `${API_PATH}/${tenantId}/menus`,
method: "get",
});
},
setTenantMenus(tenantId: number, menuIds: number[]) {
return request<ApiResponse>({
url: `${API_PATH}/${tenantId}/menus`,
method: "put",
data: { menu_ids: menuIds },
});
},
};
export default TenantAPI;
@@ -63,8 +148,17 @@ export interface TenantPageQuery extends PageQuery {
export interface TenantTable extends BaseType {
name: string;
code: string;
status?: string;
description?: string;
start_time?: string;
end_time?: string;
contact_name?: string;
contact_phone?: string;
contact_email?: string;
address?: string;
domain?: string;
logo_url?: string;
sort?: number;
}
export interface TenantForm {
@@ -75,6 +169,13 @@ export interface TenantForm {
description?: string;
start_time?: string;
end_time?: string;
contact_name?: string;
contact_phone?: string;
contact_email?: string;
address?: string;
domain?: string;
logo_url?: string;
sort?: number;
}
export interface TenantCreateForm {
@@ -84,6 +185,13 @@ export interface TenantCreateForm {
description?: string;
start_time?: string;
end_time?: string;
contact_name?: string;
contact_phone?: string;
contact_email?: string;
address?: string;
domain?: string;
logo_url?: string;
sort?: number;
}
export interface TenantUpdateForm {
@@ -92,9 +200,58 @@ export interface TenantUpdateForm {
description?: string;
start_time?: string;
end_time?: string;
contact_name?: string;
contact_phone?: string;
contact_email?: string;
address?: string;
domain?: string;
logo_url?: string;
sort?: number;
}
export interface BatchType {
ids: number[];
status: string;
}
export interface TenantUser {
id: number;
user_id: number;
tenant_id: number;
role: string;
is_default: number;
create_time?: string;
username: string;
name: string;
}
export interface TenantUserAddForm {
user_id: number;
role: string;
is_default: number;
}
// P1 types
export interface TenantQuota {
id: number;
tenant_id: number;
max_users: number;
max_roles: number;
max_storage_mb: number;
max_depts: number;
}
export interface TenantQuotaUpdate {
max_users?: number;
max_roles?: number;
max_storage_mb?: number;
max_depts?: number;
}
export interface TenantConfigItem {
id?: number;
tenant_id?: number;
config_key: string;
config_value: string;
config_type: string;
}
@@ -0,0 +1,84 @@
import { request } from "@utils";
const API_PATH = "/system/ticket";
const TicketAPI = {
listTicket(query?: TicketPageQuery) {
return request<ApiResponse<PageResult<TicketTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: query,
});
},
detailTicket(id: number) {
return request<ApiResponse<TicketTable>>({ url: `${API_PATH}/detail/${id}`, method: "get" });
},
createTicket(body: TicketCreateForm) {
return request<ApiResponse>({ url: `${API_PATH}/create`, method: "post", data: body });
},
updateTicket(id: number, body: TicketUpdateForm) {
return request<ApiResponse>({ url: `${API_PATH}/update/${id}`, method: "put", data: body });
},
deleteTicket(body: number[]) {
return request<ApiResponse>({ url: `${API_PATH}/delete`, method: "delete", data: body });
},
exportTicket(query?: TicketPageQuery) {
return request<ApiResponse<Blob>>({
url: `${API_PATH}/export`,
method: "get",
params: query,
responseType: "blob",
});
},
batchTicket(body: { ids: number[]; status: string }) {
return request<ApiResponse>({ url: `${API_PATH}/batch`, method: "put", data: body });
},
};
export default TicketAPI;
export interface TicketPageQuery extends PageQuery {
title?: string;
ticket_type?: string;
status?: string;
created_id?: number;
assigned_id?: number;
}
export interface TicketTable extends BaseType {
title: string;
ticket_content?: string;
content: string;
ticket_type: string;
status: string;
images?: string;
reply?: string;
assigned_id?: number;
assigned_by?: { id: number; name: string; avatar?: string };
created_by?: { id: number; name: string; avatar?: string };
updated_by?: { id: number; name: string; avatar?: string };
}
export interface TicketCreateForm {
title: string;
ticket_content: string;
content?: string;
ticket_type: string;
images?: string;
description?: string;
}
export interface TicketUpdateForm {
title?: string;
ticket_content?: string;
content?: string;
ticket_type?: string;
status?: string;
reply?: string;
assigned_id?: number;
description?: string;
}
export interface TicketForm extends TicketCreateForm, TicketUpdateForm {
id?: number;
}
+8 -1
View File
@@ -13,7 +13,7 @@ export const UserAPI = {
uploadCurrentUserAvatar(body: any) {
return request<ApiResponse<UploadFilePath>>({
url: `${API_PATH}/current/avatar/upload`,
url: `/common/file/upload?upload_type=avatar`,
method: "post",
data: body,
headers: { "Content-Type": "multipart/form-data" },
@@ -191,6 +191,13 @@ export interface UserInfo extends BaseType {
created_by?: CommonType;
updated_by?: CommonType;
deleted_by?: CommonType;
tenant_id?: number;
tenant_name?: string;
gitee_login?: string;
github_login?: string;
wx_login?: string;
qq_login?: string;
description?: string;
}
export interface deptTreeType {