Skip to content

Commit

Permalink
chore: 修复日志滚动问题
Browse files Browse the repository at this point in the history
  • Loading branch information
han201379873 committed Aug 3, 2024
1 parent d7fc693 commit edadea9
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/views/schedule/log/LogDetailModal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<a-modal v-model:visible="visible" title="任务日志详情" :width="width >= 1500 ? 1500 : '100%'" :footer="false"
@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 class="job_list">
<div :class="`job_list_item ${item.id === activeId ? 'active' : ''}`" v-for="item in dataList" :key="item.id"
Expand All @@ -16,7 +16,7 @@
</div>
</div>
</div>
<div>
<div class="code_view">
<GiCodeView :code-json="content" />
</div>
</div>
Expand All @@ -37,27 +37,33 @@ const activeId = ref<string | number>('')
const statusList = {
'1': {
title: '待处理',
color: 'gray'
color: 'gray',
isRun: false
},
'2': {
title: '运行中',
color: 'cyan'
color: 'cyan',
isRun: true
},
'3': {
title: '成功',
color: 'green'
color: 'green',
isRun: false
},
'4': {
title: '已失败',
color: 'red'
color: 'red',
isRun: false
},
'5': {
title: '已停止',
color: 'purple'
color: 'purple',
isRun: false
},
'6': {
title: '已取消',
color: 'orange'
color: 'orange',
isRun: false
}
}
Expand Down Expand Up @@ -100,9 +106,16 @@ const onLogDetail = async (record: JobInstanceResp) => {
const onStartInfo = (record: JobInstanceResp) => {
content.value = ''
clearInterval(setIntervalNode.value)
setIntervalNode.value = setInterval(() => {
let isRun = statusList[record.taskStatus].isRun
if (isRun) {
setIntervalNode.value = setInterval(() => {
onLogDetail(record)
}, 1000)
} else {
onLogDetail(record)
}, 1000)
}
}
// 查询列表数据
const getInstanceList = async (query: JobInstanceQuery = { ...queryForm }) => {
Expand Down Expand Up @@ -158,4 +171,9 @@ defineExpose({ onDetail })
background-color: var(--color-neutral-3) !important;
}
}
.code_view {
position: relative;
overflow: auto;
}
</style>

0 comments on commit edadea9

Please sign in to comment.