广州市综治平台前端
liuwh
4 days ago fa5361c6776f01975737fb5630594a9c60924fc5
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-07-26 10:16:26
 * @LastEditTime: 2022-12-02 09:22:55
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 司法确认申请列表 - 查看详情
 */
import React, { useState, useEffect, useRef } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { Space, Descriptions, Typography, Row, Col, Button, Select, Input } from 'antd';
import { ProfileOutlined, ScheduleOutlined } from '@ant-design/icons';
import { cardIconCaseCheck } from '../../../assets/images/icon';
import * as $$ from '../../../utils/utility';
import Page from '../../../components/Page';
import NameCard from '../../../components/NameCard';
import FilesDrawer from '../../../components/FilesDrawer';
import MyModal from '../../../components/MyModal';
import MyUpload from '../../../components/MyUpload';
import { DisputeMsg } from '../../caseDetail/components';
 
const { Text, Link } = Typography;
 
const { Option } = Select;
 
const { TextArea } = Input;
 
// 立案法院
function getFilingCourtApi() {
    return $$.ax.request({ url: 'ctUnit/listCourt', type: 'get', service: 'cust' });
}
 
// 获取司法确认详情
function getJudicialApplyDetailDataApi(submitData) {
    return $$.ax.request({ url: `judicInfo/getJudicInfo?id=${submitData}`, type: 'get', service: 'mediate' });
}
 
// 司法申请提交
function applyJudicialApi(submitData) {
    return $$.ax.request({ url: 'judicInfo/unitApplyJudic', type: 'post', data: submitData, service: 'mediate' });
}
 
// 撤销申请
function handleRecallApi(submitData) {
    return $$.ax.request({ url: 'judicInfo/withdraw', type: 'get', data: submitData, service: 'mediate' });
}
 
