mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-24 05:26:58 +00:00
feat: 添加演示模块并优化日期选择器组件
refactor: 重构文件导入组件为通用组件 fix: 修复导出文件名统一问题 docs: 更新README添加二次开发教程 style: 统一系统管理页面的日期选择器实现 chore: 更新数据库迁移脚本和初始化数据 perf: 优化前端页面日期范围选择交互 test: 添加演示模块相关测试文件 build: 更新依赖项配置 ci: 调整CI/CD脚本配置
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
const ExampleAPI = {
|
||||
getExampleList(query: ExamplePageQuery) {
|
||||
return request<ApiResponse<PageResult<ExampleTable[]>>>({
|
||||
url: `/demo/example/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getExampleDetail(query: number) {
|
||||
return request<ApiResponse<ExampleTable>>({
|
||||
url: `/demo/example/detail/${query}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createExample(body: ExampleForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateExample(body: ExampleForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/update`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteExample(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
batchAvailableExample(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/available/setting`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportExample(body: ExamplePageQuery) {
|
||||
return request<Blob>({
|
||||
url: `/demo/example/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
downloadTemplate() {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/download/template`,
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
importExample(body: any) {
|
||||
return request<ApiResponse>({
|
||||
url: `/demo/example/import`,
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default ExampleAPI;
|
||||
|
||||
export interface ExamplePageQuery extends PageQuery {
|
||||
/** 示例标题 */
|
||||
name?: string;
|
||||
/** 示例状态 */
|
||||
status?: boolean;
|
||||
/** 开始时间 */
|
||||
start_time?: string;
|
||||
/** 结束时间 */
|
||||
end_time?: string;
|
||||
}
|
||||
|
||||
export interface ExampleTable {
|
||||
index?: number;
|
||||
id?: number;
|
||||
name?: string;
|
||||
status?: boolean;
|
||||
description?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
creator?: creatorType;
|
||||
}
|
||||
|
||||
export interface ExampleForm {
|
||||
id?: number;
|
||||
name?: string;
|
||||
status?: boolean;
|
||||
description?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user