Commit 0a4815c5 by qinjianhui

fix: 备货数量和备货单价添加不能为0的校验

parent fef856a1
......@@ -323,6 +323,7 @@ const validateField = (
) => {
const value = row[field]
const strValue = value === 0 || value === '0' ? '0' : String(value ?? '')
const fieldLabel = field === 'buyAmount' ? '备货数量' : '备货单价'
if (!strValue) {
if (field === 'buyAmount') row._buyAmountError = '必填项'
......@@ -330,6 +331,9 @@ const validateField = (
} else if (!/^\d+(\.\d+)?$/.test(strValue)) {
if (field === 'buyAmount') row._buyAmountError = '请输入有效数字'
else row._priceError = '请输入有效数字'
} else if (Number(strValue) === 0) {
if (field === 'buyAmount') row._buyAmountError = `${fieldLabel}不能为0`
else row._priceError = `${fieldLabel}不能为0`
} else {
if (field === 'buyAmount') row._buyAmountError = ''
else row._priceError = ''
......@@ -487,7 +491,7 @@ const handleAddSingleProduct = (row: StockingOrderProduct) => {
formData.value.currencyCode &&
row.currencyCode !== formData.value.currencyCode
) {
ElMessage.warning(`只能添加币种为 ${formData.value.currencyCode} 的商品`)
ElMessage.warning('商品币种与主单币种不一致,添加失败!')
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