const JudicialApplyDetail = () => {
    const navigate = useNavigate();
 
    const [searchParams] = useSearchParams();
 
    const back = searchParams.get('back');
 
    const judicialId = searchParams.get('judicialId');
 
    const myUploadRef = useRef();
 
    const myUploadRef2 = useRef();
 
    // 司法确认详情
    const [data, setData] = useState({});
 
    // 是否修改申请
    const [isEdit, setIsEdit] = useState(false);
 
    const [caseCheckModal, setCaseCheckModal] = useState(false);
 
    // 立案法院数据
    const [flingCourtSelectData, setFlingCourtSelectData] = useState([]);
 
    function handleChangeInput(key, value) {
        if (key === 'courtId') {
            data.courtId = value[0];
            data.courtName = value[1];
        } else {
            data[key] = value;
        }
        setData({ ...data });
    }
 
    // 提交申请
    function handleApply() {
        let msg = '';
        if (!data.courtId) {
            msg = '请选择受理单位';
        } else if (!myUploadRef.current.fileList) {
            msg = '请上传调解协议书';
        }
        if (!!msg) {
            $$.info({ type: 'error', content: msg });
            return;
        }
        $$.modalInfo({
            title: '申请司法确认提交确认',
            content: '确定提交当前司法确认申请吗?',
            okText: '确定提交',
            cancelText: '我再想想',
            onOk: applyJudicial,
        });
    }
 
    // 提交申请
    async function applyJudicial() {
        global.setSpinning(true);
        let submitData = {
            id: data.id,
            caseId: data.caseId,
            applyContent: data.applyContent,
            courtId: data.courtId,
            courtName: data.courtName,
        };
        const res = await applyJudicialApi(submitData);
        global.setSpinning(false);
        if (res.type) {
            setIsEdit(false);
            $$.infoSuccess({ content: '修改成功,页面即将跳转' });
            await $$.sleep();
            navigate(`${back}?isBack=true`);
        }
    }
 
    // 获取受理单位法院
    async function getFilingCourt() {
        const res = await getFilingCourtApi();
        if (res.type) {
            setFlingCourtSelectData(res.data || []);
        }
    }
 
    // 撤销申请
    function handleRecall() {
        $$.modalInfo({
            title: '撤销申请提示',
            content: '确定撤销当前司法确认申请吗?',
            okText: '确定撤销',
            cancelText: '我再想想',
            onOk: async () => {
                global.setSpinning(true);
                const res = await handleRecallApi({ id: judicialId });
                global.setSpinning(false);
                if (res.type) {
                    $$.infoSuccess({ content: '撤销成功,页面即将跳转' });
                    await $$.sleep();
                    navigate(`${back}?isBack=true`);
                }
            },
        });
    }
 
    // 初始化
    useEffect(() => {
        // 获取司法确认申请详情信息
        async function getJudicialApplyDetailData() {
            global.setSpinning(true);
            const res = await getJudicialApplyDetailDataApi(judicialId);
            global.setSpinning(false);
            if (res.type) {
                setData(res.data || {});
            }
        }
        getJudicialApplyDetailData();
    }, [judicialId]);
 
    const auditInfo = data.auditInfo || {};
 
    const getFiles = (type) => {
        return data.applyFileList?.filter((item) => item.ownerType === type)[0]?.fileList || [];
    };
 
    return (
        <Page
            pageHead={{
                title: '详情',
                subtitle: '查看和跟进已提交的申请结果和进度',
                breadcrumbData: [{ title: '司法确认申请列表', url: '/mediate/applicationList' }, { title: '详情' }],
                handleReturn: () => navigate(`${back}?isBack=true`, { replace: true }),
            }}
        >
            <div className="judicialApplyDetail">
                <div className="caseDetail-headerCard">
                    <div className="caseDetail-cardTitle">
                        <Space size="small">
                            <div className="caseDetail-cardTitle-icon caseDetail-cardTitle-iconGreen">
                                <ProfileOutlined />
                            </div>
                            <h5>审查信息</h5>
                        </Space>
                    </div>
                    <div className="caseDetail-descriptions">
                        <Descriptions size="small">
                            <Descriptions.Item label="审查单位">{auditInfo.handlerUnitName || '-'}</Descriptions.Item>
                            <Descriptions.Item label="审查时间">{$$.timeFormat(auditInfo.finishTime)}</Descriptions.Item>
                            <Descriptions.Item label="审查人">
                                {auditInfo.handlerUserName ? <NameCard name={auditInfo.handlerUserName} userId={auditInfo.handlerUserId} /> : '-'}
                            </Descriptions.Item>
                            <Descriptions.Item label="审查结果">{auditInfo.auditResultName || '-'}</Descriptions.Item>
                            <Descriptions.Item label="审查意见">
                                <Text className="public-fontBg" ellipsis={{ tooltip: auditInfo.handleContent }}>{auditInfo.handleContent || '-'}</Text>
                            </Descriptions.Item>
                            <Descriptions.Item label="附件信息">
                                <FilesDrawer filesData={auditInfo.fileInfoList || []} />
                            </Descriptions.Item>
                        </Descriptions>
                    </div>
                </div>
                <div className="judicialApplyDetail-main">
                    <div className="caseDetail-cardTitle">
                        <Space size="small">
                            <div className="caseDetail-cardTitle-icon caseDetail-cardTitle-iconBlue">
                                <ScheduleOutlined />
                            </div>
                            <h5>申请信息</h5>
                        </Space>
                    </div>
                    <div className="caseDetail-cardMain" style={{ flex: 1 }}>
                        {isEdit ? (
                            <Row gutter={[16, 16]}>
                                <Col span={24}>
                                    <h5>
                                        调解案件
                                        <span className="leftRequired">*</span>
                                    </h5>
                                    <div className="public-fileCard">
                                        <img src={cardIconCaseCheck} alt="" onClick={() => setCaseCheckModal(true)} style={{ cursor: 'pointer' }} />
                                        <div className="public-fileCard-main">
                                            <Text ellipsis={{ tooltip: data.plaintiffs }}>申请人:{data.plaintiffs}</Text>
                                            <Text ellipsis={{ tooltip: data.defendants }} style={{ marginTop: '4px', display: 'block' }}>
                                                被申请人:{data.defendants}
                                            </Text>
                                        </div>
                                    </div>
                                </Col>
                                <Col span={24}>
                                    <h5>
                                        受理单位
                                        <span className="leftRequired">*</span>
                                    </h5>
                                    <Select
                                        style={{ width: '354px' }}
                                        placeholder="选择开展司法确认工作的相关单位"
                                        value={data.courtId}
                                        onChange={(value, options) => handleChangeInput('courtId', [value, options.label])}
                                    >
                                        {flingCourtSelectData.length !== 0 &&
                                            flingCourtSelectData.map((item) => {
                                                return (
                                                    <Option key={item.value} value={item.value} label={item.label}>
                                                        {item.label}
                                                    </Option>
                                                );
                                            })}
                                    </Select>
                                </Col>
                                <Col span={24}>
                                    <h5>申请说明</h5>
                                    <TextArea
                                        value={data.applyContent}
                                        onChange={(e) => handleChangeInput('applyContent', e.target.value)}
                                        rows={2}
                                        placeholder="描述申请的背景和理由"
                                        allowClear
                                    />
                                </Col>
                                <Col span={24}>
                                    <div className="applyJudicial-divider" />
                                </Col>
                                <Col span={24}>
                                    <h5>
                                        调解协议书
                                        <span className="leftRequired">*</span>
                                    </h5>
                                    <MyUpload
                                        fileId={data.caseId}
                                        fileType="22_00018-302"
                                        myUploadRef={myUploadRef}
                                        fileList={data.applyFileList?.filter((item) => item.ownerType === '22_00018-302')[0]?.fileList || []}
                                    />
                                </Col>
                                <Col span={24}>
                                    <h5>司法确认申请书</h5>
                                    <MyUpload
                                        fileId={data.caseId}
                                        fileType="22_00018-402"
                                        fileList={data.applyFileList?.filter((item) => item.ownerType === '22_00018-402')[0]?.fileList || []}
                                    />
                                </Col>
                                <Col span={24}>
                                    <h5>人民调解委员会主持调解的证明</h5>
                                    <MyUpload
                                        fileId={data.caseId}
                                        fileType="22_00018-306"
                                        fileList={data.applyFileList?.filter((item) => item.ownerType === '22_00018-306')[0]?.fileList || []}
                                    />
                                </Col>
                                <Col span={24}>
                                    <h5>其他材料</h5>
                                    <MyUpload
                                        fileId={data.caseId}
                                        fileType="22_00018-409"
                                        fileList={data.applyFileList?.filter((item) => item.ownerType === '22_00018-409')[0]?.fileList || []}
                                    />
                                </Col>
                                <Col span={24}>
                                    <Button onClick={handleApply} type="primary">
                                        提交申请
                                    </Button>
                                </Col>
                            </Row>
                        ) : (
                            <>
                                {/* 为了获取myUploadRef实例调用方法 */}
                                <MyUpload type="diy" showFileList={false} myUploadRef={myUploadRef2} />
                                <Row gutter={[16, 16]}>
                                    <Col span={24}>
                                        <h5>调解案件</h5>
                                        <div className="public-fileCard">
                                            <img src={cardIconCaseCheck} alt="" onClick={() => setCaseCheckModal(true)} style={{ cursor: 'pointer' }} />
                                            <div className="public-fileCard-main">
                                                <Text ellipsis={{ tooltip: data.plaintiffs }}>申请人:{data.plaintiffs}</Text>
                                                <Text ellipsis={{ tooltip: data.defendants }} style={{ marginTop: '4px', display: 'block' }}>
                                                    被申请人:{data.defendants}
                                                </Text>
                                            </div>
                                        </div>
                                    </Col>
                                    <Col span={24}>
                                        <h5>受理单位</h5>
                                        <div>{data.courtName}</div>
                                    </Col>
                                    <Col span={24}>
                                        <h5>申请说明</h5>
                                        <pre>{data.applyContent || '-'}</pre>
                                    </Col>
                                    {[
                                        { key: '22_00018-302', title: '调解协议书' },
                                        { key: '22_00018-402', title: '司法确认申请书' },
                                        { key: '22_00018-306', title: '人民调解委员会主持调解的证明' },
                                        { key: '22_00018-409', title: '其他材料' },
                                    ].map((item, index) => (
                                        <Col span={24} key={index}>
                                            <h5>{item.title}</h5>
                                            <Row gutter={[16, 8]}>
                                                {getFiles(item.key).length === 0
                                                    ? $$.MyEmpty({ style: { margin: 0 } })
                                                    : getFiles(item.key).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={() => myUploadRef2.current.handleOpenFiles(x)}>预览</Link>
                                                                            <Link onClick={() => myUploadRef2.current.handleDownloadFiles(x)}>下载</Link>
                                                                        </Space>
                                                                    </div>
                                                                </div>
                                                                <div className="public-fileCard-text">
                                                                    <div>上传人:{x.uploaderName || '-'}</div>
                                                                    <div>上传时间:{$$.timeFormat(x.createTime)}</div>
                                                                </div>
                                                            </Col>
                                                      ))}
                                            </Row>
                                        </Col>
                                    ))}
                                    <Col span={24}>
                                        <Space size="middle">
                                            {/* 退回申请人才有修改申请 */}
                                            {auditInfo.judicHandle === '22_00033-1' && (
                                                <Button
                                                    onClick={() => {
                                                        getFilingCourt();
                                                        setIsEdit(true);
                                                    }}
                                                    type="primary"
                                                >
                                                    修改申请
                                                </Button>
                                            )}
                      {/* 退回申请人(除了不予受理)或未审查案件才有撤销功能,目前审查处理只有退回和不予受理 */}
                                            {(auditInfo.judicHandle === '22_00033-1' || !auditInfo.auditResult) && (
                                                <Button onClick={handleRecall} className="public-mainBtn">
                                                    撤销申请
                                                </Button>
                                            )}
                                        </Space>
                                    </Col>
                                </Row>
                            </>
                        )}
                    </div>
                </div>
            </div>
            <MyModal width={1200} visible={caseCheckModal} onCancel={() => setCaseCheckModal(false)} footer={false}>
                <DisputeMsg caseId={data.caseId} isModal />
            </MyModal>
        </Page>
    );
};
 
export default JudicialApplyDetail;