|
@@ -16,16 +16,22 @@ type LeftProps = {
|
|
|
function Left(props: LeftProps) {
|
|
|
const dispatch = useDispatch()
|
|
|
const [topInfo, setTopInfo] = useState<any>()
|
|
|
+ const [pagination, setPagination] = useState({
|
|
|
+ current: 1,
|
|
|
+ pageSize: 20
|
|
|
+ })
|
|
|
+ const [isFound, setIsFound] = useState<boolean>(true)
|
|
|
const getListFu = useCallback(
|
|
|
(pageNum: number, pageSize: number) => {
|
|
|
dispatch(
|
|
|
Clue_APIgetClueList({
|
|
|
pageNum: pageNum,
|
|
|
- pageSize: pageSize
|
|
|
+ pageSize: pageSize,
|
|
|
+ ...(isFound ? { status: 2 } : {})
|
|
|
})
|
|
|
)
|
|
|
},
|
|
|
- [dispatch]
|
|
|
+ [dispatch, isFound]
|
|
|
)
|
|
|
|
|
|
const getTopinfoFu = useCallback(async () => {
|
|
@@ -37,28 +43,13 @@ function Left(props: LeftProps) {
|
|
|
const { list: listAll, total } = useSelector((state: RootState) => state.Clue.tableInfo)
|
|
|
|
|
|
useEffect(() => {
|
|
|
- getListFu(1, 20)
|
|
|
getTopinfoFu()
|
|
|
- }, [getListFu, getTopinfoFu])
|
|
|
-
|
|
|
- const fingingList = useMemo(() => {
|
|
|
- return listAll.filter((item: ClueItem) => item.status === '跟进中')
|
|
|
- }, [listAll])
|
|
|
- const foundList = useMemo(() => {
|
|
|
- return listAll.filter((item: ClueItem) => item.status === '已找到')
|
|
|
- }, [listAll])
|
|
|
- const clueList = useMemo(() => {
|
|
|
- return listAll.filter(
|
|
|
- (item: ClueItem) => item.status !== '待确定' && item.status !== '作废'
|
|
|
- )
|
|
|
- }, [listAll])
|
|
|
- const [curClueList, setCurClueList] = useState<ClueItem[]>()
|
|
|
+ }, [getTopinfoFu])
|
|
|
|
|
|
+ // 状态:0:待确认 | 1:跟进中 | 2:已找到 | 3:未找到 | 4:作废
|
|
|
useEffect(() => {
|
|
|
- if (foundList.length && !curClueList) {
|
|
|
- setCurClueList(foundList)
|
|
|
- }
|
|
|
- }, [curClueList, foundList])
|
|
|
+ getListFu(pagination.current, pagination.pageSize)
|
|
|
+ }, [getListFu, pagination])
|
|
|
|
|
|
// 预览视频
|
|
|
const lookFileFu = useCallback((file: string) => {
|
|
@@ -111,14 +102,20 @@ function Left(props: LeftProps) {
|
|
|
<div className='mainInfoBox'>
|
|
|
<div className='tab'>
|
|
|
<div
|
|
|
- className={curClueList === foundList ? 'active' : ''}
|
|
|
- onClick={() => setCurClueList(foundList)}
|
|
|
+ className={isFound ? 'active' : ''}
|
|
|
+ onClick={() => {
|
|
|
+ setIsFound(true)
|
|
|
+ setPagination({ current: 1, pageSize: 20 })
|
|
|
+ }}
|
|
|
>
|
|
|
寻亲案例
|
|
|
</div>
|
|
|
<div
|
|
|
- className={curClueList === clueList ? 'active' : ''}
|
|
|
- onClick={() => setCurClueList(clueList)}
|
|
|
+ className={!isFound ? 'active' : ''}
|
|
|
+ onClick={() => {
|
|
|
+ setIsFound(false)
|
|
|
+ setPagination({ current: 1, pageSize: 20 })
|
|
|
+ }}
|
|
|
>
|
|
|
线索更新
|
|
|
</div>
|
|
@@ -126,7 +123,7 @@ function Left(props: LeftProps) {
|
|
|
<div className='mainInfoListBox'>
|
|
|
<div className='slide'></div>
|
|
|
<div className='mainInfoList'>
|
|
|
- {curClueList?.map((item: ClueItem) => {
|
|
|
+ {listAll?.map((item: ClueItem) => {
|
|
|
return (
|
|
|
<div className='mainInfo' key={item.id}>
|
|
|
<div className='labelList'>
|
|
@@ -175,10 +172,13 @@ function Left(props: LeftProps) {
|
|
|
<Pagination
|
|
|
total={total}
|
|
|
simple
|
|
|
- defaultPageSize={20}
|
|
|
- defaultCurrent={1}
|
|
|
- current={1}
|
|
|
- onChange={(page, size) => getListFu(page, size)}
|
|
|
+ defaultPageSize={pagination.pageSize}
|
|
|
+ defaultCurrent={pagination.current}
|
|
|
+ current={pagination.current}
|
|
|
+ onChange={(page, size) => {
|
|
|
+ setPagination({ current: page, pageSize: size })
|
|
|
+ getListFu(page, size)
|
|
|
+ }}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|