This commit is contained in:
jxxghp
2023-09-24 12:26:42 +08:00
parent 0c9c70b067
commit 5424e7e02a
+12 -10
View File
@@ -29,6 +29,8 @@ function getSchedulerColor(status: string) {
switch (status) { switch (status) {
case '正在运行': case '正在运行':
return 'success' return 'success'
case '已停止':
return 'error'
case '等待': case '等待':
return '' return ''
default: default:
@@ -37,22 +39,21 @@ function getSchedulerColor(status: string) {
} }
// 执行命令 // 执行命令
async function runCommand(id: string) { function runCommand(id: string) {
// 取id|前面的命令 // 取id|前面的命令
id = `/${id.split('|')[0]}` id = id.split('|')[0]
try { try {
const result: { [key: string]: any } = await api.get('system/command', { // 异步提交
api.get('system/runscheduler', {
params: { params: {
cmd: id, jobid: id,
}, },
}) })
if (result.success) { $toast.success('定时作业执行请求提交成功!')
$toast.success('执行请求提交成功!') // 1秒后刷新数据
setTimeout(() => {
loadSchedulerList() loadSchedulerList()
} }, 1000)
else {
$toast.error(`执行请求提交失败:${result.message}`)
}
} }
catch (e) { catch (e) {
console.log(e) console.log(e)
@@ -115,6 +116,7 @@ onUnmounted(() => {
<td> <td>
<VBtn <VBtn
small small
:disabled="scheduler.status === '正在运行'"
@click="runCommand(scheduler.id)" @click="runCommand(scheduler.id)"
> >
<template #prepend> <template #prepend>