form.validateFields(['StaffLevel'])//立即调用指定表单的item字段的校验
form.getFieldValue('StaffLevel')//获取值
From item的校验规则:
GradeLevel: [
{
required: false,
validator(rule, text) { //自定义规则
const isStaffLevel = form.getFieldValue('StaffLevel');
const isTargetLevel = form.getFieldValue('TargetLevel');
if (isTargetLevel.length == 0 && isStaffLevel == undefined) {
// return Promise.resolve();
return Promise.reject(`GradeLevel undefined!`);
}
if (isTargetLevel.length == 0 && isStaffLevel.length == 0) {
// return Promise.resolve();
return Promise.reject(`GradeLevel.length == 0!`);
}
}
}
],
07-20
348
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-26
1618
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)