Commit 6adca975798be8307903355f89484c59ccdd85cb
1 parent
969b2988
feat: update 发票核销
Showing
3 changed files
with
28 additions
and
14 deletions
src/pages/Invoice/components/BankImportModal.tsx
@@ -15,19 +15,20 @@ export default ({ setVisible, onClose }) => { | @@ -15,19 +15,20 @@ export default ({ setVisible, onClose }) => { | ||
15 | const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => | 15 | const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => |
16 | setFileList(newFileList); | 16 | setFileList(newFileList); |
17 | 17 | ||
18 | - // const [messageApi] = message.useMessage(); | 18 | + const [messageApi, contextHolder] = message.useMessage(); |
19 | const [uploadLoading, setUploading] = useState(false); | 19 | const [uploadLoading, setUploading] = useState(false); |
20 | console.log(uploadLoading); | 20 | console.log(uploadLoading); |
21 | 21 | ||
22 | - // const exportLoading = (content: string) => { | ||
23 | - // messageApi.open({ | ||
24 | - // type: 'loading', | ||
25 | - // content: content, | ||
26 | - // duration: 0, | ||
27 | - // }); | ||
28 | - // }; | 22 | + const exportLoading = (content: string) => { |
23 | + messageApi.open({ | ||
24 | + type: 'loading', | ||
25 | + content: content, | ||
26 | + duration: 0, | ||
27 | + }); | ||
28 | + }; | ||
29 | 29 | ||
30 | const downloadImportTemplate = async () => { | 30 | const downloadImportTemplate = async () => { |
31 | + exportLoading('正在下载......'); | ||
31 | axios({ | 32 | axios({ |
32 | url: '/api/service/bankStatement/exportTemplate', | 33 | url: '/api/service/bankStatement/exportTemplate', |
33 | method: 'post', | 34 | method: 'post', |
@@ -50,13 +51,19 @@ export default ({ setVisible, onClose }) => { | @@ -50,13 +51,19 @@ export default ({ setVisible, onClose }) => { | ||
50 | .catch((error) => { | 51 | .catch((error) => { |
51 | // 处理错误 | 52 | // 处理错误 |
52 | console.error('导出错误', error); | 53 | console.error('导出错误', error); |
54 | + }) | ||
55 | + .finally(() => { | ||
56 | + messageApi.destroy(); | ||
53 | }); | 57 | }); |
54 | }; | 58 | }; |
55 | const handleUpload = async () => { | 59 | const handleUpload = async () => { |
60 | + exportLoading('正在导入......'); | ||
61 | + | ||
56 | const formData = new FormData(); | 62 | const formData = new FormData(); |
57 | fileList.forEach((file) => { | 63 | fileList.forEach((file) => { |
58 | formData.append('file', file.originFileObj as RcFile); | 64 | formData.append('file', file.originFileObj as RcFile); |
59 | }); | 65 | }); |
66 | + | ||
60 | setUploading(true); | 67 | setUploading(true); |
61 | 68 | ||
62 | axios({ | 69 | axios({ |
@@ -100,6 +107,7 @@ export default ({ setVisible, onClose }) => { | @@ -100,6 +107,7 @@ export default ({ setVisible, onClose }) => { | ||
100 | }) | 107 | }) |
101 | .finally(() => { | 108 | .finally(() => { |
102 | setUploading(false); | 109 | setUploading(false); |
110 | + messageApi.destroy(); | ||
103 | }); | 111 | }); |
104 | }; | 112 | }; |
105 | const props: UploadProps = { | 113 | const props: UploadProps = { |
@@ -156,6 +164,8 @@ export default ({ setVisible, onClose }) => { | @@ -156,6 +164,8 @@ export default ({ setVisible, onClose }) => { | ||
156 | </Button> | 164 | </Button> |
157 | </Upload> | 165 | </Upload> |
158 | </ModalForm> | 166 | </ModalForm> |
167 | + | ||
168 | + {contextHolder} | ||
159 | </> | 169 | </> |
160 | ); | 170 | ); |
161 | }; | 171 | }; |
src/pages/Invoice/constant.tsx
@@ -248,31 +248,31 @@ export const BANK_STATEMENT_COLUMNS = [ | @@ -248,31 +248,31 @@ export const BANK_STATEMENT_COLUMNS = [ | ||
248 | { | 248 | { |
249 | dataIndex: 'loanAmount', | 249 | dataIndex: 'loanAmount', |
250 | title: '贷方金额', | 250 | title: '贷方金额', |
251 | - valueType: 'text', | 251 | + valueType: 'money', |
252 | width: 100, | 252 | width: 100, |
253 | }, | 253 | }, |
254 | { | 254 | { |
255 | dataIndex: 'borrowedAmount', | 255 | dataIndex: 'borrowedAmount', |
256 | title: '借方金额', | 256 | title: '借方金额', |
257 | - valueType: 'text', | 257 | + valueType: 'money', |
258 | width: 100, | 258 | width: 100, |
259 | }, | 259 | }, |
260 | { | 260 | { |
261 | dataIndex: 'transactionAmount', | 261 | dataIndex: 'transactionAmount', |
262 | title: '交易金额', | 262 | title: '交易金额', |
263 | - valueType: 'text', | 263 | + valueType: 'money', |
264 | width: 100, | 264 | width: 100, |
265 | }, | 265 | }, |
266 | { | 266 | { |
267 | dataIndex: 'balance', | 267 | dataIndex: 'balance', |
268 | title: '余额', | 268 | title: '余额', |
269 | - valueType: 'text', | 269 | + valueType: 'money', |
270 | width: 100, | 270 | width: 100, |
271 | }, | 271 | }, |
272 | { | 272 | { |
273 | dataIndex: 'actualPaymentAmount', | 273 | dataIndex: 'actualPaymentAmount', |
274 | title: '实付金额', | 274 | title: '实付金额', |
275 | - valueType: 'text', | 275 | + valueType: 'money', |
276 | width: 100, | 276 | width: 100, |
277 | }, | 277 | }, |
278 | { | 278 | { |
src/pages/Invoice/index.tsx
@@ -205,7 +205,11 @@ const InvoicePage = () => { | @@ -205,7 +205,11 @@ const InvoicePage = () => { | ||
205 | } | 205 | } |
206 | 206 | ||
207 | if (dataType === 'money') { | 207 | if (dataType === 'money') { |
208 | - textValue = '¥' + textValue; | 208 | + if (textValue === null || textValue === undefined) { |
209 | + textValue = ''; | ||
210 | + } else { | ||
211 | + textValue = '¥' + textValue; | ||
212 | + } | ||
209 | } | 213 | } |
210 | 214 | ||
211 | switch (dataIndex) { | 215 | switch (dataIndex) { |