测试跟踪首页计划列表

This commit is contained in:
chenjianxing 2020-05-15 10:44:42 +08:00
parent 8ca36edc88
commit ff387a1b0c
14 changed files with 267 additions and 10 deletions

View File

@ -8,4 +8,6 @@ import java.util.List;
public interface ExtTestPlanMapper {
List<TestPlanDTO> list(@Param("request") QueryTestPlanRequest params);
List<TestPlanDTO> listRelate(@Param("request") QueryTestPlanRequest params);
}

View File

@ -30,4 +30,19 @@
</if>
</select>
<select id="listRelate" resultType="io.metersphere.track.dto.TestPlanDTO">
select test_plan.*, project.name as project_name
from test_plan
left join project on test_plan.project_id = project.id
where test_plan.workspace_id = #{request.workspaceId}
and (test_plan.principal = #{request.principal}
<if test="request.planIds != null and request.planIds.size() > 0">
or test_plan.id in
<foreach collection="request.planIds" item="planId" open="(" close=")" separator=",">
#{planId}
</foreach>
</if>
);
</select>
</mapper>

View File

@ -15,4 +15,5 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request);
List<String> findRelateTestPlanId(String userId);
}

View File

@ -58,5 +58,9 @@
</if>
</select>
<select id="findRelateTestPlanId" resultType="java.lang.String">
select distinct plan_id from test_plan_test_case where executor = #{userId};
</select>
</mapper>

View File

@ -36,6 +36,10 @@ public class TestPlanController {
return testPlanService.listTestAllPlan(currentWorkspaceId);
}
@PostMapping("/list/all/relate")
public List<TestPlanDTO> listRelateAll() {
return testPlanService.listRelateAllPlan();
}
@GetMapping("recent/{count}")
public List<TestPlan> recentTestPlans(@PathVariable int count) {

View File

@ -4,9 +4,12 @@ import io.metersphere.base.domain.TestPlan;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class QueryTestPlanRequest extends TestPlan {
private boolean recent = false;
private List<String> planIds;
}

View File

@ -6,8 +6,11 @@ import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import io.metersphere.track.dto.TestPlanDTO;
@ -33,6 +36,9 @@ public class TestPlanService {
@Resource
ExtTestPlanMapper extTestPlanMapper;
@Resource
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
@Resource
TestCaseMapper testCaseMapper;
@ -132,4 +138,14 @@ public class TestPlanService {
testPlanExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
return testPlanMapper.selectByExample(testPlanExample);
}
public List<TestPlanDTO> listRelateAllPlan() {
SessionUser user = SessionUtils.getUser();
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setPrincipal(user.getId());
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId()));
return extTestPlanMapper.listRelate(request);
}
}

View File

@ -0,0 +1,26 @@
<template>
<div>
<span v-if="stage == 'smoke'">{{$t('test_track.plan.smoke_test')}}</span>
<span v-if="stage == 'functional'">{{$t('test_track.plan.functional_test')}}</span>
<span v-if="stage == 'integration'">{{$t('test_track.plan.integration_testing')}}</span>
<span v-if="stage == 'system'">{{$t('test_track.plan.system_test')}}</span>
<span v-if="stage == 'regression'">{{$t('test_track.plan.regression_test')}}</span>
<span v-if="stage == 'version'">{{$t('test_track.plan.version_validation')}}</span>
</div>
</template>
<script>
export default {
name: "PlanStageTableItem",
components: {},
props: {
stage: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -1,13 +1,32 @@
<template>
<div class="container">
<div class="main-content">
<h1>测试跟踪首页</h1>
<el-row>
<el-col :span="12">
<related-test-plan-list/>
</el-col>
<el-col :span="12">
<el-row>
<el-col>
<recent-test-case-list/>
</el-col>
<el-col>
<pending-test-case-list/>
</el-col>
</el-row>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import PendingTestCaseList from "./components/PendingTestCaseList";
import RecentTestCaseList from "./components/RecentTestCaseList";
import RelatedTestPlanList from "./components/RelatedTestPlanList";
export default {
name: "TrackHome"
name: "TrackHome",
components: {RelatedTestPlanList, RecentTestCaseList, PendingTestCaseList}
}
</script>

View File

@ -0,0 +1,34 @@
<template>
<div class="track-home-component">
<el-card>
<template v-slot:header>
<span class="title">{{title}}</span>
</template>
<slot></slot>
</el-card>
</div>
</template>
<script>
export default {
name: "HomeBaseComponent",
props: {
title: {
type: String,
default: '标题'
}
}
}
</script>
<style scoped>
.el-card {
padding: 15px;
}
.track-home-component {
padding: 0 15px 15px;
}
</style>

View File

@ -0,0 +1,19 @@
<template>
<home-base-component :title="'待测试'">
</home-base-component>
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
export default {
name: "PendingTestCaseList",
components: {HomeBaseComponent}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,17 @@
<template>
<home-base-component :title="'最近测试'"/>
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
export default {
name: "RecentTestCaseList",
components: {HomeBaseComponent}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,100 @@
<template>
<home-base-component :title="'测试计划'">
<el-table
:data="tableData"
@row-click="intoPlan">
<el-table-column
prop="name"
fixed
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="status"
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="'通过率'"
show-overflow-tooltip>
20%
</el-table-column>
<el-table-column
prop="projectName"
:label="'已测用例'"
show-overflow-tooltip>
14/16
</el-table-column>
<el-table-column
prop="projectName"
:label="'测试进度'"
min-width="120"
show-overflow-tooltip>
<el-progress :percentage="50"></el-progress>
</el-table-column>
<el-table-column
prop="stage"
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.plan.plan_project')"
show-overflow-tooltip>
</el-table-column>
</el-table>
</home-base-component>
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
export default {
name: "RelatedTestPlanList",
components: {MsTableOperator, PlanStageTableItem, PlanStatusTableItem, HomeBaseComponent},
data() {
return {
tableData: []
}
},
mounted() {
this.initTableData();
},
methods: {
initTableData() {
this.result = this.$post('/test/plan/list/all/relate', this.condition, response => {
this.tableData = response.data;
});
},
intoPlan(row, event, column) {
this.$router.push('/track/plan/view/' + row.id);
}
}
}
</script>
<style scoped>
.el-table {
cursor:pointer;
}
</style>

View File

@ -34,12 +34,7 @@
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span v-if="scope.row.stage == 'smoke'">{{$t('test_track.plan.smoke_test')}}</span>
<span v-if="scope.row.stage == 'functional'">{{$t('test_track.plan.functional_test')}}</span>
<span v-if="scope.row.stage == 'integration'">{{$t('test_track.plan.integration_testing')}}</span>
<span v-if="scope.row.stage == 'system'">{{$t('test_track.plan.system_test')}}</span>
<span v-if="scope.row.stage == 'regression'">{{$t('test_track.plan.regression_test')}}</span>
<span v-if="scope.row.stage == 'version'">{{$t('test_track.plan.version_validation')}}</span>
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<el-table-column
@ -84,10 +79,12 @@
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
export default {
name: "TestPlanList",
components: {
PlanStageTableItem,
PlanStatusTableItem,
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination},
data() {