|
import React, { useEffect, useState } from 'react';
|
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
|
import { Form, Typography, Space } from 'antd';
|
import { Tooltip } from '@arco-design/web-react';
|
import NewTableSearch from '../../components/NewTableSearch';
|
import TableView from '../../components/TableViewCanSort';
|
import MyTabsNew from '../../components/MyTabsNew';
|
import NewPage from '../../components/NewPage';
|
import * as $$ from '../../utils/utility';
|
import './index.less';
|
// 列表数据
|
function getPageApi(submitData) {
|
return $$.ax.request({ url: 'judicInfo/pageCourtConfirm', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
|
const { Link } = Typography;
|
|
|
// 两个列表的默认搜索参数
|
const unApplySearch = { page: 1, size: 10, sortColmn: 3, sortType: 2 }
|
const applySearch = { page: 1, size: 10, sortColmn: 2, sortType: 2 }
|
const CourtList = () => {
|
let location = useLocation();
|
|
let navigate = useNavigate();
|
|
const [searchParams] = useSearchParams();
|
|
const [form] = Form.useForm();
|
|
// 搜索 申请渠道,22_00001-1:机构登记,22_00001-2:小程序,22_00001-3:其他渠道
|
const [search, setSearch] = useState(unApplySearch);
|
|
// tabs标签分页
|
const [mediateTab, setMediateTab] = useState('0');
|
|
// 数据
|
const [data, setData] = useState({ tableData: [] });
|
|
//自定义排序
|
function getOrderPara(field, order) {
|
// field, 1 applyTime 2 judicEndTime 3 waitHours
|
// sortColmn 1 申请时间 2 结案时间 3 办结时限
|
// sortType 1-升序,2-降序
|
if (field === 'waitHours') {
|
if (order === 'descend') {
|
return { sortColmn: 3, sortType: 2 }
|
}
|
if (order === 'ascend') {
|
return { sortColmn: 3, sortType: 1 }
|
}
|
if (order === 'undefined') {
|
return { sortColmn: 3, sortType: '' }
|
}
|
}
|
if (field === 'judicEndTime') {
|
if (order === 'descend') {
|
return { sortColmn: 2, sortType: 2 }
|
}
|
if (order === 'ascend') {
|
return { sortColmn: 2, sortType: 1 }
|
}
|
if (order === 'undefined') {
|
return { sortColmn: 2, sortType: '' }
|
}
|
}
|
if (field === 'applyTime') {
|
if (order === 'descend') {
|
return { sortColmn: 1, sortType: 2 }
|
}
|
if (order === 'ascend') {
|
return { sortColmn: 1, sortType: 1 }
|
}
|
if (order === 'undefined') {
|
return { sortColmn: 1, sortType: '' }
|
}
|
}
|
};
|
|
// 查看,签收跳转
|
function handleJump(record) {
|
$$.setSessionStorage(location.pathname, { search: search });
|
navigate(`/mediate/visit/fileMessage?caseTaskId=${record.caseTaskId}&caseId=${record.caseId}&judicId=${record.judicId}&back=${location.pathname}&tab=${mediateTab}`)
|
}
|
//修改页面
|
function modifyJump(record) {
|
navigate(`/mediate/courtEdit?caseId=${record.caseId}&judicId=${record.id}&back=${location.pathname}`)
|
}
|
|
// 搜索 or 重置
|
function handleSearch(type, data, tab) {
|
// 重置
|
if (type === 'reset') {
|
let defaultSearch = tab === '0' ? unApplySearch : applySearch;
|
form.resetFields();
|
getImportDraftData({ ...defaultSearch, status: tab });
|
return;
|
}
|
// 筛选条件搜索
|
if (type === 'search') {
|
let values = form.getFieldsValue();
|
$$.changeTimNeweFormat(values, 'judicTime', 'judicEndStart', 'judicEndEnd');
|
$$.changeTimNeweFormat(values, 'applyTime', 'applyStart', 'applyEnd');
|
$$.searchCascader(values, 'caseType', 1, ['caseType', 'caseType'])
|
getImportDraftData({ page: search.page, size: search.size, sortColmn: search.sortColmn, sortType: search.sortType, ...values, status: tab });
|
}
|
// 翻页、正序倒序
|
if (type === 'sort') {
|
getImportDraftData({ ...data, status: tab });
|
}
|
// 案件详情返回时恢复跳转前查询
|
if (type === 'recovery') {
|
let obj = { ...data };
|
if (obj.judicEndStart) {
|
obj.judicTime = [obj.judicEndStart, obj.judicEndEnd];
|
}
|
if (obj.applyStart) {
|
obj.applyTime = [obj.applyStart, obj.applyEnd];
|
}
|
form.setFieldsValue(obj);
|
getImportDraftData({ ...data, status: tab });
|
return;
|
}
|
}
|
|
// 获取草稿数据
|
async function getImportDraftData(submitData) {
|
global.setSpinning(true);
|
const res = await getPageApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setData({ total: res.data.totalElements, tableData: res.data.content, totalData: res.data?.totalData });
|
setSearch(submitData);
|
}
|
}
|
|
// 初始化
|
useEffect(() => {
|
let returnRouteData = $$.getSessionStorage(location.pathname);
|
if (searchParams.get('isBack') && !!returnRouteData) {
|
searchParams.get('tab') && setMediateTab(searchParams.get('tab'));
|
handleSearch('recovery', returnRouteData.search, searchParams.get('tab'));
|
} else {
|
handleSearch('reset', '', '0');
|
}
|
if (!!returnRouteData) {
|
$$.clearSessionStorage(location.pathname);
|
}
|
}, []);
|
|
const columns = [
|
{ title: '申请时间', width: 120, dataIndex: 'applyTime', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
|
{
|
title: '办结时限', width: 120, dataIndex: 'waitHours', defaultSortOrder: 'descend', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text, record) =>
|
<div>
|
{record.outTimeType === '2' && <div className='courtList-flex public-tag-tagRed public-danger'><div className='public-roundDot-red'></div>{`超${$$.formatHoursToDaysAndHours(record.waitHours)}`}</div>}
|
{record.outTimeType === '1' && <div className='courtList-flex public-tag-tagGreen public-success'><div className='public-roundDot-green'></div>{`剩${$$.formatHoursToDaysAndHours(record.waitHours)}`}</div>}
|
</div>
|
},
|
{ title: '申请部门', dataIndex: 'applyUnitName' },
|
{ title: '纠纷类型', width: 120, dataIndex: 'caseTypeName' },
|
{ title: '申请方', width: 100, dataIndex: 'plaintiffs' },
|
{ title: '被申请方', width: 150, dataIndex: 'defendants' },
|
{ title: '承办部门', dataIndex: 'mediateUnitName' },
|
{ title: '承办法官', width: 150, dataIndex: 'judgeName' },
|
{ title: '助理/书记员', dataIndex: 'judgeName', render: (text, record) => <div>{record.judicAssistList?.length > 0 ? record.judicAssistList?.map(i => i.assUserName)?.join('、') : ''}</div> },
|
{ title: '司法确认案号', dataIndex: 'judicNo' },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 90,
|
render: (_, record) => {
|
return (
|
<Space size="middle">
|
<Link onClick={() => modifyJump(record)}>处理</Link>
|
</Space>
|
);
|
},
|
},
|
];
|
|
const appliedColumns = [
|
{ title: '结案时间', width: 120, dataIndex: 'judicEndTime', defaultSortOrder: 'descend', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
|
{ title: '承办法官', width: 100, dataIndex: 'judgeName' },
|
{ title: '助理/书记员', dataIndex: 'judgeName', render: (text, record) => <div>{record.judicAssistList?.length > 0 ? record.judicAssistList?.map(i => i.assUserName)?.join('、') : ''}</div> },
|
{ title: '司法确认结果', width: 110, dataIndex: 'judicResult', render: (text) => <span className={text === '22_00028-1' ? 'public-success' : text === '22_00028-2' ? 'public-danger' : ''}>{text === '22_00028-1' ? '已达成' : text === '22_00028-2' ? '未达成' : '-'}</span> },
|
{ title: '司法确认案号', width: 120, dataIndex: 'judicNo' },
|
{ title: '申请时间', width: 120, dataIndex: 'applyTime', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
|
{ title: '申请部门', dataIndex: 'mediateUnitName' },
|
{ title: '纠纷类型', dataIndex: 'caseTypeName' },
|
{ title: '申请方', width: 150, dataIndex: 'plaintiffs' },
|
{ title: '被申请方', width: 150, dataIndex: 'defendants' },
|
{ title: '承办部门', width: 130, dataIndex: 'mediateUnitName', render: (text) => <span> <Tooltip content={text}>{$$.ellipsis(text, 7)}</Tooltip></span> },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 90,
|
render: (_, record) => {
|
return (
|
<Space size="middle">
|
<Link onClick={() => handleJump(record)}>详情</Link>
|
</Space>
|
);
|
},
|
},
|
];
|
|
return (
|
<NewPage pageHead={{ breadcrumbData: [{ title: '工作台' }, { title: '司法确认' }], title: '司法确认' }}>
|
<div className="comprehensive">
|
<div className="myMediation-search">
|
<NewTableSearch
|
exportButtonShow={false}
|
headTitle={'查询条件'}
|
labelLength={4}
|
rowNum={2}
|
form={form}
|
itemData={[
|
{ type: 'RangePicker', name: 'applyTime', label: '申请时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
|
{ type: 'RangePicker', name: 'judicTime', label: '结案时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
|
{ type: 'Select', name: 'judicResult', label: '司法确认结果', placeholder: '请选择', span: 8, selectdata: [{ label: '已达成', value: '22_00028-1' }, { label: '未达成', value: '22_00028-2' }] },
|
{ type: 'Input', name: 'plaintiffs', label: '申请方', placeholder: '请填写', },
|
{ type: 'Input', name: 'defendants', label: '被申请方', placeholder: '请填写', },
|
{ type: 'Input', name: 'judicNo', label: '司法确认案号', placeholder: '请填写', },
|
]}
|
handleReset={() => handleSearch('reset', '', mediateTab)}
|
handleSearch={() => handleSearch('search', '', mediateTab)}
|
/>
|
</div>
|
<div className="pageTabs" style={{ borderBottom: '1px solid #e5e6eb' }}>
|
<MyTabsNew
|
tabs={[
|
{ key: '0', label: `进行中(${$$.showMoreNum(data.totalData?.unApplyNum || 0)})` },
|
{ key: '1', label: `已结案(${$$.showMoreNum(data.totalData?.applyNum || 0)})` },
|
]}
|
activeKey={mediateTab}
|
onChange={(activeKey) => {
|
setMediateTab(activeKey);
|
handleSearch('sort', activeKey === '0' ? unApplySearch : applySearch, activeKey);
|
}}
|
/>
|
</div>
|
<div style={{ margin: '6px 0' }}>
|
</div>
|
<div style={{ flex: '1', marginBottom: '16px' }} className="pageTable">
|
{/* 未申请 */}
|
{mediateTab === '0' && <TableView
|
showHeader
|
title="查询结果"
|
columns={columns}
|
dataSource={data.tableData}
|
onChange={(pagination, filters, sorter) => {
|
handleSearch('sort', { page: pagination.current, size: pagination.pageSize, ...getOrderPara(sorter.field, sorter.order) }, mediateTab)
|
}}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
}}
|
/>}
|
{/* 已申请 */}
|
{mediateTab === '1' && <TableView
|
showHeader
|
title="查询结果"
|
columns={appliedColumns}
|
dataSource={data.tableData}
|
onChange={(pagination, filters, sorter) => {
|
handleSearch('sort', { page: pagination.current, size: pagination.pageSize, ...getOrderPara(sorter.field, sorter.order) }, mediateTab)
|
}}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
}}
|
/>}
|
</div>
|
</div>
|
</NewPage>
|
);
|
};
|
|
export default CourtList;
|