/*
|
* @Company: hugeInfo
|
* @Author: xzx
|
* @Date: 2022-04-19 11:23:52
|
* @LastEditors: ldh
|
* @LastEditTime: 2022-11-07 11:52:50
|
* @Version: 1.0.0
|
* @Description: 司法确认申请列表
|
*/
|
import React, { useEffect, useState } from 'react';
|
import Page from '../../../components/Page/index';
|
import { Form, Button, Typography } from 'antd';
|
import { PlusOutlined } from '@ant-design/icons';
|
import * as $$ from '../../../utils/utility';
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
import TableView from '../../../components/TableView';
|
import TableSearch from '../../../components/TableSearch';
|
|
const { Link } = Typography;
|
|
// 获取司法确认申请列表
|
function getApplicationListDataApi(submitData) {
|
return $$.ax.request({ url: 'judicInfo/pageUnitApply', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
const ApplicationList = () => {
|
const [form] = Form.useForm();
|
|
let location = useLocation();
|
|
let navigate = useNavigate();
|
|
let [searchParams] = useSearchParams();
|
|
// 搜索
|
const [search, setSearch] = useState({ page: 1, size: 10 });
|
|
// 数据
|
const [data, setData] = useState({ tableData: [] });
|
|
// 表头
|
const columns = [
|
{ title: '调解案号', dataIndex: 'caseNo' },
|
{ title: '司法确认案号', dataIndex: 'judicNo' },
|
{ title: '申请时间', dataIndex: 'applyTime' },
|
{ title: '受理单位', dataIndex: 'courtName' },
|
{
|
title: '审查结果',
|
dataIndex: 'auditResult',
|
render: (text, record) =>
|
!text ? (
|
'-'
|
) : (
|
<div className={`public-tag public-tag-${text === '22_00032-1' ? 'tagBlue2' : text === '22_00032-2' ? 'tagRed' : 'tagOrange'}`}>
|
{record.auditResultName}
|
</div>
|
),
|
},
|
{ title: '审查处理', dataIndex: 'judicHandleName' },
|
{ title: '申请人', dataIndex: 'plaintiffs' },
|
{ title: '被申请人', dataIndex: 'defendants' },
|
{ title: '纠纷类型', dataIndex: 'caseTypeName' },
|
{ title: '纠纷发生地详址', dataIndex: 'addr' },
|
{ title: '调解组织', dataIndex: 'mediateUnitName' },
|
{ title: '调解员', dataIndex: 'mediateUserName' },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 50,
|
render: (_, record) => <Link onClick={() => handleJump(record)}>查看</Link>,
|
},
|
];
|
|
// 获取数据
|
async function getApplicationListData(submitData, tableActive) {
|
global.setSpinning(true);
|
const res = await getApplicationListDataApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setData({ total: res.data?.totalElements, tableData: res.data?.content || [], tableActive });
|
}
|
}
|
|
// 反馈跳转
|
function handleJump(info) {
|
$$.setSessionStorage(location.pathname, {
|
search,
|
tableActive: info.id,
|
});
|
navigate(`/mediate/applicationList/judicialApplyDetail?judicialId=${info.id}&back=${location.pathname}`);
|
}
|
|
// 页码修改
|
function handleChangePage(page, pageSize) {
|
let paramsObj = Object.assign(search, { page, size: pageSize });
|
setSearch(paramsObj);
|
getApplicationListData(paramsObj);
|
}
|
|
// 搜索 or 重置 待优化
|
function handleSearch(type, value) {
|
let paramsObj = {};
|
if (type === 'recurrent') {
|
paramsObj = { ...search, ...value.search };
|
let copyObj = { ...paramsObj };
|
if (copyObj.applyStart) {
|
copyObj.applyTime = [$$.myMoment(copyObj.applyStart), $$.myMoment(copyObj.applyEnd)];
|
}
|
form.setFieldsValue(copyObj);
|
}
|
if (type === 'search') {
|
paramsObj = { ...search, ...form.getFieldsValue(), page: 1 };
|
$$.changeTimeFormat(paramsObj, 'applyTime', 'applyStart', 'applyEnd');
|
}
|
if (type === 'reset') {
|
form.resetFields();
|
paramsObj = { page: 1, size: 10 };
|
}
|
setSearch(paramsObj);
|
getApplicationListData(paramsObj, value?.tableActive || null);
|
}
|
|
// 初始化
|
useEffect(() => {
|
// 判断是否回显或是重置
|
let values = $$.getSessionStorage(location.pathname);
|
if (searchParams.get('isBack') && !!values) {
|
handleSearch('recurrent', values);
|
} else {
|
handleSearch('reset');
|
}
|
if (!!values) {
|
$$.clearSessionStorage(location.pathname);
|
}
|
}, []);
|
|
return (
|
<Page pageHead={{ title: '司法确认申请列表', subtitle: '查询已经向司法单位申请司法确认的案件进展' }}>
|
<div className="applicationList">
|
<div className="pageSearch">
|
<TableSearch
|
form={form}
|
itemData={[
|
{ type: 'Input', name: 'plaintiffs', label: '申请人' },
|
{ type: 'Input', name: 'defendants', label: '被申请人' },
|
{ type: 'RangePicker', name: 'applyTime', label: '申请时间' },
|
{ type: 'Select', name: 'auditResult', label: '审查结果', selectdata: $$.options.auditResult },
|
{ type: 'Input', name: 'addr', label: '纠纷发生地' },
|
{ type: 'Input', name: 'caseNo', label: '调解案号' },
|
]}
|
handleReset={() => handleSearch('reset')}
|
handleSearch={() => handleSearch('search')}
|
/>
|
</div>
|
<div className="pageTable">
|
<TableView
|
showHeader
|
title="查询结果"
|
buttonAction={[
|
<Button type="primary" icon={<PlusOutlined />} onClick={() => navigate(`/mediate/applicationList/applyJudicial`)}>
|
发起申请
|
</Button>,
|
]}
|
columns={columns}
|
dataSource={data.tableData}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
onChange: (page, pageSize) => handleChangePage(page, pageSize),
|
}}
|
rowClassName={(record) => (record.id === data.tableActive ? 'tableRowActive' : '')}
|
/>
|
</div>
|
</div>
|
</Page>
|
);
|
};
|
|
export default ApplicationList;
|