diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 914c1b08ba..2b47dab229 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -601,7 +601,7 @@ public class ApiAutomationService { } } if (http.isEnable()) { - if (http.getIsRefEnvironment()) { + if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) { env.getProjectIds().add(http.getProjectId()); env.setFullUrl(false); } @@ -633,7 +633,7 @@ public class ApiAutomationService { // 校验是否是全路径 MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr; if (httpSamplerProxy.isEnable()) { - if (httpSamplerProxy.getIsRefEnvironment()) { + if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || (httpSamplerProxy.getIsRefEnvironment()!= null && httpSamplerProxy.getIsRefEnvironment())) { env.getProjectIds().add(httpSamplerProxy.getProjectId()); env.setFullUrl(false); } @@ -674,7 +674,7 @@ public class ApiAutomationService { http.setUrl(apiDefinition.getPath()); } if (http.isEnable()) { - if (http.getIsRefEnvironment()) { + if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) { env.setFullUrl(false); env.getProjectIds().add(http.getProjectId()); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue index 07bf54b83d..e27d64faed 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue @@ -110,7 +110,7 @@ export default { map.set(dt.id, dt.selectEnv); }) if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境2!"); return; } this.$emit('setProjectEnvMap', map); @@ -130,7 +130,7 @@ export default { } if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境3!"); return false; } return true; diff --git a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue index b3ea7098a4..cd7fd040f6 100644 --- a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue +++ b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue @@ -275,6 +275,9 @@ export default { checkEnv(data) { let sign = true; this.isFullUrl = true; + if(data){ + return true; + } if (this.data.length > 0) { this.data.forEach(dt => { if (!dt.selectEnv) { @@ -291,14 +294,7 @@ export default { return false; } }) - } else { - if (!data) { - sign = false; - } } - // 校验是否全是全路径 - //this.checkFullUrl(data); - //sign = this.isFullUrl; } if (!sign) { diff --git a/frontend/src/business/components/track/common/EnvSelect.vue b/frontend/src/business/components/track/common/EnvSelect.vue index a8c7ba5d7e..f574dac96a 100644 --- a/frontend/src/business/components/track/common/EnvSelect.vue +++ b/frontend/src/business/components/track/common/EnvSelect.vue @@ -127,7 +127,7 @@ export default { map.set(dt.id, dt.selectEnv); }); if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境4!"); return; } this.$emit('setProjectEnvMap', map); @@ -158,7 +158,7 @@ export default { } if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境5!"); return false; } return true;