|
|
@ -1,38 +1,43 @@ |
|
|
|
<template> |
|
|
|
<el-dialog :visible.sync="visible" width="80%" top="5vh" append-to-body> |
|
|
|
<div style="display: flex; flex-direction: column; gap: 10px;"> |
|
|
|
<el-dialog v-model="visible" width="80%" top="5vh" append-to-body> |
|
|
|
|
|
|
|
<div style="display: flex; flex-direction: column; gap: 10px;"> |
|
|
|
<!-- 第一部分:实例表格(带分页) --> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<div slot="header" class="clearfix"> |
|
|
|
<span>实例列表</span> |
|
|
|
</div> |
|
|
|
<template v-slot:header> |
|
|
|
<div class="clearfix"> |
|
|
|
<span>实例列表</span> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="instances" |
|
|
|
border |
|
|
|
style="width: 100%" |
|
|
|
@row-click="handleFirstRowClick" |
|
|
|
:height="350" |
|
|
|
:height="350" |
|
|
|
> |
|
|
|
<el-table-column prop="id" label="实例ID" width="100" /> |
|
|
|
<el-table-column prop="name" label="实例名称" /> |
|
|
|
<el-table-column prop="state" label="状态" width="100" > |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-table-column prop="state" label="状态" width="100"> |
|
|
|
<template v-slot:default="scope"> |
|
|
|
<dict-tag |
|
|
|
:options="dict.type.meta_instance_status" |
|
|
|
:options="meta_instance_status" |
|
|
|
:value="scope.row.state" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> <el-table-column prop="startTime" label="开始时间" width="200" /> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="startTime" label="开始时间" width="200" /> |
|
|
|
<el-table-column prop="endTime" label="结束时间" width="200" /> |
|
|
|
<el-table-column prop="duration" label="运行时长" width="80" /> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
background |
|
|
|
layout="prev, pager, next" |
|
|
|
:total="total" |
|
|
|
:page-size="pageSize" |
|
|
|
:current-page.sync="currentPage" |
|
|
|
:current-page="currentPage" |
|
|
|
@current-change="fetchInstances" |
|
|
|
style="margin-top: 10px; text-align: right;" |
|
|
|
/> |
|
|
@ -40,34 +45,39 @@ |
|
|
|
|
|
|
|
<!-- 第二部分:任务节点表格 --> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<div slot="header" class="clearfix"> |
|
|
|
<span>任务节点</span> |
|
|
|
</div> |
|
|
|
<template v-slot:header> |
|
|
|
<div class="clearfix"> |
|
|
|
<span>任务节点</span> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="taskNodes" |
|
|
|
:data="taskNodesData" |
|
|
|
border |
|
|
|
style="width: 100%" |
|
|
|
@row-click="handleSecondRowClick" |
|
|
|
:height="300" |
|
|
|
:height="300" |
|
|
|
> |
|
|
|
<el-table-column prop="name" label="节点名称"/> |
|
|
|
<el-table-column prop="name" label="节点名称" /> |
|
|
|
<el-table-column prop="taskType" label="任务类型" /> |
|
|
|
<el-table-column prop="state" label="状态" width="100" > |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-table-column prop="state" label="状态" width="100"> |
|
|
|
<template v-slot:default="scope"> |
|
|
|
<dict-tag |
|
|
|
:options="dict.type.meta_instance_status" |
|
|
|
:options="meta_instance_status" |
|
|
|
:value="scope.row.state" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<!-- 第三部分:日志内容 --> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<div slot="header" class="clearfix"> |
|
|
|
<span>日志详情</span> |
|
|
|
</div> |
|
|
|
<template v-slot:header> |
|
|
|
<div class="clearfix"> |
|
|
|
<span>日志详情</span> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
v-model="logDetailsContent" |
|
|
@ -81,53 +91,61 @@ |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup> |
|
|
|
import { listInstances, taskNodes, logDetails } from "@/api/meta/metatask"; |
|
|
|
import { ref } from "vue"; |
|
|
|
const { proxy } = getCurrentInstance(); |
|
|
|
const { meta_instance_status} = proxy.useDict("meta_instance_status"); |
|
|
|
// Define props |
|
|
|
const props = defineProps({ |
|
|
|
defindName: String, // Assuming defindName is a string, you can adjust based on actual type |
|
|
|
}); |
|
|
|
|
|
|
|
export default { |
|
|
|
props: ["defindName"], |
|
|
|
dicts:["meta_instance_status"], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
visible: false, // 弹窗显示状态 |
|
|
|
instances: [], // 第一个表格数据 |
|
|
|
total: 0, // 数据总数,用于分页 |
|
|
|
pageSize: 10, // 每页条数 |
|
|
|
currentPage: 1, // 当前页码 |
|
|
|
taskNodes: [], // 第二个表格数据 |
|
|
|
logDetailsContent: "", // 第三部分的日志内容 |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 显示弹窗并加载实例数据 |
|
|
|
show(defindName) { |
|
|
|
this.visible = true; |
|
|
|
this.fetchInstances(defindName); |
|
|
|
}, |
|
|
|
// 获取第一个表格数据 |
|
|
|
fetchInstances(defindName) { |
|
|
|
listInstances({ page_num: this.currentPage, page_size: this.pageSize, searchVal: defindName }).then((response) => { |
|
|
|
console.log(response, "response"); |
|
|
|
this.instances = response.rows; |
|
|
|
this.total = response.total; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 点击第一个表格行获取任务节点数据 |
|
|
|
handleFirstRowClick(row) { |
|
|
|
taskNodes(row.id).then((response) => { |
|
|
|
this.taskNodes = response.rows; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 点击第二个表格行获取日志详情 |
|
|
|
handleSecondRowClick(row) { |
|
|
|
logDetails(row.id).then((response) => { |
|
|
|
this.logDetailsContent = response.data; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// Define reactive state |
|
|
|
const visible = ref(false); //弹窗显示状态 |
|
|
|
const instances = ref([]); // 第一个表格数据 |
|
|
|
const total = ref(0); // 数据总数,用于分页 |
|
|
|
const pageSize = ref(10); // 每页条数 |
|
|
|
const currentPage = ref(1); // 当前页码 |
|
|
|
const taskNodesData = ref([]); // 第二个表格数据 |
|
|
|
const logDetailsContent = ref(""); // 第三部分的日志内容 |
|
|
|
|
|
|
|
defineExpose({ |
|
|
|
show(name) { |
|
|
|
visible.value = true; |
|
|
|
console.log(visible.value,name, "visible"); |
|
|
|
fetchInstances(name); |
|
|
|
}, |
|
|
|
}); |
|
|
|
// Fetch first table data |
|
|
|
const fetchInstances = (defindName) => { |
|
|
|
listInstances({ |
|
|
|
page_num: currentPage.value, |
|
|
|
page_size: pageSize.value, |
|
|
|
searchVal: defindName, |
|
|
|
}).then((response) => { |
|
|
|
console.log(response, "response"); |
|
|
|
instances.value = response.rows; |
|
|
|
total.value = response.total; |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// Handle row click in the first table and fetch task node data |
|
|
|
const handleFirstRowClick = (row) => { |
|
|
|
taskNodes(row.id).then((response) => { |
|
|
|
taskNodesData.value = response.rows; |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// Handle row click in the second table and fetch log details |
|
|
|
const handleSecondRowClick = (row) => { |
|
|
|
logDetails(row.id).then((response) => { |
|
|
|
logDetailsContent.value = response.data; |
|
|
|
}); |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
/* 添加全局间距和样式优化 */ |
|
|
|
.el-card { |
|
|
@ -137,4 +155,4 @@ export default { |
|
|
|
font-weight: bold; |
|
|
|
font-size: 17px; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|