feat(sj_1.0.0): 定时任务,任务项列表缺少任务状态

This commit is contained in:
opensnail 2024-05-21 17:46:19 +08:00
parent d62df9c417
commit 00705e1ead
6 changed files with 78 additions and 3 deletions

View File

@ -213,6 +213,15 @@ export const taskBatchStatusRecord: Record<Api.Common.TaskBatchStatus, App.I18n.
};
export const taskBatchStatusRecordOptions = transformRecordToNumberOption(taskBatchStatusRecord);
export const taskStatusRecord: Record<Api.Common.TaskStatus, App.I18n.I18nKey> = {
2: 'common.taskStatus.items.running',
3: 'common.taskStatus.items.success',
4: 'common.taskStatus.items.fail',
5: 'common.taskStatus.items.stop',
6: 'common.taskStatus.items.cancel'
};
export const taskStatusRecordOptions = transformRecordToNumberOption(taskStatusRecord);
export const operationReasonRecord: Record<Api.Common.OperationReason, App.I18n.I18nKey> = {
0: 'common.jobOperationReason.items.none',
1: 'common.jobOperationReason.items.taskExecutionTimeout',

View File

@ -133,6 +133,17 @@ const local: App.I18n.Schema = {
cancel: 'Cancel'
}
},
taskStatus: {
label: 'Task status',
form: 'Please enter task status',
items: {
running: 'Running',
success: 'Success',
fail: 'Fail',
stop: 'Stop',
cancel: 'Cancel'
}
},
jobOperationReason: {
label: 'Job operation reason',
form: 'Please enter job operation reason',
@ -1003,6 +1014,7 @@ const local: App.I18n.Schema = {
title: 'Job task list',
id: 'ID',
groupName: 'Group name',
taskStatus: 'Status',
clientInfo: 'Client address',
argsStr: 'Argument string',
resultMessage: 'Result message',

View File

@ -133,6 +133,17 @@ const local: App.I18n.Schema = {
cancel: '取消'
}
},
taskStatus: {
label: '状态',
form: '请选择状态',
items: {
running: '运行中',
success: '处理成功',
fail: '处理失败',
stop: '任务停止',
cancel: '取消'
}
},
jobOperationReason: {
label: '操作原因',
form: '请选择执行状态',
@ -1010,6 +1021,7 @@ const local: App.I18n.Schema = {
title: 'JobTask 列表',
id: 'ID',
groupName: '组名称',
taskStatus: '状态',
clientInfo: '地址',
argsStr: '参数',
resultMessage: '结果',

View File

@ -88,6 +88,9 @@ declare namespace Api {
/** 1、待处理 2、运行中 3、成功 4、失败 5、停止 6、取消 */
type TaskBatchStatus = 1 | 2 | 3 | 4 | 5 | 6;
/** 2、处理中 3、处理成功 4、处理失败、5、任务停止 6、取消 */
type TaskStatus = 2 | 3 | 4 | 5 | 6;
/**
* 1 2 3JOB已关闭 4 5 6 7 8 9 10 11 12
* 13 14
@ -995,6 +998,8 @@ declare namespace Api {
createDt: string;
/** 任务批次 ID */
taskBatchId: string;
/** 任务状态 ID */
taskStatus: Common.TaskStatus;
}>;
/** jobTask search params */

12
src/typings/app.d.ts vendored
View File

@ -383,6 +383,17 @@ declare namespace App {
cancel: string;
};
};
taskStatus: {
label: string;
form: string;
items: {
running: string;
success: string;
fail: string;
stop: string;
cancel: string;
};
};
jobOperationReason: {
label: string;
form: string;
@ -1149,6 +1160,7 @@ declare namespace App {
title: string;
id: string;
groupName: string;
taskStatus: string;
clientInfo: string;
argsStr: string;
resultMessage: string;

View File

@ -1,9 +1,13 @@
<script setup lang="tsx">
import { NButton } from 'naive-ui';
import { NButton, NTag } from 'naive-ui';
import { onBeforeUnmount, ref } from 'vue';
import { executorTypeRecord, operationReasonRecord, taskBatchStatusRecord } from '@/constants/business';
import {
executorTypeRecord,
operationReasonRecord,
taskBatchStatusRecord,
taskStatusRecord
} from '@/constants/business';
import { $t } from '@/locales';
// import { fetchGetJobBatchDetail } from '@/service/api';
import { tagColor } from '@/utils/common';
import { useTable } from '@/hooks/common/table';
import { fetchGetJobTaskList } from '@/service/api';
@ -71,6 +75,27 @@ const { columns, data, loading, mobilePagination } = useTable({
align: 'left',
minWidth: 120
},
{
key: 'taskStatus',
title: $t('page.jobBatch.jobTask.taskStatus'),
align: 'left',
minWidth: 80,
render: row => {
if (row.taskStatus === null) {
return null;
}
const label = $t(taskStatusRecord[row.taskStatus!]);
const tagMap: Record<number, NaiveUI.ThemeColor> = {
1: 'info',
2: 'info',
3: 'info',
4: 'error',
5: 'error',
6: 'error'
};
return <NTag type={tagMap[row.taskStatus!]}>{label}</NTag>;
}
},
{
key: 'clientInfo',
title: $t('page.jobBatch.jobTask.clientInfo'),