/*
|
* @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;
|