广州市综治平台前端
xusd
2025-06-07 ee685c9f350ec9241107d4e8a05799768a0bce9a
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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
/*
 * @Author: dminyi 1301963064@qq.com
 * @Date: 2024-08-09 09:59:43
 * @LastEditors: lwh
 * @LastEditTime: 2025-03-07 14:52:17
 * @FilePath: \gzDyh\gz-customerSystem\src\views\basicInformation\organization\index.jsx
 * @Description: 来访登记
 */
 
import React, { useState, useRef, Fragment, useEffect } from 'react';
import { useSearchParams, useNavigate } from 'react-router-dom';
import NewPage from '@/components/NewPage';
import * as $$ from '@/utils/utility';
import '@arco-themes/react-gzzz/css/arco.css';
import '../index.less';
import { Space, Col, Row } from 'antd';
import { Button, Steps, Message, Form, Input, Modal, Empty, Select } from '@arco-design/web-react';
import { scan } from '@/assets/images/icon';
import { empty, tip, question1 } from '@/assets/images';
import VisitorRegister from './component/visitorRegister';
import RepeatDetail from './RepeatDetail';
import HandleRecord from './HandleRecord';
import ArcoUpload from '@/components/ArcoUpload';
import CaseUpdateInfo from '@/components/CaseUpdateInfo';
 
const Step = Steps.Step;
const FormItem = Form.Item;
const TextArea = Input.TextArea;
 
const appUrl = $$.appUrl;
 
function saveDispute(data) {
    return $$.ax.request({ url: `casedraftInfo/caseDraftRegister`, type: 'post', service: 'mediate', data });
}
 
function getId() {
    return $$.ax.request({ url: `caseUtils/getNewTimeCaseId`, type: 'get', service: 'utils' });
}
 
function submitDispute(data) {
    return $$.ax.request({ url: `case/modify/update`, type: 'post', service: 'mediate', data });
}
 
function getDetailData(id) {
    return $$.ax.request({ url: `caseInfo/getCaseInfo?id=${id}`, type: 'get', service: 'mediate' });
}
 
// ai分析是否为风险/重点案件
function getRiskResultApi(data) {
    return $$.ax.request({ urlAi: `case-law/getRiskResult`, data, typeAi: 'post', service: 'mediate' });
}
function embeddingTextToMilvusApi(data) {
    return $$.ax.request({ urlAi: `case-law/embeddingTextToMilvus`, data, typeAi: 'post', service: 'mediate' });
}
 
// ai分析是否为重复来访案件
function getRepeatResultApi(data) {
    return $$.ax.request({ urlAi: `case-law/getRepeatResult`, data, typeAi: 'post', service: 'mediate' });
}
 
function getCaseInfoApi(id) {
    return $$.ax.request({ url: 'caseInfo/getCaseInfo?id=' + id, type: 'get', service: 'mediate' });
}
 
function listFeedbackApi(id) {
    return $$.ax.request({ url: `caseFeedback/listFeedback?id=` + id, type: 'get', service: 'mediate' });
}
 
function delFile(id) {
    return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
}
 
function updateFeedbackApi(data) {
    return $$.ax.request({ url: `caseFeedback/updateFeedback`, type: 'post', service: 'mediate', data });
}
 
function saveFeedbackApi(data) {
    return $$.ax.request({ url: `caseFeedback/saveFeedback`, type: 'post', service: 'mediate', data });
}
 
function getTransactResultApi(caseId) {
    return $$.ax.request({ url: `caseInfoUnfold/getTransactResult?caseId=${caseId}`, type: 'get', service: 'mediate' });
}
 
function getNewTimeIdApi(id) {
    return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
}
// 获取修改记录列表
function getModifyRecordApi(caseId) {
    return $$.ax.request({
        url: 'cases/modify-record/group-by-time-user',
        type: 'get',
        data: { caseId },
        service: 'mediate'
    });
}
 
