Commit 0d3aa8319362240531c2a18d56d2caba9cb3505c

Authored by 曾国涛
1 parent e7075134

feat: 开票功能开发

src/pages/Order/components/InvoicingDrawerForm.tsx
1 1 import {
2 2 DrawerForm,
3   - ProForm,
4   - ProFormDateRangePicker,
  3 + ProFormList,
  4 + ProFormMoney,
5 5 ProFormSelect,
6 6 ProFormText,
  7 + ProFormUploadDragger,
7 8 } from '@ant-design/pro-components';
8 9 import { Form, message } from 'antd';
9 10  
... ... @@ -15,7 +16,7 @@ const waitTime = (time: number = 100) => {
15 16 });
16 17 };
17 18  
18   -export default ({ subOrders, totalPayment, onClose }) => {
  19 +export default ({ subOrders, onClose }) => {
19 20 const [form] = Form.useForm<{ name: string; company: string }>();
20 21  
21 22 return (
... ... @@ -23,7 +24,7 @@ export default ({ subOrders, totalPayment, onClose }) =&gt; {
23 24 name: string;
24 25 company: string;
25 26 }>
26   - title="新建表单"
  27 + title="申请开票"
27 28 resize={{
28 29 onResize() {
29 30 console.log('resize!');
... ... @@ -48,85 +49,134 @@ export default ({ subOrders, totalPayment, onClose }) =&gt; {
48 49 await waitTime(2000);
49 50 console.log(values);
50 51 console.log(subOrders);
51   - console.log(totalPayment);
52 52 message.success('提交成功');
53 53 onClose();
54 54 // 不返回不会关闭弹框
55 55 return true;
56 56 }}
57 57 >
58   - <ProForm.Group>
59   - <ProFormText
60   - name="name"
61   - width="md"
62   - label="签约客户名称"
63   - tooltip="最长为 24 位"
64   - placeholder="请输入名称"
65   - />
66   - <ProFormText
67   - rules={[
68   - {
69   - required: true,
70   - },
71   - ]}
72   - width="md"
73   - name="company"
74   - label="我方公司名称"
75   - placeholder="请输入名称"
76   - />
77   - </ProForm.Group>
78   - <ProForm.Group>
79   - <ProFormText
80   - width="md"
81   - name="contract"
82   - label="合同名称"
83   - placeholder="请输入名称"
84   - />
85   - <ProFormDateRangePicker name="contractTime" label="合同生效时间" />
86   - </ProForm.Group>
87   - <ProForm.Group>
88   - <ProFormSelect
89   - options={[
90   - {
91   - value: 'chapter',
92   - label: '盖章后生效',
93   - },
94   - ]}
95   - width="xs"
96   - name="useMode"
97   - label="合同约定生效方式"
98   - />
99   - <ProFormSelect
100   - width="xs"
101   - options={[
102   - {
103   - value: 'time',
104   - label: '履行完终止',
105   - },
106   - ]}
107   - formItemProps={{
108   - style: {
109   - margin: 0,
110   - },
111   - }}
112   - name="unusedMode"
113   - label="合同约定失效效方式"
114   - />
115   - </ProForm.Group>
116   - <ProFormText width="sm" name="id" label="主合同编号" />
117 58 <ProFormText
118   - name="project"
119   - disabled
120   - label="项目名称"
121   - initialValue="xxxx项目"
  59 + style={{ padding: 0 }}
  60 + width="md"
  61 + name="name"
  62 + label="开票订单"
122 63 />
  64 + <ProFormList
  65 + name="subOrders"
  66 + creatorButtonProps={{
  67 + creatorButtonText: '新建',
  68 + icon: false,
  69 + type: 'link',
  70 + style: { width: 'unset' },
  71 + }}
  72 + min={1}
  73 + copyIconProps={false}
  74 + deleteIconProps={{ tooltipText: '删除' }}
  75 + itemRender={({ listDom, action }) => (
  76 + <div
  77 + style={{
  78 + display: 'inline-flex',
  79 + marginInlineEnd: 25,
  80 + }}
  81 + >
  82 + {listDom}
  83 + {action}
  84 + </div>
  85 + )}
  86 + >
  87 + <ProFormText allowClear={false} width="xs" name={['name']} />
  88 + </ProFormList>
123 89 <ProFormText
124   - width="xs"
125   - name="mangerName"
126   - disabled
127   - label="商务经理"
128   - initialValue="启途"
  90 + rules={[
  91 + {
  92 + required: true,
  93 + },
  94 + ]}
  95 + width="md"
  96 + name="company"
  97 + label="购方名称"
  98 + placeholder="请输入名称"
129 99 />
  100 + <ProFormText
  101 + rules={[
  102 + {
  103 + required: true,
  104 + },
  105 + ]}
  106 + width="md"
  107 + name="company"
  108 + label="购方税号"
  109 + placeholder="请输入名称"
  110 + />
  111 + <ProFormText
  112 + rules={[
  113 + {
  114 + required: true,
  115 + },
  116 + ]}
  117 + width="md"
  118 + name="company"
  119 + label="开户银行"
  120 + placeholder="请输入名称"
  121 + />
  122 + <ProFormText
  123 + rules={[
  124 + {
  125 + required: true,
  126 + },
  127 + ]}
  128 + width="md"
  129 + name="company"
  130 + label="开户行账号"
  131 + placeholder="请输入名称"
  132 + />
  133 + <ProFormMoney
  134 + label="开票金额"
  135 + name="amount2"
  136 + locale="en-GB"
  137 + initialValue={22.22}
  138 + />
  139 + <ProFormSelect
  140 + name="select"
  141 + label="开具类型"
  142 + valueEnum={{
  143 + open: '未解决',
  144 + closed: '已解决',
  145 + }}
  146 + placeholder="Please select a country"
  147 + rules={[{ required: true, message: 'Please select your country!' }]}
  148 + />
  149 + <ProFormSelect
  150 + name="select"
  151 + label="开票类型"
  152 + valueEnum={{
  153 + open: '未解决',
  154 + closed: '已解决',
  155 + }}
  156 + placeholder="Please select a country"
  157 + rules={[{ required: true, message: 'Please select your country!' }]}
  158 + />
  159 + <ProFormSelect
  160 + name="select"
  161 + label="开票收款单位"
  162 + valueEnum={{
  163 + open: '未解决',
  164 + closed: '已解决',
  165 + }}
  166 + placeholder="Please select a country"
  167 + rules={[{ required: true, message: 'Please select your country!' }]}
  168 + />
  169 + <ProFormSelect
  170 + name="select"
  171 + label="是否加急"
  172 + valueEnum={{
  173 + open: '未解决',
  174 + closed: '已解决',
  175 + }}
  176 + placeholder="Please select a country"
  177 + rules={[{ required: true, message: 'Please select your country!' }]}
  178 + />
  179 + <ProFormUploadDragger name="drag-pic" label="拖拽上传" />
130 180 </DrawerForm>
131 181 );
132 182 };
... ...
src/pages/Order/index.tsx
... ... @@ -3972,18 +3972,20 @@ const OrderPage = () =&gt; {
3972 3972 );
3973 3973 }
3974 3974  
3975   - <Button
3976   - type="primary"
3977   - key="out"
3978   - onClick={() => {
3979   - setIsEdit(false);
3980   - setIsMainOrder(true);
3981   - setInvoicingDrawerFormVisible(true);
3982   - }}
3983   - disabled={selectedSubOrderKeys?.length === 0}
3984   - >
3985   - 申请开票
3986   - </Button>;
  3975 + toolBtns.push(
  3976 + <Button
  3977 + type="primary"
  3978 + key="applyInvoicing"
  3979 + onClick={() => {
  3980 + setIsEdit(false);
  3981 + setIsMainOrder(true);
  3982 + setInvoicingDrawerFormVisible(true);
  3983 + }}
  3984 + disabled={selectedSubOrderKeys?.length === 0}
  3985 + >
  3986 + 申请开票
  3987 + </Button>,
  3988 + );
3987 3989  
3988 3990 if (rolePath?.includes('mergeInvoicing')) {
3989 3991 toolBtns.push(
... ...