From ab81f09329d55f7daf5af82deab3a4bc2f5de4d3 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Wed, 6 Jul 2022 17:30:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=8A=A5=E9=94=99400=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=20(#15539)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014651 --user=王孝刚 【接口测试】sql协议选中未规划接口后,再导入jmeter格式文件报错 https://www.tapd.cn/55049933/s/1195602 Co-authored-by: wxg0103 <727495428@qq.com> --- .../scenario/common/ScenarioImport.vue | 8 +++++ .../components/import/ApiImport.vue | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue b/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue index d36dc7b8a7..001cc289b5 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ScenarioImport.vue @@ -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: '', diff --git a/frontend/src/business/components/api/definition/components/import/ApiImport.vue b/frontend/src/business/components/api/definition/components/import/ApiImport.vue index eb8702ddae..5ecf441780 100644 --- a/frontend/src/business/components/api/definition/components/import/ApiImport.vue +++ b/frontend/src/business/components/api/definition/components/import/ApiImport.vue @@ -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: '',