Commit c8b6fb22 authored by 何洋's avatar 何洋

fix: 业务员剩余数量0时输入框禁用

parent a293f812
......@@ -326,35 +326,37 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
title: '下单数量',
dataIndex: 'materielNo',
width: 372,
render: (text, record, index) => (
<div className={styles['member-rights-editable']}>
<Form.Item
name={['materials', 'requisitionList', `${record.key}`]}
rules={[
{
required: checkedKeysState.includes(record.key) ? true : false,
message: '请输入下单数量',
},
{
pattern: PATTERN_MAPS.quantity,
message: '请输入整数',
},
{
validator: (_, value) => {
const intVal = +value;
const max = record.purchaseProductSalesManResponse?.purchaseRemainingQuantity || 0;
if (intVal > max) {
return Promise.reject('下单数量不可超过业务员剩余数量');
}
return Promise.resolve();
render: (text, record, index) => {
const max = record.purchaseProductSalesManResponse?.purchaseRemainingQuantity || 0
return (
<div className={styles['member-rights-editable']}>
<Form.Item
name={['materials', 'requisitionList', `${record.key}`]}
rules={[
{
required: checkedKeysState.includes(record.key) ? true : false,
message: '请输入下单数量',
},
},
]}
>
<Input />
</Form.Item>
</div>
),
{
pattern: PATTERN_MAPS.quantity,
message: '请输入整数',
},
{
validator: (_, value) => {
const intVal = +value;
if (intVal > max) {
return Promise.reject('下单数量不可超过业务员剩余数量');
}
return Promise.resolve();
},
},
]}
>
<Input disabled={ max <= 0 }/>
</Form.Item>
</div>
)
},
},
];
return (
......
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