广州市综治平台前端
xusd
1 days ago bdeacb9f02dfa74bac74296a4a2c989a8e0d45ff
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-03-22 17:02:07
 * @LastEditTime: 2022-12-02 17:15:30
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 操作Modal
 */
import React, { useMemo, useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Space } from 'antd';
import {
    MediationWindowClose,
    mediationWindowModalBg1,
    mediationWindowModalBg2,
    mediationWindowModalBg3,
    mediationWindowModalBg4,
} from '../../../assets/images/icon';
import { MediateStart, MediationCode, OrderMediation, DocumentMaking, ResultFeedback, ApplyMsg, MediateSetting } from './index';
import FilesCheck from '../../filesCheck';
import { DisputeMsg } from '../../caseDetail/components';
 
/**
 * visible, // 显隐
 * actionType, // 操作区别
 * onClose, // 关闭modal
 * onStartMediation, // 开始司法确认回调
 * getDisputeData, // 获取案件信息回调
 */
const ActionModal = ({ caseId, judicialId, taskId, disputeData, visible, actionType, getDisputeData, onClose, onStartMediation }) => {
    const [tabActive, setTabActive] = useState();
 
    // 设置标题
    const title = useMemo(() => {
        let str = '标题';
        if (actionType === 'mediationStart') {
            str = '开始司法确认';
        } else if (actionType === 'qrCode') {
            str = '司法确认邀请码';
        } else if (actionType === 'orderMediation') {
            if (tabActive === '1') {
                str = '预约记录';
            } else {
                str = '添加预约';
            }
        } else if (actionType === 'documentMaking') {
            if (tabActive === '22_00018-405') {
                str = '民事裁定书';
            } else if (tabActive === '22_00018-401') {
                str = '问询笔录';
            } else {
                str = '送达回证';
            }
        } else if (actionType === 'mediationOver') {
            str = '提交司法确认结果';
        } else if (actionType === 'materialCheck') {
            str = '材料查看';
        } else if (actionType === 'caseCheck') {
            str = '案件信息';
        } else if (actionType === 'applyMsg') {
            str = '司法确认申请信息';
        } else if (actionType === 'setting') {
            if (tabActive === '1') {
                str = '助理/书记员设置';
            } else {
                str = '司法确认任务退回';
            }
        }
        return str;
    }, [actionType, tabActive]);
 
    // 设置tabs
    const tabs = useMemo(() => {
        let arr = [];
        if (actionType === 'orderMediation') {
            arr = [
                { value: '1', label: '预约记录' },
                { value: '2', label: '添加预约' },
            ];
        } else if (actionType === 'documentMaking') {
            arr = [
                { value: '22_00018-405', label: '民事裁定书' },
                { value: '22_00018-401', label: '问询笔录' },
                { value: '22_00018-407', label: '送达回证' },
            ];
        } else if (actionType === 'setting') {
            arr = [
                // { value: '1', label: '助理/书记员设置' },
                { value: '2', label: '司法确认任务退回' },
            ];
        }
        return arr;
    }, [actionType]);
 
    // 设置右下角背景
    const bg = useMemo(() => {
        let img = mediationWindowModalBg1;
        if (actionType === 'orderMediation') {
            img = mediationWindowModalBg2;
        }
        if (actionType === 'documentMaking') {
            img = mediationWindowModalBg3;
        }
        if (actionType === 'setting') {
            img = mediationWindowModalBg4;
        }
        return img;
    }, [actionType]);
 
    // 修改tab
    function handleChangeTab(type) {
        setTabActive(type);
    }
 
    useEffect(() => {
        if (actionType === 'orderMediation') {
            setTabActive('1');
        } else if (actionType === 'documentMaking') {
            setTabActive('22_00018-405');
        } else if (actionType === 'setting') {
            setTabActive('2');
        }
    }, [actionType]);
 
    return (
        <div
            className={`mediationWindow-modal ${['caseCheck'].includes(actionType) ? 'mediationWindow-modal-fullScreen' : ''} animated faster ${
                visible ? 'backInUp' : 'backOutDown'
            }`}
        >
            <div className="mediationWindow-modal-close" onClick={onClose}>
                <MediationWindowClose />
            </div>
            {tabs.length !== 0 && (
                <div className="mediationWindow-modal-left">
                    {tabs.map((x, t) => (
                        <div
                            onClick={() => handleChangeTab(x.value)}
                            className={`mediationWindow-modal-left-tab ${tabActive === x.value ? 'mediationWindow-modal-left-tabActive' : ''}`}
                            key={x.value}
                        >
                            {x.label}
                        </div>
                    ))}
                </div>
            )}
            <div className="mediationWindow-modal-right">
                <div className="mediationWindow-modal-header">
                    <Space align="center">
                        <div className="mediationWindow-modal-header-divider" />
                        <h4>{title}</h4>
                    </Space>
                </div>
                {/* 右下角背景 */}
                <div className="mediationWindow-modal-bg">
                    <img src={bg} alt="" />
                </div>
                {/* 开始司法确认 */}
                {actionType === 'mediationStart' && (
                    <MediateStart
                        onStartMediation={() => {
                            onStartMediation();
                            onClose();
                        }}
                    />
                )}
                {/* 预约司法确认 */}
                {actionType === 'orderMediation' && (
                    <OrderMediation tabActive={tabActive} onChangeTab={handleChangeTab} getDisputeData={() => getDisputeData('isNoLoading')} />
                )}
                {/* 文书制作 */}
                {actionType === 'documentMaking' && <DocumentMaking tabActive={tabActive} />}
                {/* 司法确认结束 */}
                {actionType === 'mediationOver' && <ResultFeedback caseId={caseId} taskId={taskId} disputeData={disputeData} />}
                {/* 司法确认邀请码 */}
                {actionType === 'qrCode' && <MediationCode disputeData={disputeData} caseId={caseId} taskId={taskId} />}
                {/* 案件材料查看 */}
                {actionType === 'materialCheck' && (
                    <div className="mediationWindow-modal-main" style={{ display: 'flex' }}>
                        <FilesCheck />
                    </div>
                )}
                {/* 案件信息查看 */}
                {actionType === 'caseCheck' && (
                    <div className="mediationWindow-modal-main">
                        <DisputeMsg caseId={caseId} />
                    </div>
                )}
                {/* 司法确认申请信息 */}
                {actionType === 'applyMsg' && <ApplyMsg judicialId={judicialId} />}
                {/* 其他功能 */}
                {actionType === 'setting' && <MediateSetting taskId={taskId} disputeData={disputeData} tabActive={tabActive} />}
            </div>
        </div>
    );
};
 
ActionModal.propTypes = {
    caseId: PropTypes.string,
    judicialId: PropTypes.string,
    taskId: PropTypes.string,
    disputeData: PropTypes.object,
    visible: PropTypes.bool,
    actionType: PropTypes.string,
    getDisputeData: PropTypes.func,
    onClose: PropTypes.func,
    onStartMediation: PropTypes.func,
};
 
export default ActionModal;