Commit e2b1c6c9580d68df38ed9b5c3c898220d997a803
1 parent
4780a364
feat: 添加开票时会先获取所有销售代表
Showing
1 changed file
with
30 additions
and
9 deletions
src/pages/Invoice/components/AddInvoiceDrawerForm.tsx
1 | import { RESPONSE_CODE } from '@/constants/enum'; | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | -import { postServiceInvoiceAddInvoice } from '@/services'; | 2 | +import { |
3 | + postServiceInvoiceAddInvoice, | ||
4 | + postServiceOrderQuerySalesCode, | ||
5 | +} from '@/services'; | ||
3 | import { PlusOutlined } from '@ant-design/icons'; | 6 | import { PlusOutlined } from '@ant-design/icons'; |
4 | import { | 7 | import { |
5 | DrawerForm, | 8 | DrawerForm, |
@@ -12,6 +15,7 @@ import { | @@ -12,6 +15,7 @@ import { | ||
12 | ProFormTextArea, | 15 | ProFormTextArea, |
13 | } from '@ant-design/pro-components'; | 16 | } from '@ant-design/pro-components'; |
14 | import { Button, Form, message } from 'antd'; | 17 | import { Button, Form, message } from 'antd'; |
18 | +import { useEffect, useState } from 'react'; | ||
15 | 19 | ||
16 | export default ({ onClose }) => { | 20 | export default ({ onClose }) => { |
17 | const [form] = Form.useForm<{ | 21 | const [form] = Form.useForm<{ |
@@ -30,7 +34,21 @@ export default ({ onClose }) => { | @@ -30,7 +34,21 @@ export default ({ onClose }) => { | ||
30 | ]; | 34 | ]; |
31 | money: ''; | 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 | return ( | 52 | return ( |
35 | <DrawerForm<{ | 53 | <DrawerForm<{ |
36 | invoiceNumber: string; | 54 | invoiceNumber: string; |
@@ -54,7 +72,7 @@ export default ({ onClose }) => { | @@ -54,7 +72,7 @@ export default ({ onClose }) => { | ||
54 | console.log('resize!'); | 72 | console.log('resize!'); |
55 | }, | 73 | }, |
56 | maxWidth: window.innerWidth * 0.8, | 74 | maxWidth: window.innerWidth * 0.8, |
57 | - minWidth: 400, | 75 | + minWidth: 500, |
58 | }} | 76 | }} |
59 | form={form} | 77 | form={form} |
60 | trigger={ | 78 | trigger={ |
@@ -125,12 +143,14 @@ export default ({ onClose }) => { | @@ -125,12 +143,14 @@ export default ({ onClose }) => { | ||
125 | placeholder="请输入联系人" | 143 | placeholder="请输入联系人" |
126 | rules={[{ required: true, message: '请输入联系人!' }]} | 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 | <ProFormDateTimePicker | 155 | <ProFormDateTimePicker |
136 | name="invoicingTime" | 156 | name="invoicingTime" |
@@ -145,6 +165,7 @@ export default ({ onClose }) => { | @@ -145,6 +165,7 @@ export default ({ onClose }) => { | ||
145 | name="mainOrderIdObjs" | 165 | name="mainOrderIdObjs" |
146 | label="订单号" | 166 | label="订单号" |
147 | min={1} | 167 | min={1} |
168 | + copyIconProps={false} | ||
148 | deleteIconProps={{ | 169 | deleteIconProps={{ |
149 | tooltipText: '删除', | 170 | tooltipText: '删除', |
150 | }} | 171 | }} |