feat(测试跟踪): 测试跟踪-报告 列表表头增加运行耗时和成功率字段显示

--story=1004747 --user=周骏弘 【国信证券】测试跟踪-报告表头增加运行耗时列和成功率 https://www.tapd.cn/55049933/s/1089868
This commit is contained in:
junhong 2022-01-11 16:03:01 +08:00 committed by john1298308460
parent 9f18193c95
commit 44b34b239f
7 changed files with 158 additions and 49 deletions

View File

@ -91,10 +91,12 @@
parameterType="io.metersphere.track.request.report.QueryTestPlanReportRequest"> parameterType="io.metersphere.track.request.report.QueryTestPlanReportRequest">
SELECT tpr.id AS id, tpr.`name` AS `name`, tp.`name` AS testPlanName, SELECT tpr.id AS id, tpr.`name` AS `name`, tp.`name` AS testPlanName,
IF(u.name is null,tpr.creator,u.name)AS creator, tpr.is_new, tpr.test_plan_id, IF(u.name is null,tpr.creator,u.name)AS creator, tpr.is_new, tpr.test_plan_id,
tpr.create_time AS createTime,tpr.trigger_mode AS triggerMode,tpr.status AS status tpr.create_time AS createTime,tpr.trigger_mode AS triggerMode,tpr.status AS status,
tpr.end_time AS endTime, (tpr.end_time - tpr.create_time) AS runTime, tprc.pass_rate AS passRate
FROM test_plan tp FROM test_plan tp
INNER JOIN test_plan_report tpr on tp.id = tpr.test_plan_id INNER JOIN test_plan_report tpr on tp.id = tpr.test_plan_id
LEFT JOIN user u on tpr.creator = u.id LEFT JOIN user u on tpr.creator = u.id
LEFT JOIN test_plan_report_content tprc on tpr.id = tprc.test_plan_report_id
<where> <where>
<if test="combine != null"> <if test="combine != null">
<include refid="combine"> <include refid="combine">
@ -123,8 +125,18 @@
tp.name ${order.type} tp.name ${order.type}
</if> </if>
<if test="order.name != 'test_plan_name'"> <if test="order.name != 'test_plan_name'">
<if test="order.name == 'run_time'">
runTime ${order.type}
</if>
<if test="order.name == 'pass_rate'">
passRate ${order.type}
</if>
<if test="order.name != 'run_time' and order.name != 'pass_rate'">
tpr.${order.name} ${order.type} tpr.${order.name} ${order.type}
</if> </if>
</if>
</foreach> </foreach>
</if> </if>
</select> </select>

View File

@ -35,4 +35,7 @@ public class TestPlanReportDTO {
private Long startTime; private Long startTime;
private Long endTime; private Long endTime;
private String projectName; private String projectName;
private Long runTime;
private Double passRate;
} }

View File

