/*
|
* @Company: hugeInfo
|
* @Author: lwh
|
* @Date: 2022-03-23 09:35:00
|
* @LastEditTime: 2022-11-30 12:24:11
|
* @LastEditors: ldh
|
* @Version: 1.0.0
|
* @Description: 调度历史
|
*/
|
|
import React, { useState, useEffect } from 'react';
|
import * as $$ from '../../../utils/utility';
|
import { Form, Typography } from 'antd';
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
import Page from '../../../components/Page/index';
|
import TableView from '../../../components/TableView';
|
import TableSearch from '../../../components/TableSearch';
|
import MyTabs from '../../../components/MyTabs';
|
|
// 调度历史列表
|
function listQueryApi(submitData) {
|
return $$.ax.request({ url: 'caseDisp/pageHistory', type: 'get', data: submitData, service: 'disp' });
|
}
|
|
const { Link } = Typography;
|
|
const MediateHis = () => {
|
const [form] = Form.useForm();
|
|
const navigate = useNavigate();
|
|
const [searchParams] = useSearchParams();
|
|
const location = useLocation();
|
|
// 搜索
|
const [search, setSearch] = useState({ page: 1, size: 10, acceptObjSign: '1' });
|
|
// 数据
|
const [data, setData] = useState({ tableData: [] });
|
|
// 搜索 or 重置
|
function handleSearch(type, data, tableActive) {
|
if (type === 'recovery') {
|
// 详情返回时恢复跳转前查询
|
let obj = { ...search, ...data };
|
if (obj.dispTimeStart) {
|
obj.dispTime = [$$.myMoment(obj.dispTimeStart), $$.myMoment(obj.dispTimeEnd)];
|
}
|
form.setFieldsValue(obj);
|
getData(obj, tableActive);
|
}
|
if (type === 'search') {
|
let values = form.getFieldsValue();
|
$$.changeTimeFormat(values, 'dispTime', 'dispTimeStart', 'dispTimeEnd');
|
getData({ ...search, ...values, page: 1 });
|
}
|
if (type === 'reset') {
|
form.resetFields();
|
getData({ page: 1, size: 10, acceptObjSign: '1' });
|
}
|
}
|
|
const columns = () => {
|
const otherColumns =
|
search.acceptObjSign === '1'
|
? [{ title: '已调度天数', dataIndex: 'dispTime2', render: (_, record) => parseInt($$.getHours(new Date(), record.dispTime)?.hours / 24) }]
|
: [];
|
const columnsData = [
|
{ title: '调解案号', dataIndex: 'caseNo' },
|
...otherColumns,
|
{ title: '调度方式', dataIndex: 'dispWayName' },
|
{ title: '受理对象', dataIndex: 'acceptObjName' },
|
{ title: '申请渠道', dataIndex: 'applyCanalName' },
|
{ title: '调度状态', dataIndex: 'statusName' },
|
{ title: '纠纷类型', dataIndex: 'caseTypeName' },
|
{ title: '申请人', dataIndex: 'plaintiffs' },
|
{ title: '被申请人', dataIndex: 'defendants' },
|
{ title: '纠纷发生地', dataIndex: 'addr' },
|
{ title: '调解类型', dataIndex: 'mediTypeName' },
|
{ title: '调度时间', dataIndex: 'dispTime' },
|
{ title: '调度人', dataIndex: 'dispUserName' },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 50,
|
render: (_, record) => {
|
return (
|
<Link onClick={() => handleJump(record.caseNo, record.caseId, record.dispId)}>{search.acceptObjSign === '1' ? '处理' : '查看'}</Link>
|
);
|
},
|
},
|
];
|
return columnsData;
|
};
|
|
// 查看,处理跳转
|
function handleJump(title, caseId, dispId) {
|
$$.setSessionStorage(location.pathname, {
|
search: { ...search },
|
breadcrumbData: [{ title: '调度历史', url: location.pathname }, { title: '调度记录' }],
|
title,
|
tableActive: dispId,
|
isEdit: search.acceptObjSign === '1' ? true : false,
|
pageFrom: 'mediateHis',
|
});
|
navigate(`/mediate/caseDetail?caseId=${caseId}&dispId=${dispId}&back=${location.pathname}`);
|
}
|
|
// 获取数据
|
async function getData(submitData, tableActive) {
|
global.setSpinning(true);
|
const res = await listQueryApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setSearch(submitData);
|
setData({
|
total: res.data?.dtoPage?.totalElements,
|
tableData: res.data?.dtoPage?.content || [],
|
tableActive,
|
countWqs: res.data.countWqs,
|
countYqs: res.data.countYqs,
|
});
|
}
|
}
|
|
// 初始化
|
useEffect(() => {
|
let returnRouteData = $$.getSessionStorage(location.pathname);
|
if (searchParams.get('isBack') && !!returnRouteData) {
|
handleSearch('recovery', returnRouteData.search, returnRouteData.tableActive);
|
} else {
|
handleSearch('reset');
|
}
|
if (!!returnRouteData) {
|
$$.clearSessionStorage(location.pathname);
|
}
|
}, []);
|
|
const countWqs = (search.acceptObjSign === '1' ? data.total : data.countWqs) || 0;
|
|
const countYqs = (search.acceptObjSign === '2' ? data.total : data.countYqs) || 0;
|
|
return (
|
<Page pageHead={{ title: '调度历史', subtitle: '展示账号下已调度的矛盾纠纷案件列表' }}>
|
<div className="mediateList">
|
<div className="pageSearch">
|
<TableSearch
|
form={form}
|
itemData={[
|
{ type: 'Input', name: 'plaintiffs', label: '申请人' },
|
{ type: 'Input', name: 'defendants', label: '被申请人' },
|
{ type: 'RangePicker', name: 'dispTime', label: '调度时间' },
|
{
|
type: 'Select',
|
name: 'applyCanal',
|
label: '申请渠道',
|
selectdata: $$.options.caseCanal,
|
},
|
{ type: 'Input', name: 'acceptObjName', label: '受理对象', placeholder: '调解组织名称或调解员姓名' },
|
{
|
type: 'Select',
|
name: 'dispWay',
|
label: '调度方式',
|
selectdata: [
|
{ value: '1', label: '系统调度' },
|
{ value: '2', label: '人工调度' },
|
],
|
},
|
{ type: 'Input', name: 'caseNo', label: '调解案号' },
|
{ type: 'Input', name: 'addr', label: '纠纷发生地' },
|
{
|
type: 'Select',
|
name: 'caseType',
|
label: '纠纷类型',
|
selectdata: $$.caseOptions.caseCause,
|
},
|
]}
|
handleReset={() => handleSearch('reset')}
|
handleSearch={() => handleSearch('search')}
|
/>
|
</div>
|
<div className="pageTabs">
|
<MyTabs
|
tabs={[
|
{ key: '1', label: `未签收(${$$.showMoreNum(countWqs)})` },
|
{ key: '2', label: `已签收(${$$.showMoreNum(countYqs)})` },
|
]}
|
activeKey={search.acceptObjSign}
|
onChange={(activeKey) => getData({ ...search, page: 1, size: 10, acceptObjSign: activeKey })}
|
/>
|
</div>
|
<div className="pageTable">
|
<TableView
|
showHeader
|
title="查询结果"
|
rowKey="dispId"
|
columns={columns()}
|
dataSource={data.tableData}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
onChange: (page, pageSize) => getData({ ...search, page, size: pageSize }),
|
}}
|
rowClassName={(record) => (record.dispId === data.tableActive ? 'tableRowActive' : '')}
|
/>
|
</div>
|
</div>
|
</Page>
|
);
|
};
|
|
export default MediateHis;
|