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="操作" <el-table-column align="center" class-name="small-padding fixed-width" label="操作"
width="260"> width="260">
<template #default="scope"> <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> </el-button>
</template> </template>
@ -136,6 +136,10 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog title="任务执行日志" v-model="logDialogVisible" width="500px" append-to-body>
<taskLog :list="logDialogData" :height="300" />
</el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -455,6 +459,15 @@ const subscribeDebounced = debounce(async (sub) => {
} }
}, 300); }, 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(() => { onMounted(() => {
getTaskData(); getTaskData();
getRobotData(); getRobotData();

View File

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