提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<Dialog v-model="dialogVisible" title="任务详细" width="700px"> |
|
3 |
<el-descriptions :column="1" border> |
|
4 |
<el-descriptions-item label="任务编号" min-width="60"> |
|
5 |
{{ detailData.id }} |
|
6 |
</el-descriptions-item> |
|
7 |
<el-descriptions-item label="任务名称"> |
|
8 |
{{ detailData.name }} |
|
9 |
</el-descriptions-item> |
|
10 |
<el-descriptions-item label="任务名称"> |
|
11 |
<dict-tag :type="DICT_TYPE.INFRA_JOB_STATUS" :value="detailData.status" /> |
|
12 |
</el-descriptions-item> |
|
13 |
<el-descriptions-item label="处理器的名字"> |
|
14 |
{{ detailData.handlerName }} |
|
15 |
</el-descriptions-item> |
|
16 |
<el-descriptions-item label="处理器的参数"> |
|
17 |
{{ detailData.handlerParam }} |
|
18 |
</el-descriptions-item> |
|
19 |
<el-descriptions-item label="Cron 表达式"> |
|
20 |
{{ detailData.cronExpression }} |
|
21 |
</el-descriptions-item> |
|
22 |
<el-descriptions-item label="重试次数"> |
|
23 |
{{ detailData.retryCount }} |
|
24 |
</el-descriptions-item> |
|
25 |
<el-descriptions-item label="重试间隔"> |
|
26 |
{{ detailData.retryInterval + ' 毫秒' }} |
|
27 |
</el-descriptions-item> |
|
28 |
<el-descriptions-item label="监控超时时间"> |
|
29 |
{{ detailData.monitorTimeout > 0 ? detailData.monitorTimeout + ' 毫秒' : '未开启' }} |
|
30 |
</el-descriptions-item> |
|
31 |
<el-descriptions-item label="后续执行时间"> |
|
32 |
<el-timeline> |
|
33 |
<el-timeline-item |
|
34 |
v-for="(nextTime, index) in nextTimes" |
|
35 |
:key="index" |
|
36 |
:timestamp="formatDate(nextTime)" |
|
37 |
> |
|
38 |
第 {{ index + 1 }} 次 |
|
39 |
</el-timeline-item> |
|
40 |
</el-timeline> |
|
41 |
</el-descriptions-item> |
|
42 |
</el-descriptions> |
|
43 |
</Dialog> |
|
44 |
</template> |
|
45 |
<script lang="ts" setup> |
|
46 |
import { DICT_TYPE } from '@/utils/dict' |
|
47 |
import { formatDate } from '@/utils/formatTime' |
|
48 |
import * as JobApi from '@/api/infra/job' |
|
49 |
|
|
50 |
defineOptions({ name: 'InfraJobDetail' }) |
|
51 |
|
|
52 |
const dialogVisible = ref(false) // 弹窗的是否展示 |
|
53 |
const detailLoading = ref(false) // 表单的加载中 |
|
54 |
const detailData = ref({} as JobApi.JobVO) // 详情数据 |
|
55 |
const nextTimes = ref([]) // 下一轮执行时间的数组 |
|
56 |
|
|
57 |
/** 打开弹窗 */ |
|
58 |
const open = async (id: number) => { |
|
59 |
dialogVisible.value = true |
|
60 |
// 查看,设置数据 |
|
61 |
if (id) { |
|
62 |
detailLoading.value = true |
|
63 |
try { |
|
64 |
detailData.value = await JobApi.getJob(id) |
|
65 |
// 获取下一次执行时间 |
|
66 |
nextTimes.value = await JobApi.getJobNextTimes(id) |
|
67 |
} finally { |
|
68 |
detailLoading.value = false |
|
69 |
} |
|
70 |
} |
|
71 |
} |
|
72 |
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
73 |
</script> |