diff --git a/.env b/.env index cdf208a..84a2446 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ VITE_APP_TITLE=Snail Job VITE_APP_DESC=A flexible, reliable, and fast platform for distributed task retry and distributed task scheduling. -VITE_APP_VERSION=1.2.0-beta2 +VITE_APP_VERSION=1.2.0 VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj diff --git a/src/components/common/job-task-list-table.vue b/src/components/common/job-task-list-table.vue index a52753b..1a66ea6 100644 --- a/src/components/common/job-task-list-table.vue +++ b/src/components/common/job-task-list-table.vue @@ -4,6 +4,7 @@ import { NButton, NCode, NTag } from 'naive-ui'; import hljs from 'highlight.js/lib/core'; import json from 'highlight.js/lib/languages/json'; import { ref, render } from 'vue'; +import dayjs from 'dayjs'; import { taskStatusRecord, taskStatusRecordOptions } from '@/constants/business'; import { $t } from '@/locales'; import { isNotNull, parseArgsJson, translateOptions } from '@/utils/common'; @@ -251,6 +252,18 @@ const { columns, searchParams, columnChecks, data, getData, loading, mobilePagin title: $t('page.jobBatch.jobTask.createDt'), align: 'left', minWidth: 130 + }, + { + key: 'duration', + title: $t('page.jobBatch.duration'), + align: 'center', + width: 120, + render: row => { + if (row.taskStatus === 3) { + return Math.round(dayjs(row.updateDt).diff(dayjs(row.createDt)) / 1000); + } + return null; + } } ] }); diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts index 3e86d38..3544cfd 100644 --- a/src/hooks/common/table.ts +++ b/src/hooks/common/table.ts @@ -245,6 +245,15 @@ export function useTableOperate(data: Ref, openDrawer(); } + function handleCopy(id: T['id']) { + operateType.value = 'add'; + const findItem = data.value.find(item => item.id === id) || null; + editingData.value = jsonClone(findItem); + delete editingData.value?.id; + + openDrawer(); + } + /** the checked row keys of table */ const checkedRowKeys = ref([]); @@ -272,6 +281,7 @@ export function useTableOperate(data: Ref, handleAdd, editingData, handleEdit, + handleCopy, checkedRowKeys, onBatchDeleted, onDeleted diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index a674f68..91db826 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -1073,6 +1073,8 @@ declare namespace Api { children: JobTaskTree[]; /** 是否存在下级 */ isLeaf: boolean; + /** 执行时长(virtual) */ + duration?: number; }>; type JobTaskTree = { diff --git a/src/views/group/modules/group-operate-drawer.vue b/src/views/group/modules/group-operate-drawer.vue index 4b6c085..662d698 100644 --- a/src/views/group/modules/group-operate-drawer.vue +++ b/src/views/group/modules/group-operate-drawer.vue @@ -1,5 +1,6 @@