Merge pull request #229 from HmEJ/patch-1

feat(infra): 定时任务添加同步按钮
master^2
芋道源码 2026-06-14 01:06:25 +08:00 committed by GitHub
commit 827665dd50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View File

@ -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' })
}

View File

@ -68,6 +68,9 @@
<el-button type="info" plain @click="handleJobLog()" v-hasPermi="['infra:job:query']">
<Icon icon="ep:zoom-in" class="mr-5px" /> 执行日志
</el-button>
<el-button type="warning" plain @click="handleSyncJob()" :loading="syncLoading">
<Icon icon="ep:refresh" class="mr-5px" /> 同步任务
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
@ -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) => {