From 354892fd9c6ef0272c57c761b724bb4ade9e2fc9 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 22 Feb 2021 16:01:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9C=BA=E6=99=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=9C=BA=E6=99=AF=E6=AD=A5=E9=AA=A4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=89=80=E5=B1=9E=E9=A1=B9=E7=9B=AE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scenario/component/ApiComponent.vue | 15 +++++++++++++++ .../scenario/component/ApiScenarioComponent.vue | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 695a5a4300..a0f0f73968 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -15,6 +15,7 @@ {{$t('api_test.automation.reference_deleted')}} {{ $t('commons.copy') }} {{ $t('api_test.scenario.reference') }} + {{getProjectName(request.projectId)}} @@ -94,6 +95,7 @@ export default { reportId: "", runData: [], isShowInput: false, + projects: [] } }, created() { @@ -102,6 +104,7 @@ export default { } // 加载引用对象数据 this.getApiInfo(); + this.getWsProjects(); if (this.request.protocol === 'HTTP') { this.setUrl(this.request.url); this.setUrl(this.request.path); @@ -270,6 +273,18 @@ export default { this.loading = false }) }, + getWsProjects() { + this.$get("/project/listAll", res => { + this.projects = res.data; + }) + }, + getProjectName(id) { + const project = this.projects.find(p => p.id === id); + if (project) { + return project.name; + } + return ''; + } } } diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index 6e37b464ba..dfe6d2656b 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -16,6 +16,8 @@ {{$t('api_test.automation.reference_deleted')}} {{ $t('commons.copy') }} {{ $t('api_test.scenario.reference') }} + + {{scenario.projectName}} @@ -41,6 +43,7 @@ watch: {}, created() { if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) { + this.getWsProjects(); this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => { if (response.data) { this.scenario.loaded = true; @@ -52,6 +55,8 @@ } this.scenario.disabled = true; this.scenario.name = response.data.name; + const project = this.projects.find(p => p.id === this.scenario.projectId); + this.scenario.projectName = project.name; this.$emit('refReload'); } else { this.scenario.referenced = "Deleted"; @@ -63,7 +68,8 @@ data() { return { loading: false, - isShowInput: false + isShowInput: false, + projects: [] } }, computed: { @@ -109,6 +115,11 @@ } } }, + getWsProjects() { + this.$get("/project/listAll", res => { + this.projects = res.data; + }) + } } }