feat: 任务执行日志

This commit is contained in:
zhanghao 2026-06-05 17:18:47 +08:00
parent 64d6cad887
commit 780665fa9a
2 changed files with 19 additions and 3 deletions

View File

@ -98,7 +98,7 @@
<el-table-column align="center" class-name="small-padding fixed-width" label="操作"
width="260">
<template #default="scope">
<el-button icon="Edit" link type="primary" @click="handleUpdate(scope.row)">
<el-button icon="Edit" link type="primary" @click="handleOpenLog(scope.row)">
日志
</el-button>
</template>
@ -136,6 +136,10 @@
</div>
</template>
</el-dialog>
<el-dialog title="任务执行日志" v-model="logDialogVisible" width="500px" append-to-body>
<taskLog :list="logDialogData" :height="300" />
</el-dialog>
</div>
</template>
<script setup>
@ -455,6 +459,15 @@ const subscribeDebounced = debounce(async (sub) => {
}
}, 300);
const logDialogVisible = ref(false)
const logDialogData = ref([])
const handleOpenLog = async (row) => {
logDialogVisible.value = true
const res = await getTaskLogListApi({ taskInstanceId: row.id })
if (res.code === 200) {
logDialogData.value = res.rows
}
}
onMounted(() => {
getTaskData();
getRobotData();

View File

@ -1,5 +1,5 @@
<template>
<div class="log-container" ref="messageContainer">
<div class="log-container" :style="{ 'height': height + 'px' }" ref="messageContainer">
<div class="log" v-for="log, index in list">
<div class="time">{{ formatDate(log.logTime) }}</div>
<div class="context">{{ log.logContent }}</div>
@ -13,6 +13,10 @@ const props = defineProps({
list: {
type: Array,
default: () => []
},
height: {
type: Number,
default: 150
}
})
@ -43,7 +47,6 @@ onMounted(() => {
<style lang="scss" scoped>
.log-container {
margin-top: 12px;
max-height: 150px;
overflow-y: auto;
background: #fff;
border: 1px solid #eee;