|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Card, Form, Button, Image, Input, message } from 'antd';
|
|
2
|
+import { Card, Form, Button, Image, Input, message, Radio, Modal } from 'antd';
|
3
|
3
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
4
|
4
|
import { getApplicationDetail, updateAudit, getPetCardNo } from '@/services/application'
|
5
|
5
|
import { history } from 'umi';
|
|
@@ -15,6 +15,7 @@ export default (props) => {
|
15
|
15
|
const { id } = location.query;
|
16
|
16
|
const [application, setApplication] = useState({});
|
17
|
17
|
const [rejectReason, setRejectReason] = useState();
|
|
18
|
+ const [examineType, SetExamineType] = useState(1);
|
18
|
19
|
const [loading, setLoading] = useState(false)
|
19
|
20
|
|
20
|
21
|
const getAudit = (val) => {
|
|
@@ -28,29 +29,44 @@ export default (props) => {
|
28
|
29
|
setLoading(false)
|
29
|
30
|
})
|
30
|
31
|
}
|
31
|
|
- const handleAudit = (val) => {
|
32
|
|
- if ((val == 2 && rejectReason) || val == 1) {
|
33
|
|
- if (val == 1 && application.applyType == 'first') {
|
|
32
|
+ const handleAudit = () => {
|
|
33
|
+ if ((examineType == 2 && rejectReason) || examineType == 1) {
|
|
34
|
+ if (examineType == 1 && application.applyType == 'first') {
|
34
|
35
|
getPetCardNo(application.petId).then((res) => {
|
35
|
36
|
if (!res) {
|
36
|
|
- getAudit(val);
|
|
37
|
+ getAudit(examineType);
|
37
|
38
|
} else {
|
38
|
|
- message.info('该宠物已有犬证,请驳回犬主申请');
|
|
39
|
+ message.info('该宠物已有犬证,请拒绝犬主办证申请');
|
39
|
40
|
}
|
40
|
41
|
})
|
41
|
42
|
} else {
|
42
|
|
- getAudit(val);
|
|
43
|
+ getAudit(examineType);
|
43
|
44
|
}
|
44
|
45
|
}
|
45
|
46
|
else {
|
46
|
47
|
message.success('请输入处理结果');
|
47
|
48
|
}
|
48
|
49
|
}
|
|
50
|
+ //列表切换通知状态方法
|
|
51
|
+ const handleOK = (record, data) => {
|
|
52
|
+ const title = examineType == 1
|
|
53
|
+ ? '您确定要通过该申请吗'
|
|
54
|
+ : '您确定要拒绝该申请吗';
|
|
55
|
+ Modal.confirm({
|
|
56
|
+ title: title,
|
|
57
|
+ okText: '确认',
|
|
58
|
+ cancelText: '取消',
|
|
59
|
+ onOk() {
|
|
60
|
+ handleAudit()
|
|
61
|
+ },
|
|
62
|
+ });
|
|
63
|
+ };
|
49
|
64
|
|
50
|
65
|
useEffect(() => {
|
51
|
66
|
getApplicationDetail(id).then((res) => {
|
52
|
67
|
setApplication(res)
|
53
|
68
|
setRejectReason(res.rejectReason)
|
|
69
|
+ if (res.verifyStatus == 2) { SetExamineType(2) }
|
54
|
70
|
}).catch((err) => {
|
55
|
71
|
console.log(err.message)
|
56
|
72
|
});
|
|
@@ -121,8 +137,14 @@ export default (props) => {
|
121
|
137
|
? '已支付' : ''
|
122
|
138
|
}
|
123
|
139
|
</FormItem>
|
|
140
|
+ <FormItem label="审核意见">
|
|
141
|
+ <Radio.Group onChange={e =>{if(application.verifyStatus==0)SetExamineType(e.target.value)}} value={examineType}>
|
|
142
|
+ <Radio value={1}>同意</Radio>
|
|
143
|
+ <Radio value={2}>拒绝</Radio>
|
|
144
|
+ </Radio.Group>
|
|
145
|
+ </FormItem>
|
124
|
146
|
{
|
125
|
|
- application.verifyStatus != 1 &&
|
|
147
|
+ application.verifyStatus != 1 &&
|
126
|
148
|
<FormItem label="驳回原因">
|
127
|
149
|
<TextArea placeholder='请输入驳回原因' rows='3'
|
128
|
150
|
style={{ width: '350px' }}
|
|
@@ -135,16 +157,11 @@ export default (props) => {
|
135
|
157
|
<FormItem label=" " colon={false}>
|
136
|
158
|
{
|
137
|
159
|
application.verifyStatus == 0 &&
|
138
|
|
- <>
|
139
|
|
- <Button type="primary" loading={loading} style={{ marginRight: '16px' }} onClick={() => handleAudit(1)}>
|
140
|
|
- 同意
|
141
|
|
- </Button>
|
142
|
|
- <Button type="primary" loading={loading} style={{ marginRight: '16px' }} onClick={() => handleAudit(2)}>
|
143
|
|
- 拒绝
|
144
|
|
- </Button>
|
145
|
|
- </>
|
|
160
|
+ <Button type="primary" loading={loading} style={{ marginRight: '16px' }} onClick={handleOK}>
|
|
161
|
+ 确定
|
|
162
|
+ </Button>
|
146
|
163
|
}
|
147
|
|
- <Button type="default" onClick={() => goBack()}>
|
|
164
|
+ <Button type="default" onClick={goBack}>
|
148
|
165
|
返回
|
149
|
166
|
</Button>
|
150
|
167
|
</FormItem>
|