李志伟 il y a 2 ans
Parent
révision
6017f302a6

+ 1
- 1
config/routes.js Voir le fichier

@@ -96,7 +96,7 @@ export default [
96 96
   },
97 97
   {
98 98
     path: '/cardNoList',
99
-    name: '证件制卡',
99
+    name: '物料制作',
100 100
     access:'admin',
101 101
     icon: 'CreditCardOutlined',
102 102
     component: '@/pages/cardNoList',

+ 1
- 1
src/pages/cardNoList/index.jsx Voir le fichier

@@ -36,7 +36,7 @@ export default (props) => {
36 36
 
37 37
   const actions = () => [
38 38
     <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => setVisible(true)}>
39
-      批量制
39
+      批量制
40 40
     </Button>,
41 41
   ];
42 42
   const columns = [

+ 238
- 13
src/pages/certificateIssuance/index.jsx Voir le fichier

@@ -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
 }

+ 12
- 76
src/pages/certificateIssuance/issuance.jsx Voir le fichier

@@ -1,8 +1,8 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { history } from 'umi';
3
-import { Card, Form, Button, message, Input, Image } from 'antd';
3
+import { Card, Form, Button, Image } from 'antd';
4 4
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
5
-import { getApplicationDetail, updateMake } from '@/services/application'
5
+import { getApplicationDetail } from '@/services/application'
6 6
 
7 7
 const FormItem = Form.Item;
8 8
 const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
@@ -13,50 +13,17 @@ export default (props) => {
13 13
   const { location } = props;
14 14
   const { id } = location.query;
15 15
   const [application, setApplication] = useState({});
16
-  const [loading, setLoading] = useState(false)
17
-  const [form] = Form.useForm();
18
-  const handleMake = (value) => {
19
-    if (value.originCardNo) {
20
-      if (
21
-        (application.applyMethod == 2
22
-          && value.trackingType
23
-          && value.trackingNo)
24
-        || application.applyMethod == 1) {
25
-        setLoading(true)
26
-        var data = {
27
-          cardNo: value.originCardNo,
28
-          makeStatus: application.makeStatus,
29
-          trackingType: value.trackingType,
30
-          trackingNo: value.trackingNo
31
-        }
32
-        updateMake(id, data).then(() => {
33
-          message.success('操作成功');
34
-          goBack()
35
-          setLoading(false)
36
-        }).catch(err => {
37
-          console.log(err.message)
38
-          setLoading(false)
39
-        })
40
-      } else {
41
-        message.success('请输入快递信息');
42
-      }
43
-    }
44
-    else {
45
-      message.success('请输入证件号');
46
-    }
47
-  }
48 16
   useEffect(() => {
49 17
     getApplicationDetail(id).then((res) => {
50
-      form.setFieldsValue(res);
51 18
       setApplication(res)
52 19
     }).catch((err) => {
53 20
       console.log(err.message)
54 21
     });
55 22
   }, [id])
56 23
   return (
57
-    <PageHeaderWrapper    >
24
+    <PageHeaderWrapper>
58 25
       <Card>
59
-        <Form {...formItemLayout} onFinish={handleMake} form={form}>
26
+        <Form {...formItemLayout}>
60 27
           <FormItem label="犬主">
61 28
             {application?.personName}
62 29
           </FormItem>
@@ -132,52 +99,21 @@ export default (props) => {
132 99
               <Image src={application.penaltyInfo} width={100} />
133 100
             </FormItem>
134 101
           }
135
-          <FormItem label="付款状态">
136
-            {
137
-              application.payStatus === 0
138
-                ? '待支付'
139
-                : application.payStatus === 1
140
-                  ? '支付中'
141
-                  : application.payStatus === 2
142
-                    ? '已支付' : ''
143
-            }
144
-          </FormItem>
145
-          <FormItem label="证件号" name='originCardNo' rules={[{ required: true, message: '请输入证件号' }]}>
146
-            <Input
147
-              style={{ width: '360px' }}
148
-              readOnly={application?.makeStatus != 0}
149
-              placeholder='请输入证件号(必填)'
150
-            />
102
+          <FormItem label="证件号">
103
+            {application.originCardNo}
151 104
           </FormItem>
152 105
           {
153
-            application.applyMethod == 2 && <>
154
-              <FormItem label="快递公司" name='trackingType' rules={[{ required: true, message: '请输入快递公司' }]}>
155
-                <Input
156
-                  style={{ width: '360px' }}
157
-                  placeholder='请输入快递公司(必填)'
158
-                  readOnly={application?.makeStatus != 0}
159
-                 />
106
+            application.applyMethod == 2 &&
107
+            <>
108
+              <FormItem label="快递公司" >
109
+                {application.trackingType}
160 110
               </FormItem>
161
-              <FormItem label="快递单号" name='trackingNo' rules={[{ required: true, message: '请输入快递公司' }]}>
162
-                <Input
163
-                  style={{ width: '360px' }}
164
-                  placeholder='请输入快递单号(必填)'
165
-                  readOnly={application?.makeStatus != 0}
166
-                />
111
+              <FormItem label="快递单号">
112
+                {application.trackingNo}
167 113
               </FormItem>
168 114
             </>
169 115
           }
170 116
           <FormItem label=" " colon={false}>
171
-            {
172
-              application?.makeStatus == 0 &&
173
-              <>
174
-                <Button type="primary" loading={loading}
175
-                htmlType="Submit"
176
-                  style={{ marginRight: '16px' }}>
177
-                  发放
178
-                </Button>
179
-              </>
180
-            }
181 117
             <Button type="default" onClick={() => goBack()}>
182 118
               返回
183 119
             </Button>

+ 12
- 0
src/services/application.js Voir le fichier

@@ -7,6 +7,12 @@ import request from '@/utils/request';
7 7
  */
8 8
 export const updateAudit = (id, data) => request(`/application/${id}/audit`, { method: 'put', data });
9 9
 
10
+/**
11
+ * 绑卡
12
+ * @param {*} data
13
+ * @returns
14
+ */
15
+export const updateBindCard = (id, data) => request(`/application/${id}/bindCard`, { method: 'put', data });
10 16
 /**
11 17
  * 发证
12 18
  * @param {*} data
@@ -49,3 +55,9 @@ export const getApplicationDetail = (id) => request(`/application/${id}`);
49 55
  */
50 56
 export const getPetCardNo = (id) => request(`/pet/${id}/card`);
51 57
 
58
+/**
59
+ * 导出制证数据
60
+ * @param {*} params
61
+ * @returns
62
+ */
63
+ export const exportCardList = (data) => request('/application/card/export', { method: 'post',data });