mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-26 22:31:21 +00:00
chore: 初始化uniapp前端项目基础框架
新增项目配置、静态资源、工具类、状态管理、API接口、组件库集成等全套基础代码,完成项目初始化搭建
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 定时任务 API 模块(对应后端 `plugin.module_task.cronjob.job`)
|
||||
* 包含: 调度器管理 / 任务管理 / 任务执行日志
|
||||
*/
|
||||
import { http } from '@/http'
|
||||
|
||||
const JOB_BASE = '/task/cronjob/job'
|
||||
|
||||
/* ==================== 调度器管理 ==================== */
|
||||
export const SchedulerAPI = {
|
||||
/** 获取调度器状态 */
|
||||
getStatus(): Promise<SchedulerStatus> {
|
||||
return http.Get(`${JOB_BASE}/scheduler/status`)
|
||||
},
|
||||
/** 获取调度器任务列表 */
|
||||
getJobs(): Promise<SchedulerJob[]> {
|
||||
return http.Get(`${JOB_BASE}/scheduler/jobs`)
|
||||
},
|
||||
/** 启动调度器 */
|
||||
start(): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/scheduler/start`)
|
||||
},
|
||||
/** 暂停调度器 */
|
||||
pause(): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/scheduler/pause`)
|
||||
},
|
||||
/** 恢复调度器 */
|
||||
resume(): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/scheduler/resume`)
|
||||
},
|
||||
/** 关闭调度器 */
|
||||
shutdown(): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/scheduler/shutdown`)
|
||||
},
|
||||
/** 清空所有任务 */
|
||||
clear(): Promise<void> {
|
||||
return http.Delete(`${JOB_BASE}/scheduler/jobs/clear`)
|
||||
},
|
||||
/** 获取调度器控制台信息 */
|
||||
getConsole(): Promise<unknown> {
|
||||
return http.Get(`${JOB_BASE}/scheduler/console`)
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 任务管理 ==================== */
|
||||
export const JobAPI = {
|
||||
/** 暂停任务 */
|
||||
pause(jobId: string): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/task/pause/${jobId}`)
|
||||
},
|
||||
/** 恢复任务 */
|
||||
resume(jobId: string): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/task/resume/${jobId}`)
|
||||
},
|
||||
/** 立即执行任务 */
|
||||
run(jobId: string): Promise<void> {
|
||||
return http.Post(`${JOB_BASE}/task/run/${jobId}`)
|
||||
},
|
||||
/** 修改任务 */
|
||||
modify(jobId: string, data: Record<string, any>): Promise<void> {
|
||||
return http.Put(`${JOB_BASE}/task/modify/${jobId}`, data)
|
||||
},
|
||||
/** 移除任务 */
|
||||
remove(jobId: string): Promise<void> {
|
||||
return http.Delete(`${JOB_BASE}/task/remove/${jobId}`)
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 任务执行日志 ==================== */
|
||||
export const JobLogAPI = {
|
||||
/** 查询执行日志列表 */
|
||||
getPage(params?: Record<string, any>): Promise<PageResult<JobLogItem>> {
|
||||
return http.Get(`${JOB_BASE}/log/list`, params)
|
||||
},
|
||||
/** 获取执行日志详情 */
|
||||
getDetail(id: number): Promise<JobLogItem> {
|
||||
return http.Get(`${JOB_BASE}/log/detail/${id}`)
|
||||
},
|
||||
/** 删除执行日志 */
|
||||
remove(ids: number[]): Promise<void> {
|
||||
return http.Delete(`${JOB_BASE}/log/delete`, { ids: JSON.stringify(ids) })
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 类型定义 ==================== */
|
||||
|
||||
export interface SchedulerStatus {
|
||||
status?: string
|
||||
is_running?: boolean
|
||||
running: boolean
|
||||
job_count: number
|
||||
}
|
||||
|
||||
export interface SchedulerJob {
|
||||
id: string
|
||||
name: string
|
||||
status?: string
|
||||
next_run_time?: string
|
||||
trigger?: string
|
||||
func?: string
|
||||
args?: any[]
|
||||
}
|
||||
|
||||
export interface JobLogItem {
|
||||
id: number
|
||||
job_name?: string
|
||||
job_id?: string
|
||||
status?: string
|
||||
result?: string
|
||||
error_msg?: string
|
||||
start_time?: string
|
||||
end_time?: string
|
||||
created_time?: string
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 任务节点 API 模块(对应后端 `plugin.module_task.cronjob.node`)
|
||||
*/
|
||||
import { http } from '@/http'
|
||||
|
||||
const NODE_BASE = '/task/cronjob/node'
|
||||
|
||||
/* ==================== 任务节点 ==================== */
|
||||
export const NodeAPI = {
|
||||
/** 获取节点列表(选项) */
|
||||
getOptions(): Promise<NodeOption[]> {
|
||||
return http.Get(`${NODE_BASE}/options`)
|
||||
},
|
||||
/** 获取节点详情 */
|
||||
getDetail(id: number): Promise<NodeItem> {
|
||||
return http.Get(`${NODE_BASE}/detail/${id}`)
|
||||
},
|
||||
/** 节点分页列表 */
|
||||
getPage(params?: Record<string, any>): Promise<PageResult<NodeItem>> {
|
||||
return http.Get(`${NODE_BASE}/list`, params)
|
||||
},
|
||||
/** 创建节点 */
|
||||
create(data: NodeForm): Promise<NodeItem> {
|
||||
return http.Post(`${NODE_BASE}/create`, data)
|
||||
},
|
||||
/** 修改节点 */
|
||||
update(id: number, data: NodeForm): Promise<NodeItem> {
|
||||
return http.Put(`${NODE_BASE}/update/${id}`, data)
|
||||
},
|
||||
/** 删除节点 */
|
||||
remove(ids: number[]): Promise<void> {
|
||||
return http.Delete(`${NODE_BASE}/delete`, { ids: JSON.stringify(ids) })
|
||||
},
|
||||
/** 清空节点 */
|
||||
clear(_id?: number): Promise<void> {
|
||||
return http.Delete(`${NODE_BASE}/clear`)
|
||||
},
|
||||
/** 调试节点 */
|
||||
execute(id: number): Promise<unknown> {
|
||||
return http.Post(`${NODE_BASE}/execute/${id}`)
|
||||
},
|
||||
/** 批量设置节点状态 */
|
||||
batchStatus(data: { ids: number[], status: number }): Promise<void> {
|
||||
return http.Patch(`${NODE_BASE}/status/batch`, data)
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 类型定义 ==================== */
|
||||
|
||||
export interface NodeOption {
|
||||
value: number
|
||||
label: string
|
||||
path: string
|
||||
}
|
||||
|
||||
export interface NodeForm {
|
||||
name: string
|
||||
host: string
|
||||
port: number
|
||||
type: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface NodeItem extends NodeForm {
|
||||
id: number
|
||||
status?: string
|
||||
task_count?: number
|
||||
created_time?: string
|
||||
updated_time?: string
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* 工作流流程 API 模块(对应后端 `plugin.module_task.workflow.flow`)
|
||||
* 与 web 端 module_task/workflow/flow.ts 对齐(完整字段定义)
|
||||
*/
|
||||
import { http } from '@/http'
|
||||
|
||||
const FLOW_BASE = '/task/workflow/flow'
|
||||
|
||||
/* ==================== 流程编排 ==================== */
|
||||
export const WorkflowAPI = {
|
||||
/** 工作流详情 */
|
||||
getDetail(id: number): Promise<WorkflowItem> {
|
||||
return http.Get(`${FLOW_BASE}/detail/${id}`)
|
||||
},
|
||||
/** 工作流列表 */
|
||||
getPage(params?: Record<string, any>): Promise<PageResult<WorkflowItem>> {
|
||||
return http.Get(`${FLOW_BASE}/list`, params)
|
||||
},
|
||||
/** 创建工作流 */
|
||||
create(data: WorkflowForm): Promise<WorkflowItem> {
|
||||
return http.Post(`${FLOW_BASE}/create`, data)
|
||||
},
|
||||
/** 更新工作流 */
|
||||
update(id: number, data: WorkflowForm): Promise<WorkflowItem> {
|
||||
return http.Put(`${FLOW_BASE}/update/${id}`, data)
|
||||
},
|
||||
/** 删除工作流 */
|
||||
remove(ids: number[]): Promise<void> {
|
||||
return http.Delete(`${FLOW_BASE}/delete`, { ids: JSON.stringify(ids) })
|
||||
},
|
||||
/** 发布工作流 */
|
||||
publish(id: number): Promise<void> {
|
||||
return http.Post(`${FLOW_BASE}/publish/${id}`)
|
||||
},
|
||||
/** 执行工作流 */
|
||||
execute(data: WorkflowExecuteForm): Promise<WorkflowExecuteResult> {
|
||||
return http.Post(`${FLOW_BASE}/execute`, data)
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 类型定义 ==================== */
|
||||
|
||||
export interface WorkflowPageQuery extends PageQuery {
|
||||
name?: string
|
||||
code?: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
export interface WorkflowForm {
|
||||
name: string
|
||||
description?: string
|
||||
nodes?: WorkflowNode[]
|
||||
edges?: WorkflowEdge[]
|
||||
}
|
||||
|
||||
export interface WorkflowItem extends WorkflowForm {
|
||||
id: number
|
||||
status?: string
|
||||
version?: number
|
||||
created_time?: string
|
||||
updated_time?: string
|
||||
}
|
||||
|
||||
export interface WorkflowPublishForm {
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface WorkflowExecuteForm {
|
||||
workflow_id: number
|
||||
variables?: Record<string, any>
|
||||
business_key?: string
|
||||
job_id?: number
|
||||
}
|
||||
|
||||
export interface WorkflowExecuteResult {
|
||||
workflow_id: number
|
||||
workflow_name: string
|
||||
status: number
|
||||
start_time?: string
|
||||
end_time?: string
|
||||
variables?: Record<string, any>
|
||||
node_results?: Record<string, any>
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface WorkflowNode {
|
||||
id?: string
|
||||
type: string
|
||||
label?: string
|
||||
position?: { x: number, y: number }
|
||||
data?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface WorkflowEdge {
|
||||
id?: string
|
||||
source: string
|
||||
target: string
|
||||
label?: string
|
||||
condition?: string
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 工作流节点类型 API 模块(对应后端 `plugin.module_task.workflow.nodes`)
|
||||
*/
|
||||
import { http } from '@/http'
|
||||
|
||||
const NODES_BASE = '/task/workflow/nodes'
|
||||
|
||||
/* ==================== 工作流节点类型 ==================== */
|
||||
export const WorkflowNodeTypeAPI = {
|
||||
/** 节点选项 */
|
||||
getOptions(): Promise<WorkflowNodeTypeOption[]> {
|
||||
return http.Get(`${NODES_BASE}/options`)
|
||||
},
|
||||
/** 节点详情 */
|
||||
getDetail(id: number): Promise<WorkflowNodeTypeItem> {
|
||||
return http.Get(`${NODES_BASE}/detail/${id}`)
|
||||
},
|
||||
/** 节点列表 */
|
||||
getPage(params?: Record<string, any>): Promise<PageResult<WorkflowNodeTypeItem>> {
|
||||
return http.Get(`${NODES_BASE}/list`, params)
|
||||
},
|
||||
/** 创建节点 */
|
||||
create(data: WorkflowNodeTypeForm): Promise<WorkflowNodeTypeItem> {
|
||||
return http.Post(`${NODES_BASE}/create`, data)
|
||||
},
|
||||
/** 更新节点 */
|
||||
update(id: number, data: WorkflowNodeTypeForm): Promise<WorkflowNodeTypeItem> {
|
||||
return http.Put(`${NODES_BASE}/update/${id}`, data)
|
||||
},
|
||||
/** 删除节点 */
|
||||
remove(ids: number[]): Promise<void> {
|
||||
return http.Delete(`${NODES_BASE}/delete`, { ids: JSON.stringify(ids) })
|
||||
},
|
||||
/** 节点选择列表 */
|
||||
getSelect(): Promise<WorkflowNodeTypeOption[]> {
|
||||
return http.Get(`${NODES_BASE}/select`)
|
||||
},
|
||||
}
|
||||
|
||||
/* ==================== 类型定义 ==================== */
|
||||
|
||||
export interface WorkflowNodeTypeOption {
|
||||
value: number
|
||||
label: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export interface WorkflowNodeTypeForm {
|
||||
name: string
|
||||
type: string
|
||||
handler_path?: string
|
||||
params_schema?: Record<string, any>
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface WorkflowNodeTypeItem extends WorkflowNodeTypeForm {
|
||||
id: number
|
||||
created_time?: string
|
||||
updated_time?: string
|
||||
}
|
||||
Reference in New Issue
Block a user