mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-26 22:31:21 +00:00
refactor: 大规模代码整理与功能优化
1. 重构后端API路由、CRUD与模块结构,整合日志管理,移除废弃demo代码 2. 优化前端组件类型定义、样式与路由配置,修复权限判断逻辑 3. 调整默认排序规则、滚动条样式与工具类函数,更新依赖与配置文件 4. 修复多处类型不匹配与默认值问题,完善表单与菜单验证逻辑
This commit is contained in:
@@ -83,7 +83,7 @@ export default DemoAPI;
|
||||
|
||||
export interface DemoPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: string;
|
||||
status?: number;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
@@ -92,33 +92,26 @@ export interface DemoPageQuery extends PageQuery {
|
||||
|
||||
export interface DemoTable extends BaseType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
deleted_by?: CommonType;
|
||||
a?: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: boolean;
|
||||
e?: string;
|
||||
f?: string;
|
||||
g?: string;
|
||||
h?: string;
|
||||
i?: Record<string, any>;
|
||||
int_val?: number;
|
||||
bigint_val?: number;
|
||||
float_val?: number;
|
||||
bool_val?: boolean;
|
||||
date_val?: string;
|
||||
time_val?: string;
|
||||
datetime_val?: string;
|
||||
text_val?: string;
|
||||
json_val?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface DemoForm extends BaseFormType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
a?: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: boolean;
|
||||
e?: string;
|
||||
f?: Date | string;
|
||||
g?: Date | string;
|
||||
h?: string;
|
||||
i?: Record<string, any>;
|
||||
int_val?: number;
|
||||
bigint_val?: number;
|
||||
float_val?: number;
|
||||
bool_val?: boolean;
|
||||
date_val?: string;
|
||||
time_val?: Date | string;
|
||||
datetime_val?: Date | string;
|
||||
text_val?: string;
|
||||
json_val?: Record<string, any>;
|
||||
}
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/example/demo01";
|
||||
|
||||
const Demo01API = {
|
||||
getDemo01List(query: Demo01PageQuery) {
|
||||
return request<ApiResponse<PageResult<Demo01Table>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getDemo01Detail(id: number) {
|
||||
return request<ApiResponse<Demo01Table>>({
|
||||
url: `${API_PATH}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createDemo01(body: Demo01Form) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateDemo01(id: number, body: Demo01Form) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteDemo01(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
batchDemo01(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportDemo01(body: Demo01PageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
downloadDemo01Template() {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/download/template`,
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
importDemo01(body: FormData) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import`,
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default Demo01API;
|
||||
|
||||
export interface Demo01PageQuery extends PageQuery {
|
||||
/** 与后端 Demo01QueryParam 一致 */
|
||||
name?: string;
|
||||
description?: string;
|
||||
/** 是否启用:0 启用 / 1 禁用(字符串) */
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 与后端 Demo01OutSchema 一致:
|
||||
* Demo01CreateSchema(name,status,description) + BaseSchema + UserBySchema
|
||||
*/
|
||||
export interface Demo01Table extends BaseType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
deleted_by?: CommonType;
|
||||
}
|
||||
|
||||
/** 与后端 Demo01CreateSchema / Demo01UpdateSchema 一致(不含 id,更新走 URL) */
|
||||
export interface Demo01Form extends BaseFormType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user