refactor(接口测试): 修复接口定义导入报错400的缺陷 (#15538)
--bug=1014651 --user=王孝刚 【接口测试】sql协议选中未规划接口后,再导入jmeter格式文件报错 https://www.tapd.cn/55049933/s/1195602 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
ca1ae84fcd
commit
572d25d30a
|
@ -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: '',
|
||||
|
|
|
@ -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: '',
|
||||
|
|
Loading…
Reference in New Issue