Commit 7a41a347 authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 物料信息提示问题

parent a98d83ca
......@@ -149,18 +149,10 @@ export const MaterialTableCell: React.FC<MaterialTableCellProps> = ({
}
}
let childNode = children;
if (editable) {
console.log(dataIndex)
childNode =
<>
<Form.Item
style={{ margin: 0 }}
name={dataIndex}
initialValue={record[dataIndex] || ''}
rules={dataIndex === 'quantity' ? [
const switchValidator = () => {
switch (dataIndex) {
case 'quantity': {
return [
{
required: true,
message: `${title}${intl.formatMessage({ id: 'purchaseRequisition.bixutianxie', defaultMessage: '必须填写' })}`,
......@@ -172,18 +164,11 @@ export const MaterialTableCell: React.FC<MaterialTableCellProps> = ({
{
validator: validatorNumber
},
] : (dataIndex === 'remark' ?
[
{
required: true,
message: intl.formatMessage({ id: 'purchaseRequisition.neirongbuneng1weikong', defaultMessage: '内容不能为空' }),
},
{
validator: (r, v, c) => validatorByte(r, v, c, 200)
}
]
:
[
}
case 'price' : {
return [
{
pattern: /^\d+(\.\d{1,4})?$/,
message: intl.formatMessage({ id: 'purchaseRequisition.danjiajinxiansi', defaultMessage: '单价仅限四位小数' }),
......@@ -191,8 +176,33 @@ export const MaterialTableCell: React.FC<MaterialTableCellProps> = ({
{
validator: validatorNumber
}
])
]
}
case 'remark': {
return [
{
validator: (r, v, c) => validatorByte(r, v, c, 200)
}
]
}
default : {
return []
}
}
}
let childNode = children;
if (editable) {
childNode =
<>
<Form.Item
style={{ margin: 0 }}
name={dataIndex}
initialValue={record[dataIndex] || ''}
rules={switchValidator()}
>
{chooseFormItem(formItem, record[dataIndex] || '')}
</Form.Item>
......
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