/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-03-08 17:31:29
|
* @LastEditTime: 2022-08-04 14:20:53
|
* @LastEditors: ldh
|
* @Version: 1.0.0
|
* @Description: 签收列表
|
*/
|
import React, { useEffect, useState } from 'react';
|
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
|
import { Form, Typography } from 'antd';
|
import Page from '../../components/Page';
|
import * as $$ from '../../utils/utility';
|
import TableView from '../../components/TableView';
|
import TableSearch from '../../components/TableSearch';
|
import MyTabs from '../../components/MyTabs';
|
|
// 获取签收列表
|
function getSignForListDataApi(submitData) {
|
return $$.ax.request({ url: 'caseSign/pageQuery', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
const { Link } = Typography;
|
|
const SignForList = () => {
|
const location = useLocation();
|
|
const navigate = useNavigate();
|
|
const [searchParams] = useSearchParams();
|
|
const [form] = Form.useForm();
|
|
// 搜索
|
const [search, setSearch] = useState({ page: 1, size: 10, status: '1' });
|
|
// 数据
|
const [data, setData] = useState({});
|
|
// 查看,签收跳转
|
function handleJump(type, record) {
|
$$.setSessionStorage(location.pathname, {
|
search,
|
breadcrumbData: [{ title: '签收列表', url: location.pathname }, { title: type === 'check' ? '签收详情' : '签收' }],
|
title: record.caseNo,
|
subtitle: '签收处理相关案件',
|
tabs: [{ label: '签收', key: 'signFor' }],
|
tableActive: record.id,
|
signForEditType: type,
|
pageFrom: 'signForList',
|
});
|
navigate(`/mediate/caseDetail?caseId=${record.caseId}&signForId=${record.id}&back=${location.pathname}`);
|
}
|
|
// 搜索 or 重置
|
function handleSearch(type, data) {
|
if (type === 'recovery') {
|
// 案件详情返回时恢复跳转前查询
|
let obj = Object.assign({}, data.search);
|
if (obj.acceptStart) {
|
obj.acceptTime = [$$.myMoment(obj.acceptStart), $$.myMoment(obj.acceptEnd)];
|
}
|
if (obj.createStart) {
|
obj.createTime = [$$.myMoment(obj.createStart), $$.myMoment(obj.createEnd)];
|
}
|
form.setFieldsValue(obj);
|
getSignForListData(data.search, data.tableActive);
|
return;
|
}
|
if (type === 'reset') {
|
form.resetFields();
|
getSignForListData({ page: 1, size: 10, status: search.status });
|
return;
|
}
|
if (type === 'search') {
|
let values = form.getFieldsValue();
|
$$.changeTimeFormat(values, 'acceptTime', 'acceptStart', 'acceptEnd');
|
$$.changeTimeFormat(values, 'createTime', 'createStart', 'createEnd');
|
getSignForListData({ ...search, ...values, page: 1 });
|
return;
|
}
|
if (type === 'changeTabs' || type === 'changePage') {
|
let obj = type === 'changeTabs' ? { page: 1, status: data } : { page: data[0], size: data[1] };
|
getSignForListData({ ...search, ...obj });
|
}
|
}
|
|
// 获取数据
|
async function getSignForListData(submitData, tableActive) {
|
global.setSpinning(true);
|
const res = await getSignForListDataApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setData({
|
total: res.data?.caseSignPage?.totalElements,
|
tableData: res.data?.caseSignPage?.content || [],
|
countWqcStatus: res.data?.countWqcStatus,
|
countYqcStatus: res.data?.countYqcStatus,
|
tableActive,
|
});
|
setSearch(submitData);
|
}
|
}
|
|
// 初始化
|
useEffect(() => {
|
let returnRouteData = $$.getSessionStorage(location.pathname);
|
if (searchParams.get('isBack') && !!returnRouteData) {
|
handleSearch('recovery', returnRouteData);
|
} else {
|
handleSearch('reset');
|
}
|
if (!!returnRouteData) {
|
$$.clearSessionStorage(location.pathname);
|
}
|
}, []);
|
|
// 表头
|
const columns = (type) => {
|
let typeColumns =
|
type === '1'
|
? [
|
{ title: '派单时间', dataIndex: 'createTime' },
|
{
|
title: '处理时限',
|
dataIndex: 'expireTime',
|
render: (text, record) => {
|
let obj = $$.getHours(text);
|
return record.status === '1' ? (
|
<span className={obj.isNegativeNum ? 'tableView-dangerTime' : ''}>{!!text ? `${obj.hours}小时` : '-'}</span>
|
) : (
|
'-'
|
);
|
},
|
},
|
]
|
: [
|
{ title: '签收时间', dataIndex: 'signTime' },
|
{ title: '签收人', dataIndex: 'handlerUserName' },
|
];
|
return [
|
{ title: '调解案号', dataIndex: 'caseNo' },
|
{ title: '申请人', dataIndex: 'plaintiffs' },
|
{ title: '被申请人', dataIndex: 'defendants' },
|
{ title: '纠纷发生地', dataIndex: 'addr' },
|
{ title: '调解类型', dataIndex: 'mediTypeName' },
|
{ title: '纠纷类型', dataIndex: 'caseTypeName' },
|
{ title: '申请渠道', dataIndex: 'canalName' },
|
...typeColumns,
|
{ title: '纠纷受理时间', dataIndex: 'acceptTime' },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 50,
|
render: (_, record) => (
|
<Link onClick={() => handleJump(search.status === '1' ? 'edit' : 'check', record)}>{search.status === '1' ? '处理' : '查看'}</Link>
|
),
|
},
|
];
|
};
|
|
const countWqc = (search.status === '1' ? data.total : data.countWqcStatus) || 0;
|
|
const countYqc = (search.status === '2' ? data.total : data.countYqcStatus) || 0;
|
|
return (
|
<Page pageHead={{ title: '签收列表', subtitle: '签收案件列表' }}>
|
<div className="signForList">
|
<div className="pageSearch">
|
<TableSearch
|
labelLength={6}
|
form={form}
|
itemData={[
|
{ type: 'Input', name: 'plaintiffs', label: '申请人' },
|
{ type: 'Input', name: 'defendants', label: '被申请人' },
|
{ type: 'RangePicker', name: 'acceptTime', label: '纠纷受理时间' },
|
{ type: 'Input', name: 'caseNo', label: '调解案号' },
|
{ type: 'Input', name: 'addr', label: '纠纷发生地' },
|
{ type: 'RangePicker', name: 'createTime', label: '派单时间' },
|
]}
|
handleReset={() => handleSearch('reset')}
|
handleSearch={() => handleSearch('search')}
|
/>
|
</div>
|
<div className="pageTabs">
|
<MyTabs
|
tabs={[
|
{ key: '1', label: `待签收(${$$.showMoreNum(countWqc)})` },
|
{ key: '2', label: `已签收(${$$.showMoreNum(countYqc)})` },
|
]}
|
activeKey={search.status || '0'}
|
onChange={(activeKey) => handleSearch('changeTabs', activeKey)}
|
/>
|
</div>
|
<div className="pageTable">
|
<TableView
|
showHeader
|
title="查询结果"
|
columns={columns(search.status)}
|
dataSource={data.tableData || []}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
onChange: (page, pageSize) => handleSearch('changePage', [page, pageSize]),
|
}}
|
rowClassName={(record) => (record.id === data.tableActive ? 'tableRowActive' : '')}
|
/>
|
</div>
|
</div>
|
</Page>
|
);
|
};
|
|
export default SignForList;
|