|
@@ -1,10 +1,9 @@
|
1
|
1
|
import { Form, Input, Button } from 'antd';
|
2
|
|
-import QRCode from '@/components/QRCode'
|
3
|
2
|
import { history } from 'umi';
|
4
|
3
|
import React, { useEffect, useState, useCallback, useRef, useMemo } from 'react'
|
5
|
4
|
import { useModel } from 'umi'
|
6
|
5
|
import { getDetail, saveOrg, updateOrg } from '@/services/org';
|
7
|
|
-
|
|
6
|
+import QRCode from './QRCode'
|
8
|
7
|
|
9
|
8
|
export default (props) => {
|
10
|
9
|
const { id } = props;
|
|
@@ -13,13 +12,8 @@ export default (props) => {
|
13
|
12
|
const [form] = Form.useForm();
|
14
|
13
|
const [formData, setFormData] = useState()
|
15
|
14
|
const [loading, setLoading] = useState(false)
|
16
|
|
- const qrcodeRef = useRef()
|
|
15
|
+
|
17
|
16
|
const qrcodeText = useMemo(() => initialState.report_url + '#resume-work-form?org=' + id, [id, initialState.report_url])
|
18
|
|
- const downloadQrcode = useCallback(() => {
|
19
|
|
- if (qrcodeRef.current) {
|
20
|
|
- qrcodeRef.current.download();
|
21
|
|
- }
|
22
|
|
- }, [])
|
23
|
17
|
|
24
|
18
|
const onFinish = (values) => {
|
25
|
19
|
setLoading(true)
|
|
@@ -76,19 +70,14 @@ export default (props) => {
|
76
|
70
|
<Input type='number' min='0' />
|
77
|
71
|
</Form.Item>
|
78
|
72
|
{
|
79
|
|
- id && <Form.Item label=' ' colon={false} wrapperCol={{ offset: 3 }}>
|
80
|
|
- <QRCode ref={qrcodeRef} border width={200} content={qrcodeText} title={formData?.orgName} fileName={formData?.orgName} />
|
|
73
|
+ id && <Form.Item label='申报二维码' >
|
|
74
|
+ <QRCode text={qrcodeText} title={formData?.orgName} />
|
81
|
75
|
</Form.Item>
|
82
|
76
|
}
|
83
|
77
|
<Form.Item label=' ' colon={false} >
|
84
|
78
|
<Button type="primary" htmlType="submit" loading={loading}>
|
85
|
79
|
保存
|
86
|
80
|
</Button>
|
87
|
|
- {id &&
|
88
|
|
- <Button style={{ marginLeft: '32px' }} onClick={downloadQrcode} >
|
89
|
|
- 下载二维码
|
90
|
|
- </Button>
|
91
|
|
- }
|
92
|
81
|
<Button style={{ marginLeft: '32px' }} onClick={() => { history.go(-1); }} >返回</Button>
|
93
|
82
|
</Form.Item>
|
94
|
83
|
</Form>
|