From 80fa0ab39405935befd4c98e5a8b135d8f214dd8 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 1 Dec 2020 10:38:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E9=87=8D=E6=9E=84=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/plan/view/TestPlanView.vue | 138 +++++++----------- .../comonents/TestPlanCommonComponent.vue | 29 ++++ .../plan/view/comonents/api/TestPlanApi.vue | 115 +++++++++++++++ .../functional/TestPlanFunctional.vue | 115 +++++++++++++++ .../view/comonents/head/TestPlanHeaderBar.vue | 51 +++++++ 5 files changed, 361 insertions(+), 87 deletions(-) create mode 100644 frontend/src/business/components/track/plan/view/comonents/TestPlanCommonComponent.vue create mode 100644 frontend/src/business/components/track/plan/view/comonents/api/TestPlanApi.vue create mode 100644 frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue create mode 100644 frontend/src/business/components/track/plan/view/comonents/head/TestPlanHeaderBar.vue diff --git a/frontend/src/business/components/track/plan/view/TestPlanView.vue b/frontend/src/business/components/track/plan/view/TestPlanView.vue index 8f8aaa439a..0928018ee2 100644 --- a/frontend/src/business/components/track/plan/view/TestPlanView.vue +++ b/frontend/src/business/components/track/plan/view/TestPlanView.vue @@ -1,39 +1,25 @@ @@ -46,20 +32,23 @@ import MsContainer from "../../../common/components/MsContainer"; import MsAsideContainer from "../../../common/components/MsAsideContainer"; 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 { name: "TestPlanView", components: { + TestPlanApi, + TestPlanFunctional, + MsTestPlanHeaderBar, MsMainContainer, MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu}, data() { return { - result: {}, testPlans: [], currentPlan: {}, - selectNodeIds: [], - selectParentNodes: [], - treeNodes: [] + activeIndex: "functional" } }, computed: { @@ -68,33 +57,11 @@ } }, mounted() { - this.initData(); - this.openTestCaseEdit(this.$route.path); - }, - watch: { - '$route'(to, from) { - this.openTestCaseEdit(to.path); - }, - planId() { - this.initData(); - } + this.getTestPlans(); }, methods: { - refresh() { - this.selectNodeIds = []; - this.selectParentNodes = []; - this.$refs.testCaseRelevance.search(); - this.getNodeTreeByPlanId(); - }, - initData() { - this.getTestPlans(); - this.getNodeTreeByPlanId(); - }, - openTestCaseRelevanceDialog() { - this.$refs.testCaseRelevance.openTestCaseRelevanceDialog(); - }, getTestPlans() { - this.result = this.$post('/test/plan/list/all', {}, response => { + this.$post('/test/plan/list/all', {}, response => { this.testPlans = response.data; this.testPlans.forEach(plan => { 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) { this.currentPlan = plan; this.$router.push('/track/plan/view/' + plan.id); }, - 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); - } - }); - } + handleSelect(key) { + this.activeIndex = key; } } } diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanCommonComponent.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanCommonComponent.vue new file mode 100644 index 0000000000..4ca9b25873 --- /dev/null +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanCommonComponent.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApi.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApi.vue new file mode 100644 index 0000000000..3a40507adc --- /dev/null +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApi.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue new file mode 100644 index 0000000000..ad3244fff9 --- /dev/null +++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/head/TestPlanHeaderBar.vue b/frontend/src/business/components/track/plan/view/comonents/head/TestPlanHeaderBar.vue new file mode 100644 index 0000000000..fa6a6249b1 --- /dev/null +++ b/frontend/src/business/components/track/plan/view/comonents/head/TestPlanHeaderBar.vue @@ -0,0 +1,51 @@ + + + + +