Commit fd96bc58 authored by 前端-许佳敏's avatar 前端-许佳敏
parents 8128bba7 c1704c39
...@@ -81,13 +81,17 @@ const Add = () => { ...@@ -81,13 +81,17 @@ const Add = () => {
const basicFormCol = [ const basicFormCol = [
{ {
label: intl.formatMessage({ id: 'balance.danjuzhaiyao' }), name: 'reconciliationAbstract', placeholder: '请输入对账单摘要', rules: [{ required: true, message: '请输入对账单摘要' }, { label: intl.formatMessage({ id: 'balance.danjuzhaiyao' }), name: 'reconciliationAbstract', placeholder: '请输入对账单摘要', rules: [{ required: true, message: '请输入对账单摘要' }, {
validator: (_, value) => { validator: (_, value, callback) => {
let _str = value; try {
_str = _str.replace(/[\u4E00-\u9FA5]/g, "AA"); let _str = value;
if (_str.length > 30 * 2) { _str = _str.replace(/[\u4E00-\u9FA5]/g, "AA");
return Promise.reject(new Error(`最长60个字符,30个汉字`)) if (_str.length > 30 * 2) {
} else { callback('最长60个字符,30个汉字')
return Promise.resolve(); // return Promise.reject(new Error(`最长60个字符,30个汉字`))
}
callback();
} catch (error) {
callback();
} }
} }
}] }]
...@@ -95,13 +99,18 @@ const Add = () => { ...@@ -95,13 +99,18 @@ const Add = () => {
{ {
label: intl.formatMessage({ id: 'balance.beizhu' }), name: 'remark', placeholder: '请输入对备注', rules: [ label: intl.formatMessage({ id: 'balance.beizhu' }), name: 'remark', placeholder: '请输入对备注', rules: [
{ {
validator: (_, value) => { validator: (_, value, callback) => {
let _str = value; try {
_str = _str.replace(/[\u4E00-\u9FA5]/g, "AA"); let _str = value;
if (value.length > 60 * 2) { _str = _str.replace(/[\u4E00-\u9FA5]/g, "AA");
return Promise.reject(new Error(`最长120个字符`)) if (value.length > 60 * 2) {
} else { callback('最长120个字符')
return Promise.resolve(); // return Promise.reject(new Error(`最长120个字符`))
}
callback();
// return Promise.resolve();
} catch (error) {
callback();
} }
} }
} }
...@@ -288,7 +297,7 @@ const Add = () => { ...@@ -288,7 +297,7 @@ const Add = () => {
if (!reg.test(value)) { if (!reg.test(value)) {
return Promise.reject(new Error('数量需要大于0')) return Promise.reject(new Error('数量需要大于0'))
} }
if(value > record.reconciliationQuantity){ if (value > record.reconciliationQuantity) {
return Promise.reject(new Error('不能大于待对账数量')) return Promise.reject(new Error('不能大于待对账数量'))
} }
return Promise.resolve() return Promise.resolve()
......
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