Commit cdebb511 authored by 武广's avatar 武广

fix: 修改校验问题他

parent 2208b4ba
...@@ -3,6 +3,7 @@ import { Modal, Form, InputNumber, Checkbox, Switch } from 'antd'; ...@@ -3,6 +3,7 @@ import { Modal, Form, InputNumber, Checkbox, Switch } from 'antd';
import { deepClone } from '@/utils/utils'; import { deepClone } from '@/utils/utils';
import styles from '../../style.less'; import styles from '../../style.less';
import { apiProductStock } from '../../service'; import { apiProductStock } from '../../service';
import { isIntegerNotZero } from '@/utils/validator';
const StockModal = options => { const StockModal = options => {
const [stockType, setStockType] = useState(0); const [stockType, setStockType] = useState(0);
...@@ -81,7 +82,7 @@ const StockModal = options => { ...@@ -81,7 +82,7 @@ const StockModal = options => {
} }
}, [options.visible]); }, [options.visible]);
const maxStockRule = []; const maxStockRule = [{ validator: isIntegerNotZero, message: '请输入大于0的整数' }];
if (isChecked) { if (isChecked) {
maxStockRule.push({ required: true, message: '请输入最大库存!' }); maxStockRule.push({ required: true, message: '请输入最大库存!' });
} }
...@@ -111,7 +112,10 @@ const StockModal = options => { ...@@ -111,7 +112,10 @@ const StockModal = options => {
name="productStock" name="productStock"
labelCol={{ span: 6 }} labelCol={{ span: 6 }}
wrapperCol={{ span: 8 }} wrapperCol={{ span: 8 }}
rules={[{ required: true, message: '请输入剩余库存!' }]} rules={[
{ required: true, message: '请输入剩余库存!' },
{ validator: isIntegerNotZero, message: '请输入大于0的整数' },
]}
> >
<InputNumber <InputNumber
min={0} min={0}
......
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