@ -4,49 +4,78 @@
<ms-table-header :condition.sync="condition" :show-create="false" <ms-table-header :condition.sync="condition" :show-create="false"
@search="initTableData"/> @search="initTableData"/>
</template> </template>
<el-table border :data="tableData"
@select-all="handleSelectAll" <ms-table
@select="handleSelect" v-loading="result.loading"
:height="screenHeight" operator-width="170px"
ref="testPlanReportTable"
row-key="id" row-key="id"
class="test-content adjust-table ms-select-all-fixed" :data="tableData"
@filter-change="filter" @sort-change="sort"> :condition="condition"
<el-table-column width="50" type="selection"/>
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total" :total="total"
:select-data-counts="selectDataCounts" :page-size.sync="pageSize"
:table-data-count-in-page="tableData.length" :operators="operators"
@selectPageAll="isSelectDataAll(false)" :screen-height="screenHeight"
@selectAll="isSelectDataAll(true)"/> :batch-operators="batchButtons"
:remember-order="true"
:fields.sync="fields"
:field-key="tableHeaderKey"
@handlePageChange="initTableData"
@refresh="initTableData"
ref="testPlanReportTable">
<el-table-column width="30" :resizable="false" align="center"> <span v-for="item in fields" :key="item.key">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column min-width="300" prop="name" :label="$t('test_track.report.list.name')" <ms-table-column
show-overflow-tooltip></el-table-column> prop="name"
<el-table-column prop="testPlanName" min-width="150" sortable :label="$t('test_track.report.list.test_plan')" :field="item"
show-overflow-tooltip></el-table-column> :fields-width="fieldsWidth"
<el-table-column prop="creator" :label="$t('test_track.report.list.creator')" sortable
show-overflow-tooltip></el-table-column> :label="$t('test_track.report.list.name')"
<el-table-column prop="createTime" sortable :label="$t('test_track.report.list.create_time' )" min-width="200px">
show-overflow-tooltip> </ms-table-column>
<ms-table-column
prop="testPlanName"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.report.list.test_plan')"
min-width="100"/>
<ms-table-column
prop="creator"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.report.list.creator')"/>
<ms-table-column
prop="createTime"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.create_time')"
min-width="150px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </ms-table-column>
<el-table-column prop="triggerMode" :label="$t('test_track.report.list.trigger_mode')" show-overflow-tooltip>
<ms-table-column
prop="triggerMode"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.trigger_mode')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/> <report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/>
</template> </template>
</el-table-column> </ms-table-column>
<el-table-column prop="status" :label="$t('commons.status')">
<ms-table-column
prop="status"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('commons.status')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-tag v-if="scope.row.status == 'RUNNING'" type="success" effect="plain" :content="'Running'"/> <ms-tag v-if="scope.row.status == 'RUNNING'" type="success" effect="plain" :content="'Running'"/>
<ms-tag <ms-tag
@ -54,19 +83,34 @@
type="info" effect="plain" :content="'Completed'"/> type="info" effect="plain" :content="'Completed'"/>
<ms-tag v-else type="effect" effect="plain" :content="scope.row.status"/> <ms-tag v-else type="effect" effect="plain" :content="scope.row.status"/>
</template> </template>
</el-table-column> </ms-table-column>
<el-table-column min-width="150" :label="$t('commons.operating')">
<ms-table-column
prop="runTime"
:field="item"
:fields-width="fieldsWidth"
sortable="custom"
:label="$t('test_track.report.list.run_time')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<div> <span v-if="scope.row.endTime != null">{{ (scope.row.runTime / 1000).toFixed(2) }}</span>
<ms-table-operator-button :tip="$t('test_track.plan_view.view_report')" icon="el-icon-document" <span v-else>/</span>
@exec="openReport(scope.row)"/>
<ms-table-operator-button v-permission="['PROJECT_TRACK_REPORT:READ+DELETE']" type="danger"
:tip="$t('commons.delete')" icon="el-icon-delete"
@exec="handleDelete(scope.row)"/>
</div>
</template> </template>
</el-table-column> </ms-table-column>
</el-table>
<ms-table-column
prop="passRate"
:field="item"
:fields-width="fieldsWidth"
sortable="custom"
:label="$t('test_track.report.list.pass_rate')">
<template v-slot:default="scope">
<span>{{ (scope.row.passRate ? (scope.row.passRate * 100 ).toFixed(1) : 0) + '%'}}</span>
</template>
</ms-table-column>
</span>
</ms-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
<test-plan-report-view @refresh="initTableData" ref="testPlanReportView"/> <test-plan-report-view @refresh="initTableData" ref="testPlanReportView"/>
@ -95,11 +139,15 @@ import {
initCondition, initCondition,
saveLastTableSortField, saveLastTableSortField,
setUnSelectIds, setUnSelectIds,
toggleAllSelection toggleAllSelection,
getCustomTableWidth,
getCustomTableHeader
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanDbReport from "@/business/components/track/report/components/TestPlanDbReport"; import TestPlanDbReport from "@/business/components/track/report/components/TestPlanDbReport";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default { export default {
name: "TestPlanReportList", name: "TestPlanReportList",
@ -110,6 +158,8 @@ export default {
MsTableOperator, MsTableOperatorButton, MsTableHeader, MsTablePagination, MsTableOperator, MsTableOperatorButton, MsTableHeader, MsTablePagination,
ReportTriggerModeItem, MsTag, ReportTriggerModeItem, MsTag,
ShowMoreBtn, MsTableSelectAll, ShowMoreBtn, MsTableSelectAll,
MsTableColumn,
MsTable,
}, },
data() { data() {
return { return {
@ -118,7 +168,7 @@ export default {
tableHeaderKey: "TRACK_REPORT_TABLE", tableHeaderKey: "TRACK_REPORT_TABLE",
queryPath: "/test/plan/report/list", queryPath: "/test/plan/report/list",
condition: { condition: {
components: TEST_PLAN_REPORT_CONFIGS components: TEST_PLAN_REPORT_CONFIGS,
}, },
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
@ -145,6 +195,29 @@ export default {
}, },
], ],
selectDataCounts: 0, selectDataCounts: 0,
fields: getCustomTableHeader('TRACK_REPORT_TABLE'),
fieldsWidth: getCustomTableWidth('TRACK_REPORT_TABLE'),
operators: [],
batchButtons: [],
publicButtons: [
{
name: this.$t('api_test.definition.request.batch_delete'),
handleClick: this.handleDeleteBatch,
permission: ['PROJECT_TRACK_REPORT:READ+DELETE'],
},
],
simpleOperators: [
{
tip: this.$t('test_track.plan_view.view_report'), icon: "el-icon-document",
exec: this.openReport,
},
{
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete,
permissions: ['PROJECT_TRACK_REPORT:READ+DELETE']
},
],
}; };
}, },
watch: { watch: {
@ -156,6 +229,8 @@ export default {
}, },
created() { created() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
this.batchButtons = this.publicButtons;
this.operators = this.simpleOperators;
if (!this.projectId) { if (!this.projectId) {
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
} }
@ -225,7 +300,7 @@ export default {
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
let deleteParam = {}; let deleteParam = {};
let ids = Array.from(this.selectRows).map(row => row.id); let ids = this.$refs.testPlanReportTable.selectIds;
deleteParam.dataIds = ids; deleteParam.dataIds = ids;
deleteParam.projectId = this.projectId; deleteParam.projectId = this.projectId;
deleteParam.selectAllDate = this.condition.selectAll; deleteParam.selectAllDate = this.condition.selectAll;

View File

@ -198,6 +198,19 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'desc', key: '9', label: 'test_track.case.case_desc'}, {id: 'desc', key: '9', label: 'test_track.case.case_desc'},
{id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'}, {id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'},
], ],
// 测试报告
TRACK_REPORT_TABLE: [
{id: 'name', key: '1', label: 'test_track.report.list.name'},
{id: 'testPlanName', key: '2', label: 'test_track.report.list.test_plan'},
{id: 'creator', key: '3', label: 'test_track.report.list.creator'},
{id: 'createTime', key: '4', label: 'test_track.report.list.create_time'},
{id: 'triggerMode', key: '5', label: 'test_track.report.list.trigger_mode'},
{id: 'status', key: '6', label: 'commons.status'},
{id: 'runTime', key: '7', label: 'test_track.report.list.run_time'},
{id: 'passRate', key: '8', label: 'test_track.report.list.pass_rate'},
],
//缺陷列表 //缺陷列表
ISSUE_LIST: [ ISSUE_LIST: [
{id: 'num', key: '1', label: 'test_track.issue.id'}, {id: 'num', key: '1', label: 'test_track.issue.id'},

View File

@ -2280,6 +2280,8 @@ export default {
creator: "Creator", creator: "Creator",
create_time: "Create Time", create_time: "Create Time",
trigger_mode: "Trigger Mode", trigger_mode: "Trigger Mode",
run_time: "run time(s)",
pass_rate: "pass rate",
status: "Status", status: "Status",
operation: "Operation", operation: "Operation",
}, },

View File

@ -2284,6 +2284,8 @@ export default {
creator: "创建人", creator: "创建人",
create_time: "创建时间", create_time: "创建时间",
trigger_mode: "触发方式", trigger_mode: "触发方式",
run_time: "运行耗时(s)",
pass_rate: "成功率",
status: "状态", status: "状态",
operation: "操作", operation: "操作",
}, },

View File

@ -2284,6 +2284,8 @@ export default {
creator: "創建人", creator: "創建人",
create_time: "創建時間", create_time: "創建時間",
trigger_mode: "觸發方式", trigger_mode: "觸發方式",
run_time: "運行耗時(s)",
pass_rate: "成功率",
status: "狀態", status: "狀態",
operation: "操作", operation: "操作",
}, },