广州市综治平台前端
xusd
4 days ago 05d7e8192f6a5b2f3295c87536db9245cc45d442
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
 
import React, { useEffect, useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { Form, Typography, Space, Checkbox } from 'antd';
import { IconInfoCircle } from '@arco-design/web-react/icon';
import NewPage from '@/components/NewPage';
import * as $$ from '@/utils/utility';
import TableView from '@/components/TableViewCanSort';
import { Button } from '@arco-design/web-react';
import NewTableSearch from '@/components/NewTableSearch';
import MyTabsNew from '@/components/MyTabsNew';
import { Modal } from '@arco-design/web-react';
import BatchAuditInfo from './components/BatchAuditInfo';
import './index.less';
 
//转入申请列表
function getAuditData(data) {
  return $$.ax.request({ url: 'rmtj/pageFirstAudit', type: 'get', data, service: 'mediate' });
}
 
//批量移除
function batchDelete(data) {
  return $$.ax.request({ url: 'rmtj/batchDeleteApply', type: 'post', data, service: 'mediate' });
}
 
//获取部门数据
function getDataApi(data) {
  return $$.ax.request({ url: `ctUnit/rmtjUnitChoose`, type: 'get', data, service: 'cust' });
}
 
const { Link } = Typography;
 
const MediateAll = () => {
  let location = useLocation();
  let navigate = useNavigate();
  const [form] = Form.useForm();
  // 搜索
  const [search, setSearch] = useState({ page: 1, size: 10 });
  // tabs标签分页
  const [mediateTab, setMediateTab] = useState('1');
  // 未审核数据
  const [data, setData] = useState({ tableData: [] });
  // 已审核数据
  const [miniData, setMiniData] = useState({ tableData: [] })
  // table选择数据
  const [selectedRowsObj, setSelectedRowsObj] = useState({});
  //自定义排序
  const [sortType, setSortType] = useState(1);
  const [visible, setVisible] = useState(false);
  const [treeData, setTreeData] = useState([]);
 
  const columns = [
    { title: '提审时间', width: 120, dataIndex: 'applyTime', render: (text) => <span>{$$.dateFormat(text)}</span> },
    { title: '事项编号', dataIndex: 'caseRef' },
    {
      title: '化解结果',
      dataIndex: 'mediResultName',
      width: 100,
      render: (text, record) =>
        !text ? '-' : <div className={`public-notag public-notag-${record.mediResult === '22_00025-1' ? 'tagGreen' : 'tagRed'}`}>{text}</div>,
    },
    { title: '调解组织', dataIndex: 'mediateUnitName' },
    { title: '调解员', width: 60, dataIndex: 'mediator' },
    {
      title: '事项来源',
      dataIndex: 'caseSource',
      width: 120,
    },
    {
      title: '事项等级',
      dataIndex: 'caseLevel',
      width: 100,
    },
    { title: '纠纷类型', dataIndex: 'caseType' },
    { title: '申请方', dataIndex: 'plaintiffs' },
    { title: '被申请方', dataIndex: 'defendants' },
    {
      title: '操作',
      dataIndex: 'action',
      width: 120,
      render: (_, record) => {
        return (
          <Space size="middle">
            <Link onClick={() => handleJump(record)}>详情</Link>
            {mediateTab === '1' && <Link onClick={() => handleAudit(record)}>审核</Link>}
          </Space>
        );
      },
    },
  ];
  //已审核表头添加
  const applyColumns = [
    { title: '初审时间', width: 100, dataIndex: 'firstAuditTime', render: (text) => <span>{$$.dateFormat(text)}</span> },
    {
      title: '初审结果',
      dataIndex: 'firstAuditResultName',
      width: 80,
      render: (text, record) =>
        !text ? '-' : <div className={`public-notag public-notag-${record.firstAuditResult === '1' ? 'tagGreen' : record.firstAuditResult === '2' ? 'tagRed' : ''}`}>{text}</div>,
    },
    {
      title: '终审结果',
      dataIndex: 'endAuditResultName',
      width: 80,
      render: (text, record) =>
        !text ? '-' : <div className={`public-notag public-notag-${record.endAuditResult === '1' ? 'tagGreen' : record.endAuditResult === '2' ? 'tagRed' : ''}`}>{text}</div>,
    },
    {
      title: '转入结果',
      dataIndex: 'rmtjStatusName',
      width: 80,
      render: (text, record) =>
        !text ? '-' : <div className={`public-notag public-notag-${record.rmtjStatus === '3' ? 'tagGreen' : record.rmtjStatus === '4' ? 'tagRed' : ''}`}>{text}</div>,
    },
    { title: '提审时间', width: 100, dataIndex: 'applyTime', render: (text) => <span>{$$.dateFormat(text)}</span> },
    { title: '转入时间', width: 100, dataIndex: 'rmtjTime', render: (text) => <span>{$$.dateFormat(text)}</span> },
    { title: '事项编号', width: 100, dataIndex: 'caseRef', ellipsis: true, },
    {
      title: '化解结果',
      dataIndex: 'mediResultName',
      width: 100,
      render: (text, record) =>
        !text ? '-' : <div className={`public-notag public-notag-${record.mediResult === '22_00025-1' ? 'tagGreen' : 'tagRed'}`}>{text}</div>,
    },
    { title: '调解组织', dataIndex: 'mediateUnitName', width: 80, ellipsis: true, },
    { title: '调解员', width: 60, dataIndex: 'mediator' },
    {
      title: '事项来源',
      dataIndex: 'caseSource',
      width: 80,
    },
    {
      title: '事项等级',
      dataIndex: 'caseLevel',
      width: 80,
    },
    { title: '纠纷类型', width: 80, dataIndex: 'caseType', ellipsis: true, },
    { title: '申请方', dataIndex: 'plaintiffs', width: 60, ellipsis: true, },
    { title: '被申请方', dataIndex: 'defendants', width: 80, ellipsis: true, },
    {
      title: '操作',
      dataIndex: 'action',
      width: 80,
      render: (_, record) => {
        return (
          <Space size="middle">
            <Link onClick={() => handleJump(record)}>详情</Link>
          </Space>
        );
      },
    },
  ]
  const selectedRowKeys = handleGetSelectedRowKeys('selectedRowKeys');
 
  // 初始化
  useEffect(() => {
    getDeptData()
    let returnRouteData = $$.getSessionStorage(location.pathname);
    if (returnRouteData && returnRouteData.search) {
      const { auditType, ...rest } = returnRouteData.search
      setMediateTab(auditType)
      handleSearch('recovery', { ...rest }, '1');
      handleSearch('recovery', { ...rest }, '2');
    } else {
      handleSearch('reset', '', '1');
      handleSearch('reset', '', '2');
    }
    if (!!returnRouteData) {
      $$.clearSessionStorage(location.pathname);
    }
  }, []);
 
  //获取部门数据
  const getDeptData = async () => {
    const res = await getDataApi({})
    if (res.type) {
      setTreeData(res.data)
    }
  }
 
  //自定义排序
  function getOrderPara(field, order) {
    // if (field === 'acceptTime') {
    //   setSortFieldParm(1);
    //   if (order === 'descend') {
    //     setSortType(1);
    //     handleSearch('changePage', [page, size, 1], mediateTab);
    //   }
    //   if (order === 'ascend') {
    //     handleSearch('changePage', [page, size, 2], mediateTab);
    //     setSortType(2);
    //   }
    // }
    // if (typeof order === 'undefined') {
    //   handleSearch('changePage', [page, size], mediateTab);
    //   setSortType('');
    // }
  };
 
  // 查看,签收跳转
  function handleJump(record) {
    $$.setSessionStorage(location.pathname, { search: search });
    navigate(`/mediate/visit/fileMessage?caseTaskId=${record.taskId}&caseId=${record.caseId}`)
  }
 
  //审核
  function handleAudit(record) {
    $$.setSessionStorage(location.pathname, { search: search });
    navigate(`/mediate/transferStart/audit?applyId=${record.applyId}&caseId=${record.caseId}`);
  }
 
  // 搜索 or 重置
  function handleSearch(type, data, tab) {
    if (type === 'recovery') {
      // 案件详情返回时恢复跳转前查询
      let obj = { ...data };
      if (obj.acceptTime) {
        obj.acceptTime = [$$.myMoment(obj.acceptStart), $$.myMoment(obj.acceptEnd)];
      }
      if (obj.mediEndTime) {
        obj.mediEndTime = [$$.myMoment(obj.mediEndTimeStart), $$.myMoment(obj.mediEndTimeEnd)];
      }
      form.setFieldsValue(obj);
      getImportDraftData({ ...data, sortType, auditType: tab });
 
      return;
    }
    if (type === 'reset') {
      form.resetFields();
      getImportDraftData({ page: 1, size: 10, sortType, auditType: tab });
 
      return;
    }
    if (type === 'search' || type === 'changePage') {
      let values = form.getFieldsValue();
      let obj = type === 'changePage' ? { page: data[0], size: data[1] } : { page: 1 };
      let paramsObj = { ...search, ...values, ...obj, auditType: tab }
      $$.changeTimNeweFormat(paramsObj, 'firstAuditTime', 'firstAuditStart', 'firstAuditEnd');
      $$.changeTimNeweFormat(paramsObj, 'applyTime', 'applyStart', 'applyEnd');
      $$.changeTimNeweFormat(paramsObj, 'rmtjTime', 'rmtjStart', 'rmtjEnd');
      getImportDraftData(paramsObj);
    }
  }
 
  // 获取已审核未审核数据
  async function getImportDraftData(submitData) {
    global.setSpinning(true);
    const res = await getAuditData(submitData);
    global.setSpinning(false);
    if (res.type) {
      if (submitData.auditType === '1') {
        //已审核
        setData({ total: res.data.totalElements, tableData: res.data.content });
      } else {
        //未审核
        setMiniData({ total: res.data.totalElements, tableData: res.data.content });
      }
      setSearch(submitData);
    }
  }
 
  // 选择导出内容
  function onSelectChange(selectedRowKeys, selectedRows) {
    let obj = {};
    obj[search.page] = { selectedRowKeys, selectedRows };
 
    setSelectedRowsObj({ ...selectedRowsObj, ...obj });
  }
 
  //草稿 获取table选择数据
  function handleGetSelectedRowKeys(type) {
    let arr = [];
    for (let item in selectedRowsObj) {
      if (type == 'selectedRowKeys') {
        arr = arr.concat(selectedRowsObj[item][type]);
      } else {
        arr = arr.concat(selectedRowsObj[item]['selectedRows'].map(res => res[type]));
      }
    }
    return arr;
  }
 
  // 批量审核
  async function handleBatchAudit() {
    setVisible(true)
  }
 
  //批量移除
  const handleDelete = () => {
    const keys = handleGetSelectedRowKeys('selectedRowKeys')
    $$.arcoModalInfo({
      icon: <IconInfoCircle style={{ color: '#1A6FB8' }} />,
      title: '提醒',
      content: <span>确定移除选中的<span className='public-color'>{keys.length}</span>个案件吗?</span>,
      okText: '确定',
      cancelText: '我再想想',
      onOk: async () => {
        global.setSpinning(true);
        const res = await batchDelete(keys);
        global.setSpinning(false);
        if (res.type) {
          $$.infoSuccess({ content: <div><div>移除成功</div><div>成功移除<span className='public-color'>{keys.length}</span>条矛盾纠纷数据</div></div> });
          setSelectedRowsObj({});
          handleSearch('reset', '', '1');
          handleSearch('reset', '', '2');
        }
      },
    });
  }
 
  return (
    <NewPage pageHead={{ breadcrumbData: [{ title: '工作台' }, { title: '转入审核' }], title: '转入审核' }}>
      <div className="comprehensive" style={{ marginBottom: selectedRowKeys?.length > 0 ? '56px' : '0', overflowY: 'auto' }}>
        <div className="myMediation-search">
          <NewTableSearch
            exportButtonShow={false}
            labelLength={4}
            rowNum={2}
            form={form}
            itemData={[
              { type: 'RangePicker', name: 'firstAuditTime', label: '初审时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
              { type: 'RangePicker', name: 'applyTime', label: '提审时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
              { type: 'RangePicker', name: 'rmtjTime', label: '转入时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
              { type: 'Select', name: 'firstAuditResult', label: '初审结果', placeholder: '请选择', selectdata: $$.options.resultList, },
              { type: 'Select', name: 'endAuditResult', label: '终审结果', placeholder: '请选择', selectdata: $$.options.resultList, },
              { type: 'Select', name: 'rmtjStatus', label: '转入结果', placeholder: '请选择', selectdata: $$.options.rmtjList, },
              { type: 'Input', name: 'rmtjCaseId', label: '转入案号' },
              { type: 'Input', name: 'plaintiffs', label: '申请方' },
              { type: 'Input', name: 'defendants', label: '被申请方' },
              { type: 'Input', name: 'caseRef', label: '事项编号' },
              { type: 'TreeSelect1', name: 'mediateUnitId', label: '调解组织', treedata: treeData },
              { type: 'Select', name: 'inputWay', label: '登记方式', placeholder: '请选择', selectdata: $$.options.inputWay, },
            ]}
            handleReset={() => handleSearch('reset', '', mediateTab)}
            handleSearch={() => handleSearch('search', '', mediateTab)}
          />
        </div>
        <div className="pageTabs">
          <MyTabsNew
            tabs={[
              { key: '1', label: `未审核(${$$.showMoreNum(data.total || 0)})` },
              { key: '2', label: `已审核(${$$.showMoreNum(miniData.total || 0)})` },
            ]}
            activeKey={mediateTab}
            onChange={(activeKey) => {
              setSelectedRowsObj({});
              setMediateTab(activeKey);
              handleSearch('reset', '', activeKey);
            }}
          />
        </div>
        {/* 未审核 */}
        {mediateTab === '1' && <div style={{ flex: '1', margin: '16px 0' }} className="pageTable">
          <TableView
            onValueChange={getOrderPara}
            showHeader
            title="查询结果"
            columns={columns}
            dataSource={data.tableData}
            rowKey="caseId"
            rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
            pagination={{
              current: search.page,
              pageSize: search.size,
              total: data.total,
              onChange: (page, pageSize) => {
                handleSearch('changePage', [page, pageSize, sortType], mediateTab)
              }
            }}
          />
        </div>
        }
        {/* 导入成功 */}
        {mediateTab === '2' && <>
          <div style={{ flex: '1', marginBottom: '16px' }} className="pageTable">
            <TableView
              rowKey="caseId"
              onValueChange={getOrderPara}
              showHeader
              title="查询结果"
              columns={applyColumns}
              dataSource={miniData.tableData}
              rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
              pagination={{
                current: search.page,
                pageSize: search.size,
                total: miniData.total,
                onChange: (page, pageSize) => {
                  handleSearch('changePage', [page, pageSize], mediateTab)
                }
              }}
            />
          </div>
        </>}
        {selectedRowKeys.filter(d => d).length > 0 && (
          <div className="ledger-main-excel">
            <Space size="middle">
              <Checkbox
                onChange={(e) => {
                  if (!e.target.checked) {
                    setSelectedRowsObj({});
                  }
                }}
                checked={(selectedRowKeys.filter(d => d).length = data.total)}
                indeterminate={selectedRowKeys.filter(d => d).length < data.total}
              >
                已选{selectedRowKeys.filter(d => d).length}项
              </Checkbox>
              <Link onClick={() => setSelectedRowsObj({})}>取消</Link>
            </Space>
            <div>
              {mediateTab === '1' && <Space size="middle">
                <Button onClick={handleDelete} type="outline" style={{ marginLeft: '24px' }}>
                  移除案件
                </Button>
                {/* <Button onClick={() => showDrawer(handleGetSelectedRowKeys('selectedRowKeys'))} type="outline" style={{ marginLeft: '24px' }}>
                  导出案件
                </Button> */}
                <Button type="primary" ghost onClick={handleBatchAudit}>批量审核</Button>
              </Space>
              }
              {mediateTab === '2' && <Space size="middle">
                <Button onClick={handleDelete} type="outline" style={{ marginLeft: '24px' }}>
                  移除案件
                </Button>
              </Space>
              }
            </div>
          </div>
        )}
        <Modal
          title='转入人民调解系统审核'
          visible={visible}
          onOk={() => setVisible(false)}
          onCancel={() => {
            setVisible(false)
          }}
          autoFocus={false}
          focusLock={true}
          footer={null}
          unmountOnExit={true}
          maskClosable={false}
        >
          <BatchAuditInfo
            selectKeys={handleGetSelectedRowKeys('applyId')}
            onCancel={() => {
              setVisible(false)
              handleSearch('reset', '', '1');
              setSelectedRowsObj({});
            }}
          />
        </Modal>
      </div>
    </NewPage>
  );
};
 
export default MediateAll;