Commit ea699301c93c156c708a6628eb6b81721668e02d

Authored by jiangwei
2 parents b65b53f7 db42ca00

Merge remote-tracking branch 'origin/pms' into test

src/pages/pms/transfer/HuolalaSetting/components/AccountModal.tsx
... ... @@ -6,11 +6,12 @@ const Item = Form.Item;
6 6 interface Props {
7 7 visible?: boolean,
8 8 onCancel: Function,
9   - onOk: Function
  9 + onOk: Function,
  10 + accounts: string[]
10 11 }
11 12  
12 13 export default function Index(props: Props) {
13   - const { visible, onCancel, onOk } = props;
  14 + const { visible, onCancel, onOk, accounts } = props;
14 15 const [form] = Form.useForm();
15 16  
16 17 useEffect(() => {
... ... @@ -49,10 +50,12 @@ export default function Index(props: Props) {
49 50 { required: true, message: "请填写发单账号" },
50 51 () => ({
51 52 validator(_, value) {
52   - if (value.length == 11) {
53   - return Promise.resolve();
  53 + if (value.length != 11) {
  54 + return Promise.reject(new Error('发单账号不符合要求'));
  55 + } else if (accounts.includes(value)) {
  56 + return Promise.reject(new Error('发单账号重复'));
54 57 }
55   - return Promise.reject(new Error('发单账号的长度不符合要求'));
  58 + return Promise.resolve();
56 59 },
57 60 }),
58 61 ]}
... ...
src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx
... ... @@ -39,6 +39,7 @@ export default function Index(props:Props) {
39 39 }
40 40 if (!visible) {
41 41 form.resetFields();
  42 + setAccounts([]);
42 43 }
43 44 }, [visible]);
44 45  
... ... @@ -138,7 +139,7 @@ export default function Index(props:Props) {
138 139 )}
139 140 </Item>
140 141 </Form>
141   - <AccountModal visible={accountVisible} onCancel={() => setAccountVisible(false)} onOk={onOk} />
  142 + <AccountModal visible={accountVisible} onCancel={() => setAccountVisible(false)} onOk={onOk} accounts={accounts} />
142 143 </Modal>
143 144 );
144 145 }
... ...