diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index 6918a61b50..cd62a99e2c 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -359,6 +359,8 @@ export default { }); this.selectVariable = ""; this.searchType = ""; + this.selectType = "CONSTANT"; + this.editData = {}; if (jsondiffpatch.diff(JSON.parse(JSON.stringify(this.variables)), this.variablesOld) || jsondiffpatch.diff(JSON.parse(JSON.stringify(this.headers)), this.headersOld)) { this.$emit('setVariables', saveVariables, this.headers); } @@ -374,9 +376,15 @@ export default { }, confirmVariable() { if (this.editData && (this.editData.name == undefined || this.editData.name == '')) { - this.$warning("变量名不能为空"); + this.$warning(this.$t('api_test.automation.variable_warning')); return; } + if (this.editData.type === 'CSV' && this.$refs.csv) { + if (this.editData.files.length === 0) { + this.$warning(this.$t('api_test.automation.csv_warning')); + return; + } + } // 更新场景,修改左边数据 if (this.showDelete) { this.updateParameters(this.editData); diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 275ca6837f..c709f0f936 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1468,7 +1468,9 @@ export default { generate_report: "Generate report", rerun: "fail and rerun", rerun_warning: "The connection is abnormal, please check the environment configuration", - rerun_success: "Rerun has already started, refresh the results later to view" + rerun_success: "Rerun has already started, refresh the results later to view", + csv_warning: "Please add csv file", + variable_warning: "Variable name cannot be empty" }, environment: { id: 'Environment ID', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index eb582afaca..d18af1301c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1476,7 +1476,9 @@ export default { generate_report: "生成报告", rerun: "失败重跑", rerun_warning: "连接异常,请检查环境配置", - rerun_success: "已经开始重跑,稍后刷新结果查看" + rerun_success: "已经开始重跑,稍后刷新结果查看", + csv_warning: "请添加 csv 文件", + variable_warning: "变量名不能为空" }, environment: { id: '环境ID', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 5a7722b13e..54d28a687d 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1473,7 +1473,9 @@ export default { generate_report: "生成報告", rerun: "失敗重跑", rerun_warning: "連接異常,請檢查環境配置", - rerun_success: "已經開始重跑,稍後重繪結果查看" + rerun_success: "已經開始重跑,稍後重繪結果查看", + csv_warning: "請添加 csv 文件", + variable_warning: "變量名不能為空" }, environment: { id: '環境ID',