chore: 修复日志滚动问题

This commit is contained in:
秋帆
2024-08-03 20:38:30 +08:00
parent d7fc693650
commit edadea91ed

View File

@@ -1,7 +1,7 @@
<template> <template>
<a-modal v-model:visible="visible" title="任务日志详情" :width="width >= 1500 ? 1500 : '100%'" :footer="false" <a-modal v-model:visible="visible" title="任务日志详情" :width="width >= 1500 ? 1500 : '100%'" :footer="false"
@close="closed"> @close="closed">
<div style="display: flex; min-height: 600px;"> <div style="display: flex; min-height: 600px;max-height: 800px;">
<div style="padding: 10px 10px;"> <div style="padding: 10px 10px;">
<div class="job_list"> <div class="job_list">
<div :class="`job_list_item ${item.id === activeId ? 'active' : ''}`" v-for="item in dataList" :key="item.id" <div :class="`job_list_item ${item.id === activeId ? 'active' : ''}`" v-for="item in dataList" :key="item.id"
@@ -16,7 +16,7 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div class="code_view">
<GiCodeView :code-json="content" /> <GiCodeView :code-json="content" />
</div> </div>
</div> </div>
@@ -37,27 +37,33 @@ const activeId = ref<string | number>('')
const statusList = { const statusList = {
'1': { '1': {
title: '待处理', title: '待处理',
color: 'gray' color: 'gray',
isRun: false
}, },
'2': { '2': {
title: '运行中', title: '运行中',
color: 'cyan' color: 'cyan',
isRun: true
}, },
'3': { '3': {
title: '成功', title: '成功',
color: 'green' color: 'green',
isRun: false
}, },
'4': { '4': {
title: '已失败', title: '已失败',
color: 'red' color: 'red',
isRun: false
}, },
'5': { '5': {
title: '已停止', title: '已停止',
color: 'purple' color: 'purple',
isRun: false
}, },
'6': { '6': {
title: '已取消', title: '已取消',
color: 'orange' color: 'orange',
isRun: false
} }
} }
@@ -100,9 +106,16 @@ const onLogDetail = async (record: JobInstanceResp) => {
const onStartInfo = (record: JobInstanceResp) => { const onStartInfo = (record: JobInstanceResp) => {
content.value = '' content.value = ''
clearInterval(setIntervalNode.value) clearInterval(setIntervalNode.value)
setIntervalNode.value = setInterval(() => { let isRun = statusList[record.taskStatus].isRun
if (isRun) {
setIntervalNode.value = setInterval(() => {
onLogDetail(record)
}, 1000)
} else {
onLogDetail(record) onLogDetail(record)
}, 1000) }
} }
// 查询列表数据 // 查询列表数据
const getInstanceList = async (query: JobInstanceQuery = { ...queryForm }) => { const getInstanceList = async (query: JobInstanceQuery = { ...queryForm }) => {
@@ -158,4 +171,9 @@ defineExpose({ onDetail })
background-color: var(--color-neutral-3) !important; background-color: var(--color-neutral-3) !important;
} }
} }
.code_view {
position: relative;
overflow: auto;
}
</style> </style>