广州市综治平台前端
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
/*
 * @Company: hugeInfo
 * @Author: lwh
 * @Date: 2022-03-23 09:35:07
 * @LastEditTime: 2022-07-22 15:35:38
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 预审异常
 */
 
import React, { useState, useEffect } from 'react';
import * as $$ from '../../../utils/utility';
import { Form, Typography } from 'antd';
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import Page from '../../../components/Page/index';
import TableView from '../../../components/TableView';
import TableSearch from '../../../components/TableSearch';
import MyTabs from '../../../components/MyTabs';
 
//预审异常列表
function getMyMediationDataApi(submitData) {
    return $$.ax.request({ url: 'caseInquiry/pageQuery', type: 'get', data: submitData, service: 'disp' });
}
 
const MediateAbnormal = () => {
    const [form] = Form.useForm();
 
    const navigate = useNavigate();
 
    const location = useLocation();
 
    const [searchParams] = useSearchParams();
 
    // 搜索
    const [search, setSearch] = useState({ page: 1, size: 10 });
 
    // 数据
    const [data, setData] = useState({ tableData: [] });
 
    // 搜索 or 重置
    function handleSearch(type, data) {
        if (type === 'recovery') {
            // 详情返回时恢复跳转前查询
            let obj = Object.assign({}, data.search);
            form.setFieldsValue(obj);
            getMyMediationData(obj, data.tableActive);
            return;
        }
        if (type === 'search') {
            let values = form.getFieldsValue();
            getMyMediationData({ ...search, ...values, page: 1 });
            return;
        }
        if (type === 'reset') {
            form.resetFields();
            getMyMediationData({ page: 1, size: 10 });
        }
    }
 
    // 查看,处理跳转
    function handleJump(caseId, id) {
        $$.setSessionStorage(location.pathname, {
            search: { ...search },
            title: '处理',
            subtitle: '处理被预审规则拦截的矛盾纠纷案件',
            breadcrumbData: [{ title: '预审异常', url: location.pathname }, { title: '处理' }],
            pageFrom: 'mediateAbnormal',
            isNotTabs: true,
        });
        navigate(`/mediate/caseDetail?caseId=${caseId}&dispId=${id}&back=${location.pathname}`);
    }
 
    // 初始化
    useEffect(() => {
        let returnRouteData = $$.getSessionStorage(location.pathname);
        if (searchParams.get('isBack') && !!returnRouteData) {
            handleSearch('recovery', returnRouteData);
        } else {
            handleSearch('reset');
        }
        if (!!returnRouteData) {
            $$.clearSessionStorage(location.pathname);
        }
    }, []);
 
    // 获取数据
    async function getMyMediationData(submitData, tableActive) {
        global.setSpinning(true);
        const res = await getMyMediationDataApi(submitData);
        global.setSpinning(false);
        if (res.type) {
            setSearch(submitData);
            setData({ total: res.data?.totalElements, tableData: res.data?.content || [], tableActive });
        }
    }
 
    const columns = () => {
        const otherColumns = true
            ? [{ title: '异常原因', dataIndex: 'errorReason' }]
            : [
                    { title: '处理意见', dataIndex: 'handleIdeaName' },
                    { title: '处理时间', dataIndex: 'xxx2' },
                    { title: '处理人', dataIndex: 'xxx3' },
              ];
        const columnsData = [
            { title: '申请渠道', dataIndex: 'canalName' },
            { title: '纠纷类型', dataIndex: 'caseTypeName' },
            { title: '申请人', dataIndex: 'plaintiffs' },
            { title: '被申请人', dataIndex: 'defendants' },
            { title: '纠纷发生地', dataIndex: 'addr' },
            { title: '调解类型', dataIndex: 'mediTypeName' },
            { title: '拦截时间', dataIndex: 'xxx1' },
            ...otherColumns,
            {
                title: '操作',
                dataIndex: 'action',
                width: 50,
                render: (_, record) => {
                    return <Typography.Link onClick={() => handleJump(record.caseId, record.id)}>{true ? '处理' : '查看'}</Typography.Link>;
                },
            },
        ];
        return columnsData;
    };
 
    return (
        <Page pageHead={{ title: '预审异常', subtitle: '在矛盾纠纷案件进入调度中心前被预审规则拦截的案件列表' }}>
            <div className="mediateList">
                <div className="pageSearch">
                    <TableSearch
                        form={form}
                        itemData={[
                            { type: 'Input', name: 'plaintiffs', label: '申请人' },
                            { type: 'Input', name: 'defendants', label: '被申请人' },
                            { type: 'RangePicker', name: 'xxx1', label: '拦截时间' },
                            {
                                type: 'Select',
                                name: 'caseType',
                                label: '纠纷类型',
                                selectdata: $$.caseOptions.caseCause,
                            },
                            { type: 'Input', name: 'addr', label: '纠纷发生地' },
                            { type: 'RangePicker', name: 'xxx1', label: '处理时间' },
                        ]}
                        handleReset={() => handleSearch('reset')}
                        handleSearch={() => handleSearch('search')}
                    />
                </div>
                <div className="pageTabs">
                    <MyTabs
                        tabs={[
                            { key: '1', label: `未处理()` },
                            { key: '2', label: `已处理()` },
                        ]}
                        activeKey={'1'}
                    />
                </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) => getMyMediationData({ ...search, page, size: pageSize }),
                        }}
                        rowClassName={(record, index) => (record.id === data.tableActive ? 'tableRowActive' : '')}
                    />
                </div>
            </div>
        </Page>
    );
};
 
export default MediateAbnormal;