Record it and use it directly next time.
need
When ID card is selected as the ID type, the ID card number is verified, which is limited to 18 digits
the code
FormSchema configuration
{
field: 'certificate_type',
label: '证件类型',
component: 'Select',
componentProps: {
placeholder: '请选择证件类型',
options: DictData.getDictById('IdCardType'),
},
colProps: {
span: 8,
offset: 2,
pull: 2,
},
rules: [{
required: true, message: '请选择证件类型', trigger: 'change' }],
},
{
field: 'certificate_num',
label: '证件号码',
component: 'Input',
colProps: {
span: 8,
},
componentProps: ({
formModel }) => {
return {
placeholder: '请输入证件号码',
maxlength: formModel?.certificate_type == '身份证' ? 18 : 100,
};
},
dynamicRules({
model }) {
if (model?.certificate_type === '身份证') {
return [{
required: true, validator: idNumberValidator, trigger: 'blur' }];
} else {
return [{
required: true, message: '请输入证件号码', trigger: 'blur' }];
}
},
},