forked from gzzfw/frontEnd/gzDyh

dminyi
2024-09-11 009868da80db32c846b32e4c406253935b4b3966
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-03-23 14:34:29
 * @LastEditTime: 2022-12-02 17:14:34
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 其他功能
 */
import React, { useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { Row, Col, Space, Input, Button, Tooltip } from 'antd';
import { UserAddOutlined } from '@ant-design/icons';
import WantUserTag from '../../../components/WantUserTag';
import MyUpload from '../../../components/MyUpload';
import { ax, infoSuccess, modalInfo, sleep } from '../../../utils/utility';
 
// 退回上一处理人接口
function returnTaskApi(submitData) {
    return ax.request({ url: 'judicTask/backTask', type: 'post', data: submitData, service: 'mediate' });
}
 
const { TextArea } = Input;
 
const MediateSetting = ({ taskId, disputeData, tabActive }) => {
    const [searchParams] = useSearchParams();
 
    const navigate = useNavigate();
 
    const back = searchParams.get('back');
 
    const [handleContent, setHandleContent] = useState();
 
    // 退回上一环节
    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`);
                }
            },
        });
    }
 
    // 选择助理/书记员TODO:暂无
    const oneDom = (
        <Row gutter={[16, 16]}>
            <Col>
                <h5>选择助理/书记员</h5>
                <div className="caseDetail-subtitle" style={{ marginBottom: '8px' }}>
                    助理/书记员可在“我的司法确认-我参与的”列表中跟进案件调解工作
                </div>
                <Button type="dashed" icon={<UserAddOutlined />}>
                    选择人员
                </Button>
            </Col>
            <Col span={24}>
                <h5>助理/书记员名单</h5>
                <Space size="large">
                    <WantUserTag name="陈雄" onClose={() => console.log(99)} />
                    <WantUserTag name="陈雄" onClose={() => console.log(99)} />
                </Space>
            </Col>
        </Row>
    );
 
    // 退回上一环节
    const twoDom = (
        <>
            <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>
        </>
    );
 
    return (
        <>
            {tabActive === '1' && oneDom}
            {tabActive === '2' && twoDom}
        </>
    );
};
 
export default MediateSetting;