|
@@ -10,48 +10,46 @@ import {
|
10
|
10
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
11
|
11
|
import { Card, Col, Row, Space } from "antd";
|
12
|
12
|
import { useEffect, useRef } from "react";
|
|
13
|
+import {
|
|
14
|
+ savetCooperationPerson,
|
|
15
|
+ gettCooperationPersonDetail,
|
|
16
|
+ updatetCooperationPerson,
|
|
17
|
+} from "@/services/cooperationUnits";
|
13
|
18
|
|
14
|
19
|
export default (props) => {
|
15
|
20
|
const [searchParams] = useSearchParams();
|
16
|
21
|
const id = searchParams.get("id");
|
|
22
|
+ const orgId = searchParams.get("orgId");
|
17
|
23
|
const navigate = useNavigate();
|
18
|
24
|
|
19
|
25
|
const formRef = useRef();
|
20
|
|
- // useEffect(() => {
|
21
|
|
- // if (id) {
|
22
|
|
- // getPostsDetail(id).then((res) => {
|
23
|
|
- // formRef.current.setFieldsValue({
|
24
|
|
- // ...res,
|
25
|
|
- // filesList: res.filesList?.map((x) => x.fileAddr)[0] || null,
|
26
|
|
- // });
|
27
|
|
- // });
|
28
|
|
- // }
|
29
|
|
- // }, [id]);
|
30
|
|
-
|
31
|
|
- // const onFinish = async (values) => {
|
32
|
|
- // console.log(values);
|
|
26
|
+ useEffect(() => {
|
|
27
|
+ if (id) {
|
|
28
|
+ gettCooperationPersonDetail(id).then((res) => {
|
|
29
|
+ formRef.current.setFieldsValue({
|
|
30
|
+ ...res,
|
|
31
|
+ });
|
|
32
|
+ });
|
|
33
|
+ }
|
|
34
|
+ }, [id]);
|
33
|
35
|
|
34
|
|
- // savePosts({
|
35
|
|
- // ...values,
|
36
|
|
- // type: 'regulation',
|
37
|
|
- // filesList: values.filesList
|
38
|
|
- // ? [
|
39
|
|
- // {
|
40
|
|
- // fileAddr: values.filesList,
|
41
|
|
- // fileName: values.filesList?.substring(
|
42
|
|
- // values.filesList?.lastIndexOf("/") + 1
|
43
|
|
- // ),
|
44
|
|
- // },
|
45
|
|
- // ]
|
46
|
|
- // : null,
|
47
|
|
- // status: Number(values.status),
|
48
|
|
- // ...(id ? { id } : {}),
|
49
|
|
- // }).then((res) => {
|
50
|
|
- // navigate(-1);
|
51
|
|
- // });
|
52
|
|
-
|
53
|
|
- // return false;
|
54
|
|
- // };
|
|
36
|
+ const onFinish = async (values) => {
|
|
37
|
+ console.log(values);
|
|
38
|
+ if (id) {
|
|
39
|
+ updatetCooperationPerson(id, {
|
|
40
|
+ ...values,
|
|
41
|
+ }).then((res) => {
|
|
42
|
+ navigate(-1);
|
|
43
|
+ });
|
|
44
|
+ } else {
|
|
45
|
+ savetCooperationPerson({
|
|
46
|
+ ...values,
|
|
47
|
+ orgId,
|
|
48
|
+ }).then((res) => {
|
|
49
|
+ navigate(-1);
|
|
50
|
+ });
|
|
51
|
+ }
|
|
52
|
+ };
|
55
|
53
|
|
56
|
54
|
return (
|
57
|
55
|
<PageContainer>
|
|
@@ -61,7 +59,7 @@ export default (props) => {
|
61
|
59
|
layout={"horizontal"}
|
62
|
60
|
labelCol={{ span: 8 }}
|
63
|
61
|
wrapperCol={{ span: 12 }}
|
64
|
|
- // onFinish={onFinish}
|
|
62
|
+ onFinish={onFinish}
|
65
|
63
|
initialValues={{ status: 0 }}
|
66
|
64
|
submitter={{
|
67
|
65
|
searchConfig: {
|
|
@@ -80,32 +78,37 @@ export default (props) => {
|
80
|
78
|
}}
|
81
|
79
|
>
|
82
|
80
|
<ProFormText
|
83
|
|
- name="createPerson"
|
|
81
|
+ name="name"
|
84
|
82
|
label="姓名"
|
85
|
83
|
width={460}
|
|
84
|
+ rules={[{ required: true, message: "请输入姓名" }]}
|
86
|
85
|
/>
|
87
|
|
- <ProFormText
|
88
|
|
- name="createPerson"
|
89
|
|
- label="身份证号"
|
90
|
|
- width={460}
|
91
|
|
- />
|
92
|
|
- <ProFormText
|
93
|
|
- name="createPerson"
|
94
|
|
- label="名族"
|
95
|
|
- width={460}
|
96
|
|
- />
|
97
|
|
- <ProFormText
|
98
|
|
- name="createPerson"
|
99
|
|
- label="政治面貌"
|
100
|
|
- width={460}
|
101
|
|
- />
|
102
|
|
- <ProFormText
|
103
|
|
- name="createPerson"
|
104
|
|
- label="联系电话"
|
|
86
|
+ <ProFormText name="idNo" label="身份证号" width={460} />
|
|
87
|
+ <ProFormSelect
|
|
88
|
+ name="sex"
|
|
89
|
+ label="性别"
|
105
|
90
|
width={460}
|
|
91
|
+ options={[
|
|
92
|
+ {
|
|
93
|
+ value: 1,
|
|
94
|
+ label: "男",
|
|
95
|
+ },
|
|
96
|
+ {
|
|
97
|
+ value: 2,
|
|
98
|
+ label: "女",
|
|
99
|
+ },
|
|
100
|
+ {
|
|
101
|
+ value: 9,
|
|
102
|
+ label: "未知",
|
|
103
|
+ },
|
|
104
|
+ ]}
|
106
|
105
|
/>
|
|
106
|
+
|
|
107
|
+ <ProFormText name="ethnic" label="名族" width={460} />
|
|
108
|
+ <ProFormText name="politicalStatus" label="政治面貌" width={460} />
|
|
109
|
+ <ProFormText name="phone" label="联系电话" width={460} />
|
107
|
110
|
<ProFormSelect
|
108
|
|
- name="status"
|
|
111
|
+ name="isHealthCertificate"
|
109
|
112
|
label="是否有健康证"
|
110
|
113
|
width={460}
|
111
|
114
|
options={[
|
|
@@ -123,11 +126,7 @@ export default (props) => {
|
123
|
126
|
},
|
124
|
127
|
]}
|
125
|
128
|
/>
|
126
|
|
- <ProFormText
|
127
|
|
- name="createPerson"
|
128
|
|
- label="家庭住址"
|
129
|
|
- width={460}
|
130
|
|
- />
|
|
129
|
+ <ProFormText name="homeAddr" label="家庭住址" width={460} />
|
131
|
130
|
</ProForm>
|
132
|
131
|
</Card>
|
133
|
132
|
</PageContainer>
|