/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-03-04 11:27:15
|
* @LastEditTime: 2024-08-09 15:17:48
|
* @LastEditors: dminyi 1301963064@qq.com
|
* @Version: 1.0.0
|
* @Description: 案件完善
|
*/
|
import React, { useEffect, useState } from 'react';
|
import { Button, Typography, Space } from 'antd';
|
import { CheckCircleFilled } from '@ant-design/icons';
|
import { useSearchParams, useNavigate } from 'react-router-dom';
|
import {
|
material_apply,
|
material_apply_active,
|
material_evidence,
|
material_evidence_active,
|
material_other,
|
material_other_active,
|
} from '../../../assets/images/icon';
|
import * as $$ from '../../../utils/utility';
|
import Page from '../../../components/Page';
|
import { CasePerfectionForm } from '../../../components/disputeRegistration/casePerfection';
|
import sopStatus from '../../../status/sopStatus';
|
import SelectObjModal from '../../../components/SelectObjModal';
|
import ProgressStep from '../../../components/ProgressStep';
|
|
// 获取案件信息
|
function getCaseDataApi(caseId, isDraft) {
|
return $$.ax.request({ url: `caseInfo/${isDraft ? 'getDraftInfo' : 'getCaseInfo'}?id=${caseId}`, type: 'get', service: 'mediate' });
|
}
|
|
// 案情完善
|
function registerApi(submitData) {
|
return $$.ax.request({ url: 'caseInfo/caseRegister', type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
// 移除系列案中的案件
|
function deleteFolderCaseApi(caseId) {
|
return $$.ax.request({ url: 'caseInfo/removeDraftSerie?id=' + caseId, type: 'get', service: 'mediate' });
|
}
|
|
// 系列案提交调解
|
function submitFolderCaseApi(submitData) {
|
return $$.ax.request({ url: 'caseInfo/submitSerie', type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
// 案件特征缓存接口
|
function cacheCaseFeatureApi(submitData) {
|
return $$.ax.request({ url: `guide/cacheCaseFeature`, type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
// 类案推荐的案件特征缓存接口
|
function cacheLatjCaseFeatureListApi(submitData) {
|
return $$.ax.request({ url: `guide/cacheLatjCaseFeatureList`, type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
// hh的兼容性修改0419
|
// 调解导航
|
// function getCacheLatjCaseGuideApi(submitData) {
|
// return $$.ax.request({ url: 'guide/cacheLatjCaseGuide', type: 'get', data: submitData, service: 'mediate' });
|
// }
|
function getCacheLatjCaseGuideApi(submitData) {
|
return $$.ax.request({ url: 'guide/cacheLatjCaseRelCpws', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
// 人工智能推荐
|
function getCacheOpenAiCaseGuideApi(submitData) {
|
return $$.ax.request({ url: 'guide/cacheOpenAiCaseGuideList', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
/**
|
* isMediationWindow, // 判断是否来自调解视窗则不显示提交成功后的显示 和 page的头部
|
* onSuccessSubmit, // 提交成功后的回调
|
*/
|
const CasePerfection = ({ isMediationWindow, onSuccessSubmit }) => {
|
const [searchParams] = useSearchParams();
|
|
// 判断路由是否有caseId则为完善,无则为新增
|
const caseId = searchParams.get('caseId');
|
|
// 判断如果来自草稿修改则执行不同的api接口
|
const isDraft = searchParams.get('isDraft');
|
|
const navigate = useNavigate();
|
|
// 是否登记成功, '1':草稿案件 '2':正式案件
|
const [isRegisterSuccess, setIsRegisterSuccess] = useState(false);
|
|
// 案件数据
|
const [data, setData] = useState({});
|
|
// 意向调解员modal
|
const [selectModal, setSelectModal] = useState(false);
|
|
// 调解员
|
const [wantUser, setWantUser] = useState({});
|
|
// 新增后的案件id
|
const [newCaseId, setNewCaseId] = useState('');
|
|
// 材料tabs选中项
|
const materialTabs = [
|
{ label: '全部', value: 'all' },
|
{ label: '申请材料', value: '22_00018-101', tag: '申请', icon: material_apply, iconActive: material_apply_active },
|
{ label: '证据材料', value: '22_00018-102', tag: '证据', icon: material_evidence, iconActive: material_evidence_active },
|
{ label: '其他材料', value: '22_00018-199', tag: '其他', icon: material_other, iconActive: material_other_active },
|
];
|
const [materialActive, setMaterialActive] = useState(1);
|
|
// 保存
|
function handleSubmit(submitData, caseType, caseIndex) {
|
// 非系列案
|
submitData.acceptTime = $$.timeFormat(submitData.acceptTime, 'isValue');
|
submitData.occurTime = $$.timeFormat(submitData.occurTime, 'isValue');
|
// 二次校验,从快速登记保存的草稿进行常规登记修改时,验证申请人是否存在身份证
|
let info = false;
|
forEach1: for (let i = 0; i < submitData['plaintiffList']?.length; i++) {
|
if (!$$.verifyEmpty(submitData['plaintiffList'][i].certiNo)) {
|
info = true;
|
$$.info({ type: 'warning', content: `请填写申请人${submitData['plaintiffList'][i].trueName}的证件号码` });
|
break forEach1;
|
}
|
}
|
if (info) return;
|
if (caseType === 1) {
|
submitData = { ...submitData, ...wantUser };
|
if (submitData.inputStatus === '1') {
|
$$.modalInfo({
|
title: '确定将案件保存为草稿信息吗?',
|
content: '不生成正式案号,仅存在于「登记列表中」,需转为正式案件后才可以进行调解',
|
okText: '保存草稿',
|
cancelText: '我再想想',
|
onOk: () => register(submitData),
|
});
|
} else {
|
$$.modalInfo({
|
title: '确定提交当前调解信息吗?',
|
content: '提交前请仔细核对纠纷信息和双方申请人信息,确定提交调解吗?',
|
okText: '确定提交',
|
cancelText: '我再想想',
|
onOk: () => { register(submitData) },
|
});
|
}
|
}
|
// 系列案中单个案件的保存
|
if (caseType === 2) {
|
saveFolderCase(submitData, caseIndex);
|
}
|
}
|
|
// 移除系列案中的案件
|
function handleDeleteFolderCase(caseId, caseIndex) {
|
$$.modalInfo({
|
title: '移除案件确认',
|
content: '确定从当前系列案中移除该案件吗?',
|
okText: '确定移除',
|
onOk: async () => {
|
global.setSpinning(true);
|
const res = await deleteFolderCaseApi(caseId);
|
global.setSpinning(false);
|
if (res.type) {
|
$$.infoSuccess({ content: '移除成功' });
|
data.content.splice(caseIndex, 1);
|
setData({ ...data });
|
}
|
},
|
});
|
}
|
|
// 系列案提交调解
|
function handleSubmitFolderCase() {
|
let submitData = { content: data.content, ...wantUser };
|
// 二次校验:1.从快速登记保存的草稿进行常规登记修改时,验证申请人是否存在身份证; 2.复制案件后生成系列案二次验证
|
let info = false;
|
let arr = ['caseType', 'mediType', 'area', 'caseDes', 'caseClaim'];
|
submitData.content.forEach((x, t) => {
|
if (arr.find((item) => !x[item])) {
|
info = `请填写系列案${t + 1}的纠纷信息并保存`;
|
return;
|
}
|
if (x['plaintiffList'].length < 1) {
|
info = `请添加系列案${t + 1}的申请人并保存`;
|
return;
|
}
|
if (x['defendantList'].length < 1) {
|
info = `请添加系列案${t + 1}的被申请人并保存`;
|
return;
|
}
|
forEach1: for (let i = 0; i < x['plaintiffList']?.length; i++) {
|
if (!$$.verifyEmpty(x['plaintiffList'][i].certiNo)) {
|
info = `请填写系列案${t + 1}的申请人${x['plaintiffList'][i].trueName}的证件号码`;
|
break forEach1;
|
}
|
}
|
});
|
if (info) {
|
$$.info({ type: 'warning', content: info });
|
return;
|
}
|
$$.modalInfo({
|
title: '系列案提交确认',
|
content: '确定提交当前系列案吗?',
|
okText: '确定提交',
|
onOk: async () => {
|
submitData.content.forEach((x) => (x.inputStatus = '2'));
|
global.setSpinning(true);
|
const res = await submitFolderCaseApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setIsRegisterSuccess('2');
|
}
|
},
|
});
|
}
|
|
|
// hh的兼容性修改0419
|
// 调解视窗-Openai接口-缓存
|
async function getCacheOpenAiCaseGuide(submitData, tableActive) {
|
// $$.setLocal(`cacheOpenAiCaseGuideList${submitData.caseId}`, '')
|
// const res = await getCacheOpenAiCaseGuideApi(submitData);
|
// if (res.type) {
|
// $$.clearLocal(`cacheOpenAiCaseGuideList${submitData.caseId}`)
|
// }
|
// const res = await getCacheOpenAiCaseGuideApi(submitData);
|
}
|
|
// hh的兼容性修改0419
|
// 调解视窗-类案推荐-缓存
|
async function getCacheLatjCaseGuide(submitData) {
|
// $$.setLocal(`cacheLatjCaseGuide${submitData.caseId}`, '')
|
// const res = await getCacheLatjCaseGuideApi(submitData);
|
// if (res.type) {
|
// $$.clearLocal(`cacheLatjCaseGuide${submitData.caseId}`)
|
// cacheLatjCaseFeatureList(submitData)
|
// }
|
// const res = await getCacheLatjCaseGuideApi(submitData);
|
}
|
|
// hh的兼容性修改0419
|
// 案件特征缓存
|
async function cacheCaseFeature(submitData) {
|
// $$.setLocal(`cacheCaseFeature${submitData.caseId}`, '')
|
// const res = await cacheCaseFeatureApi(submitData);
|
// if (res.type) {
|
// $$.clearLocal(`cacheCaseFeature${submitData.caseId}`)
|
|
// }
|
// const res = await cacheCaseFeatureApi(submitData);
|
}
|
|
// hh的兼容性修改0419
|
// 类案推荐的案件特征缓存接口
|
async function cacheLatjCaseFeatureList(submitData) {
|
// $$.setLocal(`cacheLatjCaseFeatureList${submitData.caseId}`, '')
|
// const res = await cacheLatjCaseFeatureListApi(submitData);
|
// if (res.type) {
|
// $$.clearLocal(`cacheLatjCaseFeatureList${submitData.caseId}`)
|
// }
|
const res = await cacheLatjCaseFeatureListApi(submitData);
|
}
|
|
// 系列案中单个案件保存信息
|
async function saveFolderCase(submitData, caseIndex) {
|
global.setSpinning(true);
|
const res = await registerApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
$$.infoSuccess({ content: '保存成功' });
|
data.content.splice(caseIndex, 1, submitData);
|
// changeTime:用于更新系列案展示的申请人和被申请人
|
setData({ ...data, changeTime: $$.timeFormat(new Date()) });
|
console.log('res', res.data);
|
// 1:类案推荐,2:法条推荐,3:要素提取,4:司法解释,5:调解策略,6:争议焦点
|
getCacheOpenAiCaseGuide({ caseId: res.data, guideTypes: '5,6,7' })
|
getCacheLatjCaseGuide({ caseId: res.data, start_page_num: 0, end_page_num: 1000 })
|
cacheCaseFeature({ caseId: res.data || '' })
|
}
|
}
|
|
// 非系列案纠纷登记(保存表单数据)
|
async function register(submitData) {
|
global.setSpinning(true);
|
const res = await registerApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
if (isMediationWindow) {
|
$$.infoSuccess({ content: '修改成功' });
|
onSuccessSubmit();
|
} else {
|
setIsRegisterSuccess(submitData.inputStatus);
|
setNewCaseId(res.data);
|
console.log('res', res.data);
|
// 1:类案推荐,2:法条推荐,3:要素提取,4:司法解释,5:调解策略,6:争议焦点
|
getCacheOpenAiCaseGuide({ caseId: res.data, guideTypes: '5,6,7' })
|
getCacheLatjCaseGuide({ caseId: res.data, start_page_num: 0, end_page_num: 1000 })
|
cacheCaseFeature({ caseId: res.data || '' })
|
}
|
}
|
}
|
|
useEffect(() => {
|
// 获取案件信息
|
async function getCaseData() {
|
global.setSpinning(true);
|
const res = await getCaseDataApi(caseId, isDraft);
|
global.setSpinning(false);
|
if (res.type) {
|
setData(res.data);
|
if (res.data?.wantUserId) {
|
setWantUser({ wantUserId: res.data.wantUserId, wantUserName: res.data.wantUserName });
|
}
|
}
|
}
|
if (caseId) {
|
getCaseData();
|
} else {
|
setData({ serieStatus: '1' });
|
setWantUser({});
|
}
|
setIsRegisterSuccess(false);
|
return () => {
|
sopStatus.handleVisible(false);
|
};
|
}, [caseId, isDraft]);
|
|
return (
|
<Page
|
pageHead={
|
isMediationWindow
|
? null
|
: {
|
...(caseId && { breadcrumbData: [{ url: '/mediate/registerList', title: '草稿箱' }, { title: '常规登记' }] }),
|
title: '常规登记',
|
sopVisible: true,
|
subtitle: (
|
<span>
|
适合登记完整的案件信息,如临时登记或需要马上启动调解等工作场景,建议使用
|
<Typography.Link type='line' onClick={() => navigate('/mediate/register')}>
|
快速登记
|
</Typography.Link>
|
</span>
|
),
|
}
|
}
|
>
|
{!!isRegisterSuccess ? (
|
// 登记成功
|
<div className="register-over">
|
<div className="register-over-success">
|
<CheckCircleFilled className="register-over-icon" />
|
<div className="h6">{isRegisterSuccess === '1' ? '草稿保存' : '提交'}成功</div>
|
<div className="register-over-subtitle">
|
{isRegisterSuccess === '1' ? (
|
'可在「草稿箱」中查看和修改保存成功的案件信息'
|
) : wantUser.wantUserId ? (
|
<>
|
<span className="public-color">已将案件分派至{wantUser.wantUserName}名下</span>,可在「调解总览-办转记录」中查看处理环节与经办人信息
|
</>
|
) : (
|
<>
|
案件已提交,可通过<span className="public-color">调解总览</span>进行查看
|
</>
|
)}
|
</div>
|
</div>
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
<div className="caseDetail-cardMain" style={{}}>
|
<h5>进度</h5>
|
<ProgressStep caseId={caseId || newCaseId} pageFrom="dispatchRecord" />
|
</div>
|
</div>
|
{/* <Space size="large">
|
<Button type="primary" onClick={() => navigate(isRegisterSuccess === '1' ? '/mediate/registerList' : '/mediate/mediateAll')}>
|
{isRegisterSuccess === '1' ? '草稿箱' : '调解总览'}
|
</Button>
|
<Button onClick={() => navigate('/mediate/workbench')}>工作台</Button>
|
</Space> */}
|
</div>
|
) : (
|
// 登记组件
|
<CasePerfectionForm
|
isMediationWindow={isMediationWindow}
|
caseId={caseId}
|
data={data}
|
materialTabs={materialTabs}
|
materialActive={materialActive}
|
wantUser={wantUser}
|
handleSubmit={handleSubmit}
|
handleChangeTab={(x, t) => setMaterialActive(t)}
|
handleOpenWantUser={() => setSelectModal(true)}
|
handleCloseWantUser={() => setWantUser({ wantUserId: null, wantUserName: null })}
|
handleDeleteFolderCase={handleDeleteFolderCase}
|
handleSubmitFolderCase={handleSubmitFolderCase}
|
/>
|
)}
|
{/* 选择调解员modal */}
|
<SelectObjModal
|
visible={selectModal}
|
checkKeys={wantUser.wantUserId ? [{ label: wantUser.wantUserName, value: wantUser.wantUserId }] : undefined}
|
onOk={(value) => {
|
setSelectModal(false);
|
setWantUser({ wantUserId: value.keys[0], wantUserName: value.items[0].name });
|
}}
|
onClose={() => setSelectModal(false)}
|
/>
|
</Page>
|
);
|
};
|
|
export default CasePerfection;
|