diff --git a/src/api/infra/job/index.ts b/src/api/infra/job/index.ts index 033b2cbe8..e312e8c68 100644 --- a/src/api/infra/job/index.ts +++ b/src/api/infra/job/index.ts @@ -61,3 +61,9 @@ export const runJob = (id: number) => { export const getJobNextTimes = (id: number) => { return request.get({ url: '/infra/job/get_next_times?id=' + id }) } + + +// 同步定时任务到 Quartz +export const syncJob = () => { + return request.post({ url: '/infra/job/sync' }) +} \ No newline at end of file diff --git a/src/views/infra/job/index.vue b/src/views/infra/job/index.vue index 29460030c..72f339beb 100644 --- a/src/views/infra/job/index.vue +++ b/src/views/infra/job/index.vue @@ -68,6 +68,9 @@ 执行日志 + + 同步任务 + @@ -174,6 +177,7 @@ const queryParams = reactive({ }) const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 +const syncLoading = ref(false) // 同步的加载中 /** 查询列表 */ const getList = async () => { @@ -214,6 +218,20 @@ const handleExport = async () => { } } +/** 同步任务到 Quartz */ +const handleSyncJob = async () => { + try { + await message.confirm('确认要同步所有任务到调度器?', t('common.reminder')) + syncLoading.value = true + await JobApi.syncJob() + message.success('同步成功') + await getList() + } catch { + } finally { + syncLoading.value = false + } +} + /** 添加/修改操作 */ const formRef = ref() const openForm = (type: string, id?: number) => {