forked from gzzfw/frontEnd/gzDyh

xusd
2024-09-18 3ae864f005e8a874de01c15e14b83196a3f6f11b
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
/*
 * @Company: hugeInfo
 * @Author: xzx
 * @Date: 2022-04-19 11:27:07
 * @LastEditors: ldh
 * @LastEditTime: 2022-11-07 11:52:49
 * @Version: 1.0.0
 * @Description: 司法确认申请审查历史
 */
import React, { useEffect, useState } from 'react';
import Page from '../../../components/Page/index';
import { Form, Typography } from 'antd';
import * as $$ from '../../../utils/utility';
import { useLocation, useNavigate } from 'react-router-dom';
import TableView from '../../../components/TableView';
import TableSearch from '../../../components/TableSearch';
import publicDataStatus from '../../../status/publicData';
 
const { Link } = Typography;
 
// 获取司法确认审查历史
function getCourtReviewDataApi(submitData) {
    return $$.ax.request({ url: 'judicTask/pageAuditHistory', type: 'get', data: submitData, service: 'mediate' });
}
 
const CourtReview = () => {
    const [form] = Form.useForm();
 
    const location = useLocation();
 
    const navigate = useNavigate();
 
    // 搜索
    const [search, setSearch] = useState({ page: 1, size: 10 });
 
    // 数据
    const [data, setData] = useState({ tableData: [] });
 
    // 调解组织select框数据
    const [adjustOrgData, setAdjustOrgData] = useState([]);
 
    // 表头
    const columns = [
        { title: '司法确认案号', dataIndex: 'judicNo' },
        { title: '申请时间', dataIndex: 'applyTime' },
        { title: '审查时间', dataIndex: 'finishTime' },
        {
            title: '审查结果',
            dataIndex: 'judicAudit',
            render: (text, record) =>
                !text ? (
                    '-'
                ) : (
                    <div className={`public-tag public-tag-${text === '22_00032-1' ? 'tagBlue2' : text === '22_00032-2' ? 'tagRed' : 'tagOrange'}`}>
                        {record.judicAuditName}
                    </div>
                ),
        },
        { title: '审查处理', dataIndex: 'judicHandleName' },
        { title: '申请人', dataIndex: 'plaintiffs' },
        { title: '被申请人', dataIndex: 'defendants' },
        { title: '纠纷类型', dataIndex: 'caseTypeName' },
        { title: '纠纷发生地详址', dataIndex: 'addr' },
        { title: '调解组织', dataIndex: 'mediateUnitName' },
        { title: '调解员', dataIndex: 'mediateUserName' },
        {
            title: '操作',
            dataIndex: 'action',
            width: 50,
            render: (_, record) => <Link onClick={() => handleJump(record)}>查看</Link>,
        },
    ];
 
    // 反馈跳转
    function handleJump(info) {
        $$.setSessionStorage(location.pathname, {
            search,
            tableActive: info.id,
        });
        navigate(`/mediate/courtReview/judicialAuditDetail?judicialId=${info.judicId}&back=${location.pathname}`);
    }
 
    // 页码修改
    function handleChangePage(page, pageSize) {
        getCourtReviewData({ ...search, page, size: pageSize });
    }
 
    // 搜索 or 重置 待优化
    function handleSearch(type, session) {
        let paramsObj = {};
        if (type === 'search') {
            paramsObj = { ...search, ...form.getFieldsValue(), page: 1 };
            $$.changeTimeFormat(paramsObj, 'applyTime', 'applyStart', 'applyEnd');
        }
        if (type === 'reset') {
            form.resetFields();
            paramsObj = { page: 1, size: 10 };
        }
        if (type === 'recurrent') {
            paramsObj = { ...search, ...session.search };
            let copyObj = { ...paramsObj };
            if (copyObj.applyStart) {
                copyObj.applyTime = [$$.myMoment(copyObj.applyStart), $$.myMoment(copyObj.applyEnd)];
            }
            form.setFieldsValue(copyObj);
        }
        getCourtReviewData(paramsObj, session?.tableActive);
    }
 
    // 获取数据
    async function getCourtReviewData(submitData, tableActive) {
        global.setSpinning(true);
        const res = await getCourtReviewDataApi(submitData);
        global.setSpinning(false);
        if (res.type) {
            setSearch(submitData);
            setData({ total: res.data?.totalElements, tableData: res.data?.content || [], tableActive });
        }
    }
 
    // 初始化
    useEffect(() => {
        publicDataStatus.getUnitData((data) => setAdjustOrgData(data));
        let values = $$.getSessionStorage(location.pathname);
        if ($$.getQueryString('isBack') && !!values) {
            handleSearch('recurrent', values);
        } else {
            handleSearch('reset');
        }
        if (!!values) {
            $$.clearSessionStorage(location.pathname);
        }
    }, []);
 
    return (
        <Page pageHead={{ title: '司法确认审查历史', subtitle: '查看已经审查的司法确认申请历史记录' }}>
            <div className="courtReview">
                <div className="pageSearch">
                    <TableSearch
                        labelLength={6}
                        form={form}
                        itemData={[
                            { type: 'Input', name: 'plaintiffs', label: '申请人' },
                            { type: 'Input', name: 'defendants', label: '被申请人' },
                            { type: 'RangePicker', name: 'applyTime', label: '申请时间' },
                            { type: 'TreeSelect', name: 'applyUnitId', label: '调解组织', treedata: adjustOrgData },
                            { type: 'Input', name: 'addr', label: '纠纷发生地' },
                            { type: 'Input', name: 'judicNo', label: '司法确认案号' },
                        ]}
                        handleReset={() => handleSearch('reset')}
                        handleSearch={() => handleSearch('search')}
                    />
                </div>
                <div className="pageTable">
                    <TableView
                        showHeader
                        title="查询结果"
                        columns={columns}
                        dataSource={data.tableData}
                        pagination={{
                            current: search.page,
                            pageSize: search.size,
                            total: data.total,
                            onChange: (page, pageSize) => handleChangePage(page, pageSize),
                        }}
                        rowClassName={(record) => (record.id === data.tableActive ? 'tableRowActive' : '')}
                    />
                </div>
            </div>
        </Page>
    );
};
 
export default CourtReview;