diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index c872f3a654..b2492190de 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -59,6 +59,7 @@
@@ -76,14 +77,14 @@
- - - - + + + +
@@ -186,8 +187,12 @@ }], isApiListEnable: true, syncTabs: [], + projectId: "" } }, + mounted() { + this.projectId = getCurrentProjectID(); + }, watch: { currentProtocol() { this.handleCommand("CLOSE_ALL"); @@ -248,7 +253,7 @@ } }, handleTabAdd(e) { - if (!getCurrentProjectID()) { + if (!this.projectId) { this.$warning(this.$t('commons.check_project_tip')); return; } @@ -286,7 +291,7 @@ this.$refs.nodeTree.createRootModel(); }, handleTabsEdit(targetName, action, api) { - if (!getCurrentProjectID()) { + if (!this.projectId) { this.$warning(this.$t('commons.check_project_tip')); return; } @@ -325,7 +330,7 @@ this.$warning('用例列表暂不支持导出,请切换成接口列表'); return; } - let obj = {projectName: getCurrentProjectID(), protocol: this.currentProtocol} + let obj = {projectName: this.projectId, protocol: this.currentProtocol} if (this.$refs.apiList[0].selectRows && this.$refs.apiList[0].selectRows.size > 0) { let arr = Array.from(this.$refs.apiList[0].selectRows); obj.data = arr; @@ -339,7 +344,7 @@ ["status", ["Prepare", "Underway", "Completed"]], ] ); - condition.projectId = getCurrentProjectID(); + condition.projectId = this.projectId; this.$post(url, condition, response => { obj.data = response.data; this.buildApiPath(obj.data); diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue index be68994833..235431817c 100644 --- a/frontend/src/business/components/api/definition/components/ApiConfig.vue +++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue @@ -38,7 +38,6 @@ request: Sampler, config: {}, response: {}, - projectId: "", maintainerOptions: [], } }, @@ -47,9 +46,9 @@ moduleOptions: {}, currentProtocol: String, syncTabs: Array, + projectId: String }, created() { - this.projectId = getCurrentProjectID(); this.getMaintainerOptions(); switch (this.currentProtocol) { case Request.TYPES.SQL: diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue index 8b1aa32bc4..1643d36bbb 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestDubboPage.vue @@ -44,7 +44,7 @@