From 2cc45e88cb0f6714920b7241f0242487ca900ff2 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Thu, 19 Dec 2024 13:45:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E9=9D=9Ejson=E6=A0=BC=E5=BC=8F=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=A4=9A=E6=9D=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1034499 --user=王旭 【项目设置】环境配置-通用配置-导入变量-导入非json格式报错提示有两条 https://www.tapd.cn/55049933/s/1634418 --- .../automation/scenario/variable/VariableImport.vue | 7 ++++++- .../frontend/src/components/environment/VariableImport.vue | 7 ++++++- .../environment/commons/variable/VariableImport.vue | 7 ++++++- .../src/business/menu/environment/EnvironmentImport.vue | 7 ++++++- .../business/workspace/environment/EnvironmentImport.vue | 7 ++++++- .../business/workspace/environment/WsEnvironmentImport.vue | 7 ++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/variable/VariableImport.vue b/api-test/frontend/src/business/automation/scenario/variable/VariableImport.vue index d695562212..40340293dd 100644 --- a/api-test/frontend/src/business/automation/scenario/variable/VariableImport.vue +++ b/api-test/frontend/src/business/automation/scenario/variable/VariableImport.vue @@ -98,7 +98,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if (this.uploadValidate(this.uploadFiles[i])) { + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -139,10 +141,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > 20) { this.$warning(this.$t('api_test.api_import.file_size_limit')); + return true; } + return false; }, open() { this.dialogVisible = true; diff --git a/framework/sdk-parent/frontend/src/components/environment/VariableImport.vue b/framework/sdk-parent/frontend/src/components/environment/VariableImport.vue index 8f887c9ac2..f5a168fd39 100644 --- a/framework/sdk-parent/frontend/src/components/environment/VariableImport.vue +++ b/framework/sdk-parent/frontend/src/components/environment/VariableImport.vue @@ -96,7 +96,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if(this.uploadValidate(this.uploadFiles[i])){ + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -138,10 +140,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > 20) { this.$warning(this.$t('api_test.api_import.file_size_limit')); + return true; } + return false; }, open() { this.dialogVisible = true; diff --git a/framework/sdk-parent/frontend/src/components/environment/commons/variable/VariableImport.vue b/framework/sdk-parent/frontend/src/components/environment/commons/variable/VariableImport.vue index 73a39518a1..47694d7997 100644 --- a/framework/sdk-parent/frontend/src/components/environment/commons/variable/VariableImport.vue +++ b/framework/sdk-parent/frontend/src/components/environment/commons/variable/VariableImport.vue @@ -94,7 +94,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if(this.uploadValidate(this.uploadFiles[i])){ + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -136,10 +138,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > 20) { this.$warning(this.$t('api_test.api_import.file_size_limit')); + return true; } + return false; }, open() { this.dialogVisible = true; diff --git a/project-management/frontend/src/business/menu/environment/EnvironmentImport.vue b/project-management/frontend/src/business/menu/environment/EnvironmentImport.vue index 7057d0f70e..94e93e0942 100644 --- a/project-management/frontend/src/business/menu/environment/EnvironmentImport.vue +++ b/project-management/frontend/src/business/menu/environment/EnvironmentImport.vue @@ -93,7 +93,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if (this.uploadValidate(this.uploadFiles[i])) { + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -133,10 +135,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > this.uploadSize) { this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize})); + return true } + return false; }, open() { this.dialogVisible = true; diff --git a/system-setting/frontend/src/business/workspace/environment/EnvironmentImport.vue b/system-setting/frontend/src/business/workspace/environment/EnvironmentImport.vue index 46cd4e0568..c439945fa0 100644 --- a/system-setting/frontend/src/business/workspace/environment/EnvironmentImport.vue +++ b/system-setting/frontend/src/business/workspace/environment/EnvironmentImport.vue @@ -86,7 +86,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if (this.uploadValidate(this.uploadFiles[i])) { + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -133,10 +135,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > this.uploadSize) { this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize})); + return true; } + return false; }, open() { this.dialogVisible = true; diff --git a/system-setting/frontend/src/business/workspace/environment/WsEnvironmentImport.vue b/system-setting/frontend/src/business/workspace/environment/WsEnvironmentImport.vue index f90ffda7b2..3ec4357f5c 100644 --- a/system-setting/frontend/src/business/workspace/environment/WsEnvironmentImport.vue +++ b/system-setting/frontend/src/business/workspace/environment/WsEnvironmentImport.vue @@ -81,7 +81,9 @@ export default { save() { if (this.uploadFiles.length > 0) { for (let i = 0; i < this.uploadFiles.length; i++) { - this.uploadValidate(this.uploadFiles[i]); + if (this.uploadValidate(this.uploadFiles[i])) { + return; + } let file = this.uploadFiles[i]; if (!file) { continue; @@ -118,10 +120,13 @@ export default { const extension = file.name.substring(file.name.lastIndexOf('.') + 1); if (!(extension === 'json')) { this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); + return true; } if (file.size / 1024 / 1024 > 20) { this.$warning(this.$t('api_test.api_import.file_size_limit')); + return true; } + return false; }, open() { this.dialogVisible = true;