refactor(接口测试): 修复接口定义导入报错400的缺陷 (#15539)

--bug=1014651 --user=王孝刚 【接口测试】sql协议选中未规划接口后,再导入jmeter格式文件报错
https://www.tapd.cn/55049933/s/1195602

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-07-06 17:30:54 +08:00 committed by GitHub
parent 53c0caeb53
commit ab81f09329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -227,6 +227,9 @@ export default {
},
open(module) {
this.currentModule = module;
if (localStorage.getItem('scenarioModule')) {
this.formData.moduleId = localStorage.getItem('scenarioModule');
}
this.visible = true;
listenGoBack(this.close);
},
@ -252,6 +255,7 @@ export default {
return true;
},
save() {
localStorage.setItem('scenarioModule', this.formData.moduleId);
if (!this.formData.file) {
this.$warning("请添加一个文件");
return;
@ -289,6 +293,9 @@ export default {
})
param.modeId = this.formData.modeId
}
if (this.formData.moduleId.length === 0) {
param.moduleId = ''
}
param.projectId = this.projectId;
if (!this.swaggerUrlEable) {
param.swaggerUrl = undefined;
@ -296,6 +303,7 @@ export default {
return param;
},
close() {
localStorage.setItem('scenarioModule', this.formData.moduleId);
this.formData = {
file: undefined,
swaggerUrl: '',

View File

@ -362,9 +362,23 @@ export default {
open(module) {
this.currentModule = module;
this.visible = true;
this.formData.moduleId = this.rememberModuleId();
listenGoBack(this.close);
},
rememberModuleId() {
if (localStorage.getItem('tcp') || localStorage.getItem('http') || localStorage.getItem('sql') || localStorage.getItem('dubbo')) {
if (this.protocol === 'TCP') {
return localStorage.getItem('tcp');
} else if (this.protocol === 'HTTP') {
return localStorage.getItem('http');
} else if (this.protocol === 'SQL') {
return localStorage.getItem('sql');
} else if (this.protocol === 'DUBBO') {
return localStorage.getItem('dubbo');
}
}
},
upload(file) {
this.formData.file = file.file;
},
@ -391,7 +405,19 @@ export default {
}
return true;
},
saveModule() {
if (this.protocol === 'TCP') {
localStorage.setItem('tcp', this.formData.moduleId);
} else if (this.protocol === 'HTTP') {
localStorage.setItem('http', this.formData.moduleId);
} else if (this.protocol === 'SQL') {
localStorage.setItem('sql', this.formData.moduleId);
} else if (this.protocol === 'DUBBO') {
localStorage.setItem('dubbo', this.formData.moduleId);
}
},
save() {
this.saveModule();
this.$refs.form.validate(valid => {
if (valid) {
if ((this.selectedPlatformValue != 'Swagger2' || (this.selectedPlatformValue == 'Swagger2' && !this.swaggerUrlEnable)) && !this.formData.file) {
@ -440,6 +466,9 @@ export default {
if (this.currentModule) {
param.modeId = this.formData.modeId
}
if (this.formData.moduleId.length === 0) {
param.moduleId = ''
}
param.projectId = this.projectId;
param.protocol = this.protocol;
if (!this.swaggerUrlEnable) {
@ -459,6 +488,7 @@ export default {
return param;
},
close() {
this.saveModule();
this.formData = {
file: undefined,
swaggerUrl: '',