测试用例首页跳转

This commit is contained in:
chenjianxing 2020-05-15 15:10:46 +08:00
parent 7364f84da0
commit ccde2f50a2
9 changed files with 73 additions and 101 deletions

View File

@ -27,6 +27,9 @@
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">

View File

@ -27,6 +27,11 @@ public class TestPlanTestCaseController {
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
@GetMapping("/get/{caseId}")
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId){
return testPlanTestCaseService.get(caseId);
}
@PostMapping("recent/{count}")
public List<TestPlanCaseDTO> getRecentTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request){
return testPlanTestCaseService.getRecentTestCases(request, count);

View File

@ -7,9 +7,10 @@ import lombok.Setter;
@Getter
@Setter
public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String executor;
private String executorName;
private String status;
private String results;
private String planId;
private String caseId;
}

View File

@ -97,4 +97,9 @@ public class TestPlanTestCaseService {
request.setExecutor(user.getId());
}
public TestPlanCaseDTO get(String caseId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setId(caseId);
return extTestPlanTestCaseMapper.list(request).get(0);
}
}

View File

@ -218,6 +218,11 @@ const router = new VueRouter({
name: "planView",
component: TestPlanView
},
{
path: "plan/view/edit/:caseId",
name: "planViewEdit",
component: TestPlanView
},
{
path: "project/:type",
name: "trackProject",

View File

@ -8,10 +8,10 @@
<el-col :span="9">
<el-row>
<el-col>
<recent-test-case-list/>
<test-case-side-list :title="'最近测试'" :type="'recent'"/>
</el-col>
<el-col>
<pending-test-case-list/>
<test-case-side-list :title="'待完成'" :type="'pending'"/>
</el-col>
</el-row>
</el-col>
@ -21,12 +21,11 @@
</template>
<script>
import PendingTestCaseList from "./components/PendingTestCaseList";
import RecentTestCaseList from "./components/RecentTestCaseList";
import RelatedTestPlanList from "./components/RelatedTestPlanList";
import TestCaseSideList from "./components/TestCaseSideList";
export default {
name: "TrackHome",
components: {RelatedTestPlanList, RecentTestCaseList, PendingTestCaseList}
components: {TestCaseSideList, RelatedTestPlanList}
}
</script>

View File

@ -1,74 +0,0 @@
<template>
<home-base-component :title="'最近测试'">
<el-table
row-key="id"
:data="tableData">
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="priority"
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
prop="status"
:label="$t('test_track.plan_view.execute_result')">
<template v-slot:default="scope">
<status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
</el-table>
</home-base-component>
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
import StatusTableItem from "../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
export default {
name: "RecentTestCaseList",
components: {PriorityTableItem, TypeTableItem, StatusTableItem, HomeBaseComponent},
data() {
return {
tableData: []
}
},
mounted() {
this.initTableData();
},
methods: {
initTableData() {
this.result = this.$post('/test/plan/case/recent/5', {}, response => {
this.tableData = response.data;
});
},
}
}
</script>
<style scoped>
</style>

View File

@ -1,9 +1,10 @@
<template>
<home-base-component :title="'待测试'">
<home-base-component :title="title">
<el-table
row-key="id"
@row-click="editTestCase"
:data="tableData">
<el-table-column
@ -44,29 +45,40 @@
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import StatusTableItem from "../../common/tableItems/planview/StatusTableItem";
export default {
name: "PendingTestCaseList",
components: {StatusTableItem, TypeTableItem, PriorityTableItem, HomeBaseComponent},
data() {
return {
tableData: []
}
import HomeBaseComponent from "./HomeBaseComponent";
import StatusTableItem from "../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
export default {
name: "TestCaseSideList",
components: {PriorityTableItem, TypeTableItem, StatusTableItem, HomeBaseComponent},
data() {
return {
tableData: [],
}
},
props: {
type: {
type: String
},
mounted() {
this.initTableData();
title: {
type: String
},
methods: {
initTableData() {
this.result = this.$post('/test/plan/case/pending/5', {}, response => {
this.tableData = response.data;
});
},
},
mounted() {
this.initTableData();
},
methods: {
initTableData() {
this.result = this.$post('/test/plan/case/' + this.type + '/5', {}, response => {
this.tableData = response.data;
});
},
editTestCase(row, event, column) {
this.$router.push('/track/plan/view/edit/' + row.caseId)
}
}
}
</script>
<style scoped>

View File

@ -24,7 +24,7 @@
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testCasePlanList"/>
ref="testPlanTestCaseList"/>
</el-main>
</el-container>
@ -63,8 +63,12 @@
},
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
@ -106,6 +110,18 @@
this.treeNodes = response.data;
});
}
},
openTestCaseEdit(path) {
if (path.indexOf("/plan/view/edit") >= 0){
let caseId = this.$route.params.caseId;
this.$get('/test/plan/case/get/' + caseId, response => {
let testCase = response.data;
if (testCase) {
this.$refs.testPlanTestCaseList.handleEdit(testCase);
this.$router.push('/track/plan/view/' + testCase.planId);
}
});
}
}
}
}