From b9983880ea83512c7f86ec7184f829a8f5e8c24a Mon Sep 17 00:00:00 2001 From: junhong Date: Tue, 15 Feb 2022 16:16:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E5=88=9B=E5=BB=BA=E7=8E=AF=E5=A2=83=E6=97=B6=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=89=8D=E5=90=8E=E7=BD=AE=E8=84=9A=E6=9C=AC=E4=B8=8D?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=8F=98=E6=9B=B4=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/environment/ApiEnvironmentConfig.vue | 11 +++++++++-- .../api/test/components/ApiEnvironmentConfig.vue | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/environment/ApiEnvironmentConfig.vue b/frontend/src/business/components/api/definition/components/environment/ApiEnvironmentConfig.vue index 8bb0a9e479..7d080771d6 100644 --- a/frontend/src/business/components/api/definition/components/environment/ApiEnvironmentConfig.vue +++ b/frontend/src/business/components/api/definition/components/environment/ApiEnvironmentConfig.vue @@ -7,7 +7,7 @@ :env-add-permission="['PROJECT_ENVIRONMENT:READ+CREATE']" :data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment" :delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/> - + @@ -50,7 +50,8 @@ permissions: ['PROJECT_ENVIRONMENT:READ+DELETE'] } ], - selectEnvironmentId: '' + selectEnvironmentId: '', + ifCreate: false, //是否是创建环境 } }, computed: { @@ -67,6 +68,7 @@ listenGoBack(this.close); }, deleteEnvironment(environment, index) { + this.ifCreate = false; if (environment.id) { this.result = this.$get('/api/environment/delete/' + environment.id, () => { this.$success(this.$t('commons.delete_success')); @@ -78,6 +80,7 @@ } }, copyEnvironment(environment) { + this.ifCreate = false; this.currentEnvironment = environment; if (!environment.id) { this.$warning(this.$t('commons.please_save')); @@ -110,6 +113,7 @@ return name; }, addEnvironment() { + this.ifCreate = true; let newEnvironment = new Environment({ projectId: this.projectId }); @@ -147,6 +151,9 @@ getEnvironment(environment) { parseEnvironment(environment); this.currentEnvironment = environment; + if(this.currentEnvironment.name){ + this.ifCreate = false; + } }, close() { this.$emit('close'); diff --git a/frontend/src/business/components/api/test/components/ApiEnvironmentConfig.vue b/frontend/src/business/components/api/test/components/ApiEnvironmentConfig.vue index 9bf09b63c6..885859a488 100644 --- a/frontend/src/business/components/api/test/components/ApiEnvironmentConfig.vue +++ b/frontend/src/business/components/api/test/components/ApiEnvironmentConfig.vue @@ -7,7 +7,7 @@ :data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment" :env-add-permission="ENV_CREATE" :delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/> - @@ -53,7 +53,8 @@ ['PROJECT_ENVIRONMENT:READ+DELETE'] : ['WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE'] } ], - selectEnvironmentId: '' + selectEnvironmentId: '', + ifCreate: false, //是否是创建环境 } }, props: { @@ -88,6 +89,7 @@ listenGoBack(this.close); }, deleteEnvironment(environment, index) { + this.ifCreate = false; if (environment.id) { this.result = this.$get('/api/environment/delete/' + environment.id, () => { this.$success(this.$t('commons.delete_success')); @@ -99,6 +101,7 @@ } }, copyEnvironment(environment) { + this.ifCreate = false; //点击复制的时候先选择改行,否则会出现解析错误 this.environmentSelected(environment); this.currentEnvironment = environment; @@ -133,6 +136,7 @@ return name; }, addEnvironment() { + this.ifCreate = true; let newEnvironment = new Environment({ projectId: this.projectId }); @@ -170,6 +174,9 @@ getEnvironment(environment) { parseEnvironment(environment); this.currentEnvironment = environment; + if(this.currentEnvironment.name){ + this.ifCreate = false; + } }, close() { this.$emit('close');