Commit b65b53f7fc71a38d95731289e187ab78ff0bb088
Merge remote-tracking branch 'origin/pms' into test
Showing
4 changed files
with
105 additions
and
8 deletions
src/pages/pms/storage/StorageManage/subpages/LocationManage/index.tsx
... | ... | @@ -39,7 +39,6 @@ export default function RepertoryIndex({ match }: common.ConnectProps) { |
39 | 39 | <Search |
40 | 40 | allowClear |
41 | 41 | placeholder="根据件号|编码|名称|库位" |
42 | - onChange={(e) => _onChange({ keyword: e.target.value })} | |
43 | 42 | onSearch={(value) => _onChange({ keywords: value })} |
44 | 43 | style={{ maxWidth: 300 }} |
45 | 44 | /> |
... | ... | @@ -60,7 +59,7 @@ export default function RepertoryIndex({ match }: common.ConnectProps) { |
60 | 59 | <ItemDetailModal |
61 | 60 | storageId={id} |
62 | 61 | visible={view} |
63 | - onCancel={() => { setView(false) }} | |
62 | + onCancel={() => { setView(false); }} | |
64 | 63 | fetchList={() => setLoading(true)} |
65 | 64 | /> |
66 | 65 | <UploadModal |
... | ... | @@ -68,7 +67,7 @@ export default function RepertoryIndex({ match }: common.ConnectProps) { |
68 | 67 | pagination={paginationConfig} |
69 | 68 | loading={loading} |
70 | 69 | visible={visible} |
71 | - onCancel={() => { setVisible(false) }} | |
70 | + onCancel={() => { setVisible(false); }} | |
72 | 71 | setParams={setParams} |
73 | 72 | /> |
74 | 73 | <UploadMoreModal | ... | ... |
src/pages/pms/transfer/HuolalaSetting/components/AccountModal.tsx
0 → 100644
1 | +import React, { useEffect } from 'react'; | |
2 | +import { Form, Button, Modal, Input } from 'antd'; | |
3 | + | |
4 | +const Item = Form.Item; | |
5 | + | |
6 | +interface Props { | |
7 | + visible?: boolean, | |
8 | + onCancel: Function, | |
9 | + onOk: Function | |
10 | +} | |
11 | + | |
12 | +export default function Index(props: Props) { | |
13 | + const { visible, onCancel, onOk } = props; | |
14 | + const [form] = Form.useForm(); | |
15 | + | |
16 | + useEffect(() => { | |
17 | + if (!visible) { | |
18 | + form.resetFields(); | |
19 | + } | |
20 | + }, [visible]); | |
21 | + | |
22 | + const onSave = () => { | |
23 | + form.validateFields().then(files => { | |
24 | + onOk(files.account); | |
25 | + onCancel(); | |
26 | + }); | |
27 | + }; | |
28 | + | |
29 | + return ( | |
30 | + <Modal | |
31 | + title="发单账号" | |
32 | + open={visible} | |
33 | + maskClosable={false} | |
34 | + onCancel={() => onCancel()} | |
35 | + footer={[ | |
36 | + <Button onClick={() => onCancel()}>取消</Button>, | |
37 | + <Button type="primary" htmlType="submit" onClick={() => onSave()}>确定</Button> | |
38 | + ]} | |
39 | + > | |
40 | + <Form | |
41 | + form={form} | |
42 | + labelCol={{ span: 5 }} | |
43 | + wrapperCol={{ span: 12 }} | |
44 | + > | |
45 | + <Item | |
46 | + label="发单账号" | |
47 | + name="account" | |
48 | + rules={[ | |
49 | + { required: true, message: "请填写发单账号" }, | |
50 | + () => ({ | |
51 | + validator(_, value) { | |
52 | + if (value.length == 11) { | |
53 | + return Promise.resolve(); | |
54 | + } | |
55 | + return Promise.reject(new Error('发单账号的长度不符合要求')); | |
56 | + }, | |
57 | + }), | |
58 | + ]} | |
59 | + > | |
60 | + <Input /> | |
61 | + </Item> | |
62 | + </Form> | |
63 | + </Modal> | |
64 | + ); | |
65 | +} | ... | ... |
src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx
... | ... | @@ -6,6 +6,7 @@ import {getContactUnit, ContactItem} from '@/pages/pms/transfer/transferManage/a |
6 | 6 | import {getShopApi} from '@/pages/pms/storage/partShop/api'; |
7 | 7 | import usePagination from '@/hooks/usePagination'; |
8 | 8 | import useInitail from '@/hooks/useInitail'; |
9 | +import AccountModal from './AccountModal'; | |
9 | 10 | |
10 | 11 | const Item = Form.Item; |
11 | 12 | |
... | ... | @@ -23,15 +24,17 @@ export default function Index(props:Props) { |
23 | 24 | const [loading, setLoading] = useState(false); |
24 | 25 | const { visible, onCancel, item, onRefreshing } = props; |
25 | 26 | const [form] = Form.useForm(); |
27 | + const [accountVisible, setAccountVisible] = useState(false); | |
28 | + const [accounts, setAccounts] = useState<string[]>([]); | |
26 | 29 | |
27 | 30 | useEffect(() => { |
28 | 31 | if (visible && item?.id) { |
32 | + setAccounts(item.account?.split(',') || []); | |
29 | 33 | form.setFieldsValue({ |
30 | 34 | supplierId: item.supplierId, |
31 | 35 | shopId: item.shopId, |
32 | 36 | minAmount: item.minAmount, |
33 | 37 | roleCode: item.roleCode, |
34 | - account: item.account | |
35 | 38 | }); |
36 | 39 | } |
37 | 40 | if (!visible) { |
... | ... | @@ -40,6 +43,10 @@ export default function Index(props:Props) { |
40 | 43 | }, [visible]); |
41 | 44 | |
42 | 45 | const onSave = () => { |
46 | + if (!accounts.length) { | |
47 | + message.error('填写发单账号'); | |
48 | + return; | |
49 | + } | |
43 | 50 | form.validateFields().then(files => { |
44 | 51 | const params = { |
45 | 52 | id: item?.id, |
... | ... | @@ -49,7 +56,7 @@ export default function Index(props:Props) { |
49 | 56 | minAmount: files.minAmount, |
50 | 57 | roleCode: files.roleCode, |
51 | 58 | roleName: list.find(i => i.roleCode == files.roleCode)?.roleName, |
52 | - account: files.account | |
59 | + account: accounts.join() | |
53 | 60 | }; |
54 | 61 | setLoading(true); |
55 | 62 | saveApi(params).then(res => { |
... | ... | @@ -64,10 +71,15 @@ export default function Index(props:Props) { |
64 | 71 | }); |
65 | 72 | }; |
66 | 73 | |
74 | + const onOk = (v: any) => { | |
75 | + setAccounts([...accounts, v]); | |
76 | + }; | |
77 | + | |
67 | 78 | return ( |
68 | 79 | <Modal |
69 | 80 | title={item?.id ? "编辑货拉拉账户配置" : "新增货拉拉账户配置"} |
70 | 81 | open={visible} |
82 | + width={500} | |
71 | 83 | maskClosable={false} |
72 | 84 | onCancel={() => onCancel()} |
73 | 85 | footer={[ |
... | ... | @@ -101,10 +113,32 @@ export default function Index(props:Props) { |
101 | 113 | options={list.filter(i => i.roleType != 1).map(item => ({value: item.roleCode, label: item.roleName}))} |
102 | 114 | /> |
103 | 115 | </Item> |
104 | - <Item label="发单账号" name="account" rules={[{ required: true, message: "请填写发单账号" }]}> | |
105 | - <Input /> | |
116 | + <Item | |
117 | + label="发单账号" | |
118 | + name="account" | |
119 | + labelCol={{ span: 5 }} | |
120 | + wrapperCol={{ span: 19 }} | |
121 | + > | |
122 | + {accounts.length ? ( | |
123 | + <div> | |
124 | + {accounts.map((i, index) => ( | |
125 | + <div style={{display: 'flex', alignItems: 'center', marginBottom: 5}} key={i}> | |
126 | + <Input value={i} disabled style={{width: 226}} /> | |
127 | + <span style={{ color: '#FF4D4F', marginLeft: 10, cursor: 'pointer' }} onClick={() => setAccounts(accounts.filter(it => it != i))}>删除</span> | |
128 | + {index == accounts.length - 1 && <span style={{ color: '#FAAD14', marginLeft: 10, cursor: 'pointer' }} onClick={() => setAccountVisible(true)}>添加</span>} | |
129 | + </div> | |
130 | + ))} | |
131 | + </div> | |
132 | + ) | |
133 | + : ( | |
134 | + <div style={{display: 'flex', alignItems: 'center'}}> | |
135 | + <Input disabled style={{width: 226}} /> | |
136 | + <span style={{ color: '#FAAD14', marginLeft: 10, cursor: 'pointer'}} onClick={() => setAccountVisible(true)}>添加</span> | |
137 | + </div> | |
138 | + )} | |
106 | 139 | </Item> |
107 | 140 | </Form> |
141 | + <AccountModal visible={accountVisible} onCancel={() => setAccountVisible(false)} onOk={onOk} /> | |
108 | 142 | </Modal> |
109 | 143 | ); |
110 | 144 | } | ... | ... |
src/pages/pms/transfer/HuolalaSetting/index.tsx
... | ... | @@ -19,7 +19,6 @@ export default function Index() { |
19 | 19 | <Table dataSource={list} rowKey="id" loading={loading} pagination={paginationConfig}> |
20 | 20 | <Column title="往来单位" dataIndex="supplierName" /> |
21 | 21 | <Column title="签约门店" dataIndex="shopName" /> |
22 | - <Column title="当前余额(元)" dataIndex="amount" /> | |
23 | 22 | <Column title="低余额推待办(元)" dataIndex="minAmount" /> |
24 | 23 | <Column title="推待办角色" dataIndex="roleName" /> |
25 | 24 | <Column title="发单账号" dataIndex="account" /> | ... | ... |