/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-03-23 14:34:29
|
* @LastEditTime: 2023-05-12 17:12:17
|
* @LastEditors: lwh
|
* @Version: 1.0.0
|
* @Description: 其他功能
|
*/
|
import React, { useState, useEffect } from 'react';
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
import { Row, Col, Input, Button, Tooltip, Space } from 'antd';
|
import {
|
UsergroupAddOutlined,
|
} from '@ant-design/icons';
|
import { ax, infoSuccess, modalInfo, sleep } from '../../../utils/utility';
|
import MyUpload from '../../../components/MyUpload';
|
import SelectObjModal from '../../../components/SelectObjModal';
|
import WantUserTag from '../../../components/WantUserTag';
|
|
const { TextArea } = Input;
|
|
// 退回上一处理人接口
|
function returnTaskApi(submitData) {
|
return ax.request({ url: 'caseTask/backTask', type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
// 回显
|
function listByCaseIdApi(submitData) {
|
return ax.request({ url: 'caseAssist/listByCaseId', type: 'get', data: submitData, service: 'mediate' });
|
}
|
|
// 新增
|
function setUpAssistApi(caseId, submitData) {
|
return ax.request({ url: 'caseAssist/setUpAssist?caseId=' + caseId, type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
// 删除
|
function removeAssistApi(submitData) {
|
return ax.request({ url: 'caseAssist/removeAssist', type: 'post', data: submitData, service: 'mediate' });
|
}
|
|
|
|
const MediateSetting = ({ tabActive, caseId, taskId, disputeData }) => {
|
const [searchParams] = useSearchParams();
|
|
const navigate = useNavigate();
|
|
const back = searchParams.get('back');
|
|
const [handleContent, setHandleContent] = useState();
|
|
const [otherMediatorList, setOtherMediatorList] = useState([]);
|
|
// 选择协助调解员modal显隐
|
const [selectHelpObjModal, setSelectHelpObjModal] = useState({ visible: false, type: 'person', isCheckbox: true });
|
|
|
async function handleChangeInput(key, value) {
|
console.log(key, value);
|
// 选择后被保存
|
global.setSpinning(true);
|
const res = await setUpAssistApi(caseId, value.map(item => item.value));
|
global.setSpinning(false);
|
if (res.type) {
|
infoSuccess({ content: '保存成功' });
|
setSelectHelpObjModal({ visible: false });
|
setOtherMediatorList(value)
|
}
|
}
|
|
// 退回上一环节
|
function handleReturn() {
|
modalInfo({
|
title: '调解任务退回确认',
|
content: '确定将调解任务退回给上一级处理人吗?',
|
okText: '确定退回',
|
onOk: async () => {
|
global.setSpinning(true);
|
const res = await returnTaskApi({ id: taskId, handleContent });
|
global.setSpinning(false);
|
if (res.type) {
|
infoSuccess({ content: '退回成功,即将为您跳转「我的调解」页面' });
|
await sleep();
|
navigate(`${back}?isBack=true`);
|
}
|
},
|
});
|
}
|
|
useEffect(() => {
|
listByCaseIdData()
|
}, []);
|
|
|
async function listByCaseIdData() {
|
global.setSpinning(true);
|
const res = await listByCaseIdApi({ caseId });
|
global.setSpinning(false);
|
if (res.type) {
|
let list = res.data || [];
|
setOtherMediatorList(list.map(item => ({ checkable: true, value: item.assUserId, name: item.assUserName })));
|
// infoSuccess({ content: '退回成功,即将为您跳转「我的调解」页面' });
|
// await sleep();
|
// navigate(`${back}?isBack=true`);
|
}
|
}
|
|
const oneDom = (
|
<>
|
<div className="mediationWindow-modal-main">
|
<Row gutter={[16, 16]}>
|
<Col span={24}>
|
<h5>退回理由</h5>
|
<TextArea
|
rows={2}
|
value={handleContent}
|
onChange={(e) => setHandleContent(e.target.value)}
|
placeholder="输入退回调解任务给上一级处理人的理由"
|
/>
|
</Col>
|
<Col span={24}>
|
<h5>上传附件</h5>
|
<MyUpload fileId={taskId} fileType="22_00018-501" />
|
</Col>
|
</Row>
|
</div>
|
<div className="mediationWindow-modal-footer">
|
<Tooltip title={disputeData.process === '22_00006-3' ? '司法确认中不可退回' : null}>
|
<Button disabled={disputeData.process === '22_00006-3'} onClick={handleReturn} danger>
|
退回上一环节
|
</Button>
|
</Tooltip>
|
</div>
|
</>
|
);
|
|
console.log('otherMediatorList', otherMediatorList);
|
|
const twoDom = (
|
<>
|
<div className="mediationWindow-modal-main">
|
<Row gutter={[16, 16]}>
|
<Col span={24}>
|
<h5>协助调解参与人</h5>
|
<div className="caseHandle-subtitle">设置完成后,协助调解员可在<span className="public-color">我的调解/我参与的</span>列表中查看和跟进调解案件</div>
|
<Space size="small" wrap>
|
{otherMediatorList?.map((item, index) => {
|
return <WantUserTag color='orange' key={`assistIdList${index}`} value={item.value} name={item.name} onClose={(e) => handleChangeInput('assistIdList', otherMediatorList.filter(item => item.value !== e))} />
|
})}
|
<Button type="dashed" icon={<UsergroupAddOutlined />} onClick={() => setSelectHelpObjModal({ visible: true })}>
|
选择协助调解员
|
</Button>
|
</Space>
|
</Col>
|
{/* <Col span={24}>
|
<h5>协助调解员名单</h5>
|
<Space size="small" wrap>
|
{otherMediatorList?.map((item, index) => {
|
return <WantUserTag color='orange' key={`assistIdList${index}`} value={item.value} name={item.name} onClose={(e) => handleChangeInput('assistIdList', otherMediatorList.filter(item => item.value !== e))} />
|
})}
|
</Space>
|
</Col> */}
|
</Row>
|
</div>
|
{/* <div className="mediationWindow-modal-footer">
|
<Tooltip title={disputeData.process === '22_00006-3' ? '司法确认中不可退回' : null}>
|
<Button type="primary" onClick={handleReturn}>
|
保存修改
|
</Button>
|
</Tooltip>
|
</div> */}
|
</>
|
);
|
|
return (
|
<>
|
{
|
tabActive === '1' ? oneDom : twoDom
|
}
|
<SelectObjModal
|
visible={selectHelpObjModal.visible}
|
type={selectHelpObjModal.type}
|
isCheckbox={true}
|
checkKeys={otherMediatorList ? otherMediatorList.map(item => ({ value: item.value, label: item.name })) : []}
|
onClose={() => setSelectHelpObjModal({ visible: false })}
|
onOk={(value) => {
|
|
handleChangeInput('assistIdList', value.items);
|
}}
|
/>
|
</>
|
);
|
};
|
|
export default MediateSetting;
|