广州市综治平台前端
liuwh
3 days ago 1f3626ae3932c3460d8608255c03aa834a2b221a
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
 
import React, { useEffect, useState } from 'react';
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
import { Form, Typography, Space } from 'antd';
import { Tooltip } from '@arco-design/web-react';
import NewTableSearch from '../../components/NewTableSearch';
import TableView from '../../components/TableViewCanSort';
import MyTabsNew from '../../components/MyTabsNew';
import NewPage from '../../components/NewPage';
import * as $$ from '../../utils/utility';
import './index.less';
// 列表数据
function getPageApi(submitData) {
  return $$.ax.request({ url: 'judicInfo/pageCourtConfirm', type: 'get', data: submitData, service: 'mediate' });
}
 
 
const { Link } = Typography;
 
 
// 两个列表的默认搜索参数
const unApplySearch = { page: 1, size: 10, sortColmn: 3, sortType: 2 }
const applySearch = { page: 1, size: 10, sortColmn: 2, sortType: 2 }
const CourtList = () => {
  let location = useLocation();
 
  let navigate = useNavigate();
 
  const [searchParams] = useSearchParams();
 
  const [form] = Form.useForm();
 
  // 搜索  申请渠道,22_00001-1:机构登记,22_00001-2:小程序,22_00001-3:其他渠道
  const [search, setSearch] = useState(unApplySearch);
 
  // tabs标签分页
  const [mediateTab, setMediateTab] = useState('0');
 
  // 数据
  const [data, setData] = useState({ tableData: [] });
 
  //自定义排序
  function getOrderPara(field, order) {
    // field, 1 applyTime 2 judicEndTime 3 waitHours
    // sortColmn 1 申请时间 2 结案时间 3 办结时限
    // sortType  1-升序,2-降序
    if (field === 'waitHours') {
      if (order === 'descend') {
        return { sortColmn: 3, sortType: 2 }
      }
      if (order === 'ascend') {
        return { sortColmn: 3, sortType: 1 }
      }
      if (order === 'undefined') {
        return { sortColmn: 3, sortType: '' }
      }
    }
    if (field === 'judicEndTime') {
      if (order === 'descend') {
        return { sortColmn: 2, sortType: 2 }
      }
      if (order === 'ascend') {
        return { sortColmn: 2, sortType: 1 }
      }
      if (order === 'undefined') {
        return { sortColmn: 2, sortType: '' }
      }
    }
    if (field === 'applyTime') {
      if (order === 'descend') {
        return { sortColmn: 1, sortType: 2 }
      }
      if (order === 'ascend') {
        return { sortColmn: 1, sortType: 1 }
      }
      if (order === 'undefined') {
        return { sortColmn: 1, sortType: '' }
      }
    }
  };
 
  // 查看,签收跳转
  function handleJump(record) {
    $$.setSessionStorage(location.pathname, { search: search });
    navigate(`/mediate/visit/fileMessage?caseTaskId=${record.caseTaskId}&caseId=${record.caseId}&judicId=${record.judicId}&back=${location.pathname}&tab=${mediateTab}`)
  }
  //修改页面
  function modifyJump(record) {
    navigate(`/mediate/courtEdit?caseId=${record.caseId}&judicId=${record.id}&back=${location.pathname}`)
  }
 
  // 搜索 or 重置
  function handleSearch(type, data, tab) {
    // 重置
    if (type === 'reset') {
      let defaultSearch = tab === '0' ? unApplySearch : applySearch;
      form.resetFields();
      getImportDraftData({ ...defaultSearch, status: tab });
      return;
    }
    // 筛选条件搜索
    if (type === 'search') {
      let values = form.getFieldsValue();
      $$.changeTimNeweFormat(values, 'judicTime', 'judicEndStart', 'judicEndEnd');
      $$.changeTimNeweFormat(values, 'applyTime', 'applyStart', 'applyEnd');
      $$.searchCascader(values, 'caseType', 1, ['caseType', 'caseType'])
      getImportDraftData({ page: search.page, size: search.size, sortColmn: search.sortColmn, sortType: search.sortType, ...values, status: tab });
    }
    // 翻页、正序倒序
    if (type === 'sort') {
      getImportDraftData({ ...data, status: tab });
    }
    // 案件详情返回时恢复跳转前查询
    if (type === 'recovery') {
      let obj = { ...data };
      if (obj.judicEndStart) {
        obj.judicTime = [obj.judicEndStart, obj.judicEndEnd];
      }
      if (obj.applyStart) {
        obj.applyTime = [obj.applyStart, obj.applyEnd];
      }
      form.setFieldsValue(obj);
      getImportDraftData({ ...data, status: tab });
      return;
    }
  }
 
  // 获取草稿数据
  async function getImportDraftData(submitData) {
    global.setSpinning(true);
    const res = await getPageApi(submitData);
    global.setSpinning(false);
    if (res.type) {
      setData({ total: res.data.totalElements, tableData: res.data.content, totalData: res.data?.totalData });
      setSearch(submitData);
    }
  }
 
  // 初始化
  useEffect(() => {
    let returnRouteData = $$.getSessionStorage(location.pathname);
    if (searchParams.get('isBack') && !!returnRouteData) {
      searchParams.get('tab') && setMediateTab(searchParams.get('tab'));
      handleSearch('recovery', returnRouteData.search, searchParams.get('tab'));
    } else {
      handleSearch('reset', '', '0');
    }
    if (!!returnRouteData) {
      $$.clearSessionStorage(location.pathname);
    }
  }, []);
 
  const columns = [
    { title: '申请时间', width: 120, dataIndex: 'applyTime', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
    {
      title: '办结时限', width: 120, dataIndex: 'waitHours', defaultSortOrder: 'descend', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text, record) =>
        <div>
          {record.outTimeType === '2' && <div className='courtList-flex public-tag-tagRed public-danger'><div className='public-roundDot-red'></div>{`超${$$.formatHoursToDaysAndHours(record.waitHours)}`}</div>}
          {record.outTimeType === '1' && <div className='courtList-flex public-tag-tagGreen public-success'><div className='public-roundDot-green'></div>{`剩${$$.formatHoursToDaysAndHours(record.waitHours)}`}</div>}
        </div>
    },
    { title: '申请部门', dataIndex: 'applyUnitName' },
    { title: '纠纷类型', width: 120, dataIndex: 'caseTypeName' },
    { title: '申请方', width: 100, dataIndex: 'plaintiffs' },
    { title: '被申请方', width: 150, dataIndex: 'defendants' },
    { title: '承办部门', dataIndex: 'mediateUnitName' },
    { title: '承办法官', width: 150, dataIndex: 'judgeName' },
    { title: '助理/书记员', dataIndex: 'judgeName', render: (text, record) => <div>{record.judicAssistList?.length > 0 ? record.judicAssistList?.map(i => i.assUserName)?.join('、') : ''}</div> },
    { title: '司法确认案号', dataIndex: 'judicNo' },
    {
      title: '操作',
      dataIndex: 'action',
      width: 90,
      render: (_, record) => {
        return (
          <Space size="middle">
            <Link onClick={() => modifyJump(record)}>处理</Link>
          </Space>
        );
      },
    },
  ];
 
  const appliedColumns = [
    { title: '结案时间', width: 120, dataIndex: 'judicEndTime', defaultSortOrder: 'descend', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
    { title: '承办法官', width: 100, dataIndex: 'judgeName' },
    { title: '助理/书记员', dataIndex: 'judgeName', render: (text, record) => <div>{record.judicAssistList?.length > 0 ? record.judicAssistList?.map(i => i.assUserName)?.join('、') : ''}</div> },
    { title: '司法确认结果', width: 110, dataIndex: 'judicResult', render: (text) => <span className={text === '22_00028-1' ? 'public-success' : text === '22_00028-2' ? 'public-danger' : ''}>{text === '22_00028-1' ? '已达成' : text === '22_00028-2' ? '未达成' : '-'}</span> },
    { title: '司法确认案号', width: 120, dataIndex: 'judicNo' },
    { title: '申请时间', width: 120, dataIndex: 'applyTime', order: 'ascend', sorter: { compare: (a, b) => { } }, render: (text) => <span>{$$.dateFormat(text)}</span> },
    { title: '申请部门', dataIndex: 'mediateUnitName' },
    { title: '纠纷类型', dataIndex: 'caseTypeName' },
    { title: '申请方', width: 150, dataIndex: 'plaintiffs' },
    { title: '被申请方', width: 150, dataIndex: 'defendants' },
    { title: '承办部门', width: 130, dataIndex: 'mediateUnitName', render: (text) => <span> <Tooltip content={text}>{$$.ellipsis(text, 7)}</Tooltip></span> },
    {
      title: '操作',
      dataIndex: 'action',
      width: 90,
      render: (_, record) => {
        return (
          <Space size="middle">
            <Link onClick={() => handleJump(record)}>详情</Link>
          </Space>
        );
      },
    },
  ];
 
  return (
    <NewPage pageHead={{ breadcrumbData: [{ title: '工作台' }, { title: '司法确认' }], title: '司法确认' }}>
      <div className="comprehensive">
        <div className="myMediation-search">
          <NewTableSearch
            exportButtonShow={false}
            headTitle={'查询条件'}
            labelLength={4}
            rowNum={2}
            form={form}
            itemData={[
              { type: 'RangePicker', name: 'applyTime', label: '申请时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
              { type: 'RangePicker', name: 'judicTime', label: '结案时间', shortcutsPlacementLeft: true, shortcuts: $$.shortcutsList(), span: 8 },
              { type: 'Select', name: 'judicResult', label: '司法确认结果', placeholder: '请选择', span: 8, selectdata: [{ label: '已达成', value: '22_00028-1' }, { label: '未达成', value: '22_00028-2' }] },
              { type: 'Input', name: 'plaintiffs', label: '申请方', placeholder: '请填写', },
              { type: 'Input', name: 'defendants', label: '被申请方', placeholder: '请填写', },
              { type: 'Input', name: 'judicNo', label: '司法确认案号', placeholder: '请填写', },
            ]}
            handleReset={() => handleSearch('reset', '', mediateTab)}
            handleSearch={() => handleSearch('search', '', mediateTab)}
          />
        </div>
        <div className="pageTabs" style={{ borderBottom: '1px solid #e5e6eb' }}>
          <MyTabsNew
            tabs={[
              { key: '0', label: `进行中(${$$.showMoreNum(data.totalData?.unApplyNum || 0)})` },
              { key: '1', label: `已结案(${$$.showMoreNum(data.totalData?.applyNum || 0)})` },
            ]}
            activeKey={mediateTab}
            onChange={(activeKey) => {
              setMediateTab(activeKey);
              handleSearch('sort', activeKey === '0' ? unApplySearch : applySearch, activeKey);
            }}
          />
        </div>
        <div style={{ margin: '6px 0' }}>
        </div>
        <div style={{ flex: '1', marginBottom: '16px' }} className="pageTable">
          {/* 未申请 */}
          {mediateTab === '0' && <TableView
            showHeader
            title="查询结果"
            columns={columns}
            dataSource={data.tableData}
            onChange={(pagination, filters, sorter) => {
              handleSearch('sort', { page: pagination.current, size: pagination.pageSize, ...getOrderPara(sorter.field, sorter.order) }, mediateTab)
            }}
            pagination={{
              current: search.page,
              pageSize: search.size,
              total: data.total,
            }}
          />}
          {/* 已申请 */}
          {mediateTab === '1' && <TableView
            showHeader
            title="查询结果"
            columns={appliedColumns}
            dataSource={data.tableData}
            onChange={(pagination, filters, sorter) => {
              handleSearch('sort', { page: pagination.current, size: pagination.pageSize, ...getOrderPara(sorter.field, sorter.order) }, mediateTab)
            }}
            pagination={{
              current: search.page,
              pageSize: search.size,
              total: data.total,
            }}
          />}
        </div>
      </div>
    </NewPage>
  );
};
 
export default CourtList;