From 0ace484dd0f82f4774d88bef83fc8e5a3d89e767 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 22 May 2020 10:28:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=9A=E4=B8=AAtag=E4=B8=8B=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E9=A1=B9=E7=9B=AE=E4=B8=8B=E7=94=A8=E4=BE=8B=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/track/case/TestCase.vue | 2 ++ .../components/track/case/components/TestCaseEdit.vue | 9 +++++++-- .../src/business/components/track/common/NodeEdit.vue | 7 +++++-- .../src/business/components/track/common/NodeTree.vue | 5 ++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 2077bc6b30..19b0c5b972 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -17,6 +17,7 @@ :draggable="true" :select-node.sync="selectNode" @refreshTable="refreshTable" + :current-project="currentProject" ref="nodeTree"/> @@ -39,6 +40,7 @@ :read-only="testCaseReadOnly" :tree-nodes="treeNodes" :select-node="selectNode" + :current-project="currentProject" ref="testCaseEditDialog"> diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 566e407478..8545ffa84f 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -250,6 +250,9 @@ }, selectNode: { type: Object + }, + currentProject: { + type: Object } }, mounted() { @@ -330,9 +333,11 @@ param.nodePath = item.path; } }); - if(localStorage.getItem(CURRENT_PROJECT)) { - param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id; + + if (this.currentProject) { + param.projectId = this.currentProject.id; } + param.name = param.name.trim(); if (param.name == '') { this.$warning(this.$t('test_track.case.input_name')); diff --git a/frontend/src/business/components/track/common/NodeEdit.vue b/frontend/src/business/components/track/common/NodeEdit.vue index 004cdc60ce..03955bcf86 100644 --- a/frontend/src/business/components/track/common/NodeEdit.vue +++ b/frontend/src/business/components/track/common/NodeEdit.vue @@ -57,6 +57,9 @@ props: { treeNodes: { type: Array + }, + currentProject: { + type: Object } }, methods: { @@ -106,8 +109,8 @@ } param.name = this.form.name.trim(); param.label = this.form.name; - if (localStorage.getItem(CURRENT_PROJECT)) { - param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id; + if (this.currentProject) { + param.projectId = this.currentProject.id; } return url; }, diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue index 5c304dfe7a..34e8960078 100644 --- a/frontend/src/business/components/track/common/NodeTree.vue +++ b/frontend/src/business/components/track/common/NodeTree.vue @@ -49,7 +49,7 @@ - + @@ -83,6 +83,9 @@ export default { draggable: { type: Boolean, default: true + }, + currentProject: { + type: Object } }, watch: {