fix(接口定义): 修复批量添加变量,多次弹窗提示的缺陷

--bug=1017831 --user=王孝刚 【接口测试】接口批量添加变量,会弹出多个提示框
https://www.tapd.cn/55049933/s/1258968
This commit is contained in:
wxg0103 2022-10-11 19:34:21 +08:00 committed by wxg0103
parent 04e321d5ff
commit b6a8c2aa6f

View File

@ -63,23 +63,29 @@ export default {
let params = this.parameters.split("\n");
let index = 1;
let isNormal = true;
let msg = '';
params.forEach(item => {
if (item) {
let line = item.split(/|:/);
if (!line[0]) {
isNormal = false;
this.$warning(this.$t('api_test.params_format_warning', [index]) + " :" + this.$t('api_test.automation.variable_warning'));
return;
let indexMsg = index + '、';
msg = msg + indexMsg;
}
index++;
}
});
if (msg !== '') {
this.$warning(this.$t('api_test.params_format_warning', [msg.slice(0, msg.length - 1)]) + " :" + this.$t('api_test.automation.variable_warning'));
}
if (isNormal) {
this.dialogVisible = false;
this.$emit("batchSave", this.parameters);
this.parameters = "";
}
}
}
}
</script>