|
@@ -1,21 +1,39 @@
|
1
|
|
-import React, { useRef,useState } from 'react'
|
|
1
|
+import React, { useRef, useState } from 'react'
|
2
|
2
|
import moment from 'moment';
|
3
|
3
|
import { history } from 'umi';
|
4
|
|
-import { DatePicker, Button } from 'antd';
|
|
4
|
+import { DatePicker, Button, Modal, Table, message, Form, Input, Select } from 'antd';
|
5
|
5
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
6
|
6
|
import PageTable from '@/components/PageTable'
|
7
|
|
-import { getMakeList } from '@/services/application'
|
|
7
|
+import { getMakeList, getApplicationDetail, updateBindCard, updateMake, exportCardList } from '@/services/application'
|
8
|
8
|
|
9
|
9
|
const { RangePicker } = DatePicker;
|
|
10
|
+const { Option } = Select;
|
10
|
11
|
|
11
|
12
|
const formatterTime = (val) => {
|
12
|
13
|
return val ? moment(val).format('YYYY-MM-DD HH:mm') : '';
|
13
|
14
|
};
|
|
15
|
+const FormItem = Form.Item;
|
14
|
16
|
|
15
|
17
|
export default (props) => {
|
16
|
18
|
const actionRef = useRef();
|
17
|
19
|
const [applyStart, setStart] = useState()
|
18
|
20
|
const [applyEnd, setEnd] = useState()
|
|
21
|
+ //选中的id列表
|
|
22
|
+ const [selectedRowKeys, setSelectedRowKeys] = useState([])
|
|
23
|
+ const [selectedRows, setSelectedRows] = useState([])
|
|
24
|
+ const [application, setApplication] = useState();
|
|
25
|
+
|
|
26
|
+ const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
|
|
27
|
+ //绑卡弹窗
|
|
28
|
+ const [form] = Form.useForm();
|
|
29
|
+ const [visible, setVisible] = useState(false);
|
|
30
|
+ const [loading, setLoading] = useState(false);
|
|
31
|
+
|
|
32
|
+ //发证弹窗
|
|
33
|
+ const [outForm] = Form.useForm();
|
|
34
|
+ const [outVisible, setOutVisible] = useState(false);
|
|
35
|
+ const [outLoading, setOutLoading] = useState(false);
|
|
36
|
+
|
19
|
37
|
const goDetail = (id) => {
|
20
|
38
|
history.push(`certificateIssuance/issuance.jsx?id=${id}`);
|
21
|
39
|
}
|
|
@@ -27,6 +45,89 @@ export default (props) => {
|
27
|
45
|
setStart()
|
28
|
46
|
setEnd()
|
29
|
47
|
}
|
|
48
|
+ const handleExport = () => {
|
|
49
|
+ // console.log(selectedRows);
|
|
50
|
+
|
|
51
|
+ const cardNoList = selectedRows.map(item => item.originCardNo)
|
|
52
|
+ if (cardNoList.some(item => item == null)) {
|
|
53
|
+ message.info('您选中的犬证有未绑卡数据,请先绑卡再导出数据')
|
|
54
|
+ } else {
|
|
55
|
+ exportCardList({ cardNoList: cardNoList }).then((res) => {
|
|
56
|
+ message.success('导出' + cardNoList.length + '条数据');
|
|
57
|
+
|
|
58
|
+ })
|
|
59
|
+ }
|
|
60
|
+ // setSelectedRows([])
|
|
61
|
+ // setSelectedRowKeys([])
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+ //绑卡弹窗
|
|
66
|
+ const bindCard = (val) => {
|
|
67
|
+ setLoading(true)
|
|
68
|
+ updateBindCard(
|
|
69
|
+ application.applyId,
|
|
70
|
+ { cardNo: val.originCardNo }
|
|
71
|
+ ).then((res) => {
|
|
72
|
+ message.success('绑卡成功')
|
|
73
|
+ handleBindCancel();
|
|
74
|
+ actionRef.current.reload()
|
|
75
|
+ setLoading(false)
|
|
76
|
+ }).catch(err => {
|
|
77
|
+ setLoading(false)
|
|
78
|
+ console.log(err.message)
|
|
79
|
+ })
|
|
80
|
+ }
|
|
81
|
+ const handleBindShow = (id) => {
|
|
82
|
+ getApplicationDetail(id).then((res) => {
|
|
83
|
+ form.setFieldsValue(res);
|
|
84
|
+ setApplication(res)
|
|
85
|
+ setVisible(true)
|
|
86
|
+ }).catch((err) => {
|
|
87
|
+ console.log(err.message)
|
|
88
|
+ });
|
|
89
|
+ }
|
|
90
|
+ const handleBindCancel = () => {
|
|
91
|
+ setVisible(false)
|
|
92
|
+ setTimeout(() => {
|
|
93
|
+ setApplication();
|
|
94
|
+ form.resetFields()
|
|
95
|
+ }, 100);
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ //发证弹窗
|
|
99
|
+ const outCard = (val) => {
|
|
100
|
+ setOutLoading(true)
|
|
101
|
+ updateMake(application.applyId, {
|
|
102
|
+ makeStatus: application.makeStatus,
|
|
103
|
+ trackingType: val.trackingType,
|
|
104
|
+ trackingNo: val.trackingNo
|
|
105
|
+ }).then((res) => {
|
|
106
|
+ message.success('发证成功')
|
|
107
|
+ handleOutCancel();
|
|
108
|
+ actionRef.current.reload()
|
|
109
|
+ setOutLoading(false)
|
|
110
|
+ }).catch((err) => {
|
|
111
|
+ console.log(err.message)
|
|
112
|
+ setOutLoading(false)
|
|
113
|
+ })
|
|
114
|
+ }
|
|
115
|
+ const handleOutShow = (id) => {
|
|
116
|
+ getApplicationDetail(id).then((res) => {
|
|
117
|
+ outForm.setFieldsValue(res);
|
|
118
|
+ setApplication(res)
|
|
119
|
+ setOutVisible(true)
|
|
120
|
+ }).catch((err) => {
|
|
121
|
+ console.log(err.message)
|
|
122
|
+ });
|
|
123
|
+ }
|
|
124
|
+ const handleOutCancel = () => {
|
|
125
|
+ setOutVisible(false)
|
|
126
|
+ setTimeout(() => {
|
|
127
|
+ setApplication();
|
|
128
|
+ outForm.resetFields()
|
|
129
|
+ }, 100);
|
|
130
|
+ }
|
30
|
131
|
const columns = [
|
31
|
132
|
{
|
32
|
133
|
title: '证件号',
|
|
@@ -45,10 +146,10 @@ export default (props) => {
|
45
|
146
|
dataIndex: 'isOrg',
|
46
|
147
|
key: 'isOrg',
|
47
|
148
|
search: true,
|
48
|
|
- hideInTable:true,
|
|
149
|
+ hideInTable: true,
|
49
|
150
|
render: (_, record) => {
|
50
|
151
|
return record.isOrg
|
51
|
|
- ? '企业':'个人'
|
|
152
|
+ ? '企业' : '个人'
|
52
|
153
|
},
|
53
|
154
|
valueType: 'select',
|
54
|
155
|
valueEnum: {
|
|
@@ -95,9 +196,9 @@ export default (props) => {
|
95
|
196
|
title: '申请时间',
|
96
|
197
|
dataIndex: 'createDate',
|
97
|
198
|
key: 'createDate',
|
98
|
|
- width:160,
|
|
199
|
+ width: 160,
|
99
|
200
|
render: (t) => formatterTime(t),
|
100
|
|
- renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD'onChange={handelApplyDateChange} />
|
|
201
|
+ renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD' onChange={handelApplyDateChange} />
|
101
|
202
|
},
|
102
|
203
|
{
|
103
|
204
|
title: '制证状态',
|
|
@@ -124,10 +225,10 @@ export default (props) => {
|
124
|
225
|
{
|
125
|
226
|
title: '发放时间',
|
126
|
227
|
dataIndex: 'makeDate',
|
127
|
|
- width:160,
|
|
228
|
+ width: 160,
|
128
|
229
|
key: 'makeDate',
|
129
|
230
|
render: (t) => t != '-' ? formatterTime(t) : '-',
|
130
|
|
- search:false
|
|
231
|
+ search: false
|
131
|
232
|
},
|
132
|
233
|
{
|
133
|
234
|
title: '操作',
|
|
@@ -135,18 +236,43 @@ export default (props) => {
|
135
|
236
|
width: 160,
|
136
|
237
|
render: (_, record) => [
|
137
|
238
|
<Button key={1} style={{ padding: 0 }} type="link"
|
|
239
|
+ onClick={() => handleBindShow(record.applyId)}
|
|
240
|
+ >绑卡</Button>,
|
|
241
|
+ <Button key={2} style={{ padding: 0 }} type="link"
|
|
242
|
+ onClick={() => handleOutShow(record.applyId)}
|
|
243
|
+ >发证
|
|
244
|
+ </Button>,
|
|
245
|
+ <Button key={3} style={{ padding: 0 }} type="link"
|
138
|
246
|
onClick={() => goDetail(record.applyId)}
|
139
|
|
- >
|
140
|
|
- {record.makeStatus==1?'详情':'发证'}
|
141
|
|
- </Button>
|
|
247
|
+ >详情</Button>
|
142
|
248
|
],
|
143
|
249
|
},
|
144
|
250
|
]
|
145
|
251
|
|
146
|
|
-
|
147
|
252
|
return (
|
148
|
253
|
<PageHeaderWrapper>
|
149
|
254
|
<PageTable
|
|
255
|
+ rowSelection={{
|
|
256
|
+ selectedRowKeys,
|
|
257
|
+ selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
|
|
258
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
259
|
+ setSelectedRowKeys(selectedRowKeys);
|
|
260
|
+ setSelectedRows(selectedRows)
|
|
261
|
+ },
|
|
262
|
+ }}
|
|
263
|
+ tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
|
|
264
|
+ <>
|
|
265
|
+ 已选 {selectedRowKeys.length} 张犬证
|
|
266
|
+ <a style={{ marginLeft: 8 }} onClick={onCleanSelected}>
|
|
267
|
+ 取消选择
|
|
268
|
+ </a>
|
|
269
|
+ </>
|
|
270
|
+ )}
|
|
271
|
+ tableAlertOptionRender={() => {
|
|
272
|
+ return (
|
|
273
|
+ <Button style={{ padding: 0 }} type="link" onClick={handleExport}>导出制证</Button>
|
|
274
|
+ );
|
|
275
|
+ }}
|
150
|
276
|
actionRef={actionRef}
|
151
|
277
|
columns={columns}
|
152
|
278
|
request={getMakeList}
|
|
@@ -155,6 +281,105 @@ export default (props) => {
|
155
|
281
|
onReset={handleReset}
|
156
|
282
|
rowKey="applyId"
|
157
|
283
|
/>
|
|
284
|
+ <Modal
|
|
285
|
+ forceRender
|
|
286
|
+ title='犬证绑卡'
|
|
287
|
+ visible={visible}
|
|
288
|
+ onCancel={handleBindCancel}
|
|
289
|
+ keyboard={false}
|
|
290
|
+ maskClosable={false}
|
|
291
|
+ destroyOnClose={true}
|
|
292
|
+ footer={null}
|
|
293
|
+ >
|
|
294
|
+ <Form {...formItemLayout} onFinish={bindCard} form={form}>
|
|
295
|
+ <FormItem label="证件号" name="originCardNo" rules={[{ required: true, message: '请输入证件号' }]}>
|
|
296
|
+ <Input placeholder="请输入证件号" readOnly={application?.originCardNo != null} />
|
|
297
|
+ </FormItem>
|
|
298
|
+ {
|
|
299
|
+ !application?.originCardNo &&
|
|
300
|
+ <FormItem label=" " colon={false}>
|
|
301
|
+ <Button type="default" onClick={handleBindCancel}>
|
|
302
|
+ 取消
|
|
303
|
+ </Button>
|
|
304
|
+ <Button
|
|
305
|
+ type="primary"
|
|
306
|
+ loading={loading}
|
|
307
|
+ htmlType="Submit"
|
|
308
|
+ style={{ marginLeft: '4em' }}
|
|
309
|
+ >
|
|
310
|
+ 确认
|
|
311
|
+ </Button>
|
|
312
|
+ </FormItem>
|
|
313
|
+ }
|
|
314
|
+ </Form>
|
|
315
|
+ </Modal>
|
|
316
|
+
|
|
317
|
+ <Modal
|
|
318
|
+ forceRender
|
|
319
|
+ title='犬证发放'
|
|
320
|
+ visible={outVisible}
|
|
321
|
+ onCancel={handleOutCancel}
|
|
322
|
+ keyboard={false}
|
|
323
|
+ maskClosable={false}
|
|
324
|
+ destroyOnClose={true}
|
|
325
|
+ footer={null}
|
|
326
|
+ >
|
|
327
|
+ <Form {...formItemLayout} onFinish={outCard} form={outForm}>
|
|
328
|
+ <FormItem label="证件号" name='originCardNo' rules={[{ required: true, message: '请先绑卡再发证' }]}>
|
|
329
|
+ <Input
|
|
330
|
+ readOnly
|
|
331
|
+ placeholder='请先绑卡再发证'
|
|
332
|
+ />
|
|
333
|
+ </FormItem>
|
|
334
|
+ {
|
|
335
|
+ application?.applyMethod == 2 && <>
|
|
336
|
+ <FormItem label="快递公司" name='trackingType' rules={[{ required: true, message: '请选择快递公司' }]}>
|
|
337
|
+ {
|
|
338
|
+ application?.makeStatus == 0 ?
|
|
339
|
+ <Select placeholder="请选择快递公司">
|
|
340
|
+ <Option value={'中国邮政'}>中国邮政</Option>
|
|
341
|
+ <Option value={'圆通快递'}>圆通快递</Option>
|
|
342
|
+ <Option value={'中通快递'}>中通快递</Option>
|
|
343
|
+ <Option value={'申通快递'}>申通快递</Option>
|
|
344
|
+ <Option value={'韵达快递'}>韵达快递</Option>
|
|
345
|
+ <Option value={'顺丰快递'}>顺丰快递</Option>
|
|
346
|
+ <Option value={'京东快递'}>京东快递</Option>
|
|
347
|
+ <Option value={'极兔快递'}>极兔快递</Option>
|
|
348
|
+ <Option value={'百世快递'}>百世快递</Option>
|
|
349
|
+ <Option value={'天天快递'}>天天快递</Option>
|
|
350
|
+ </Select> :
|
|
351
|
+ <Input
|
|
352
|
+ readOnly={application?.makeStatus != 0}
|
|
353
|
+ />
|
|
354
|
+ }
|
|
355
|
+ </FormItem>
|
|
356
|
+ <FormItem label="快递单号" name='trackingNo' rules={[{ required: true, message: '请输入快递单号' }]}>
|
|
357
|
+ <Input
|
|
358
|
+ placeholder='请输入快递单号(必填)'
|
|
359
|
+ readOnly={application?.makeStatus != 0}
|
|
360
|
+ />
|
|
361
|
+ </FormItem>
|
|
362
|
+ </>
|
|
363
|
+ }
|
|
364
|
+ {
|
|
365
|
+ application?.makeStatus == 0 &&
|
|
366
|
+ <FormItem label=" " colon={false}>
|
|
367
|
+ <Button type="default" onClick={handleOutCancel}>
|
|
368
|
+ 取消
|
|
369
|
+ </Button>
|
|
370
|
+ <Button
|
|
371
|
+ type="primary"
|
|
372
|
+ loading={outLoading}
|
|
373
|
+ htmlType="Submit"
|
|
374
|
+ style={{ marginLeft: '4em' }}
|
|
375
|
+ >
|
|
376
|
+ 确认
|
|
377
|
+ </Button>
|
|
378
|
+ </FormItem>
|
|
379
|
+ }
|
|
380
|
+ </Form>
|
|
381
|
+ </Modal>
|
|
382
|
+
|
158
|
383
|
</PageHeaderWrapper>
|
159
|
384
|
)
|
160
|
385
|
}
|