Commit b6fd460776e92cae8918e8296b0f622b72e7e228
1 parent
3c8b3518
Merge branch 'master' of http://39.108.227.113:8001/zhusen/canrd-erp-front
# Conflicts: # src/services/request.ts组件进行了条件渲染优化,以确保在有课题组ID的情况下才渲染成员添加相关的UI组件。 另外,对definition.ts文件中的OrderStagesCheckDo和OrderStagesSelDo接口进行了数据类型调整,以适配新的业务需求。 BREAKING CHANGE: 现在添加课题组成员时需要提供课题组ID,相关组件在没有课题组ID的情况下将不会渲染成员添加选项。
Showing
8 changed files
with
215 additions
and
643 deletions
src/pages/Invoice/Invoice/components/InvoiceDetailImportModal.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | -import { postServiceInvoiceImportInvoiceDetails } from '@/services'; | |
3 | -import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components'; | |
4 | -import { Button, Form, message } from 'antd'; | |
5 | - | |
6 | -export default ({ recordId }) => { | |
7 | - const [form] = Form.useForm(); | |
8 | - return ( | |
9 | - <ModalForm | |
10 | - title="新建表单" | |
11 | - trigger={<Button type="primary">导入明细</Button>} | |
12 | - form={form} | |
13 | - autoFocusFirstInput | |
14 | - modalProps={{ | |
15 | - destroyOnClose: true, | |
16 | - onCancel: () => console.log('run'), | |
17 | - }} | |
18 | - submitTimeout={2000} | |
19 | - onFinish={async (values) => { | |
20 | - const formData = new FormData(); | |
21 | - // console.log(fileList[0] as RcFile) | |
22 | - // formData.append('file', fileList[0] as RcFile); | |
23 | - formData.append('invoiceRecordId', recordId); | |
24 | - formData.append('detailsExcel', values.detailsExcel[0].originFileObj); | |
25 | - // You can use any AJAX library you like | |
26 | - const res = await postServiceInvoiceImportInvoiceDetails({ | |
27 | - data: formData, | |
28 | - headers: { | |
29 | - 'Content-Type': | |
30 | - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
31 | - }, | |
32 | - }); | |
33 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
34 | - message.success('导入成功'); | |
35 | - return true; | |
36 | - } | |
37 | - }} | |
38 | - > | |
39 | - <ProFormUploadDragger name="detailsExcel" label="导入明细表" /> | |
40 | - </ModalForm> | |
41 | - ); | |
42 | -}; |
src/pages/Invoice/Invoice/components/InvoiceDetailTable.tsx deleted
100644 → 0
1 | -import InvoiceDetailImportModal from '@/pages/Invoice/Invoice/components/InvoiceDetailImportModal'; | |
2 | -import { InvoiceProjectSelect } from '@/pages/Invoice/Invoice/components/InvoiceProjectSelect'; | |
3 | -import { | |
4 | - ActionType, | |
5 | - EditableProTable, | |
6 | - ProCard, | |
7 | - ProColumns, | |
8 | - ProFormField, | |
9 | -} from '@ant-design/pro-components'; | |
10 | -import { useEffect, useRef, useState } from 'react'; | |
11 | - | |
12 | -export default ({ recordId, details, updateDetails, readOnly }) => { | |
13 | - const [editableKeys, setEditableRowKeys] = useState([]); | |
14 | - const ref = useRef<ActionType>(); | |
15 | - useEffect(() => { | |
16 | - updateDetails(details); | |
17 | - }, []); | |
18 | - | |
19 | - useEffect(() => { | |
20 | - setEditableRowKeys(details?.map((item) => item.tid)); | |
21 | - }, [details]); | |
22 | - const columns: ProColumns[] = [ | |
23 | - { | |
24 | - title: '项目名称', | |
25 | - dataIndex: 'projectName', | |
26 | - width: 200, | |
27 | - ellipsis: true, | |
28 | - readonly: readOnly, | |
29 | - renderFormItem: () => { | |
30 | - return <InvoiceProjectSelect readOnly={readOnly} />; | |
31 | - }, | |
32 | - }, | |
33 | - { | |
34 | - title: '规格型号', | |
35 | - readonly: readOnly, | |
36 | - dataIndex: 'specification', | |
37 | - valueType: 'text', | |
38 | - ellipsis: true, | |
39 | - }, | |
40 | - { | |
41 | - title: '单位', | |
42 | - readonly: readOnly, | |
43 | - dataIndex: 'unit', | |
44 | - valueType: 'text', | |
45 | - ellipsis: true, | |
46 | - }, | |
47 | - { | |
48 | - title: '数量', | |
49 | - readonly: readOnly, | |
50 | - dataIndex: 'quantity', | |
51 | - valueType: 'digit', | |
52 | - ellipsis: true, | |
53 | - }, | |
54 | - { | |
55 | - title: '单价', | |
56 | - readonly: readOnly, | |
57 | - dataIndex: 'price', | |
58 | - valueType: 'digit', | |
59 | - ellipsis: true, | |
60 | - }, | |
61 | - { | |
62 | - title: '金额', | |
63 | - readonly: readOnly, | |
64 | - dataIndex: 'totalPrice', | |
65 | - valueType: 'digit', | |
66 | - ellipsis: true, | |
67 | - }, | |
68 | - { | |
69 | - title: '税率/征收率', | |
70 | - readonly: true, | |
71 | - dataIndex: 'taxRate', | |
72 | - valueType: () => ({ | |
73 | - type: 'percent', | |
74 | - }), | |
75 | - ellipsis: true, | |
76 | - }, | |
77 | - { | |
78 | - title: '税额', | |
79 | - readonly: true, | |
80 | - dataIndex: 'taxPrice', | |
81 | - valueType: 'digit', | |
82 | - ellipsis: true, | |
83 | - }, | |
84 | - { | |
85 | - title: '操作', | |
86 | - valueType: 'option', | |
87 | - width: 100, | |
88 | - render: () => { | |
89 | - return null; | |
90 | - }, | |
91 | - }, | |
92 | - ]; | |
93 | - | |
94 | - return ( | |
95 | - <> | |
96 | - <EditableProTable | |
97 | - columns={columns} | |
98 | - actionRef={ref} | |
99 | - rowKey="tid" | |
100 | - scroll={{ | |
101 | - x: 960, | |
102 | - }} | |
103 | - value={details} | |
104 | - controlled={true} | |
105 | - recordCreatorProps={ | |
106 | - readOnly | |
107 | - ? false | |
108 | - : { | |
109 | - newRecordType: 'dataSource', | |
110 | - record: () => ({ | |
111 | - tid: Date.now(), | |
112 | - }), | |
113 | - } | |
114 | - } | |
115 | - toolBarRender={() => { | |
116 | - return [ | |
117 | - <InvoiceDetailImportModal key={'import'} recordId={recordId} />, | |
118 | - ]; | |
119 | - }} | |
120 | - editable={{ | |
121 | - type: 'multiple', | |
122 | - editableKeys, | |
123 | - actionRender: (row, config, defaultDoms) => { | |
124 | - return [defaultDoms.delete]; | |
125 | - }, | |
126 | - | |
127 | - onValuesChange: (record, recordList) => { | |
128 | - //修改recordList中tid为record.tid的元素,将它的specification属性设置为invoiceProject的specification属性 | |
129 | - const records = recordList.map((item) => { | |
130 | - return item; | |
131 | - }); | |
132 | - updateDetails(records); | |
133 | - }, | |
134 | - }} | |
135 | - /> | |
136 | - { | |
137 | - <ProCard title="表格数据" headerBordered collapsible defaultCollapsed> | |
138 | - <ProFormField | |
139 | - ignoreFormItem | |
140 | - fieldProps={{ | |
141 | - style: { | |
142 | - width: '100%', | |
143 | - }, | |
144 | - }} | |
145 | - mode="read" | |
146 | - valueType="jsonCode" | |
147 | - text={JSON.stringify(details)} | |
148 | - /> | |
149 | - </ProCard> | |
150 | - } | |
151 | - </> | |
152 | - ); | |
153 | -}; |
src/pages/Invoice/Invoice/components/InvoiceProjectSelect.tsx deleted
100644 → 0
1 | -import { postServiceConstListInvoiceDetailNames } from '@/services'; | |
2 | -import { Select, Tooltip } from 'antd'; | |
3 | -import { useState } from 'react'; | |
4 | - | |
5 | -export const InvoiceProjectSelect = ({ readOnly, value, onChange }) => { | |
6 | - const [options, setOptions] = useState<any[]>([]); | |
7 | - // 定义防抖函数 | |
8 | - let timeoutId = null; | |
9 | - const fetchOptions = async (keywords) => { | |
10 | - clearTimeout(timeoutId); | |
11 | - timeoutId = setTimeout(async () => { | |
12 | - const res = await postServiceConstListInvoiceDetailNames({ | |
13 | - data: { | |
14 | - nameLike: keywords, | |
15 | - }, | |
16 | - }); | |
17 | - const data = res.data; | |
18 | - | |
19 | - setOptions( | |
20 | - data.map((item) => { | |
21 | - console.log(item); | |
22 | - return { | |
23 | - key: item.id, | |
24 | - label: | |
25 | - '*' + | |
26 | - item.productAndServiceCatagoryAbbreviation + | |
27 | - '*' + | |
28 | - item?.name, | |
29 | - value: | |
30 | - '*' + | |
31 | - item.productAndServiceCatagoryAbbreviation + | |
32 | - '*' + | |
33 | - item?.name, | |
34 | - ...item, | |
35 | - }; | |
36 | - }), | |
37 | - ); | |
38 | - // 这里可以放置实际的搜索逻辑,比如发起网络请求等 | |
39 | - }, 500); // 设置延迟时间,单位毫秒 | |
40 | - }; | |
41 | - | |
42 | - return readOnly ? ( | |
43 | - <Tooltip title={value}>{value}</Tooltip> | |
44 | - ) : ( | |
45 | - <Select | |
46 | - key="project" | |
47 | - /*readonly={readonly}*/ | |
48 | - showSearch | |
49 | - placeholder="请选择开票项目" | |
50 | - filterOption={(input, option) => (option?.label ?? '').includes(input)} | |
51 | - onChange={(e) => { | |
52 | - onChange(e); | |
53 | - }} | |
54 | - defaultValue={value} | |
55 | - options={options} | |
56 | - onSearch={(e) => { | |
57 | - fetchOptions(e); | |
58 | - }} | |
59 | - /> | |
60 | - ); | |
61 | -}; |
src/pages/Invoice/Invoice/components/invoiceWriteOffModal.tsx
0 → 100644
1 | +import { | |
2 | + EditableFormInstance, | |
3 | + EditableProTable, | |
4 | + ModalForm, | |
5 | + ProCard, | |
6 | + ProColumns, | |
7 | + ProForm, | |
8 | + ProFormDependency, | |
9 | + ProFormField, | |
10 | + ProFormInstance, | |
11 | + ProFormSwitch, | |
12 | +} from '@ant-design/pro-components'; | |
13 | +import { Button } from 'antd'; | |
14 | +import React, { useRef, useState } from 'react'; | |
15 | + | |
16 | +type DataSourceType = { | |
17 | + id: React.Key; | |
18 | + title?: string; | |
19 | + decs?: string; | |
20 | + state?: string; | |
21 | + created_at?: number; | |
22 | + update_at?: number; | |
23 | + children?: DataSourceType[]; | |
24 | +}; | |
25 | + | |
26 | +const defaultData: DataSourceType[] = [ | |
27 | + { | |
28 | + id: '624748504', | |
29 | + title: '活动名称一', | |
30 | + decs: '这个活动真好玩', | |
31 | + state: 'open', | |
32 | + created_at: 1590486176000, | |
33 | + update_at: 1590486176000, | |
34 | + }, | |
35 | + { | |
36 | + id: '624691229', | |
37 | + title: '活动名称二', | |
38 | + decs: '这个活动真好玩', | |
39 | + state: 'closed', | |
40 | + created_at: 1590481162000, | |
41 | + update_at: 1590481162000, | |
42 | + }, | |
43 | +]; | |
44 | + | |
45 | +let i = 0; | |
46 | + | |
47 | +export default () => { | |
48 | + const [editableKeys, setEditableRowKeys] = useState<React.Key[]>(() => []); | |
49 | + const [controlled, setControlled] = useState<boolean>(false); | |
50 | + const formRef = useRef<ProFormInstance<any>>(); | |
51 | + const editorFormRef = useRef<EditableFormInstance<DataSourceType>>(); | |
52 | + const columns: ProColumns<DataSourceType>[] = [ | |
53 | + { | |
54 | + title: '活动名称', | |
55 | + dataIndex: 'title', | |
56 | + formItemProps: () => { | |
57 | + return { | |
58 | + rules: [{ required: true, message: '此项为必填项' }], | |
59 | + }; | |
60 | + }, | |
61 | + }, | |
62 | + { | |
63 | + title: '状态', | |
64 | + key: 'state', | |
65 | + dataIndex: 'state', | |
66 | + valueType: 'select', | |
67 | + valueEnum: { | |
68 | + all: { text: '全部', status: 'Default' }, | |
69 | + open: { | |
70 | + text: '未解决', | |
71 | + status: 'Error', | |
72 | + }, | |
73 | + closed: { | |
74 | + text: '已解决', | |
75 | + status: 'Success', | |
76 | + }, | |
77 | + }, | |
78 | + }, | |
79 | + { | |
80 | + title: '描述', | |
81 | + dataIndex: 'decs', | |
82 | + }, | |
83 | + { | |
84 | + title: '活动时间', | |
85 | + dataIndex: 'created_at', | |
86 | + valueType: 'date', | |
87 | + }, | |
88 | + { | |
89 | + title: '操作', | |
90 | + valueType: 'option', | |
91 | + width: 200, | |
92 | + render: (text, record, _, action) => [ | |
93 | + <a | |
94 | + key="editable" | |
95 | + onClick={() => { | |
96 | + action?.startEditable?.(record.id, record); | |
97 | + }} | |
98 | + > | |
99 | + 编辑 | |
100 | + </a>, | |
101 | + <a | |
102 | + key="delete" | |
103 | + onClick={() => { | |
104 | + const tableDataSource = formRef.current?.getFieldValue( | |
105 | + 'table', | |
106 | + ) as DataSourceType[]; | |
107 | + formRef.current?.setFieldsValue({ | |
108 | + table: tableDataSource.filter((item) => item.id !== record.id), | |
109 | + }); | |
110 | + }} | |
111 | + > | |
112 | + 删除 | |
113 | + </a>, | |
114 | + ], | |
115 | + }, | |
116 | + ]; | |
117 | + | |
118 | + return ( | |
119 | + <ModalForm | |
120 | + formRef={formRef} | |
121 | + initialValues={{ | |
122 | + table: defaultData, | |
123 | + }} | |
124 | + trigger={<Button type="primary">核销</Button>} | |
125 | + validateTrigger="onBlur" | |
126 | + > | |
127 | + <EditableProTable<DataSourceType> | |
128 | + rowKey="id" | |
129 | + scroll={{ | |
130 | + x: 960, | |
131 | + }} | |
132 | + editableFormRef={editorFormRef} | |
133 | + headerTitle="可编辑表格" | |
134 | + maxLength={5} | |
135 | + name="table" | |
136 | + controlled={controlled} | |
137 | + recordCreatorProps={false} | |
138 | + toolBarRender={() => [ | |
139 | + <ProFormSwitch | |
140 | + key="render" | |
141 | + fieldProps={{ | |
142 | + style: { | |
143 | + marginBlockEnd: 0, | |
144 | + }, | |
145 | + checked: controlled, | |
146 | + onChange: (value) => { | |
147 | + setControlled(value); | |
148 | + }, | |
149 | + }} | |
150 | + checkedChildren="数据更新通知 Form" | |
151 | + unCheckedChildren="保存后通知 Form" | |
152 | + noStyle | |
153 | + />, | |
154 | + <Button | |
155 | + key="rows" | |
156 | + onClick={() => { | |
157 | + const rows = editorFormRef.current?.getRowsData?.(); | |
158 | + console.log(rows); | |
159 | + }} | |
160 | + > | |
161 | + 获取 table 的数据 | |
162 | + </Button>, | |
163 | + ]} | |
164 | + columns={columns} | |
165 | + editable={{ | |
166 | + type: 'multiple', | |
167 | + editableKeys, | |
168 | + onChange: setEditableRowKeys, | |
169 | + actionRender: (row, config, defaultDom) => { | |
170 | + return [ | |
171 | + defaultDom.save, | |
172 | + defaultDom.delete, | |
173 | + defaultDom.cancel, | |
174 | + <a | |
175 | + key="set" | |
176 | + onClick={() => { | |
177 | + console.log(config.index); | |
178 | + i++; | |
179 | + editorFormRef.current?.setRowData?.(config.index!, { | |
180 | + title: '动态设置的title' + i, | |
181 | + }); | |
182 | + }} | |
183 | + > | |
184 | + 动态设置此项 | |
185 | + </a>, | |
186 | + ]; | |
187 | + }, | |
188 | + }} | |
189 | + /> | |
190 | + <ProForm.Item> | |
191 | + <ProCard title="表格数据" headerBordered collapsible defaultCollapsed> | |
192 | + <ProFormDependency name={['table']}> | |
193 | + {({ table }) => { | |
194 | + return ( | |
195 | + <ProFormField | |
196 | + ignoreFormItem | |
197 | + fieldProps={{ | |
198 | + style: { | |
199 | + width: '100%', | |
200 | + }, | |
201 | + }} | |
202 | + mode="read" | |
203 | + valueType="jsonCode" | |
204 | + text={JSON.stringify(table)} | |
205 | + /> | |
206 | + ); | |
207 | + }} | |
208 | + </ProFormDependency> | |
209 | + </ProCard> | |
210 | + </ProForm.Item> | |
211 | + </ModalForm> | |
212 | + ); | |
213 | +}; | ... | ... |
src/pages/Invoice/Invoice/index.tsx
... | ... | @@ -3,6 +3,7 @@ import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
3 | 3 | import AddInvoiceDrawerForm from '@/pages/Invoice/Invoice/components/AddInvoiceDrawerForm'; |
4 | 4 | import BankImportModal from '@/pages/Invoice/Invoice/components/BankImportModal'; |
5 | 5 | import InvoiceVerificationModal from '@/pages/Invoice/Invoice/components/InvoiceVerificationModal'; |
6 | +import InvoiceWriteOffModal from '@/pages/Invoice/Invoice/components/invoiceWriteOffModal'; | |
6 | 7 | import { INVOICE_COLUMNS } from '@/pages/Invoice/constant'; |
7 | 8 | import { INVOCING_STATUS, PAYEE_OPTIONS } from '@/pages/Order/constant'; |
8 | 9 | import { |
... | ... | @@ -206,6 +207,7 @@ const InvoiceRecord = () => { |
206 | 207 | }} |
207 | 208 | key="add" |
208 | 209 | ></AddInvoiceDrawerForm>, |
210 | + <InvoiceWriteOffModal key="writeOff" />, | |
209 | 211 | ]} |
210 | 212 | /> |
211 | 213 | ... | ... |
src/pages/Invoice/InvoiceVerification/components/AddInvoiceDrawerForm.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | -import { PAYEE_OPTIONS } from '@/pages/Order/constant'; | |
3 | -import { | |
4 | - postServiceInvoiceAddInvoice, | |
5 | - postServiceOrderQuerySalesCode, | |
6 | -} from '@/services'; | |
7 | -import { enumToSelect } from '@/utils'; | |
8 | -import { PlusOutlined } from '@ant-design/icons'; | |
9 | -import { | |
10 | - DrawerForm, | |
11 | - ProFormDateTimePicker, | |
12 | - ProFormGroup, | |
13 | - ProFormList, | |
14 | - ProFormMoney, | |
15 | - ProFormSelect, | |
16 | - ProFormText, | |
17 | - ProFormTextArea, | |
18 | -} from '@ant-design/pro-components'; | |
19 | -import { Button, Form, message } from 'antd'; | |
20 | -import { useEffect, useState } from 'react'; | |
21 | - | |
22 | -export default ({ onClose }) => { | |
23 | - const [form] = Form.useForm<{ | |
24 | - invoiceNumber: ''; | |
25 | - invoiceStatus: ''; | |
26 | - purchaser: ''; | |
27 | - payee: ''; | |
28 | - contacts: ''; | |
29 | - sale: ''; | |
30 | - invoicingTime: ''; | |
31 | - notes: ''; | |
32 | - mainOrderIdObjs: [ | |
33 | - { | |
34 | - mainOrderId: ''; | |
35 | - }, | |
36 | - ]; | |
37 | - money: ''; | |
38 | - }>(); | |
39 | - const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
40 | - const getSalesCodeOptions = async () => { | |
41 | - const res = await postServiceOrderQuerySalesCode(); | |
42 | - let options = res.data?.map((item) => { | |
43 | - return { | |
44 | - label: item.userName, | |
45 | - value: item.userName, | |
46 | - number: item.number, | |
47 | - }; | |
48 | - }); | |
49 | - setSalesCodeOptions(options); | |
50 | - }; | |
51 | - useEffect(() => { | |
52 | - getSalesCodeOptions(); | |
53 | - }, []); | |
54 | - return ( | |
55 | - <DrawerForm<{ | |
56 | - invoiceNumber: string; | |
57 | - invoiceStatus: string; | |
58 | - purchaser: string; | |
59 | - payee: string; | |
60 | - contacts: string; | |
61 | - sale: string; | |
62 | - invoicingTime: Date; | |
63 | - notes: string; | |
64 | - mainOrderIdObjs: [ | |
65 | - { | |
66 | - mainOrderId: string; | |
67 | - }, | |
68 | - ]; | |
69 | - money: string; | |
70 | - }> | |
71 | - title="新增开票" | |
72 | - resize={{ | |
73 | - onResize() { | |
74 | - console.log('resize!'); | |
75 | - }, | |
76 | - maxWidth: window.innerWidth * 0.8, | |
77 | - minWidth: 500, | |
78 | - }} | |
79 | - form={form} | |
80 | - trigger={ | |
81 | - <Button type="primary"> | |
82 | - <PlusOutlined /> | |
83 | - 新增 | |
84 | - </Button> | |
85 | - } | |
86 | - autoFocusFirstInput | |
87 | - drawerProps={{ | |
88 | - destroyOnClose: true, | |
89 | - }} | |
90 | - submitTimeout={2000} | |
91 | - onFinish={async (values) => { | |
92 | - console.log(values); | |
93 | - const mainOrderIds = values.mainOrderIdObjs.flatMap( | |
94 | - (item) => item.mainOrderId, | |
95 | - ); | |
96 | - let attrs = { ...values, mainOrderIds }; | |
97 | - let res = await postServiceInvoiceAddInvoice({ | |
98 | - data: { ...attrs }, | |
99 | - }); | |
100 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
101 | - message.success(res.message); | |
102 | - } else { | |
103 | - message.error(res.message); | |
104 | - return false; | |
105 | - } | |
106 | - onClose(); | |
107 | - // 不返回不会关闭弹框 | |
108 | - return true; | |
109 | - }} | |
110 | - > | |
111 | - <ProFormText | |
112 | - name="invoiceNumber" | |
113 | - width="md" | |
114 | - label="发票号码" | |
115 | - placeholder="请输入名称" | |
116 | - rules={[{ required: true, message: '请输入名称!' }]} | |
117 | - /> | |
118 | - <ProFormSelect | |
119 | - name="invoiceStatus" | |
120 | - label="发票类型" | |
121 | - valueEnum={{ | |
122 | - SPECIALLY_INVOICED: '专票', | |
123 | - COMMON_INVOICED: '普票', | |
124 | - }} | |
125 | - rules={[{ required: true, message: '请选择发票类型!' }]} | |
126 | - /> | |
127 | - <ProFormText | |
128 | - name="purchaser" | |
129 | - width="md" | |
130 | - label="购买方" | |
131 | - placeholder="请输入购买方" | |
132 | - rules={[{ required: true, message: '请输入购买方!' }]} | |
133 | - /> | |
134 | - <ProFormSelect | |
135 | - placeholder="收款单位" | |
136 | - name="payee" | |
137 | - width="lg" | |
138 | - key="payee" | |
139 | - showSearch | |
140 | - label="开票收款单位" | |
141 | - tooltip="财务开票将依据这个字段,选择对应的公司开票" | |
142 | - options={enumToSelect(PAYEE_OPTIONS)} | |
143 | - /> | |
144 | - <ProFormText | |
145 | - name="contacts" | |
146 | - width="md" | |
147 | - label="联系人" | |
148 | - placeholder="请输入联系人" | |
149 | - rules={[{ required: true, message: '请输入联系人!' }]} | |
150 | - /> | |
151 | - <ProFormSelect | |
152 | - name="sale" | |
153 | - key="sale" | |
154 | - width="lg" | |
155 | - showSearch | |
156 | - label="销售代表" | |
157 | - placeholder="请选择销售代表" | |
158 | - options={salesCodeOptions} | |
159 | - /> | |
160 | - <ProFormDateTimePicker | |
161 | - name="invoicingTime" | |
162 | - label="开票时间" | |
163 | - fieldProps={{ | |
164 | - format: (value) => value.format('YYYY-MM-DD'), | |
165 | - }} | |
166 | - rules={[{ required: true, message: '请输入开票时间!' }]} | |
167 | - /> | |
168 | - <ProFormTextArea name="notes" label="备注" placeholder="请输入名称" /> | |
169 | - <ProFormList | |
170 | - name="mainOrderIdObjs" | |
171 | - label="订单号" | |
172 | - min={1} | |
173 | - copyIconProps={false} | |
174 | - deleteIconProps={{ | |
175 | - tooltipText: '删除', | |
176 | - }} | |
177 | - initialValue={[ | |
178 | - { | |
179 | - mainOrderId: '', | |
180 | - }, | |
181 | - ]} | |
182 | - > | |
183 | - <ProFormGroup key="group"> | |
184 | - <ProFormText | |
185 | - rules={[{ required: true, message: '请输入关联订单!' }]} | |
186 | - name="mainOrderId" | |
187 | - /> | |
188 | - </ProFormGroup> | |
189 | - </ProFormList> | |
190 | - <ProFormMoney | |
191 | - label="金额" | |
192 | - name="money" | |
193 | - customSymbol="¥" | |
194 | - min={0} | |
195 | - rules={[{ required: true, message: '请输入金额!' }]} | |
196 | - /> | |
197 | - </DrawerForm> | |
198 | - ); | |
199 | -}; |
src/pages/Invoice/InvoiceVerification/components/InvoicingModal.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | -import { postServiceInvoiceInvoicing } from '@/services'; | |
3 | -import { ModalForm } from '@ant-design/pro-components'; | |
4 | -import { Button, Form, message } from 'antd'; | |
5 | - | |
6 | -export default ({ selectedRowKeys, reloadRecordTable }) => { | |
7 | - const [form] = Form.useForm<{ name: string; company: string }>(); | |
8 | - return ( | |
9 | - <ModalForm<{ | |
10 | - name: string; | |
11 | - company: string; | |
12 | - }> | |
13 | - title="开票" | |
14 | - trigger={ | |
15 | - <Button type="primary" disabled={selectedRowKeys?.length === 0}> | |
16 | - 开票 | |
17 | - </Button> | |
18 | - } | |
19 | - form={form} | |
20 | - autoFocusFirstInput | |
21 | - modalProps={{ | |
22 | - destroyOnClose: true, | |
23 | - onCancel: () => console.log('run'), | |
24 | - }} | |
25 | - submitTimeout={2000} | |
26 | - onFinish={async (values) => { | |
27 | - let res = await postServiceInvoiceInvoicing({ | |
28 | - data: { | |
29 | - ...values, | |
30 | - invoiceRecordIds: selectedRowKeys, | |
31 | - }, | |
32 | - }); | |
33 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
34 | - message.success(res.message); | |
35 | - } | |
36 | - reloadRecordTable(); | |
37 | - message.success('提交成功'); | |
38 | - return true; | |
39 | - }} | |
40 | - > | |
41 | - {/*<ProFormSelect | |
42 | - name="invoicingAccount" | |
43 | - label="开票账号" | |
44 | - request={async () => { | |
45 | - const res = await postServiceInvoiceGetInvoicingAccount(); | |
46 | - return res.data.map((item) => { | |
47 | - return { | |
48 | - label: item.accountText, | |
49 | - value: item.account, | |
50 | - }; | |
51 | - }); | |
52 | - }} | |
53 | - placeholder="请选择开票账号" | |
54 | - rules={[{ required: true, message: '请选择开票账号!' }]} | |
55 | - />*/} | |
56 | - </ModalForm> | |
57 | - ); | |
58 | -}; |
src/pages/Invoice/InvoiceVerification/components/ManualInvoicingModal.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | -import UploadC from '@/pages/Invoice/InvoiceVerification/components/UploadSingleImg'; | |
3 | -import { | |
4 | - postOrderErpOrderStagesUpload, | |
5 | - postServiceInvoiceDealInvoicingResult, | |
6 | -} from '@/services'; | |
7 | -import { | |
8 | - ModalForm, | |
9 | - ProFormDatePicker, | |
10 | - ProFormText, | |
11 | -} from '@ant-design/pro-components'; | |
12 | -import { Col, Form, Row, message } from 'antd'; | |
13 | -import { RcFile } from 'antd/es/upload'; | |
14 | -import { useEffect } from 'react'; | |
15 | - | |
16 | -export default ({ record }) => { | |
17 | - useEffect(() => { | |
18 | - console.log('invoicing'); | |
19 | - }, []); | |
20 | - const [form] = Form.useForm(); | |
21 | - return ( | |
22 | - <ModalForm | |
23 | - title="手动开票" | |
24 | - trigger={<a type="primary">手动开票</a>} | |
25 | - width={600} | |
26 | - layout={'horizontal'} | |
27 | - form={form} | |
28 | - autoFocusFirstInput | |
29 | - modalProps={{ | |
30 | - destroyOnClose: true, | |
31 | - onCancel: () => console.log('run'), | |
32 | - }} | |
33 | - submitTimeout={2000} | |
34 | - onFinish={async (values) => { | |
35 | - const res = await postServiceInvoiceDealInvoicingResult({ | |
36 | - data: { | |
37 | - ...values, | |
38 | - isSuccess: true, | |
39 | - invoiceRecordId: record.id, | |
40 | - manual: true, | |
41 | - }, | |
42 | - }); | |
43 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
44 | - message.success('开票成功'); | |
45 | - return true; | |
46 | - } else { | |
47 | - message.error('开票失败'); | |
48 | - } | |
49 | - }} | |
50 | - > | |
51 | - {/*<ProFormText | |
52 | - rules={[{ required: true, message: '此项为必填项' }]} | |
53 | - width={'md'} | |
54 | - name="invoicingPerson" | |
55 | - label="开票人" | |
56 | - />*/} | |
57 | - <ProFormText | |
58 | - rules={[{ required: true, message: '此项为必填项' }]} | |
59 | - width={'md'} | |
60 | - name="invoiceNumber" | |
61 | - label="发票号码" | |
62 | - /> | |
63 | - <ProFormDatePicker | |
64 | - rules={[{ required: true, message: '此项为必填项' }]} | |
65 | - fieldProps={{ | |
66 | - format: 'YYYY-MM-DD', | |
67 | - }} | |
68 | - name="invoicingDate" | |
69 | - label="开票日期" | |
70 | - /> | |
71 | - <ProFormText | |
72 | - rules={[{ required: true, message: '发票必须上传' }]} | |
73 | - hidden | |
74 | - name="url" | |
75 | - label="發票地址" | |
76 | - /> | |
77 | - <Row> | |
78 | - <Col span={4}>上传发票</Col> | |
79 | - <Col span={20}> | |
80 | - <UploadC | |
81 | - onFilesChange={async (newFileList) => { | |
82 | - if (newFileList.length > 0) { | |
83 | - const formData = new FormData(); | |
84 | - formData.append('file', newFileList[0].originFileObj as RcFile); | |
85 | - const res = await postOrderErpOrderStagesUpload({ | |
86 | - data: formData, | |
87 | - headers: { | |
88 | - 'Content-Type': | |
89 | - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
90 | - }, | |
91 | - }); | |
92 | - const url = res.data; | |
93 | - form.setFieldValue('url', url); | |
94 | - } else { | |
95 | - form.setFieldValue('url', null); | |
96 | - } | |
97 | - }} | |
98 | - ></UploadC> | |
99 | - </Col> | |
100 | - </Row> | |
101 | - {/*<ProFormList | |
102 | - name="invoiceDetailDtoList" | |
103 | - label="明细" | |
104 | - creatorButtonProps={false} | |
105 | - copyIconProps={false} | |
106 | - itemRender={({ listDom }, { index }) => ( | |
107 | - <ProCard | |
108 | - bordered | |
109 | - style={{ marginBlockEnd: 8 }} | |
110 | - title={`明细${index + 1}`} | |
111 | - bodyStyle={{ paddingBlockEnd: 0 }} | |
112 | - > | |
113 | - {listDom} | |
114 | - </ProCard> | |
115 | - )} | |
116 | - creatorRecord={{ name: '', items: [{ name: '' }] }} | |
117 | - initialValue={record.invoiceDetails} | |
118 | - > | |
119 | - <ProFormText | |
120 | - name="projectName" | |
121 | - label="名称" | |
122 | - placeholder="请输入名称" | |
123 | - readonly | |
124 | - /> | |
125 | - <ProFormDigit label="税率" name="taxRate" min={0} max={100} /> | |
126 | - <ProFormMoney label="税额" name="taxPrice" locale="zh-CN" min={0} /> | |
127 | - </ProFormList>*/} | |
128 | - </ModalForm> | |
129 | - ); | |
130 | -}; |