广州矛调粤政易端
xusd
7 days ago d27794814b69d18aeb8ee96a46cae91d5613570c
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
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-12-26 11:18:30
 * @LastEditTime: 2022-12-26 11:32:28
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 老年优待证代办 - 列表组件
 */
import React, { useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { Space } from 'dingtalk-design-mobile';
import { TelephoneOutlined, LocationOutlined } from 'dd-icons';
import MyList from '../MyList';
import { dateFormat, searchTitle, setLocal } from '../../utils/utility';
import routerStatus from '../../status/router';
 
const GoodTreatmentListCom = ({ type, search, data, hasMore, getScrollTopKey, scrollTop, searchValue, getData }) => {
    const history = useHistory();
 
    // 加载更多数据
    function handleLoadMore(callback) {
        getData({ ...search, page: search.page + 1 }, '', callback);
    }
 
    // 辖区未办老人跳转登记
    function handleGoToRegister(item) {
        if (type === '1') {
            history.push(`/hztGrid/goodTreatmentList/detail?personId=${item.personId}`);
            return;
        }
        setLocal('goodTreatment', item);
        history.push(`/hztGrid/goodTreatmentRegister?personId=${item.personId}`);
    }
 
    // 数据更新
    useEffect(() => {
        if (routerStatus.spinPage['goodTreatmentList']) {
            getData({ ...search, page: 1, size: search.page * search.size }, 'spin');
            routerStatus.setPageScrollTopNow('goodTreatmentList');
            routerStatus.clearSpinPage('goodTreatmentList');
        }
    }, [routerStatus.spinPage['goodTreatmentList']]);
 
    return (
        <MyList
            data={data}
            hasMore={hasMore}
            loadMore={handleLoadMore}
            getScrollTopKey={getScrollTopKey}
            scrollTop={scrollTop}
            itemDom={(item) => {
                return (
                    <div onClick={() => handleGoToRegister(item)} className="oldsterEvent-main-item">
                        <h5>{searchValue ? searchTitle(item.personName, searchValue) : item.personName}</h5>
                        <div className="oldsterEvent-main-item-subtitle">
                            <div>{item.sexDesc || '-'}</div>
                            <div className="public-rightBorder">{item.age || '-'}岁</div>
                            <div className="public-rightBorder">{dateFormat(item.birthdate)}出生</div>
                            <div className="public-rightBorder">
                                <TelephoneOutlined />
                                <span style={{ marginLeft: '4px' }}>{item.contact || '-'}</span>
                            </div>
                        </div>
                        <div className="oldsterEvent-main-item-subtitle">
                            <div>
                                <LocationOutlined />
                            </div>
                            <div style={{ flex: 1, paddingLeft: '4px' }}>
                                {item.districtName || ''}
                                {item.subdistrictName || ''}
                                {item.communityName || ''}
                                {item.dwellingPlace || ''}
                            </div>
                        </div>
                        <Space style={{ '--gap': '8px', marginTop: '4px' }} wrap>
                            <div className="public-tag2">{item.agentGridNum}</div>
                            {item.handleNum && <div className="public-tag2">{item.handleNum}次代办</div>}
                            {item.result && (
                                <div
                                    className={`public-tag2 public-tag2-${
                                        item.result === '21_00019-2' ? 'green' : item.result === '21_00019-3' ? 'red' : item.result === '21_00019-4' ? 'organ2' : 'blue3'
                                    }`}
                                >
                                    {item.resultDesc}
                                </div>
                            )}
                        </Space>
                    </div>
                );
            }}
        />
    );
};
 
export default GoodTreatmentListCom;