Commit 6adca975798be8307903355f89484c59ccdd85cb

Authored by zhongnanhuang
1 parent 969b2988

feat: update 发票核销

src/pages/Invoice/components/BankImportModal.tsx
... ... @@ -15,19 +15,20 @@ export default ({ setVisible, onClose }) => {
15 15 const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) =>
16 16 setFileList(newFileList);
17 17  
18   - // const [messageApi] = message.useMessage();
  18 + const [messageApi, contextHolder] = message.useMessage();
19 19 const [uploadLoading, setUploading] = useState(false);
20 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 30 const downloadImportTemplate = async () => {
  31 + exportLoading('正在下载......');
31 32 axios({
32 33 url: '/api/service/bankStatement/exportTemplate',
33 34 method: 'post',
... ... @@ -50,13 +51,19 @@ export default ({ setVisible, onClose }) => {
50 51 .catch((error) => {
51 52 // 处理错误
52 53 console.error('导出错误', error);
  54 + })
  55 + .finally(() => {
  56 + messageApi.destroy();
53 57 });
54 58 };
55 59 const handleUpload = async () => {
  60 + exportLoading('正在导入......');
  61 +
56 62 const formData = new FormData();
57 63 fileList.forEach((file) => {
58 64 formData.append('file', file.originFileObj as RcFile);
59 65 });
  66 +
60 67 setUploading(true);
61 68  
62 69 axios({
... ... @@ -100,6 +107,7 @@ export default ({ setVisible, onClose }) => {
100 107 })
101 108 .finally(() => {
102 109 setUploading(false);
  110 + messageApi.destroy();
103 111 });
104 112 };
105 113 const props: UploadProps = {
... ... @@ -156,6 +164,8 @@ export default ({ setVisible, onClose }) => {
156 164 </Button>
157 165 </Upload>
158 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 248 {
249 249 dataIndex: 'loanAmount',
250 250 title: '贷方金额',
251   - valueType: 'text',
  251 + valueType: 'money',
252 252 width: 100,
253 253 },
254 254 {
255 255 dataIndex: 'borrowedAmount',
256 256 title: '借方金额',
257   - valueType: 'text',
  257 + valueType: 'money',
258 258 width: 100,
259 259 },
260 260 {
261 261 dataIndex: 'transactionAmount',
262 262 title: '交易金额',
263   - valueType: 'text',
  263 + valueType: 'money',
264 264 width: 100,
265 265 },
266 266 {
267 267 dataIndex: 'balance',
268 268 title: '余额',
269   - valueType: 'text',
  269 + valueType: 'money',
270 270 width: 100,
271 271 },
272 272 {
273 273 dataIndex: 'actualPaymentAmount',
274 274 title: '实付金额',
275   - valueType: 'text',
  275 + valueType: 'money',
276 276 width: 100,
277 277 },
278 278 {
... ...
src/pages/Invoice/index.tsx
... ... @@ -205,7 +205,11 @@ const InvoicePage = () =&gt; {
205 205 }
206 206  
207 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 215 switch (dataIndex) {
... ...