自动化测试执行日志和操作日志功能

This commit is contained in:
liangdaliang
2025-04-24 16:33:06 +08:00
parent 814a7a39d2
commit 78cbb5aaaf
5 changed files with 99 additions and 105 deletions

View File

@@ -1,60 +1,44 @@
<template>
<div>
<div class="refresh">
<div class="refresh-icon">
<i class="el-icon-refresh"></i>
<span>刷新</span>
</div>
</div>
<!-- <div class="chart-container">-->
<!-- <div class="chart-instance">-->
<!-- <div>定时任务执行记录</div>-->
<!-- <lineChart />-->
<!-- <div class="refresh">-->
<!-- <div class="refresh-icon">-->
<!-- <i class="el-icon-refresh"></i>-->
<!-- <span>刷新</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="chart-container">-->
<!-- <div class="chart-instance">-->
<!-- <div>定时任务执行记录</div>-->
<!-- <lineChart />-->
<!-- </div>-->
<!-- </div>-->
<div class="table-content">
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="triggerTime" label="触发时间"> </el-table-column>
<el-table-column prop="startTime" label="开始时间"> </el-table-column>
<el-table-column prop="triggerMethod" label="触发方式">
<el-table-column prop="triggerType" label="触发方式" :formatter="row => ['','定时任务', '手动'][row.triggerType]">
</el-table-column>
<el-table-column prop="environment" label="执行环境"> </el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<div class="status-cell">
<span class="status-icon success"></span>
<span class="status-text">{{ scope.row.status }}</span>
</div>
</template>
<el-table-column prop="resultDesc" label="情况描述"> </el-table-column>
<el-table-column prop="status" label="状态" :formatter="row => ['','成功', '失败'][row.status]">
</el-table-column>
<el-table-column label="发送状态">
<template slot-scope="scope">
<div class="status-cell">
<span class="status-icon pending"></span>
<span class="status-text">{{ scope.row.sendStatus }}</span>
</div>
</template>
<el-table-column prop="sendStatus" label="发送状态" :formatter="row => ['未发送','已发送'][row.sendStatus]">
</el-table-column>
<el-table-column prop="executionTime" label="执行耗时">
</el-table-column>
<el-table-column fixed="right" label="操作">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
</template>
<el-table-column prop="costTime" label="执行耗时(毫秒)">
</el-table-column>
<!-- <el-table-column fixed="right" label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[100, 200, 300, 400]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="400"
>
</el-pagination>
<div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getData"
/>
</div>
</div>
</div>
@@ -62,25 +46,36 @@
<script>
import lineChart from "./lineChart.vue";
import {taskResultListByTaskId} from "@/api/test/task";
export default {
components: {
lineChart,
},
mounted() {
// 在这里进行数据预处理
this.getData();
},
data() {
return {
value: "",
tableData: [],
currentPage: 1,
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
},
};
},
methods: {
handleClick(row) {
this.$router.push({
name: "Report",
});
getData() {
this.tableData=[]
this.queryParams.id = this.$route.query.id;
taskResultListByTaskId(this.queryParams).then(res => {
this.tableData = res.rows;
this.total = res.total;
})
},
handleSizeChange() {},
handleCurrentChange() {},
},
};
</script>

View File

@@ -1,73 +1,71 @@
<template>
<div>
<!-- 时间选择组件 -->
<div class="filter-container">
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:default-value="['2025-02-16', '2025-02-19']"
>
</el-date-picker>
</div>
<!-- <div class="filter-container">-->
<!-- <el-date-picker-->
<!-- v-model="dateRange"-->
<!-- type="daterange"-->
<!-- range-separator=""-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- :default-value="['', '']"-->
<!-- >-->
<!-- </el-date-picker>-->
<!-- </div>-->
<!-- 表格 -->
<el-table :data="tableData" border style="width: 100%">
<el-table-column type="index" label="序号"> </el-table-column>
<el-table-column prop="operationTime" label="操作时间"> </el-table-column>
<el-table-column prop="operator" label="操作人"> </el-table-column>
<el-table-column>
<template #header>
<span>ID</span>
<i class="el-icon-warning-outline" style="margin-left: 10px"></i>
</template>
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
<el-tooltip content="ID提示信息" placement="top">
<i
class="el-icon-info"
style="margin-left: 6px; color: #909399"
></i>
</el-tooltip>
</template>
</el-table-column>
<el-table-column>
<template #header>
<span>名称</span>
<i class="el-icon-warning-outline" style="margin-left: 10px"></i>
</template>
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
<el-tooltip content="名称提示信息" placement="top">
<i
class="el-icon-info"
style="margin-left: 6px; color: #909399"
></i>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="operationType" label="操作类型"> </el-table-column>
<el-table-column prop="operTime" label="操作时间"> </el-table-column>
<el-table-column prop="operUser" label="操作人"> </el-table-column>
<el-table-column prop="operType" label="操作类型"> </el-table-column>
<el-table-column prop="operDetail" label="操作描述"> </el-table-column>
</el-table>
<div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getData"
/>
</div>
</div>
</template>
<script>
import {taskLogListByTaskId} from "@/api/test/task";
export default {
name: "operationRecords",
mounted() {
// 在这里进行数据预处理
// console.log(this.taskId);
this.getData();
},
data() {
return {
// 时间选择组件的默认值
dateRange: ["2025-02-16", "2025-02-19"],
dateRange: ["", ""],
// 表格数据(暂时为空)
value: "",
tableData: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
},
};
},
methods: {
handleClick(row) {
console.log(row);
getData() {
this.tableData=[]
this.queryParams.id = this.$route.query.id;
taskLogListByTaskId(this.queryParams).then(res => {
this.tableData = res.rows;
this.total = res.total;
})
},
},
};