Commit 0371e839b1dd06fb6efa405df0184a7e2c3250c0
1 parent
230d5a97
feat: 手动开票功能开发
Showing
3 changed files
with
71 additions
and
40 deletions
src/pages/Client/index.tsx
@@ -17,22 +17,6 @@ export const waitTime = async (time: number = 100) => { | @@ -17,22 +17,6 @@ export const waitTime = async (time: number = 100) => { | ||
17 | await waitTimePromise(time); | 17 | await waitTimePromise(time); |
18 | }; | 18 | }; |
19 | 19 | ||
20 | -type GithubIssueItem = { | ||
21 | - url: string; | ||
22 | - id: number; | ||
23 | - number: number; | ||
24 | - title: string; | ||
25 | - labels: { | ||
26 | - name: string; | ||
27 | - color: string; | ||
28 | - }[]; | ||
29 | - state: string; | ||
30 | - comments: number; | ||
31 | - created_at: string; | ||
32 | - updated_at: string; | ||
33 | - closed_at?: string; | ||
34 | -}; | ||
35 | - | ||
36 | const columns: ProColumns<GithubIssueItem>[] = [ | 20 | const columns: ProColumns<GithubIssueItem>[] = [ |
37 | { | 21 | { |
38 | dataIndex: 'index', | 22 | dataIndex: 'index', |
@@ -150,16 +134,14 @@ const columns: ProColumns<GithubIssueItem>[] = [ | @@ -150,16 +134,14 @@ const columns: ProColumns<GithubIssueItem>[] = [ | ||
150 | export default () => { | 134 | export default () => { |
151 | const actionRef = useRef<ActionType>(); | 135 | const actionRef = useRef<ActionType>(); |
152 | return ( | 136 | return ( |
153 | - <ProTable<GithubIssueItem> | 137 | + <ProTable |
154 | columns={columns} | 138 | columns={columns} |
155 | actionRef={actionRef} | 139 | actionRef={actionRef} |
156 | cardBordered | 140 | cardBordered |
157 | request={async (params, sort, filter) => { | 141 | request={async (params, sort, filter) => { |
158 | console.log(sort, filter); | 142 | console.log(sort, filter); |
159 | await waitTime(2000); | 143 | await waitTime(2000); |
160 | - return request<{ | ||
161 | - data: GithubIssueItem[]; | ||
162 | - }>('https://proapi.azurewebsites.net/github/issues', { | 144 | + return request('https://proapi.azurewebsites.net/github/issues', { |
163 | params, | 145 | params, |
164 | }); | 146 | }); |
165 | }} | 147 | }} |
src/pages/Invoice/components/ManualInvoicingModal.tsx
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | ||
1 | import UploadC from '@/pages/Invoice/components/UploadSingleImg'; | 2 | import UploadC from '@/pages/Invoice/components/UploadSingleImg'; |
2 | -import { postOrderErpOrderStagesUpload } from '@/services'; | 3 | +import { |
4 | + postOrderErpOrderStagesUpload, | ||
5 | + postServiceInvoiceDealInvoicingResult, | ||
6 | +} from '@/services'; | ||
3 | import { | 7 | import { |
4 | ModalForm, | 8 | ModalForm, |
5 | ProCard, | 9 | ProCard, |
6 | ProFormDatePicker, | 10 | ProFormDatePicker, |
11 | + ProFormDigit, | ||
7 | ProFormList, | 12 | ProFormList, |
13 | + ProFormMoney, | ||
8 | ProFormText, | 14 | ProFormText, |
9 | } from '@ant-design/pro-components'; | 15 | } from '@ant-design/pro-components'; |
10 | import { Col, Form, Row, message } from 'antd'; | 16 | import { Col, Form, Row, message } from 'antd'; |
11 | import { RcFile } from 'antd/es/upload'; | 17 | import { RcFile } from 'antd/es/upload'; |
18 | +import { useEffect } from 'react'; | ||
12 | 19 | ||
13 | export default ({ record }) => { | 20 | export default ({ record }) => { |
14 | - const [form] = Form.useForm<{ name: string; company: string }>(); | 21 | + useEffect(() => { |
22 | + console.log('invoicing'); | ||
23 | + }, []); | ||
24 | + const [form] = Form.useForm(); | ||
15 | return ( | 25 | return ( |
16 | - <ModalForm<{ | ||
17 | - name: string; | ||
18 | - company: string; | ||
19 | - }> | 26 | + <ModalForm |
20 | title="手动开票" | 27 | title="手动开票" |
21 | trigger={<a type="primary">手动开票</a>} | 28 | trigger={<a type="primary">手动开票</a>} |
22 | - width={400} | 29 | + width={600} |
23 | layout={'horizontal'} | 30 | layout={'horizontal'} |
24 | form={form} | 31 | form={form} |
25 | autoFocusFirstInput | 32 | autoFocusFirstInput |
@@ -29,21 +36,48 @@ export default ({ record }) => { | @@ -29,21 +36,48 @@ export default ({ record }) => { | ||
29 | }} | 36 | }} |
30 | submitTimeout={2000} | 37 | submitTimeout={2000} |
31 | onFinish={async (values) => { | 38 | onFinish={async (values) => { |
32 | - console.log(values); | ||
33 | - message.success('提交成功'); | ||
34 | - return true; | 39 | + const res = await postServiceInvoiceDealInvoicingResult({ |
40 | + data: { | ||
41 | + ...values, | ||
42 | + isSuccess: true, | ||
43 | + invoiceRecordId: record.id, | ||
44 | + manual: true, | ||
45 | + }, | ||
46 | + }); | ||
47 | + if (res.result === RESPONSE_CODE.SUCCESS) { | ||
48 | + message.success('开票成功'); | ||
49 | + return true; | ||
50 | + } else { | ||
51 | + message.error('开票失败'); | ||
52 | + } | ||
35 | }} | 53 | }} |
36 | > | 54 | > |
37 | - <ProFormText width={'md'} name="invoicingPerson" label="开票人" /> | ||
38 | - <ProFormText width={'md'} name="invoiceNumber" label="发票号码" /> | 55 | + <ProFormText |
56 | + rules={[{ required: true, message: '此项为必填项' }]} | ||
57 | + width={'md'} | ||
58 | + name="invoicingPerson" | ||
59 | + label="开票人" | ||
60 | + /> | ||
61 | + <ProFormText | ||
62 | + rules={[{ required: true, message: '此项为必填项' }]} | ||
63 | + width={'md'} | ||
64 | + name="invoiceNumber" | ||
65 | + label="发票号码" | ||
66 | + /> | ||
39 | <ProFormDatePicker | 67 | <ProFormDatePicker |
68 | + rules={[{ required: true, message: '此项为必填项' }]} | ||
40 | fieldProps={{ | 69 | fieldProps={{ |
41 | - format: 'YY-MM-DD', | 70 | + format: 'YYYY-MM-DD', |
42 | }} | 71 | }} |
43 | name="invoicingDate" | 72 | name="invoicingDate" |
44 | label="开票日期" | 73 | label="开票日期" |
45 | /> | 74 | /> |
46 | - <ProFormText hidden name="url" label="發票地址" /> | 75 | + <ProFormText |
76 | + rules={[{ required: true, message: '发票必须上传' }]} | ||
77 | + hidden | ||
78 | + name="url" | ||
79 | + label="發票地址" | ||
80 | + /> | ||
47 | <Row> | 81 | <Row> |
48 | <Col span={4}>上传发票</Col> | 82 | <Col span={4}>上传发票</Col> |
49 | <Col span={20}> | 83 | <Col span={20}> |
@@ -69,16 +103,15 @@ export default ({ record }) => { | @@ -69,16 +103,15 @@ export default ({ record }) => { | ||
69 | </Col> | 103 | </Col> |
70 | </Row> | 104 | </Row> |
71 | <ProFormList | 105 | <ProFormList |
72 | - name="invoiceDetails" | 106 | + name="invoiceDetailDtoList" |
73 | label="明细" | 107 | label="明细" |
74 | creatorButtonProps={false} | 108 | creatorButtonProps={false} |
75 | copyIconProps={false} | 109 | copyIconProps={false} |
76 | - itemRender={({ listDom, action }, { index }) => ( | 110 | + itemRender={({ listDom }, { index }) => ( |
77 | <ProCard | 111 | <ProCard |
78 | bordered | 112 | bordered |
79 | style={{ marginBlockEnd: 8 }} | 113 | style={{ marginBlockEnd: 8 }} |
80 | title={`明细${index + 1}`} | 114 | title={`明细${index + 1}`} |
81 | - extra={action} | ||
82 | bodyStyle={{ paddingBlockEnd: 0 }} | 115 | bodyStyle={{ paddingBlockEnd: 0 }} |
83 | > | 116 | > |
84 | {listDom} | 117 | {listDom} |
@@ -86,7 +119,16 @@ export default ({ record }) => { | @@ -86,7 +119,16 @@ export default ({ record }) => { | ||
86 | )} | 119 | )} |
87 | creatorRecord={{ name: '', items: [{ name: '' }] }} | 120 | creatorRecord={{ name: '', items: [{ name: '' }] }} |
88 | initialValue={record.invoiceDetails} | 121 | initialValue={record.invoiceDetails} |
89 | - ></ProFormList> | 122 | + > |
123 | + <ProFormText | ||
124 | + name="projectName" | ||
125 | + label="名称" | ||
126 | + placeholder="请输入名称" | ||
127 | + readonly | ||
128 | + /> | ||
129 | + <ProFormDigit label="税率" name="taxRate" min={0} max={100} /> | ||
130 | + <ProFormMoney label="税额" name="taxPrice" locale="zh-CN" min={0} /> | ||
131 | + </ProFormList> | ||
90 | </ModalForm> | 132 | </ModalForm> |
91 | ); | 133 | ); |
92 | }; | 134 | }; |
src/pages/Invoice/index.tsx
@@ -317,7 +317,6 @@ const InvoicePage = () => { | @@ -317,7 +317,6 @@ const InvoicePage = () => { | ||
317 | valueType: 'option', | 317 | valueType: 'option', |
318 | key: 'option', | 318 | key: 'option', |
319 | render: (text, record) => { | 319 | render: (text, record) => { |
320 | - console.log('record' + JSON.stringify(record)); | ||
321 | return [ | 320 | return [ |
322 | /*<InvoiceRecordDetailModal | 321 | /*<InvoiceRecordDetailModal |
323 | key="detail" | 322 | key="detail" |
@@ -571,6 +570,14 @@ const InvoicePage = () => { | @@ -571,6 +570,14 @@ const InvoicePage = () => { | ||
571 | </ModalForm> | 570 | </ModalForm> |
572 | )} | 571 | )} |
573 | </>, | 572 | </>, |
573 | + <> | ||
574 | + {record.paths.includes('INVOICING') && ( | ||
575 | + <ManualInvoicingModal | ||
576 | + key={'ManualInvoicingModal'} | ||
577 | + record={record} | ||
578 | + ></ManualInvoicingModal> | ||
579 | + )} | ||
580 | + </>, | ||
574 | ], | 581 | ], |
575 | }, | 582 | }, |
576 | ]; | 583 | ]; |
@@ -853,7 +860,7 @@ const InvoicePage = () => { | @@ -853,7 +860,7 @@ const InvoicePage = () => { | ||
853 | 'AUDITING_NOT_PASSED', | 860 | 'AUDITING_NOT_PASSED', |
854 | 'CANCELED', | 861 | 'CANCELED', |
855 | ], | 862 | ], |
856 | - needBuildDetails: false, | 863 | + needBuildDetails: true, |
857 | needBuildSubOrders: true, | 864 | needBuildSubOrders: true, |
858 | }, | 865 | }, |
859 | }); | 866 | }); |