广州市综治平台前端
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
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-07-14 10:51:10
 * @LastEditTime: 2022-11-01 09:52:00
 * @LastEditors: ldh
 * @Version: 1.0.0
 * @Description: 工作流管理
 */
import React, { useState, useEffect } from 'react';
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
import { Button, Form, Space, Tooltip, Typography } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import Page from '../../../components/Page';
import TableView from '../../../components/TableView';
import TableSearch from '../../../components/TableSearch';
import * as $$ from '../../../utils/utility';
 
// 获取工作流管理数据
function getWorkflowManageApi(submitData) {
    return $$.ax.request({ url: '', type: 'get', data: submitData, service: '' });
}
 
const { Link } = Typography;
 
const WorkflowManage = () => {
    const location = useLocation();
 
    const navigate = useNavigate();
 
    const [searchParams] = useSearchParams();
 
    const [form] = Form.useForm();
 
    // 搜索
    const [search, setSearch] = useState({ page: 1, size: 10 });
 
    // 数据
    const [data, setData] = useState({});
 
    const columns = [
        { title: '流程类型', dataIndex: 'xxx1' },
        { title: '流程名称', dataIndex: 'xxx2' },
        { title: '纠纷类型', dataIndex: 'caseTypeName' },
        { title: '适用组织', dataIndex: 'xxx3' },
        { title: '生效状态', dataIndex: 'xxx4', width: 85, render: (text) => <div className={`public-tag public-tag-tagBlue`}>启用中</div> },
        { title: '使用次数', dataIndex: 'xxx6' },
        { title: '更新时间', dataIndex: 'xxx7' },
        { title: '更新人', dataIndex: 'xxx8' },
        {
            title: '操作',
            dataIndex: 'action',
            width: 200,
            render: (_, record) => (
                <Space size="middle">
                    <Link onClick={() => handleJump('check', 'mediate', record)}>查看</Link>
                    <Link onClick={() => handleJump('change', 'mediate', record)}>修改</Link>
                    <Link onClick={() => handleOpenOrStop(record)}>启用</Link>
                    <Link onClick={() => handleDel(record)}>删除</Link>
                </Space>
            ),
        },
    ];
 
    // 新建,修改,查看跳转
    function handleJump(editType, type, record) {
        $$.setSessionStorage(location.pathname, {
            search,
            tableActive: null,
        });
        if (editType === 'check') {
            navigate(`/mediate/workflowManage/workflowManageDetail?type=${type}&back=${location.pathname}`, { state: { aa: 11 } });
            return;
        }
        navigate(`/mediate/workflowManage/workflowManageEdit?type=${type}&editType=${editType}&back=${location.pathname}`, { state: { aa: 11 } });
    }
 
    // 启用 or 停用
    function handleOpenOrStop(record) {
        $$.modalInfo({ type: 'warning', content: `该工作流有在途任务,暂时无法停用` });
        $$.modalInfo({ title: '停用工作流确认', content: `停用后将无法继续使用该流程,确定停用「纠纷调解通用流程」吗?`, okText: '确定停用' });
        $$.modalInfo({ title: '启用工作流确认', content: `确定启用「婚姻调解工作流」吗?`, okText: '确定启用' });
    }
 
    // 删除模板
    function handleDel(record) {
        $$.modalInfo({ type: 'warning', content: `该工作流有在途任务,暂时无法删除` });
        $$.modalInfo({ title: '删除工作流确认', content: `删除后将无法继续使用该流程,确定删除「纠纷调解通用流程」吗?`, okText: '确定删除' });
    }
 
    // 搜索 or 重置
    function handleSearch(type, data) {
        if (type === 'recovery') {
            // 案件详情返回时恢复跳转前查询
            let obj = Object.assign({}, data.search);
            form.setFieldsValue(obj);
            getWorkflowManage(obj);
            return;
        }
        if (type === 'reset') {
            form.resetFields();
            getWorkflowManage({ page: 1, size: 10 });
            return;
        }
        if (type === 'search') {
            let values = form.getFieldsValue();
            getWorkflowManage({ ...search, ...values, page: 1 });
            return;
        }
        if (type === 'changePage') {
            getWorkflowManage({ ...search, page: data[0], size: data[1] });
        }
    }
 
    // 获取数据
    async function getWorkflowManage(submitData, tableActive) {
        global.setSpinning(true);
        const res = await getWorkflowManageApi(submitData);
        global.setSpinning(false);
        if (res.type) {
            setData({ total: res.data?.totalElements, tableData: res.data?.content || [], tableActive });
        }
    }
 
    return (
        <Page pageHead={{ title: '工作流管理', subtitle: '管理平台内调解及司法确认涉及的工作流配置清单与规则' }}>
            <div className="workflowManage">
                <div className="pageSearch">
                    <TableSearch
                        labelLength={4}
                        form={form}
                        itemData={[
                            { type: 'Input', name: 'xxx1', label: '流程名称' },
                            { type: 'Select', name: 'caseType', label: '纠纷类型', selectdata: $$.caseOptions.caseCause },
                            {
                                type: 'Select',
                                name: 'xxx3',
                                label: '生效状态',
                                selectdata: [
                                    { label: '启用', value: '1' },
                                    { label: '停用', value: '2' },
                                ],
                            },
                            {
                                type: 'Select',
                                name: 'xxx2',
                                label: '流程类型',
                                selectdata: [
                                    { label: '纠纷调解', value: '1' },
                                    { label: '司法确认', value: '2' },
                                    { label: '法律咨询', value: '3' },
                                ],
                            },
                            { type: 'Input', name: 'xxx4', label: '适用组织', placeholder: '选择工作流适用的组织' },
                        ]}
                        handleReset={() => handleSearch('reset')}
                        handleSearch={() => handleSearch('search')}
                    />
                </div>
                <div className="pageTable">
                    <TableView
                        showHeader
                        title="查询结果"
                        buttonAction={[
                            <Tooltip
                                title={
                                    <span>
                                        <span className="public-a" onClick={() => handleJump('add', 'mediate')}>
                                            纠纷调解
                                        </span>
                                        <span className="public-a public-rightBorder" onClick={() => handleJump('add', 'judicial')}>
                                            司法确认
                                        </span>
                                    </span>
                                }
                            >
                                <Button type="primary" icon={<PlusOutlined />}>
                                    新建流程
                                </Button>
                            </Tooltip>,
                        ]}
                        columns={columns}
                        dataSource={data.tableData || [{}]}
                        rowClassName={(record, index) => (record.id === data.tableActive ? 'tableRowActive' : '')}
                        pagination={{
                            current: search.page,
                            pageSize: search.size,
                            total: data.total,
                            onChange: (page, pageSize) => handleSearch('changePage', [page, pageSize]),
                        }}
                    />
                </div>
            </div>
        </Page>
    );
};
 
export default WorkflowManage;