Commit f54c772d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理采购下单支付比例校验问题

parent bf83b7f6
......@@ -49,21 +49,6 @@ export const EditableRow: React.FC<any> = (props) => {
);
};
const validatorNumber = (rule, value, callback) => {
try {
let n = Number(value);
if(isNaN(n)) {
throw new Error('请正确输入支付比例');
} else if(n < 0 || !Number.isInteger(n)) {
throw new Error('支付比例为大于0的整数');
} else {
callback()
}
} catch (err) {
callback(err)
}
}
export const PayInfoCell:React.FC<PayInfoCellProps> = ({
title,
editable,
......@@ -93,6 +78,24 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
}
}
const validatorNumber = (rule, value, callback) => {
try {
if(formItem !== 'input') {
callback()
}
let n = Number(value);
if(isNaN(n)) {
throw new Error('请正确输入支付比例');
} else if(n < 0 || !Number.isInteger(n)) {
throw new Error('支付比例为大于0的整数');
} else {
callback()
}
} catch (err) {
callback(err)
}
}
const save = async e => {
try {
const values = await form.validateFields();
......@@ -159,7 +162,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
message: `${title}必须填写`,
},
// 支付比例大于0
formItem === 'input' && {
{
validator: validatorNumber
}
]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment