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