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');