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 ae19cfbb4a..4e3b0e54ad 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -309,13 +309,15 @@ run() { if (this.isApiImport) { if (this.request.type && (this.request.type === "HTTPSamplerProxy" || this.request.type === "JDBCSampler" || this.request.type === "TCPSampler")) { - this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); - return false; - } else if (this.envMap && this.envMap.size > 0) { - const env = this.envMap.get(this.request.projectId); - if (!env) { + if (!this.envMap || this.envMap.size === 0) { this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); return false; + } else if (this.envMap && this.envMap.size > 0) { + const env = this.envMap.get(this.request.projectId); + if (!env) { + this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); + return false; + } } } }