feat: 调度任务支持是否进行日志记录

This commit is contained in:
TsMask
2023-10-23 18:17:46 +08:00
parent 49c12f1723
commit a5a2d68e0f

View File

@@ -32,9 +32,12 @@ let dict: {
sysJobGroup: DictType[];
/**任务状态 */
sysJobStatus: DictType[];
/**任务记录日志 */
sysJobSaveLog: DictType[];
} = reactive({
sysJobGroup: [],
sysJobStatus: [],
sysJobSaveLog: [],
});
/**查询参数 */
@@ -125,6 +128,12 @@ let tableColumns: ColumnsType = [
key: 'status',
align: 'center',
},
{
title: '记录日志',
dataIndex: 'saveLog',
key: 'saveLog',
align: 'center',
},
{
title: '操作',
key: 'jobId',
@@ -205,6 +214,7 @@ let modalState: ModalStateType = reactive({
concurrent: '0',
jobGroup: 'DEFAULT',
status: '0',
saveLog: '0',
targetParams: '',
remark: '',
},
@@ -537,6 +547,7 @@ onMounted(() => {
Promise.allSettled([
getDict('sys_job_group'),
getDict('sys_job_status'),
getDict('sys_job_save_log'),
]).then(resArr => {
if (resArr[0].status === 'fulfilled') {
dict.sysJobGroup = resArr[0].value;
@@ -544,6 +555,9 @@ onMounted(() => {
if (resArr[1].status === 'fulfilled') {
dict.sysJobStatus = resArr[1].value;
}
if (resArr[2].status === 'fulfilled') {
dict.sysJobSaveLog = resArr[2].value;
}
});
// 获取列表数据
fnGetList();
@@ -745,6 +759,9 @@ onMounted(() => {
:value="record.status"
/>
</template>
<template v-if="column.key === 'saveLog'">
<DictTag :options="dict.sysJobSaveLog" :value="record.saveLog" />
</template>
<template v-if="column.key === 'jobId'">
<a-space :size="8" align="center">
<a-tooltip>
@@ -857,20 +874,27 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="cron表达式" name="cronExpression">
<a-tag color="default">{{
modalState.from.cronExpression
}}</a-tag>
<a-tag color="default">
{{ modalState.from.cronExpression }}
</a-tag>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="创建时间" name="createTime">
<span v-if="+modalState.from.createTime > 0">
{{ parseDateToStr(+modalState.from.createTime) }}
</span>
<a-form-item label="记录日志" name="status">
<DictTag
:options="dict.sysJobSaveLog"
:value="modalState.from.saveLog"
/>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="创建时间" name="createTime">
<span v-if="+modalState.from.createTime > 0">
{{ parseDateToStr(+modalState.from.createTime) }}
</span>
</a-form-item>
<a-form-item label="传入参数" name="targetParams">
{{ modalState.from.targetParams }}
</a-form-item>
@@ -990,40 +1014,55 @@ onMounted(() => {
</a-col>
</a-row>
<a-form-item
label="cron表达式"
name="cronExpression"
:label-col="{ span: 4 }"
v-bind="modalStateFrom.validateInfos.cronExpression"
>
<a-input
v-model:value="modalState.from.cronExpression"
allow-clear
placeholder="请输入或生成cron执行表达式"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
<div>
表达式示例0/20 * * * * ? <br />
示例说明每20秒执行任务
</div>
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
<template #addonAfter>
<a-button
type="text"
size="small"
@click.prevent="fnModalCron(true)"
<a-row :gutter="16">
<a-col :lg="18" :md="18" :xs="24">
<a-form-item
label="cron表达式"
name="cronExpression"
:label-col="{ span: 4 }"
v-bind="modalStateFrom.validateInfos.cronExpression"
>
<a-input
v-model:value="modalState.from.cronExpression"
allow-clear
placeholder="请输入或生成cron执行表达式"
>
<template #icon><FieldTimeOutlined /></template>
生成表达式
</a-button>
</template>
</a-input>
</a-form-item>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
<div>
表达式示例0/20 * * * * ? <br />
示例说明每20秒执行任务
</div>
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
<template #addonAfter>
<a-button
type="text"
size="small"
@click.prevent="fnModalCron(true)"
>
<template #icon><FieldTimeOutlined /></template>
生成表达式
</a-button>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="记录日志" name="saveLog">
<a-select
v-model:value="modalState.from.saveLog"
default-value="0"
placeholder="记录日志"
:options="dict.sysJobSaveLog"
>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="传入参数"