forked from gzzfw/frontEnd/gzDyh

dminyi
2024-09-10 4ce904268ef0738537de05e5df18e54768f15575
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-07-27 17:19:17
 * @LastEditTime: 2022-12-01 11:10:33
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 司法确认视窗 - 司法确认申请信息
 */
import React, { useState, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { Row, Col, Space, Typography } from 'antd';
import * as $$ from '../../../utils/utility';
import MyUpload from '../../../components/MyUpload';
 
const { Link, Text } = Typography;
 
// 司法确认详情接口
function getJudicialApplyApi(submitData) {
    return $$.ax.request({ url: 'judicInfo/getJudicInfo', type: 'get', data: submitData, service: 'mediate' });
}
 
const ApplyMsg = ({ judicialId }) => {
    const myUploadRef = useRef();
 
    // 数据
    const [data, setData] = useState([]);
 
    const getFiles = (type) => {
        return data.applyFileList?.filter((item) => item.ownerType === type)[0]?.fileList || [];
    };
 
    //初始化
    useEffect(() => {
        async function getJudicialApply() {
            global.setSpinning(true);
            const res = await getJudicialApplyApi({ id: judicialId });
            global.setSpinning(false);
            if (res.type) {
                setData(res.data || {});
            }
        }
        getJudicialApply();
    }, [judicialId]);
 
    return (
        <>
            {/* 为了获取myUploadRef实例调用方法 */}
            <MyUpload type="diy" showFileList={false} myUploadRef={myUploadRef} />
            <div className="mediationWindow-modal-main" style={{ paddingBottom: '16px' }}>
                <Row gutter={[16, 16]}>
                    <Col span={24}>
                        <h5>申请说明</h5>
                        <pre>{data.applyContent || '-'}</pre>
                    </Col>
                    {[
                        { key: '22_00018-302', title: '调解协议书' },
                        { key: '22_00018-402', title: '司法确认申请书' },
                        { key: '22_00018-306', title: '人民调解委员会主持调解的证明' },
                        { key: '22_00018-409', title: '其他材料' },
                    ].map((item, index) => (
                        <Col span={24} key={index}>
                            <h5>{item.title}</h5>
                            <Row gutter={[16, 8]}>
                                {getFiles(item.key).length === 0
                                    ? $$.MyEmpty({ style: { margin: 0 } })
                                    : getFiles(item.key).map((x, t) => (
                                            <Col span={12} key={t}>
                                                <div className="public-fileCard">
                                                    <img src={$$.fileType(x.cat)} alt="" />
                                                    <div className="public-fileCard-main">
                                                        <Text ellipsis={{ tooltip: x.name }}>{x.name}</Text>
                                                        <Space size="middle" className="public-fileCard-action">
                                                            <Link onClick={() => myUploadRef.current.handleOpenFiles(x)}>预览</Link>
                                                            <Link onClick={() => myUploadRef.current.handleDownloadFiles(x)}>下载</Link>
                                                        </Space>
                                                    </div>
                                                </div>
                                                <div className="public-fileCard-text">
                                                    <div>上传人:{x.uploaderName || '-'}</div>
                                                    <div>上传时间:{$$.timeFormat(x.createTime)}</div>
                                                </div>
                                            </Col>
                                      ))}
                            </Row>
                        </Col>
                    ))}
                </Row>
            </div>
        </>
    );
};
 
ApplyMsg.propTypes = {
    judicialId: PropTypes.string,
    onStartMediation: PropTypes.func,
};
 
export default ApplyMsg;