Commit 0371e839b1dd06fb6efa405df0184a7e2c3250c0

Authored by 曾国涛
1 parent 230d5a97

feat: 手动开票功能开发

src/pages/Client/index.tsx
... ... @@ -17,22 +17,6 @@ export const waitTime = async (time: number = 100) => {
17 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 20 const columns: ProColumns<GithubIssueItem>[] = [
37 21 {
38 22 dataIndex: 'index',
... ... @@ -150,16 +134,14 @@ const columns: ProColumns&lt;GithubIssueItem&gt;[] = [
150 134 export default () => {
151 135 const actionRef = useRef<ActionType>();
152 136 return (
153   - <ProTable<GithubIssueItem>
  137 + <ProTable
154 138 columns={columns}
155 139 actionRef={actionRef}
156 140 cardBordered
157 141 request={async (params, sort, filter) => {
158 142 console.log(sort, filter);
159 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 145 params,
164 146 });
165 147 }}
... ...
src/pages/Invoice/components/ManualInvoicingModal.tsx
  1 +import { RESPONSE_CODE } from '@/constants/enum';
1 2 import UploadC from '@/pages/Invoice/components/UploadSingleImg';
2   -import { postOrderErpOrderStagesUpload } from '@/services';
  3 +import {
  4 + postOrderErpOrderStagesUpload,
  5 + postServiceInvoiceDealInvoicingResult,
  6 +} from '@/services';
3 7 import {
4 8 ModalForm,
5 9 ProCard,
6 10 ProFormDatePicker,
  11 + ProFormDigit,
7 12 ProFormList,
  13 + ProFormMoney,
8 14 ProFormText,
9 15 } from '@ant-design/pro-components';
10 16 import { Col, Form, Row, message } from 'antd';
11 17 import { RcFile } from 'antd/es/upload';
  18 +import { useEffect } from 'react';
12 19  
13 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 25 return (
16   - <ModalForm<{
17   - name: string;
18   - company: string;
19   - }>
  26 + <ModalForm
20 27 title="手动开票"
21 28 trigger={<a type="primary">手动开票</a>}
22   - width={400}
  29 + width={600}
23 30 layout={'horizontal'}
24 31 form={form}
25 32 autoFocusFirstInput
... ... @@ -29,21 +36,48 @@ export default ({ record }) =&gt; {
29 36 }}
30 37 submitTimeout={2000}
31 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 67 <ProFormDatePicker
  68 + rules={[{ required: true, message: '此项为必填项' }]}
40 69 fieldProps={{
41   - format: 'YY-MM-DD',
  70 + format: 'YYYY-MM-DD',
42 71 }}
43 72 name="invoicingDate"
44 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 81 <Row>
48 82 <Col span={4}>上传发票</Col>
49 83 <Col span={20}>
... ... @@ -69,16 +103,15 @@ export default ({ record }) =&gt; {
69 103 </Col>
70 104 </Row>
71 105 <ProFormList
72   - name="invoiceDetails"
  106 + name="invoiceDetailDtoList"
73 107 label="明细"
74 108 creatorButtonProps={false}
75 109 copyIconProps={false}
76   - itemRender={({ listDom, action }, { index }) => (
  110 + itemRender={({ listDom }, { index }) => (
77 111 <ProCard
78 112 bordered
79 113 style={{ marginBlockEnd: 8 }}
80 114 title={`明细${index + 1}`}
81   - extra={action}
82 115 bodyStyle={{ paddingBlockEnd: 0 }}
83 116 >
84 117 {listDom}
... ... @@ -86,7 +119,16 @@ export default ({ record }) =&gt; {
86 119 )}
87 120 creatorRecord={{ name: '', items: [{ name: '' }] }}
88 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 132 </ModalForm>
91 133 );
92 134 };
... ...
src/pages/Invoice/index.tsx
... ... @@ -317,7 +317,6 @@ const InvoicePage = () =&gt; {
317 317 valueType: 'option',
318 318 key: 'option',
319 319 render: (text, record) => {
320   - console.log('record' + JSON.stringify(record));
321 320 return [
322 321 /*<InvoiceRecordDetailModal
323 322 key="detail"
... ... @@ -571,6 +570,14 @@ const InvoicePage = () =&gt; {
571 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 = () =&gt; {
853 860 'AUDITING_NOT_PASSED',
854 861 'CANCELED',
855 862 ],
856   - needBuildDetails: false,
  863 + needBuildDetails: true,
857 864 needBuildSubOrders: true,
858 865 },
859 866 });
... ...