广州市综治平台前端
liuwh
2 days ago 07a9468ec9e069828b1e6527cffbb63b05296e24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-03-05 17:14:00
 * @LastEditTime: 2025-06-24 09:35:43
 * @LastEditors: lwh
 * @Version: 1.0.0
 * @Description: 公共上传组件
 * 附件类型对照
    NULL("22_00017-0","未分类"),
    AUDIO("22_00017-1", "音频"),
    VIDEO("22_00017-2", "视频"),
    IMAGE("22_00017-3", "图片"),
    WORD("22_00017-4", "Word文档"),
    EXCEL("22_00017-5", "Excel表格"),
    PDF("22_00017-6", "PDF"),
    TXT("22_00017-7", "txt文本"),
    ZIP("22_00017--8", "压缩文件"),
    POWERPOINT("22_00017-9", "PowerPoint"),
    UNKNOWN("22_00017-99", "其它文件");
 */
import React, {  } from 'react';
import { Upload, Button } from 'antd';
import * as $$ from '../../utils/utility';
 
const { Dragger } = Upload;
 
 
 
/**
 * type, // "diy":自定义样式
 * fileId *, // 案件id,业务id
 * fileType *, // 附件类型
 * showFileList, // 是否展示文件列表
 * fileList, // 附件数组, 用于更新附件列表展示
 * handleChangeFile, // 附件成功新增和成功删除触发事件,用于更新附件列表
 */
const MyImport = ({ fileId, fileType }) => {
    let appUrl = $$.appUrl;
 
    const props = {
        name: 'file',
        multiple: false,
        accept: '.docx,.xls,.xlsx,.png,.jpg,.jpeg,.pdf',
        action: `${appUrl.baseUrl}/${appUrl.mediate}/api/v1/caseInfo/inCaseByExcel`,
        headers: {
            Authorization: $$.getSessionStorage('customerSystemToken'),
        },
        showUploadList: false,
        onChange: (info) => {
            console.log(info)
            let { response, status } = info.file;
            if (status === 'error') {
                $$.info({ type: 'error', content: '抱歉,网络错误附件上传失败,请稍后重试' });
            }if (status === 'done') {
                if (response.code === 0 || response.code === '0') {
                    // 返回附件成功上传的回调
                    $$.infoSuccess({ content: '附件上传成功' });
                } else {
                    $$.info({ type: 'error', content: response.msg });
                }
            }
            if (status === 'uploading') global.setSpinning(true);
            if (status !== 'uploading') global.setSpinning(false, 'only');
        },
    };
 
    return (
        <Dragger {...props} style={{ width: '100%' , padding: '0 10px '}}>
                <p style={{ fontSize: '14px' }}>案件导入</p>
                <p className="ant-upload-hint">仅支持导入“已调解”的案件,其他案件请使用【纠纷登记】功能录入</p>
        </Dragger>
    );
};
 
export default MyImport;