/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-03-23 11:16:55
|
* @LastEditTime: 2022-12-02 10:11:00
|
* @LastEditors: ldh
|
* @Version: 1.0.0
|
* @Description: 司法确认结束-反馈司法确认结果
|
*/
|
import React, { useState, useEffect, useRef } from 'react';
|
import { useSearchParams, useNavigate } from 'react-router-dom';
|
import PropTypes from 'prop-types';
|
import { Row, Col, Space, Input, Button, Typography, Radio, Checkbox, Tooltip } from 'antd';
|
import { PlusOutlined, CloseCircleFilled } from '@ant-design/icons';
|
import * as $$ from '../../../utils/utility';
|
import MyUpload from '../../../components/MyUpload';
|
|
const { TextArea } = Input;
|
|
const { Link } = Typography;
|
|
// 获取司法确认结果数据
|
function getDataApi(submitData) {
|
return $$.ax.request({ url: `judicInfo/pcWindowMeetUsers?caseId=${submitData}`, type: 'get', service: 'mediate' });
|
}
|
|
// 司法确认结果反馈
|
function resultFeedbackApi(submitData) {
|
return $$.ax.request({ url: 'judicInfo/pcWindowInJudicResult', type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
const ResultFeedback = ({ caseId, taskId, disputeData }) => {
|
const myUploadRef = useRef();
|
|
const [searchParams] = useSearchParams();
|
|
let navigate = useNavigate();
|
|
const back = searchParams.get('back');
|
|
// form数据
|
const [formData, setFormData] = useState({});
|
|
// 申请人,被申请人,其他人数据
|
const [data, setData] = useState({});
|
|
function handleChangeInput(key, value) {
|
if (key === 'judicResult') {
|
formData.judicResult = value[0];
|
formData.judicResultName = value[1];
|
} else {
|
formData[key] = value;
|
}
|
setFormData({ ...formData });
|
}
|
|
// 文件展示
|
function handleChangeFile(file) {
|
$$.modalInfo({
|
content: '确定删除该文书吗?',
|
onOk: () => {
|
myUploadRef.current.handleDeleteFiles(file.id).then((res) => {
|
if (res) getData();
|
});
|
},
|
});
|
}
|
|
// 获取数据
|
async function getData() {
|
global.setSpinning(true);
|
const res = await getDataApi(caseId);
|
global.setSpinning(false);
|
if (res.type) {
|
let resData = res.data || {};
|
setData(resData);
|
}
|
}
|
|
// 司法确认结果反馈
|
async function resultFeedback() {
|
let submitData = {
|
...formData,
|
judicFalseCause: formData.judicResult !== '22_00028-2' ? undefined : formData.judicFalseCause,
|
mediateJudicNo: formData.judicResult !== '22_00028-2' ? formData.mediateJudicNo : undefined,
|
caseId,
|
taskId,
|
};
|
submitData.meetUserList = data.meetUserList.map((x) => {
|
return { id: x.id, signStatus: x.signStatus };
|
});
|
global.setSpinning(true);
|
const res = await resultFeedbackApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
$$.infoSuccess({ content: '司法确认结果提交成功!尊敬的法官您辛苦了,即将为您跳转「我的司法确认」页面' });
|
await $$.sleep();
|
if (window.location.href?.indexOf('judicialWindow') !== -1) {
|
// 返回时返回到结束tab
|
let obj = $$.getSessionStorage(back);
|
$$.setSessionStorage(back, { ...obj, search: { ...obj.search, pageType: '2' } });
|
navigate(`${back}?isBack=true`);
|
}
|
}
|
}
|
|
useEffect(() => {
|
getData();
|
setFormData({
|
judicResult: $$.options.judicResult[0].value,
|
judicResultName: $$.options.judicResult[0].label,
|
mediateJudicNo: disputeData?.mediateJudicNo,
|
handleContent: disputeData?.handleContent,
|
});
|
}, []);
|
|
return (
|
<>
|
<div className="mediationWindow-modal-main">
|
<Row gutter={[16, 16]}>
|
<Col span={24}>
|
<h5>司法确认结果</h5>
|
<Radio.Group value={formData.judicResult} onChange={(e) => handleChangeInput('judicResult', [e.target.value, e.target.label])}>
|
<Space direction="vertical">
|
{$$.options.judicResult.map((x) => (
|
<Radio value={x.value} key={x.value} label={x.label}>
|
{x.label}
|
</Radio>
|
))}
|
</Space>
|
</Radio.Group>
|
</Col>
|
{formData.judicResult === '22_00028-2' ? (
|
<Col span={24}>
|
<h5>
|
未达成原因<span className="leftRequired">*</span>
|
</h5>
|
<TextArea
|
value={formData.judicFalseCause}
|
onChange={(e) => handleChangeInput('judicFalseCause', e.target.value)}
|
placeholder="输入未达成的原因"
|
allowClear
|
rows={2}
|
/>
|
</Col>
|
) : (
|
<>
|
<Col span={24}>
|
<h5>裁定文书</h5>
|
<Row gutter={[24, 16]}>
|
{data.resultFileList
|
?.filter((item) => item.ownerType === '22_00018-405')[0]
|
?.fileList.map((x, t) => (
|
<Col span={12} key={t}>
|
<div className="public-fileCard">
|
<img src={$$.fileType(x.cat)} alt="" />
|
<div className="public-fileCard-main">
|
<Typography.Text ellipsis={{ tooltip: x.name }}>{x.name}</Typography.Text>
|
<Space size="middle" className="public-fileCard-action">
|
<Link onClick={() => myUploadRef.current.handleOpenFiles(x)}>预览</Link>
|
<Link onClick={() => myUploadRef.current.handleDownloadFiles(x)}>下载</Link>
|
</Space>
|
</div>
|
<div className="public-fileCard-del" onClick={() => handleChangeFile(x)}>
|
<CloseCircleFilled />
|
</div>
|
</div>
|
<div className="public-fileCard-text">
|
<div>制作人:{x.uploaderName || '-'}</div>
|
<div>制作时间:{$$.timeFormat(x.createTime)}</div>
|
</div>
|
</Col>
|
))}
|
<Col span={12}>
|
<MyUpload
|
type="diy"
|
fileId={caseId}
|
fileType="22_00018-405"
|
fileList={data.resultFileList?.filter((item) => item.ownerType === '22_00018-405')[0]?.fileList || []}
|
showFileList={false}
|
myUploadRef={myUploadRef}
|
handleChangeFile={(type) => {
|
if (type === 'success') getData();
|
}}
|
>
|
<Tooltip title="点击上传">
|
<div className="mediationWindow-document-plus">
|
<PlusOutlined style={{ fontSize: '24px', color: 'rgba(0,0,0,0.5)' }} />
|
</div>
|
</Tooltip>
|
</MyUpload>
|
</Col>
|
</Row>
|
</Col>
|
<Col span={24}>
|
<h5>诉前调确号</h5>
|
<Input
|
value={formData.mediateJudicNo}
|
onChange={(e) => handleChangeInput('mediateJudicNo', e.target.value)}
|
placeholder="输入审判业务系统的诉前调确号(如有)"
|
allowClear
|
style={{ width: '354px' }}
|
/>
|
</Col>
|
</>
|
)}
|
<Col span={24}>
|
<h5>人员参与情况(打勾代表参与司法确认)</h5>
|
<Space direction="vertical">
|
{!data.meetUserList?.length && $$.MyEmpty()}
|
{data.meetUserList?.map((x, t) => (
|
<Checkbox
|
key={t}
|
checked={x.signStatus === '2' ? true : false}
|
onChange={(e) => {
|
data.meetUserList[t].signStatus = e.target.checked ? '2' : '1';
|
setData({ ...data });
|
}}
|
>
|
{x.userName}
|
</Checkbox>
|
))}
|
</Space>
|
</Col>
|
<Col span={24}>
|
<h5>司法确认备注</h5>
|
<TextArea
|
value={formData.handleContent}
|
placeholder="简要对司法确认过程进行总结"
|
allowClear
|
rows={2}
|
onChange={(e) => handleChangeInput('handleContent', e.target.value)}
|
/>
|
</Col>
|
{/*TODO:暂无 <Col span={24}>
|
<h5>上传附件</h5>
|
<MyUpload fileId={caseId} fileType="22_00018-305" fileList={data.sceneFileList || []} />
|
</Col> */}
|
</Row>
|
</div>
|
<div className="mediationWindow-modal-footer">
|
<Space size="large">
|
<Button
|
type="primary"
|
onClick={() => {
|
if (formData.judicResult === '22_00028-2' && !$$.verifyEmpty(formData.judicFalseCause)) {
|
$$.info({ type: 'warning', content: '请输入未达成原因' });
|
return;
|
}
|
$$.modalInfo({
|
title: '司法确认结果提交确认',
|
content: `确定提交本案的司法确认结果为「${formData.judicResultName}」吗?`,
|
okText: '确定提交',
|
cancelText: '我再想想',
|
onOk: () => resultFeedback(),
|
});
|
}}
|
>
|
提交结果
|
</Button>
|
</Space>
|
</div>
|
</>
|
);
|
};
|
|
ResultFeedback.propTypes = {
|
caseId: PropTypes.string,
|
taskId: PropTypes.string,
|
};
|
|
export default ResultFeedback;
|