refactor: 自定义字段校验优化

This commit is contained in:
chenjianxing 2021-05-26 19:37:10 +08:00 committed by jianxing
parent 0261109580
commit 8a5f267910
4 changed files with 13 additions and 6 deletions

View File

@ -143,9 +143,13 @@ export default {
let param = {};
Object.assign(param, this.form);
param.workspaceId = getCurrentWorkspaceId();
for (const item of this.form.options) {
if (['select','multipleSelect','radio','checkbox'].indexOf(param.type) > -1 && param.options.length < 1) {
this.$warning(this.$t('custom_field.option_check'));
return;
}
for (const item of param.options) {
if (!item.text || !item.value) {
this.$warning('请填写完整选项值');
this.$warning(this.$t('custom_field.option_value_check'));
return;
}
}

View File

@ -312,6 +312,8 @@ export default {
case_template: 'Test Case Template',
default_template: 'Default Template',
system_template: 'System Template',
option_check: 'Please add option values',
option_value_check: 'Please fill in the full option values',
},
workspace: {
create: 'Create Workspace',
@ -1830,6 +1832,5 @@ export default {
after_change: "After change",
share: "Share",
change_history: "Change history",
change_content: "Change content",
}
};

View File

@ -313,6 +313,8 @@ export default {
case_template: '测试用例模板',
default_template: '默认模板',
system_template: '系统模板',
option_check: '请添加选项值',
option_value_check: '请填写完整选项值',
},
workspace: {
create: '创建工作空间',
@ -1837,6 +1839,5 @@ export default {
after_change: "变更后",
share: "分享",
change_history: "变更历史",
change_content: "变更内容",
}
};

View File

@ -313,6 +313,8 @@ export default {
case_template: '測試用例模板',
default_template: '默認模板',
system_template: '系統模板',
option_check: '請添加選項值',
option_value_check: '請填寫完整選項值',
},
workspace: {
create: '創建工作空間',
@ -1837,6 +1839,5 @@ export default {
after_change: "變更後",
share: "分享",
change_history: "變更歷史",
change_content: "变更内容",
}
};