mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-13 12:49:30 +00:00
feat(backend): 更新路由前缀和查询参数处理 style(backend): 调整导入顺序和清理无用导入 refactor(frontend): 重构工作台页面交互和样式 fix(frontend): 修复代码生成页面查询表单和表格展示
140 lines
2.7 KiB
TypeScript
140 lines
2.7 KiB
TypeScript
import request from "@/utils/request";
|
|
|
|
const API_PATH = "/application/myapp";
|
|
|
|
export const ApplicationAPI = {
|
|
/**
|
|
* 获取应用详情
|
|
* @param id 应用ID
|
|
*/
|
|
getApplicationDetail(id: number) {
|
|
return request<ApiResponse<ApplicationInfo>>({
|
|
url: `${API_PATH}/detail/${id}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 查询应用列表
|
|
* @param query 查询参数
|
|
*/
|
|
getApplicationList(query: ApplicationPageQuery) {
|
|
return request<ApiResponse<PageResult<ApplicationInfo[]>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 创建应用
|
|
* @param body 应用信息
|
|
*/
|
|
createApplication(body: ApplicationForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 修改应用
|
|
* @param id 应用ID
|
|
* @param body 应用信息
|
|
*/
|
|
updateApplication(id: number, body: ApplicationForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 删除应用
|
|
* @param body 应用ID数组
|
|
*/
|
|
deleteApplication(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 批量修改应用状态
|
|
* @param body 批量操作参数
|
|
*/
|
|
batchAvailableApplication(body: BatchType) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/available/setting`,
|
|
method: "patch",
|
|
data: body,
|
|
});
|
|
},
|
|
};
|
|
|
|
export default ApplicationAPI;
|
|
|
|
/**
|
|
* 应用分页查询参数
|
|
*/
|
|
export interface ApplicationPageQuery extends PageQuery {
|
|
/** 应用名称 */
|
|
name?: string;
|
|
/** 是否启用 */
|
|
status?: boolean;
|
|
/** 创建人 */
|
|
creator?: number;
|
|
/** 开始时间 */
|
|
start_time?: string;
|
|
/** 结束时间 */
|
|
end_time?: string;
|
|
/** 排序字段,格式:[{'field':'asc/desc'}] */
|
|
order_by?: string;
|
|
}
|
|
|
|
/**
|
|
* 应用信息
|
|
*/
|
|
export interface ApplicationInfo {
|
|
/** 应用ID */
|
|
id?: number;
|
|
/** 应用名称 */
|
|
name?: string;
|
|
/** 访问地址 */
|
|
access_url?: string;
|
|
/** 图标地址 */
|
|
icon_url?: string;
|
|
/** 是否启用 */
|
|
status?: boolean;
|
|
/** 应用描述 */
|
|
description?: string;
|
|
/** 创建时间 */
|
|
created_at?: string;
|
|
/** 更新时间 */
|
|
updated_at?: string;
|
|
/** 创建人 */
|
|
creator?: creatorType;
|
|
}
|
|
|
|
/**
|
|
* 应用表单
|
|
*/
|
|
export interface ApplicationForm {
|
|
/** 应用ID */
|
|
id?: number;
|
|
/** 应用名称 */
|
|
name: string;
|
|
/** 访问地址 */
|
|
access_url: string;
|
|
/** 图标地址 */
|
|
icon_url: string;
|
|
/** 是否启用 */
|
|
status: boolean;
|
|
/** 应用描述 */
|
|
description?: string;
|
|
}
|