const Organization = (props) => {
    const formRef = useRef();
    const formRecord = useRef();
 
    const formOralRef = useRef();
    const formRefWrite = useRef();
    const failRef = useRef();
    const [searchParams] = useSearchParams();
    const caseId = searchParams.get('caseId');
    const taskId = searchParams.get('taskId');
    const completed = searchParams.get('completed'); // Get the "completed" parameter from URL
    const navigate = useNavigate();
    const [isReview, setIsReview] = useState(false); //预览页面控制
    const [current, setCurrent] = useState(1);
    const [id, setId] = useState();
    const [editData, setEditData] = useState({}); //回显数据
    const [backFileList, setBackFileList] = useState([]); //文件列表
    const [Update, setUpdate] = useState(false);
    const [repeatData, setRepeatData] = useState({ hisData: [], newData: {}, visible: false });
    const [list, setList] = useState([]); //办理记录
    const [feedBacklist, setFeedBackList] = useState([]); //办理记录
    const [formView, setFormView] = useState(false); //编辑办理事由
    const [updateData, setUpdateData] = useState({}); //编辑办理事由
    const [scannerVisible, setScannerVisible] = useState(false); //识别材料
    const [ocrText, setOcrText] = useState(''); //识别材料
    const [handleContent, setHandleContent] = useState(''); //办理意见
    const [handleFile, setHandleFile] = useState([]); //办理附件
    const [staticButtonStatus, setStaticButtonStatus] = useState(true); //静态按钮
 
    const [selectedTemplate2, setSelectedTemplate2] = useState();
    const [selectedTemplate1, setSelectedTemplate1] = useState();
    const [selectedTemplate, setSelectedTemplate] = useState();
    const [selectedTab, setSelectedTab] = useState('1'); // 默认选中第一个 tab
    const [value, setValue] = useState(2);
    const [noHandleReason, setNoHandleReason] = useState(false);
    const [mode, setMode] = useState(false);
    const [drawerVisible, setDrawerVisible] = useState(false); //化解不成功理由抽屉控制
    const [caseDetailAi, setCaseDetailAi] = useState('');
    const [caseClaim, setCaseClaim] = useState('');
    const [canal, setCanal] = useState('');
    const [transactResult, setTransactResult] = useState(null);
    const [uniteHandleId, setUniteHandleId] = useState('');
    const [caseResultId, setCaseResultId] = useState('');
    const [supervisingId, setSupervisingId] = useState('');
    const [caseUpdateInfoVisible, setCaseUpdateInfoVisible] = useState(false);
    const [deleteFileIds, setDeleteFileIds] = useState([]);
    const [recordList, setRecordList] = useState([]);
    const tabs = [
        { index: '1', label: '化解成功' },
        { index: '2', label: '化解不成功' },
    ];
 
    const agreement = [
        { value: 1, label: '口头协议' },
        { value: 2, label: '书面协议' },
    ];
    const [init, setInit] = useState(false);
 
    useEffect(() => {
        if (caseId) {
            getDeatil(caseId);
            getModifyRecord(caseId);
            listFeedback(caseId);
            getCaseInfo(caseId);
            getTransactResult(caseId);
            setId(caseId);
        } else {
            getAppId();
        }
    }, []);
 
    const getModifyRecord = async (id) => {
        const res = await getModifyRecordApi(id);
        if (res.type) {
            setRecordList(res.data);
        }
    };
 
    const getTransactResult = async (id) => {
        const res = await getTransactResultApi(id);
        if (res.type) {
            if (res.data) {
                setTransactResult({ ...res.data, file: res.data.fileInfoBaseDTOList?.map((i) => ({ ...i, uid: i.id })) });
                setSelectedTab(res.data.mediResult === '22_00025-1' ? '1' : '2');
                setValue(res.data.agreeType === '24_00003-2' ? 2 : 1);
                setCaseResultId(res.data.caseResultId);
                if (res.data.mediResult === '22_00025-1') {
                    if (res.data.agreeType === '24_00003-2') {
                        formRefWrite.current.setFieldValue('windupContent', res.data?.windupContent);
                        formRefWrite.current.setFieldValue('file', res.data.fileInfoBaseDTOList);
                    } else {
                        formOralRef.current.setFieldValue('windupContent', res.data.windupContent);
                        formOralRef.current.setFieldValue('agreeContent', res.data.agreeContent);
                    }
                } else {
                    failRef.current.setFieldValue('windupContent', res.data.windupContent);
                }
            } else {
                setTransactResult(null);
            }
        }
    };
 
    const getCaseInfo = async (id) => {
        const res = await getCaseInfoApi(id);
        if (res.type) {
            let caseDes = res.data.caseDes;
            let caseClaim = res.data.caseClaim;
            setCanal(res.data.canal);
            setCaseDetailAi(caseDes);
            setCaseClaim(caseClaim);
        }
    };
 
    const listFeedback = async (id) => {
        const res = await listFeedbackApi(id);
        if (res.type) {
            let data = res.data.caseFeedbackList;
            setList(data);
            console.log('init', init);
            if (!init) {
                setFeedBackList(data);
                setInit(true)
            }
        }
    };
 
    //编辑
    const getDeatil = async (id) => {
        const res = await getDetailData(id);
        if (res.type) {
            const { agentList, personList, ...rest } = res.data;
            const bafileList = res.data.fileInfoList?.map((item) => item.fileList)?.flat();
            setBackFileList(bafileList);
            console.log('bafileList', bafileList);
            const parList = agentList.concat(personList);
            const newParList =
                parList?.map((item) => {
                    const fileInfoList = item.fileInfoList;
                    let file = []; //身份证明材料、企业登记材料
                    let file1 = []; //法人、机构身份证明材料、代理人授权委托书
                    if (fileInfoList && fileInfoList.length != 0) {
                        fileInfoList.forEach((item) => {
                            if (item.ownerType == '22_00018-202' || item.ownerType == '22_00018-203') {
                                item.fileList.forEach((res) => {
                                    file.push({
                                        ...res,
                                        uid: res.id,
                                    });
                                });
                            }
                            if (item.ownerType == '22_00018-204' || item.ownerType == '22_00018-207') {
                                item.fileList.forEach((res) => {
                                    file1.push({
                                        ...res,
                                        uid: res.id,
                                    });
                                });
                            }
                        });
                    }
                    return {
                        ...item,
                        file,
                        file1,
                    };
                }) || [];
            const obj = {
                ...rest,
                caseLevel: rest.caseLevel ? String(rest.caseLevel) : '',
                fakeData: newParList,
                myCaseType: rest.caseTypeFirst ? [rest.caseTypeFirst, rest.caseType] : undefined,
                myQuesAddress: rest.queRoad ? [rest.queArea, rest.queRoad] : undefined,
            };
            formRef.current.setFieldsValue(obj);
            setEditData(obj);
        }
    };
 
    //获取id
    const getAppId = async () => {
        const res = await getId();
        if (res.type) {
            setId(res.data);
        }
    };
 
    //提交信息,需要校验规则
    const handleSubmit = async () => {
        if (formRef.current) {
            formRef.current.validate(undefined, (errors, values) => {
                if (!errors) {
                    const { myCaseType, myQuesAddress, ...rest } = formRef.current.getFields();
                    const params = handleData(rest);
                    if (params.personList.length === 0 || params.personList.filter((item) => item.perType === '15_020008-1').length === 0) {
                        Message.warning('申请方当事人为空,无法提交!');
                        return;
                    }
                    $$.modalInfo({
                        title: '提醒',
                        content: '确定提交吗?',
                        cancelText: '我再想想',
                        onOk: () => {
                            reauestSubmit({
                                ...params,
                                isSelfAccept: 0,
                                isDraft: 0,
                                operateType: 0
                            });
                        },
                    });
                }
            });
        }
    };
 
    //数据处理
    const handleData = (data) => {
        const { fakeData, ...newObj } = data;
        if (data.id) {
            return {
                ...newObj,
                personList: fakeData?.filter((item) => item.perType === '15_020008-1' || item.perType === '15_020008-2'),
                agentList: fakeData
                    ?.filter((item) => item.perType === '24_00006-1' || item.perType === '24_00006-2')
                    .map((item) => {
                        return {
                            ...item,
                            personId: Array.isArray(item.personId) ? item.personId.join(',') : item.personId,
                        };
                    }),
            };
        } else {
            return {
                ...newObj,
                personList: fakeData?.filter((item) => item.perType === '15_020008-1' || item.perType === '15_020008-2'),
                agentList: fakeData
                    ?.filter((item) => item.perType === '24_00006-1' || item.perType === '24_00006-2')
                    .map((item) => {
                        return {
                            ...item,
                            personId: Array.isArray(item.personId) ? item.personId.join(',') : item.personId,
                        };
                    }),
                id: id,
            };
        }
    };
 
    // 查看修改日志弹窗
    function selfAcceptance() {
        // 查看修改日志
        setCaseUpdateInfoVisible(true);
    }
 
    //提交请求
    const reauestSubmit = async (data, isSelfAccept) => {
 
        global.setSpinning(true);
        submitDisputeApi(data, isSelfAccept);
        global.setSpinning(false);
 
    };
 
    async function submitDisputeApi(data, isSelfAccept) {
        data.fileList = backFileList;
        let caseWindupApply = {
 
        };
        if (completed) {
            // 化解成功
            if (transactResult.mediResult === '22_00025-1') {
                if (value === 2) {
                    // formOralRef.current.validateFields(['windupContent', 'file']);
                    caseWindupApply = {
                        windupContent: formRefWrite.current.getFieldValue('windupContent'),
                        file: formRefWrite.current.getFieldValue('file'),
                        agreeType: value === 1 ? '24_00003-1' : '24_00003-2',
                        agreeTypeName: value === 1 ? '口头协议' : '书面协议',
                    };
                } else {
                    // formOralRef.current.validateFields(['windupContent', 'agreeContent']);
                    caseWindupApply = {
                        windupContent: formOralRef.current.getFieldValue('windupContent'),
                        agreeContent: formOralRef.current.getFieldValue('agreeContent'),
                        agreeType: value === 1 ? '24_00003-1' : '24_00003-2',
                        agreeTypeName: value === 1 ? '口头协议' : '书面协议',
                    };
                }
            }
 
            if (transactResult.mediResult === '22_00025-2') {
                // 化解不成功
                // failRef.current.validateFields(['windupContent']);
                caseWindupApply = {
                    failReason1: failRef.current.getFieldValue('failReason1'),
                    failReason3: failRef.current.getFieldValue('failReason3'),
                    windupContent: failRef.current.getFieldValue('windupContent'),
                };
            }
        }
        data.caseWindupApply = { ...transactResult, ...caseWindupApply };
        data.caseFeedbackList = feedBacklist;
        data.deleteFileIds = deleteFileIds;
        console.log('data', data);
        // 这里提交接口todo,接口需要修改
        const response = await submitDispute(data);
        if (response.type) {
            if (isSelfAccept) {
                navigate(`/mediate/visit/handleFeedback?caseTaskId=${response.data}&caseId=${id}`);
            } else {
                Message.success('提交成功!');
                if (completed) {
                    navigate(`/mediate/visit/visitWorkBench`, { replace: true });
                    setCurrent(2);
                } else {
                    window.history.back();
                }
            }
        }
    }
 
    // ai分析是否为风险/重点案件
    async function getRiskResult(data) {
        const res = await getRiskResultApi(data);
        if (res.type) {
        }
    }
 
    // 向量化处理
    async function embeddingTextToMilvus(data) {
        const res = await embeddingTextToMilvusApi(data);
        if (res.type) {
        }
    }
 
    const handleBack = () => {
        if (!Update && completed) {
            navigate(`/mediate/visit/visitWorkBench`, { replace: true });
        } else {
            window.history.back();
        }
    };
 
    //取消添加
    const handleChange = () => {
        setFormView(false);
        setId('');
        setStaticButtonStatus(true);
        formRecord.current.resetFields();
        setUpdateData({});
    };
 
    //点击编辑办理事由
    const handleEdit = (record, index) => {
        console.log('record', record);
        setId(record.id);
        setFormView(true);
        formRecord.current.setFieldsValue({
            ...record,
            fileInfoList: record.fileInfoList?.map((i) => ({ ...i, uid: i.id })),
        });
        setUpdateData({ ...record, fileInfoList: record.fileInfoList?.map((i) => ({ ...i, uid: i.id })) });
        // setList(list.filter((i, idx) => idx !== index))
        // setCasualList(list)
    };
 
    //保存信息
    const handleFinish = () => {
        if (formRecord.current) {
            formRecord.current.validate(undefined, (errors, values) => {
                if (!errors) {
                    let submitData = formRecord.current.getFields();
                    saveFeedback(submitData);
                    setFormView(false);
                    // setStaticButtonStatus(true);
                }
            });
        }
    };
 
    //添加办理记录
    const addMark = () => {
        setFormView(true);
        getNewTimeId('addMark');
    };
 
    //获取理由id
    const getNewTimeId = async (type) => {
        const res = await getNewTimeIdApi();
        if (res.type) {
            if (type === 'uniteHandle') {
                setUniteHandleId(res.data);
            }
            if (type === 'addMark') {
                setId(res.data);
            }
            if (type === 'caseResult') {
                setCaseResultId(res.data);
            }
            if (type === 'supervising') {
                setSupervisingId(res.data);
            }
        }
    };
 
    //新增、编辑办理理由
    const saveFeedback = async (submitData) => {
        if (submitData.id) {
            //编辑
            const res = await updateFeedbackApi({
                ...submitData,
            });
            if (res.type) {
                $$.infoSuccess({ content: '修改成功' });
                // getRiskResult({ caseId, caseText: (submitData.handleContent || '') })
                listFeedback(caseId);
                formRecord.current.resetFields();
            }
        } else {
            const res = await saveFeedbackApi({
                ...submitData,
                caseId: caseId,
                id: id,
                caseTaskId: '',
            });
            if (res.type) {
                $$.infoSuccess({ content: '保存成功' });
                // getRiskResult({ caseId, caseText: (submitData.handleContent || '') })
                listFeedback(caseId);
                formRecord.current.resetFields();
            }
        }
    };
 
    //删除文件
    const handleDelFile = async (id) => {
        console.log('删除新提交文件', id);
        const res = await delFile(id);
        if (res.type) {
            $$.infoSuccess({ content: '删除成功!' });
        }
    };
 
    //删除文件
    const handleDelRealFile = async (id) => {
        console.log('删除存在文件', id);
        setDeleteFileIds([...deleteFileIds, id]);
        // const res = await delFile(id);
        // if (res.type) {
        //     $$.infoSuccess({ content: '删除成功!' });
        // }
    };
    //上传文件
    const handleUploadFile = async (id) => {
        console.log('上传文件', id);
 
    };
 
    const handleTabChange = (newTabIndex) => {
        setSelectedTab(newTabIndex);
    };
 
    const handleTemplate = (type) => {
        setSelectedTemplate(type);
        if (type === 1) {
            formOralRef.current.setFieldValue('windupContent', '双方当事人于xx时间xx地址已达成xx协议,纠纷已化解。');
        } else {
            formOralRef.current.setFieldValue('windupContent', '');
        }
    };
 
    const handleTemplate1 = (type) => {
        setSelectedTemplate1(type);
        if (type === 1) {
            formOralRef.current.setFieldValue(
                'agreeContent',
                '根据纠纷化解人员的协调,当事人双方同意如下调解协议:[简要说明协议第一条][简要说明协议第二条][……]本口头调解协议由纠纷化解人员记录,并已告知双方当事人。双方当事人确认无误。'
            );
        }
    };
 
    const handleTemplate2 = (type) => {
        setSelectedTemplate2(type);
        if (type === 1) {
            formRefWrite.current.setFieldValue('windupContent', '双方当事人于xx时间xx地址已达成xx协议,纠纷已化解。');
        } else {
            formRefWrite.current.setFieldValue('windupContent', '');
        }
    };
 
    const handleTemplate3 = (type) => {
        if (type === 1) {
            failRef.current.setFieldValue(
                'windupContent',
                '经过多次调解,尽管纠纷化解人员尽最大努力帮助双方找到解决方案,但由于以下原因,当事人双方未能达成一致意见:[详细说明化解未成功的原因之一][详细说明化解未成功的原因之二][……][……]鉴于上述情况,纠纷化解人员认为目前无法通过调解方式解决双方的争议,建议双方考虑采取其他合法途径解决纠纷。'
            );
        } else {
            failRef.current.setFieldValue('windupContent', '');
        }
    };
 
    console.log(value, 'value');
 
    return (
        <div style={{ position: 'relative' }}>
            <NewPage pageHead={{ breadcrumbData: [{ title: '工作台' }, { title: '来访登记' }], title: '来访登记' }}>
                <Fragment>
                    <div className="dataSync-page" style={{ height: 'calc(100vh - 145px)', paddingBottom: '60px' }}>
                        <VisitorRegister
                            isEdit={true}
                            formRef={formRef}
                            mainId={id}
                            partyList={editData.fakeData}
                            fileInfoList={editData.fileInfoList}
                            onValuesChange={(first, all) => { }}
                            canal={canal}
                        />
                        {completed && (<div style={{ marginBottom: '12px' }}>
                            <Space size="small">
                                <div className="MediationInfo-subTitle" style={{ marginTop: '-9px' }}></div>
                                <h4>办理记录({list.length})</h4>
                            </Space>
                            <Form layout="vertical" requiredSymbol={false} scrollToFirstError={true}>
                                <Col span={24}>
                                    <HandleRecord isReview={false} handleEdit={handleEdit} data={list} />
                                    {/* <HandleRecord isReview={false} handleEdit={handleEdit} data={list} noEdit={false} /> */}
                                    <div className="Form" style={{ display: formView ? '' : 'none', marginBottom: '50px' }}>
                                        <Col span={24} style={{ marginBottom: '8px' }}>
                                            <Space size="small">
                                                <div className="MediationInfo-subTitle" style={{ marginTop: '-9px' }}></div>
                                                <h4>添加办理记录</h4>
                                            </Space>
                                        </Col>
                                        <Col span={24}>
                                            <Form
                                                ref={formRecord}
                                                layout="vertical"
                                                requiredSymbol={false}
                                                scrollToFirstError={true}
                                                onValuesChange={(first, all) => {
                                                    // setUpdate({ first: first, all: all })
                                                }}
                                            >
                                                <Row gutter={[32, 0]}>
                                                    <Col span={24}>
                                                        <FormItem
                                                            label={
                                                                <div style={{ display: 'flex' }}>
                                                                    办理意见
                                                                    <div className="must">必填</div>
                                                                    <img src={scan} alt="" style={{ marginRight: '-2px', marginLeft: '8px' }} />
                                                                    <div
                                                                        style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }}
                                                                        onClick={() => {
                                                                            setScannerVisible(true);
                                                                            setOcrText('handleContent');
                                                                        }}
                                                                    >
                                                                        识别材料
                                                                    </div>
                                                                </div>
                                                            }
                                                            field="handleContent"
                                                            rules={[{ message: '请填写办理意见', required: true }]}
                                                        >
                                                            <Input.TextArea
                                                                maxLength={800}
                                                                showWordLimit
                                                                rows={7}
                                                                placeholder="办理意见应该填写完整,办理意见应具备5要素:调解时间+调解参与部门/人+调解地点+调解过程+调解结果"
                                                                wrapperStyle={{ width: '100%' }}
                                                            />
                                                        </FormItem>
                                                    </Col>
                                                    <Col span={24}>
                                                        <ArcoUpload
                                                            params={{
                                                                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${caseId}&ownerId=${id}&ownerType=22_00018-501`,
                                                            }}
                                                            field="fileInfoList"
                                                            label={'办理附件'}
                                                            editData={updateData}
                                                            handleDelFile={handleDelFile}
                                                            handleDelRealFile={handleDelRealFile}
                                                            handleChangeFile={handleUploadFile}
                                                            ownerType="22_00018-501"
                                                        />
                                                    </Col>
                                                </Row>
                                            </Form>
                                        </Col>
                                        <Space size="middle">
                                            <Button type="primary" onClick={() => handleFinish()}>
                                                提交
                                            </Button>
                                            <Button type="secondary" onClick={handleChange}>
                                                取消添加
                                            </Button>
                                        </Space>
                                    </div>
                                    {list?.length === 0 && !formView && (
                                        <div className="handle-content-empty" style={{ marginTop: '10%' }}>
                                            <Empty description={<span className="empty-text">暂无数据</span>} image={empty}></Empty>
                                        </div>
                                    )}
                                </Col>
                            </Form>
                        </div>)}
                        {completed && (
                            <div style={{ margin: '0 0 68px 0' }}>
                                <Space size="small">
                                    <div className="MediationInfo-subTitle" style={{ marginTop: '-9px' }}></div>
                                    <h4>办理结果</h4>
                                </Space>
                                <div style={{ height: '550px' }}>
                                    <div className="caseResult-title">化解结果</div>
                                    <div className="caseResult-tabs">
                                        {tabs.map((tab) => (
                                            <div
                                                key={tab.index}
                                                style={{
                                                    color: selectedTab === tab.index ? 'rgba(26,111,184,1)' : 'rgba(0,0,0,0.45)',
                                                    padding: '5px 16px',
                                                    border: `1px solid ${selectedTab === tab.index ? 'rgba(26,111,184,1)' : 'rgba(229,230,235,1)'}`,
                                                    borderRadius: '2px',
                                                    cursor: 'not-allowed',
                                                    pointerEvents: 'auto',
                                                }}
                                            >
                                                {tab.label}
                                            </div>
                                        ))}
                                    </div>
                                    {/*化解成功*/}
                                    {selectedTab === '1' && (
                                        <>
                                            <Col span={8} style={{ marginBottom: '16px' }}>
                                                <div style={{ marginBottom: '8px' }}>达成的协议类型</div>
                                                <Select
                                                    options={agreement}
                                                    onChange={(v) => {
                                                        setValue(v);
                                                    }}
                                                    value={value}
                                                ></Select>
                                            </Col>
                                            {/*口头协议 */}
                                            <Form ref={formOralRef} layout="vertical" requiredSymbol={false} scrollToFirstError={true}>
                                                {value === 1 && (
                                                    <>
                                                        <Row>
                                                            <Col span={24} style={{ position: 'relative' }}>
                                                                <FormItem
                                                                    label={
                                                                        <>
                                                                            <div style={{ display: 'flex' }}>
                                                                                协议要点
                                                                                <div className="must">必填</div>
                                                                            </div>
                                                                            <div className="caseResult-tips">
                                                                                <img src={tip} alt="" style={{ width: '16px', marginRight: '8px', marginTop: '-5px' }} />
                                                                                <span>协议要点应尽量简洁,当事人大厅来访或小程序线上反映问题时,可在小程序中查看到填写的协议要点内容</span>
                                                                            </div>
                                                                            <div style={{ position: 'absolute', display: 'flex ', top: '79px', zIndex: 1 }}>
                                                                                <div
                                                                                    className={`myTag ${selectedTemplate1 === 1 ? 'highlighted' : ''}`} // 条件样式
                                                                                    style={{ marginRight: '22px' }}
                                                                                    onClick={() => handleTemplate1(1)}
                                                                                >
                                                                                    公共模板:调解成功口头协议
                                                                                </div>
                                                                            </div>
                                                                        </>
                                                                    }
                                                                    field="agreeContent"
                                                                    rules={[{ message: '请填写协议要点', required: true }]}
                                                                >
                                                                    <TextArea autoSize={{ minRows: 4, maxRows: 8 }} placeholder="请填写" style={{ marginTop: '40px' }} />
                                                                </FormItem>
                                                            </Col>
                                                            <Col span={24} style={{ position: 'relative' }}>
                                                                <div style={{ position: 'absolute', display: 'flex', top: '28px', zIndex: 1 }}>
                                                                    <div
                                                                        className={`myTag ${selectedTemplate === 1 ? 'highlighted' : ''}`} // 条件样式
                                                                        style={{ marginRight: '22px' }}
                                                                        onClick={() => handleTemplate(1)}
                                                                    >
                                                                        公共模板:化解成功协议履行情况范本
                                                                    </div>
                                                                </div>
                                                                <FormItem
                                                                    label={
                                                                        <div style={{ display: 'flex' }}>
                                                                            协议履行情况<div className="must">必填</div>
                                                                        </div>
                                                                    }
                                                                    field="windupContent"
                                                                    rules={[{ message: '请填写协议履行情况', required: true }]}
                                                                >
                                                                    <TextArea autoSize={{ minRows: 4, maxRows: 8 }} placeholder="请填写" style={{ marginTop: '35px' }} />
                                                                </FormItem>
                                                            </Col>
                                                        </Row>
                                                    </>
                                                )}
                                                {/*书面协议 */}
                                                {value === 2 && (
                                                    <>
                                                        <Form ref={formRefWrite} layout="vertical" requiredSymbol={false} scrollToFirstError={true}>
                                                            <Row>
                                                                <Col span={24}>
                                                                    <ArcoUpload
                                                                        params={
                                                                            {
                                                                                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${caseId}&ownerId=${caseResultId}&ownerType=22_00018-302`,
                                                                            }
                                                                        }
                                                                        handleDelFile={handleDelFile}
                                                                        handleDelRealFile={handleDelRealFile}
                                                                        handleChangeFile={handleUploadFile}
                                                                        editData={transactResult}
                                                                        // onFileListChange={(fileList) => {
                                                                        //     // 用于上传后点击回显
                                                                        //     formRefWrite.current.setFieldValue(
                                                                        //         'file',
                                                                        //         fileList?.map((i, idx) => ({ ...i, url: `${appUrl.fileUrl}${appUrl.fileShowUrl}${i.response?.data[0]?.id}` }))
                                                                        //     );
                                                                        // }}
                                                                        formItemParams={{
                                                                            rules: [{ message: '请上传协议文书', required: true }],
                                                                        }}
                                                                        field="file"
                                                                        label={
                                                                            <>
                                                                                <div style={{ display: 'flex' }}>
                                                                                    协议文书
                                                                                    <div className="must" style={{ marginLeft: '4px' }}>
                                                                                        必填
                                                                                    </div>
                                                                                </div>
                                                                                <div className="caseResult-tips">
                                                                                    <img src={tip} alt="" style={{ width: '16px', marginRight: '8px' }} />
                                                                                    <span>如通过人民调解工作成功化解纠纷事项,建议上传签字盖章后的人民调解协议书</span>
                                                                                </div>
                                                                            </>
                                                                        }
                                                                        ownerType="22_00018-302"
                                                                    />
                                                                </Col>
                                                                <Col span={24} style={{ position: 'relative' }}>
                                                                    <div style={{ position: 'absolute', display: 'flex', top: '28px', zIndex: 1 }}>
                                                                        <div
                                                                            className={`myTag ${selectedTemplate2 === 1 ? 'highlighted' : ''}`} // 条件样式
                                                                            style={{ marginRight: '22px' }}
                                                                            onClick={() => handleTemplate2(1)}
                                                                        >
                                                                            公共模板:化解成功协议履行情况范本
                                                                        </div>
                                                                    </div>
 
                                                                    <FormItem
                                                                        label={
                                                                            <div style={{ display: 'flex' }}>
                                                                                协议履行情况<div className="must">必填</div>
                                                                            </div>
                                                                        }
                                                                        field="windupContent"
                                                                        rules={[{ message: '请填写协议履行情况', required: true }]}
                                                                    >
                                                                        <TextArea autoSize={{ minRows: 4, maxRows: 8 }} placeholder="请填写" style={{ marginTop: '35px' }} />
                                                                    </FormItem>
                                                                </Col>
                                                            </Row>
                                                        </Form>
                                                    </>
                                                )}
                                            </Form>
                                        </>
                                    )}
                                    {/*化解不成功*/}
                                    {selectedTab === '2' && (
                                        <Form ref={failRef} layout="vertical" requiredSymbol={false} scrollToFirstError={true}>
                                            <Col span={24}>
                                                <div style={{ display: 'flex', marginBottom: '16px' }}>
                                                    无法化解理由
                                                    <img
                                                        src={question1}
                                                        style={{ width: '13px', height: '13px', margin: '5px 4px 0px', cursor: 'pointer' }}
                                                        onClick={() => {
                                                            setDrawerVisible(true);
                                                        }}
                                                    />
                                                    <div className="must" style={{ marginLeft: '4px' }}>
                                                        必填
                                                    </div>
                                                </div>
                                                <table border="1" align="center" cellpadding="8" className="table">
                                                    <tr>
                                                        <th bgcolor="#F7F8FA" className="table-title" width="120">
                                                            当事人的主要诉求
                                                        </th>
                                                        <td>
                                                            <div>{caseDetailAi}</div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th bgcolor="#F7F8FA" className="table-title" width="120">
                                                            调解过程中提供的解决方案
                                                        </th>
                                                        <td>
                                                            <FormItem label="" field="failReason1" rules={[{ message: '请填写调解过程中提供的解决方案', required: true }]}>
                                                                <Input.TextArea showWordLimit rows={3} placeholder="如提出的纠纷化解建议、思路等" wrapperStyle={{ width: '100%' }} />
                                                            </FormItem>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th bgcolor="#F7F8FA" className="table-title">
                                                            最终难以调和的原因
                                                        </th>
                                                        <td>
                                                            <FormItem label="" field="failReason3" rules={[{ message: '请填写最终难以调和的原因', required: true }]}>
                                                                <Input.TextArea
                                                                    showWordLimit
                                                                    rows={3}
                                                                    placeholder="如利益分配不均、信任缺失、信息不对称等"
                                                                    wrapperStyle={{ width: '100%' }}
                                                                />
                                                            </FormItem>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </Col>
                                            {/* <Col span={24} style={{ position: 'relative' }}>
                                                <div style={{ position: 'absolute', display: 'flex ', top: '28px', zIndex: 1 }}>
                                                    <div
                                                        className="myTag"
                                                        style={{ marginRight: '22px' }}
                                                        onClick={() => {
                                                            handleTemplate3(1);
                                                        }}
                                                    >
                                                        公共模板:化解不成功结案意见范本
                                                    </div>
                                                </div>
                                                <FormItem
                                                    label={
                                                        <div style={{ display: 'flex' }}>
                                                            结案意见<div className="must">必填</div>
                                                        </div>
                                                    }
                                                    field="windupContent"
                                                    rules={[{ message: '请填写结案意见', required: true }]}
                                                >
                                                    <TextArea autoSize={{ minRows: 4, maxRows: 8 }} placeholder="请填写" style={{ marginTop: '35px' }} />
                                                </FormItem>
                                            </Col> */}
                                        </Form>
                                    )}
                                </div>
                            </div>
                        )}
                    </div>
                    <div className="dataSync-excel">
                        <Space size="middle" style={{ margin: '4px 14px' }}>
                            <Button type="primary" style={{ backgroundColor: '#1A6FB8' }} onClick={handleSubmit}>
                                提交
                            </Button>
                            {completed && (<Button type="outline" style={{ color: '#1A6FB8', border: '1px solid #1A6FB8' }} onClick={addMark}>
                                添加办理记录
                            </Button>)}
                            {recordList.length > 0 && (
                                <Button type="outline" style={{ color: '#1A6FB8', border: '1px solid #1A6FB8' }} onClick={() => selfAcceptance()}>
                                    查看修改日志 ({recordList.length})
                                </Button>
                            )}
                            <Button type="secondary" onClick={handleBack}>
                                返回上级页面
                            </Button>
                        </Space>
                    </div>
                </Fragment>
                <CaseUpdateInfo visible={caseUpdateInfoVisible} onCancel={() => setCaseUpdateInfoVisible(false)} caseId={caseId} />
            </NewPage>
 
        </div>
    );
};
 
export default Organization;