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

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) {
return request('runJob', data)
},
// 运行定时任务
jobRunJobNow(data) {
return request('runJobNow', data)
},
// 获取定时任务类
jobGetActionClass(data) {
return request('getActionClass', data, 'get')

View File

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

View File

@ -64,6 +64,8 @@
</template>
<template v-if="column.dataIndex === 'action'">
<a-space>
<a @click="immediatelyRun(record)"></a>
<a-divider type="vertical" />
<a @click="form.onOpen(record)"></a>
<a-divider type="vertical" />
<a-popconfirm title="确定要删除此定时任务吗?" @confirm="deleteJob(record)">
@ -123,7 +125,7 @@
title: '操作',
dataIndex: 'action',
align: 'center',
width: '200px'
width: '220px'
}
]
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) => {
let params = [