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; + }) + } } }