Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-12-01 10:44:38 +08:00
commit e1eef7ee41
5 changed files with 361 additions and 87 deletions

View File

@ -1,39 +1,25 @@
<template> <template>
<ms-container> <div>
<ms-test-plan-header-bar>
<ms-aside-container> <template v-slot:info>
<select-menu <select-menu
:data="testPlans" :data="testPlans"
:current-data="currentPlan" :current-data="currentPlan"
:title="$t('test_track.plan_view.plan')" :title="$t('test_track.plan_view.plan')"
@dataChange="changePlan"/> @dataChange="changePlan"/>
<node-tree class="node-tree" </template>
v-loading="result.loading" <template v-slot:menu>
@nodeSelectEvent="nodeChange" <el-menu active-text-color="#6d317c" :default-active="activeIndex"
@refresh="refresh" class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect">
:tree-nodes="treeNodes" <el-menu-item index="functional">功能测试用例</el-menu-item>
:draggable="false" <el-menu-item index="api">接口测试用例</el-menu-item>
ref="nodeTree"/> </el-menu>
</ms-aside-container> </template>
</ms-test-plan-header-bar>
<ms-main-container> <test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/>
<test-plan-test-case-list <test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/>
class="table-list" </div>
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</ms-main-container>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-container>
</template> </template>
@ -46,20 +32,23 @@
import MsContainer from "../../../common/components/MsContainer"; import MsContainer from "../../../common/components/MsContainer";
import MsAsideContainer from "../../../common/components/MsAsideContainer"; import MsAsideContainer from "../../../common/components/MsAsideContainer";
import MsMainContainer from "../../../common/components/MsMainContainer"; import MsMainContainer from "../../../common/components/MsMainContainer";
import MsTestPlanHeaderBar from "./comonents/head/TestPlanHeaderBar";
import TestPlanFunctional from "./comonents/functional/TestPlanFunctional";
import TestPlanApi from "./comonents/api/TestPlanApi";
export default { export default {
name: "TestPlanView", name: "TestPlanView",
components: { components: {
TestPlanApi,
TestPlanFunctional,
MsTestPlanHeaderBar,
MsMainContainer, MsMainContainer,
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu}, MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu},
data() { data() {
return { return {
result: {},
testPlans: [], testPlans: [],
currentPlan: {}, currentPlan: {},
selectNodeIds: [], activeIndex: "functional"
selectParentNodes: [],
treeNodes: []
} }
}, },
computed: { computed: {
@ -68,33 +57,11 @@
} }
}, },
mounted() { mounted() {
this.initData(); this.getTestPlans();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
}, },
methods: { methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getTestPlans();
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
getTestPlans() { getTestPlans() {
this.result = this.$post('/test/plan/list/all', {}, response => { this.$post('/test/plan/list/all', {}, response => {
this.testPlans = response.data; this.testPlans = response.data;
this.testPlans.forEach(plan => { this.testPlans.forEach(plan => {
if (this.planId && plan.id === this.planId) { if (this.planId && plan.id === this.planId) {
@ -103,39 +70,36 @@
}); });
}); });
}, },
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
changePlan(plan) { changePlan(plan) {
this.currentPlan = plan; this.currentPlan = plan;
this.$router.push('/track/plan/view/' + plan.id); this.$router.push('/track/plan/view/' + plan.id);
}, },
getNodeTreeByPlanId() { handleSelect(key) {
if(this.planId){ this.activeIndex = key;
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
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);
}
});
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.select-menu {
display: inline-block;
}
.ms-main-container {
height: calc(100vh - 80px - 50px);
}
.ms-aside-container {
height: calc(100vh - 80px - 51px);
margin-top: 1px;
}
.header-menu.el-menu--horizontal > li {
height: 49px;
line-height: 50px;
color: dimgray;
}
</style> </style>

View File

@ -0,0 +1,29 @@
<template>
<ms-container>
<ms-aside-container>
<slot name="aside"></slot>
</ms-aside-container>
<ms-main-container>
<slot name="main"></slot>
</ms-main-container>
<slot></slot>
</ms-container>
</template>
<script>
import MsMainContainer from "../../../../common/components/MsMainContainer";
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
import MsContainer from "../../../../common/components/MsContainer";
export default {
name: "MsTestPlanCommonComponent",
components: {MsContainer, MsAsideContainer, MsMainContainer}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,115 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<node-tree class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
:draggable="false"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-plan-test-case-list
class="table-list"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</template>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import NodeTree from "../../../../common/NodeTree";
import TestPlanTestCaseList from "../TestPlanTestCaseList";
import TestCaseRelevance from "../TestCaseRelevance";
import MsTestPlanCommonComponent from "../TestPlanCommonComponent";
export default {
name: "TestPlanApi",
components: {
MsTestPlanCommonComponent,
TestCaseRelevance,
TestPlanTestCaseList,
NodeTree,
},
data() {
return {
result: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: [],
}
},
props: [
'planId'
],
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
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);
}
});
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,115 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<node-tree class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
@refresh="refresh"
:tree-nodes="treeNodes"
:draggable="false"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-plan-test-case-list
class="table-list"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
ref="testPlanTestCaseList"/>
</template>
<test-case-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import NodeTree from "../../../../common/NodeTree";
import TestPlanTestCaseList from "../TestPlanTestCaseList";
import TestCaseRelevance from "../TestCaseRelevance";
import MsTestPlanCommonComponent from "../TestPlanCommonComponent";
export default {
name: "TestPlanFunctional",
components: {
MsTestPlanCommonComponent,
TestCaseRelevance,
TestPlanTestCaseList,
NodeTree,
},
data() {
return {
result: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: [],
}
},
props: [
'planId'
],
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);
},
watch: {
'$route'(to, from) {
this.openTestCaseEdit(to.path);
},
planId() {
this.initData();
}
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testCaseRelevance.search();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
// node
this.$refs.testPlanTestCaseList.currentPage = 1;
this.$refs.testPlanTestCaseList.pageSize = 10;
},
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
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);
}
});
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,51 @@
<template>
<div class="test-plan-header-bar">
<div class="header-info">
<slot name="info"></slot>
</div>
<div class="menu-ul">
<slot name="menu"></slot>
</div>
</div>
</template>
<script>
import SelectMenu from "../../../../common/SelectMenu";
export default {
name: "MsTestPlanHeaderBar",
components: {SelectMenu},
data() {
return {
}
},
props: {
},
methods: {
}
}
</script>
<style scoped>
.test-plan-header-bar {
height: 50px;
background-color: white;
}
.header-info {
height: 50px;
width: 300px;
line-height: 50px;
vertical-align: top;
display: inline-block;
}
.menu-ul {
width: 500px;
display: inline-block;
}
</style>