Commit e2b1c6c9580d68df38ed9b5c3c898220d997a803
1 parent
4780a364
feat: 添加开票时会先获取所有销售代表
Showing
1 changed file
with
30 additions
and
9 deletions
src/pages/Invoice/components/AddInvoiceDrawerForm.tsx
1 | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | -import { postServiceInvoiceAddInvoice } from '@/services'; | |
2 | +import { | |
3 | + postServiceInvoiceAddInvoice, | |
4 | + postServiceOrderQuerySalesCode, | |
5 | +} from '@/services'; | |
3 | 6 | import { PlusOutlined } from '@ant-design/icons'; |
4 | 7 | import { |
5 | 8 | DrawerForm, |
... | ... | @@ -12,6 +15,7 @@ import { |
12 | 15 | ProFormTextArea, |
13 | 16 | } from '@ant-design/pro-components'; |
14 | 17 | import { Button, Form, message } from 'antd'; |
18 | +import { useEffect, useState } from 'react'; | |
15 | 19 | |
16 | 20 | export default ({ onClose }) => { |
17 | 21 | const [form] = Form.useForm<{ |
... | ... | @@ -30,7 +34,21 @@ export default ({ onClose }) => { |
30 | 34 | ]; |
31 | 35 | money: ''; |
32 | 36 | }>(); |
33 | - | |
37 | + const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
38 | + const getSalesCodeOptions = async () => { | |
39 | + const res = await postServiceOrderQuerySalesCode(); | |
40 | + let options = res.data?.map((item) => { | |
41 | + return { | |
42 | + label: item.userName, | |
43 | + value: item.userName, | |
44 | + number: item.number, | |
45 | + }; | |
46 | + }); | |
47 | + setSalesCodeOptions(options); | |
48 | + }; | |
49 | + useEffect(() => { | |
50 | + getSalesCodeOptions(); | |
51 | + }, []); | |
34 | 52 | return ( |
35 | 53 | <DrawerForm<{ |
36 | 54 | invoiceNumber: string; |
... | ... | @@ -54,7 +72,7 @@ export default ({ onClose }) => { |
54 | 72 | console.log('resize!'); |
55 | 73 | }, |
56 | 74 | maxWidth: window.innerWidth * 0.8, |
57 | - minWidth: 400, | |
75 | + minWidth: 500, | |
58 | 76 | }} |
59 | 77 | form={form} |
60 | 78 | trigger={ |
... | ... | @@ -125,12 +143,14 @@ export default ({ onClose }) => { |
125 | 143 | placeholder="请输入联系人" |
126 | 144 | rules={[{ required: true, message: '请输入联系人!' }]} |
127 | 145 | /> |
128 | - <ProFormText | |
129 | - name="sale" | |
130 | - width="md" | |
131 | - label="销售" | |
132 | - placeholder="请输入销售" | |
133 | - rules={[{ required: true, message: '请输入销售!' }]} | |
146 | + <ProFormSelect | |
147 | + name="salesCode" | |
148 | + key="salesCode" | |
149 | + width="lg" | |
150 | + showSearch | |
151 | + label="销售代表" | |
152 | + placeholder="请选择销售代表" | |
153 | + options={salesCodeOptions} | |
134 | 154 | /> |
135 | 155 | <ProFormDateTimePicker |
136 | 156 | name="invoicingTime" |
... | ... | @@ -145,6 +165,7 @@ export default ({ onClose }) => { |
145 | 165 | name="mainOrderIdObjs" |
146 | 166 | label="订单号" |
147 | 167 | min={1} |
168 | + copyIconProps={false} | |
148 | 169 | deleteIconProps={{ |
149 | 170 | tooltipText: '删除', |
150 | 171 | }} | ... | ... |