refactor(测试计划): 列表加载优化

This commit is contained in:
shiziyuan9527 2021-06-09 16:03:05 +08:00 committed by 刘瑞斌
parent 9c6311e7e3
commit b9e272d961
3 changed files with 13 additions and 16 deletions

View File

@ -99,6 +99,7 @@
<select id="list" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric" <select id="list" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric"
parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest"> parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
select DISTINCT test_plan.*, user.name as user_name, project.name as projectName,schedule.id as scheduleId, select DISTINCT test_plan.*, user.name as user_name, project.name as projectName,schedule.id as scheduleId,
(select name from user where user.id = test_plan.creator) as createUser,
IF(schedule.enable = true,true,false) as scheduleOpen IF(schedule.enable = true,true,false) as scheduleOpen
from test_plan from test_plan
LEFT JOIN user ON user.id = test_plan.principal LEFT JOIN user ON user.id = test_plan.principal

View File

@ -11,4 +11,5 @@ public class TestPlanDTOWithMetric extends TestPlanDTO {
private Integer passed; private Integer passed;
private Integer tested; private Integer tested;
private Integer total; private Integer total;
private String createUser;
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="cardResult.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :create-permission="['PROJECT_TRACK_PLAN:READ+CREATE']" :condition.sync="condition" <ms-table-header :create-permission="['PROJECT_TRACK_PLAN:READ+CREATE']" :condition.sync="condition"
@search="initTableData" @create="testPlanCreate" @search="initTableData" @create="testPlanCreate"
@ -16,6 +16,7 @@
@filter-change="filter" @filter-change="filter"
@sort-change="sort" @sort-change="sort"
:height="screenHeight" :height="screenHeight"
v-loading="result.loading"
@row-click="intoPlan"> @row-click="intoPlan">
<template v-for="(item, index) in tableLabel"> <template v-for="(item, index) in tableLabel">
<el-table-column <el-table-column
@ -34,17 +35,10 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="item.id == 'createUser'" v-if="item.id == 'createUser'"
prop="creator" prop="createUser"
:label="$t('commons.create_user')" :label="$t('commons.create_user')"
show-overflow-tooltip show-overflow-tooltip
:key="index"> :key="index">
<template slot-scope="scope">
<span
:value="item.creator"
>
{{ scope.row.createUser }}
</span>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="item.id == 'status'" v-if="item.id == 'status'"
@ -275,6 +269,7 @@ export default {
headerItems: Test_Plan_List, headerItems: Test_Plan_List,
tableLabel: [], tableLabel: [],
result: {}, result: {},
cardResult: {},
enableDeleteTip: false, enableDeleteTip: false,
queryPath: "/test/plan/list", queryPath: "/test/plan/list",
deletePath: "/test/plan/delete", deletePath: "/test/plan/delete",
@ -333,7 +328,7 @@ export default {
if (!this.projectId) { if (!this.projectId) {
return; return;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.cardResult = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
@ -342,12 +337,12 @@ export default {
item.tags = JSON.parse(item.tags); item.tags = JSON.parse(item.tags);
} }
item.passRate = item.passRate + '%'; item.passRate = item.passRate + '%';
if (item.creator) { // if (item.creator) {
this.$get("user/info/" + item.creator, response => { // this.$get("user/info/" + item.creator, response => {
let name = response.data.name; // let name = response.data.name;
item.createUser = name; // item.createUser = name;
}); // });
} // }
}); });
}); });
getLabel(this, TEST_PLAN_LIST); getLabel(this, TEST_PLAN_LIST);