【更新】完成定时任务前端立即运行功能

pull/89/MERGE
小诺 2023-03-11 23:55:43 +08:00 committed by 俞宝山
parent 0b0d7e7cfd
commit d13dfb0043
3 changed files with 28 additions and 15 deletions

View File

@ -46,6 +46,10 @@ export default {
jobRunJob(data) { jobRunJob(data) {
return request('runJob', data) return request('runJob', data)
}, },
// 运行定时任务
jobRunJobNow(data) {
return request('runJobNow', data)
},
// 获取定时任务类 // 获取定时任务类
jobGetActionClass(data) { jobGetActionClass(data) {
return request('getActionClass', data, 'get') return request('getActionClass', data, 'get')

View File

@ -84,20 +84,18 @@
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value.validate().then(() => {
.validate() submitLoading.value = true
.then(() => { jobApi
submitLoading.value = true .submitForm(formData.value, !formData.value.id)
jobApi .then(() => {
.submitForm(formData.value, !formData.value.id) onClose()
.then(() => { emit('successful')
onClose() })
emit('successful') .finally(() => {
}) submitLoading.value = false
.finally(() => { })
submitLoading.value = false })
})
})
} }
// //
const categoryOptions = tool.dictTypeList('JOB_CATEGORY').map((item) => { const categoryOptions = tool.dictTypeList('JOB_CATEGORY').map((item) => {

View File

@ -64,6 +64,8 @@
</template> </template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<a-space> <a-space>
<a @click="immediatelyRun(record)"></a>
<a-divider type="vertical" />
<a @click="form.onOpen(record)"></a> <a @click="form.onOpen(record)"></a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm title="确定要删除此定时任务吗?" @confirm="deleteJob(record)"> <a-popconfirm title="确定要删除此定时任务吗?" @confirm="deleteJob(record)">
@ -123,7 +125,7 @@
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
align: 'center', align: 'center',
width: '200px' width: '220px'
} }
] ]
let selectedRowKeys = ref([]) let selectedRowKeys = ref([])
@ -169,6 +171,15 @@
}) })
} }
} }
//
const immediatelyRun = (record) => {
const params = {
id: record.id
}
jobApi.jobRunJobNow(params).then(() => {
table.value.refresh(true)
})
}
// //
const deleteJob = (record) => { const deleteJob = (record) => {
let params = [ let params = [