in src/framework/Validator.ts [16:34]
export function validateRequired(a:Assembly, schema:MFieldSchemaAnonymity, value:any, path:string): MValidationResult {
if(schema.required){
console.log('validateRequired-value', path, value)
if(_.isNil(value) || value === "" || _.isNaN(value) || (_.isArray(value) && value.length == 0)) {
return {message:'您还没有填完这一项', path};
}
// 凡是总有例外
if(schema.type === "set" && schema.openOption) {
if(value.length === 1 && !value[0]){
return {message:'您还没有填完这一项', path}; // 开放set,只勾了开放选项,没有填内容,也要算空
}
}
} else {
if(_.isNil(value)) {
return "pass";
}
}
return undefined;
}