mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-28 06:57:54 +00:00
refactor(backend): 重构任务模块并优化菜单权限
- 移除系统模块中的任务相关代码 - 新增批量设置字典类型和数据状态的功能 - 更新菜单权限获取逻辑,增加对链接类型菜单的支持 - 调整任务模块到 monitor 监控模块下
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
const JobAPI = {
|
||||
getJobList(query: JobPageQuery) {
|
||||
return request<ApiResponse<PageResult<JobTable>>>({
|
||||
url: `/monitor/job/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getJobDetail(query: DetailType) {
|
||||
return request<ApiResponse<JobTable>>({
|
||||
url: `/monitor/job/detail`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
createJob(body: JobForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateJob(body: JobForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/update`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteJob(query: DeleteType) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/delete`,
|
||||
method: "delete",
|
||||
data: query,
|
||||
});
|
||||
},
|
||||
|
||||
exportJob(body: JobPageQuery) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
clearJob() {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/clear`,
|
||||
method: "delete",
|
||||
});
|
||||
},
|
||||
|
||||
OptionJob(params: JobPageQuery) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/job/option`,
|
||||
method: "put",
|
||||
data: params,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default JobAPI;
|
||||
|
||||
export interface JobPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: boolean;
|
||||
/** 开始时间 */
|
||||
start_time?: string;
|
||||
/** 结束时间 */
|
||||
end_time?: string;
|
||||
}
|
||||
|
||||
export interface JobPageQuery extends PageQuery {
|
||||
id?: number;
|
||||
option?: number; //操作类型 1: 暂停 2: 恢复 3: 重启
|
||||
}
|
||||
|
||||
export interface JobTable {
|
||||
index?: number;
|
||||
id?: number;
|
||||
name?: string;
|
||||
func?: string;
|
||||
trigger?: string;
|
||||
args?: string;
|
||||
kwargs?: string;
|
||||
coalesce?: boolean;
|
||||
max_instances?: number;
|
||||
jobstore?: string;
|
||||
executor?: string;
|
||||
trigger_args?: string;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
status?: boolean;
|
||||
message?: string;
|
||||
description?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
creator?: creatorType;
|
||||
}
|
||||
|
||||
export interface JobForm {
|
||||
id?: number;
|
||||
name?: string;
|
||||
func?: string;
|
||||
trigger?: string;
|
||||
args?: string;
|
||||
kwargs?: string;
|
||||
coalesce?: boolean;
|
||||
max_instances?: number;
|
||||
jobstore?: string;
|
||||
executor?: string;
|
||||
trigger_args?: string;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
status?: boolean;
|
||||
message?: string;
|
||||
description?: string;
|
||||
}
|
||||
@@ -11,11 +11,11 @@ const OnlineAPI = {
|
||||
},
|
||||
|
||||
// 强退用户
|
||||
deleteOnline(session_id: string) {
|
||||
deleteOnline(query: DeleteType) {
|
||||
return request<ApiResponse>({
|
||||
url: `/monitor/online/delete`,
|
||||
method: "delete",
|
||||
data: session_id,
|
||||
data: query,
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user