fix(环境管理): 修复创建环境未选择项目报错问题 #1005210

--bug=1005210 --user=赵勇 【系统设置-项目-环境... https://www.tapd.cn/55049933/s/1025828
This commit is contained in:
fit2-zhao 2021-07-19 14:47:37 +08:00 committed by fit2-zhao
parent f3b1f97de5
commit 2de6866475
2 changed files with 7 additions and 0 deletions

View File

@ -116,6 +116,9 @@ public class ApiTestEnvironmentService {
} }
private void checkEnvironmentExist(ApiTestEnvironmentWithBLOBs environment) { private void checkEnvironmentExist(ApiTestEnvironmentWithBLOBs environment) {
if (environment.getName() != null) { if (environment.getName() != null) {
if(StringUtils.isEmpty(environment.getProjectId())){
MSException.throwException(Translator.get("项目ID不能为空"));
}
ApiTestEnvironmentExample example = new ApiTestEnvironmentExample(); ApiTestEnvironmentExample example = new ApiTestEnvironmentExample();
ApiTestEnvironmentExample.Criteria criteria = example.createCriteria(); ApiTestEnvironmentExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(environment.getName()) criteria.andNameEqualTo(environment.getName())

View File

@ -126,6 +126,10 @@
return uploadFiles; return uploadFiles;
}, },
_save(environment) { _save(environment) {
if(!this.projectId){
this.$warning(this.$t('api_test.select_project'));
return;
}
let bodyFiles = this.geFiles(environment); let bodyFiles = this.geFiles(environment);
let param = this.buildParam(environment); let param = this.buildParam(environment);
let url = '/api/environment/add'; let url = '/api/environment/add';