forked from gzzfw/frontEnd/gzDyh

dminyi
2024-08-22 9673dbc197de4fd393a9b0b19b91009e5d61ab6c
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * @Author: dminyi 1301963064@qq.com
 * @Date: 2024-08-10 15:03:57
 * @LastEditors: dminyi 1301963064@qq.com
 * @LastEditTime: 2024-08-12 14:45:28
 * @FilePath: \gzDyh\gz-customerSystem\src\components\personCard\index.jsx
 * @Description: 来访登记当事人卡片
 */
import React from 'react';
import PropTypes from 'prop-types';
import { Typography, Row, Col, Space, Tooltip } from 'antd';
import { del, add } from '../../assets/images';
 
const { Link, Text } = Typography;
/**
 * isCheck, // 是否无操作
 * data, // 当事人数据
 * handleCheckParty, // 点击查看详情
 * handleDeleteParty, // 删除当事人
 */
const PersonCard = ({ isCheck, data, handleCheckParty, handleDeleteParty, handleAdd }) => {
    let isAgent = false
    let isAgentFor = false
    const typeList = data.map(item => {
        return item.partyType
    })//获取有多少申请人和被申请人
    if (typeList.indexOf(0) != -1) {
        isAgent = true
    }
    if (typeList.indexOf(1) != -1) {
        isAgentFor = true
    }
    return (
        <Row gutter={[24, 16]}>
            {data.map((x, t) => (
                <Col span={7} key={t}>
                    <div className="public-personCard" style={{ cursor: 'pointer' }}>
                        <div
                            className={`public-personCard-card public-personCard-card-${(x.partyType === 0 || x.partyType === 2) ? 'blue' : 'orange'}`}
                            onClick={() => handleCheckParty(x)}
                        >
                            {x.trueName.substr(0, 1)}
                            <div className="public-personCard-card-check">查看</div>
                            <img
                                src={del}
                                alt=''
                                style={{ width: '16px', height: '16px', position: 'absolute', top: '-8px', left: '56px' }}
                                onClick={(event) => { handleDeleteParty(event, x) }}
                            />
                        </div>
                        <div className="public-personCard-content">
                            <div className="public-personCard-title">
                                <Text style={{ maxWidth: '80%', paddingRight: '8px' }} ellipsis={{ tooltip: x.trueName }}>
                                    {x.trueName}
                                </Text>
                                <Text ellipsis={{ tooltip: x.perClassName }} className={`public-personCard-tag public-personCard-tag-${(x.partyType === 0 || x.partyType === 2) ? 'blue' : 'orange'}`}>
                                    {x.perClassName}
                                </Text>
                            </div>
                            {
                                (x.perClass === '09_01001-1' || !x.perClass) &&
                                <>
                                    <div>证件号码:{x.mobile}</div>
                                    <div>联系方式:{x.personNumber}</div>
                                </>
                            }
                            {
                                x.perClass === '09_01001-2' &&
                                <>
                                    <div>统一社会信用代码:{x.mobile}</div>
                                    <div>法定代表人:{x.companyName}</div>
                                </>
                            }
                            {
                                x.perClass === '09_01001-3' &&
                                <>
                                    <div>组织机构代码:{x.mobile}</div>
                                    <div>机构代表人:{x.companyName}</div>
                                </>
                            }
                            <Space style={{ display: 'flex', flexWrap: 'wrap' }}>
                                {x.remark?.map((item, index) => (
                                    <div key={index} style={{ lineHeight: '22px', padding: '0px 8px', backgroundColor: `${item.color}`, width: 'fit-content', borderRadius: '4px', marginTop: '4px', color: '#fff' }}>{item.label}</div>
                                ))}
                            </Space>
                        </div>
                    </div>
                </Col>
            ))}
            <Col span={3}>
                <div className="dataSync-addBtn">
                    <Tooltip
                        title={(<Space direction='vertical '>
                            <div className="dataSync-btnApply" style={{ backgroundColor: '#1A6FB8' }} onClick={() => { handleAdd(0) }}>申请方当事人</div>
                            {isAgent && <div className="dataSync-btnApply" style={{ backgroundColor: '#3491FA' }} onClick={() => { handleAdd(2) }}>申请方代理人</div>}
                            <div className="dataSync-btnApply" style={{ backgroundColor: '#EF6C24' }} onClick={() => { handleAdd(1) }}>被申请方当事人</div>
                            {isAgentFor && <div className="dataSync-btnApply" style={{ backgroundColor: '#FA8C16' }} onClick={() => { handleAdd(3) }}>被申请方代理人</div>}
                        </Space>)}
                        placement={data.length !== 0 && data.length % 3 === 0 ? 'left' : "right"}
                        color='#ffff'
                        overlayStyle={{}}
                    >
                        <div style={{ backgroundColor: '#f2f3f5', borderRadius: '50%', width: '64px', height: '64px' }}>
                            <img src={add} alt="添加" style={{ width: '32px', margin: '16px' }} />
                        </div>
                    </Tooltip>
                </div>
            </Col>
        </Row>
    );
};
 
PersonCard.propTypes = {
    isCheck: PropTypes.bool,
    data: PropTypes.array,
    handleCheckParty: PropTypes.func,
    handleDeleteParty: PropTypes.func,
};
 
export default PersonCard;