/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-05-14 14:15:01
|
* @LastEditTime: 2022-12-02 14:30:55
|
* @LastEditors: ldh
|
* @Version: 1.0.0
|
* @Description: 开始调解
|
*/
|
import React, { useState, useEffect } from 'react';
|
import PropTypes from 'prop-types';
|
import { Row, Col, Space, Select, Input, Button, Radio } from 'antd';
|
import * as $$ from '../../../utils/utility';
|
|
const { Option } = Select;
|
|
// 获取调解预约记录
|
function getOrderRecordApi(submitData) {
|
return $$.ax.request({ url: `caseInfo/pcWindowMeetInfos?caseId=${submitData}`, type: 'get', service: 'mediate' });
|
}
|
|
// 开始调解
|
function startMediationApi(submitData) {
|
return $$.ax.request({ url: `caseInfo/pcWindowStartMediate`, type: 'post', service: 'mediate', data: submitData });
|
}
|
|
/**
|
* onStartMediation, // 开始调解回调函数
|
*/
|
const MediateStart = ({ caseId, onStartMediation }) => {
|
// 提交数据
|
const [submitData, setSubmitData] = useState({});
|
|
// 没有预约计划外的则不可以选择计划内
|
const [startTypeDis, setStartTypeDis] = useState(false);
|
|
function handleChangeInput(key, value) {
|
if (key === 'meetWay') {
|
submitData.meetWay = value[0];
|
submitData.meetWayName = value[1];
|
} else {
|
submitData[key] = value;
|
}
|
setSubmitData({ ...submitData });
|
}
|
|
// 确定开始
|
async function handleStart() {
|
global.setSpinning(true);
|
const res = await startMediationApi({ caseId, startType: submitData.startType, meetInfo: submitData.startType === '2' ? submitData : undefined });
|
global.setSpinning(false);
|
if (res.type) {
|
onStartMediation();
|
}
|
}
|
|
useEffect(() => {
|
// 获取预约记录
|
async function getOrderRecord() {
|
global.setSpinning(true);
|
const res = await getOrderRecordApi(caseId);
|
global.setSpinning(false);
|
if (res.type) {
|
let data = res.data?.reverse() || [];
|
setSubmitData({
|
startType: data[0]?.id ? '1' : '2',
|
meetWay: $$.options.meetWay[0].value,
|
meetWayName: $$.options.meetWay[0].label,
|
...data[0],
|
});
|
setStartTypeDis(!data[0]?.id);
|
}
|
}
|
getOrderRecord();
|
}, [caseId]);
|
|
return (
|
<>
|
<div className="mediationWindow-modal-main">
|
<Row gutter={[16, 16]}>
|
<Col span={24}>
|
<h5>调解选项</h5>
|
<Radio.Group onChange={(e) => handleChangeInput('startType', e.target.value)} value={submitData.startType} disabled={startTypeDis}>
|
<Space direction="vertical">
|
<Radio value="1">
|
计划内调解{submitData.startType === '1' && <span className="mediationWindow-modal-subtitle">(在预约调解时间内的调解)</span>}
|
</Radio>
|
<Radio value="2">
|
计划外调解
|
{submitData.startType === '2' && <span className="mediationWindow-modal-subtitle">(临时调解或不在预约调解时间内的调解)</span>}
|
</Radio>
|
</Space>
|
</Radio.Group>
|
</Col>
|
<Col span={24}>
|
<h5>调解方式</h5>
|
<Select
|
onChange={(value, options) => handleChangeInput('meetWay', [value, options.label])}
|
value={submitData.meetWay}
|
style={{ width: '250px' }}
|
>
|
{$$.options.meetWay.map((x) => (
|
<Option value={x.value} key={x.value} label={x.label}>
|
{x.label}
|
</Option>
|
))}
|
</Select>
|
</Col>
|
<Col span={24}>
|
<h5>调解地点</h5>
|
<Input
|
style={{ width: '500px' }}
|
onChange={(e) => handleChangeInput('meetAddr', e.target.value)}
|
value={submitData.meetAddr}
|
placeholder="输入案件的实际调解地址"
|
allowClear
|
/>
|
</Col>
|
<Col span={24}>
|
<h5>调解须知</h5>
|
<div className="mediationWindow-modal-subtitle">
|
<div>平台将在调解开始后对调解过程进行计时,并在调解结束后终止计时。</div>
|
<div>暂停调解:由于(被)申请人个人原因,导致调解工作暂缓。</div>
|
<div>结束调解:已经具备调解结论,反馈调解结果。</div>
|
</div>
|
</Col>
|
</Row>
|
</div>
|
<div className="mediationWindow-modal-footer">
|
<Button type="primary" onClick={handleStart}>
|
立即开始
|
</Button>
|
</div>
|
</>
|
);
|
};
|
|
MediateStart.propTypes = {
|
onStartMediation: PropTypes.func,
|
};
|
|
export default MediateStart;
|