lisenzhou 2 gadus atpakaļ
vecāks
revīzija
a282b6192a

+ 10
- 0
src/pages/guarantee/list/index.jsx Parādīt failu

@@ -78,6 +78,16 @@ const GuaranteeList = (props) => {
78 78
             删除
79 79
           </Button>
80 80
         </Popconfirm>,
81
+         <Button
82
+         key={4}
83
+         style={{ padding: 0 }}
84
+         type="link"
85
+         onClick={() => {
86
+           navigate(`/task/guarantee/personnel/list?id=${record.id}`);
87
+         }}
88
+       >
89
+         人员
90
+       </Button>,
81 91
       ],
82 92
     },
83 93
   ];

+ 59
- 60
src/pages/guarantee/personnel/edit/index.jsx Parādīt failu

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

+ 63
- 35
src/pages/guarantee/personnel/list/index.jsx Parādīt failu

@@ -1,24 +1,29 @@
1 1
 import { queryTable } from "@/utils/request";
2 2
 import { PageContainer, ProTable } from "@ant-design/pro-components";
3
-import { Link, useNavigate } from "react-router-dom";
3
+import { useNavigate, useSearchParams } from "react-router-dom";
4
+import {
5
+  getCooperationPersonList,
6
+  deletetCooperationPerson,
7
+} from "@/services/cooperationUnits";
4 8
 
5 9
 import { Button, message, Popconfirm } from "antd";
6 10
 import { useRef, useState } from "react";
7 11
 
8 12
 const GuaranteePersonnelList = (props) => {
13
+  const [searchParams] = useSearchParams();
14
+  const id = searchParams.get("id");
9 15
   const navigate = useNavigate();
10
-  const [isOpen, setIsOpen] = useState(false);
11
-  const [modalData, setModalData] = useState({});
16
+
12 17
   const actionRef = useRef();
13 18
   const formRef = useRef();
14 19
 
15
-  // const handleDelete = (id) => {
16
-  //   if (id) {
17
-  //     deleteGuaranteeTask(id).then((res) => {
18
-  //       actionRef.current.reload();
19
-  //     });
20
-  //   }
21
-  // };
20
+  const handleDelete = (id) => {
21
+    if (id) {
22
+      deletetCooperationPerson(id).then((res) => {
23
+        actionRef.current.reload();
24
+      });
25
+    }
26
+  };
22 27
 
23 28
   const onCancel = () => {
24 29
     setIsOpen(false);
@@ -28,32 +33,46 @@ const GuaranteePersonnelList = (props) => {
28 33
   const columns = [
29 34
     {
30 35
       title: "机构名称",
31
-      dataIndex: "guaranteeN",
36
+      dataIndex: "orgIdName",
32 37
       search: false,
33 38
     },
34 39
     {
35 40
       title: "姓名",
36
-      dataIndex: "receive",
41
+      dataIndex: "name",
37 42
       search: true,
38 43
     },
39 44
     {
40 45
       title: "性别",
41
-      dataIndex: "dateRang",
46
+      dataIndex: "sex",
42 47
       search: false,
48
+      valueEnum: {
49
+        1: "男",
50
+        2: "女",
51
+        9: "未知",
52
+      },
43 53
     },
44 54
     {
45 55
       title: "名族",
46
-      dataIndex: "addres",
56
+      dataIndex: "ethnic",
57
+      search: false,
58
+    },
59
+    {
60
+      title: "联系电话",
61
+      dataIndex: "phone",
47 62
       search: false,
48 63
     },
49 64
     {
50
-      title: "联系人",
51
-      dataIndex: "aa",
65
+      title: "是否健康证",
66
+      dataIndex: "isHealthCertificate",
52 67
       search: false,
68
+      valueEnum: {
69
+        1: "是",
70
+        2: "否",
71
+      },
53 72
     },
54 73
     {
55 74
       title: "身份证号",
56
-      dataIndex: "standar",
75
+      dataIndex: "homeAddr",
57 76
       search: false,
58 77
     },
59 78
     {
@@ -66,10 +85,22 @@ const GuaranteePersonnelList = (props) => {
66 85
           style={{ padding: 0 }}
67 86
           type="link"
68 87
           onClick={() => {
69
-            // navigate(`/task/evaluate/list?id=${record.id}`);
88
+            navigate(`/task/guarantee/personnel/edit?id=${record.id}`);
70 89
           }}
71 90
         >
91
+          修改
72 92
         </Button>,
93
+        <Popconfirm
94
+          key={3}
95
+          title="您是否确认删除 ?"
96
+          onConfirm={() => handleDelete(record.id)}
97
+          okText="确定"
98
+          cancelText="取消"
99
+        >
100
+          <Button style={{ padding: 0 }} type="link">
101
+            删除
102
+          </Button>
103
+        </Popconfirm>,
73 104
       ],
74 105
     },
75 106
   ];
@@ -79,29 +110,26 @@ const GuaranteePersonnelList = (props) => {
79 110
       <ProTable
80 111
         actionRef={actionRef}
81 112
         formRef={formRef}
82
-        postData={(data) => {
83
-          return data.map((x) => ({
84
-            dateRange: [x.startDate, x.endDate],
85
-            ...x,
86
-          }));
87
-        }}
113
+        params={{ orgId: id }}
88 114
         rowKey="id"
89 115
         toolBarRender={() => [
90
-          <Button
91
-            key="2"
92
-            type="primary"
93
-            onClick={() => {
94
-              navigate('/task/guarantee/personnel/edit');
95
-            }}
96
-          >
97
-            新增
98
-          </Button>,
116
+          id ? (
117
+            <Button
118
+              key="2"
119
+              type="primary"
120
+              onClick={() => {
121
+                navigate(`/task/guarantee/personnel/edit?orgId=${id}`);
122
+              }}
123
+            >
124
+              新增
125
+            </Button>
126
+          ) : null,
99 127
         ]}
100
-        // request={queryTable(getGuaranteeTaskList)}
128
+        request={queryTable(getCooperationPersonList)}
101 129
         columns={columns}
102 130
       />
103 131
     </PageContainer>
104 132
   );
105 133
 };
106 134
 
107
-export default GuaranteePersonnelList;
135
+export default GuaranteePersonnelList;

+ 14
- 0
src/services/cooperationUnits.js Parādīt failu

@@ -12,10 +12,24 @@ const [
12 12
   deletetCooperationUnits,
13 13
 ] = restful("/cooperationUnits");
14 14
 
15
+const [
16
+  getCooperationPersonList,
17
+  gettCooperationPersonDetail,
18
+  savetCooperationPerson,
19
+  updatetCooperationPerson,
20
+  deletetCooperationPerson,
21
+] = restful("/cooperationPerson");
22
+
15 23
 export {
16 24
   getCooperationUnitsList,
17 25
   gettCooperationUnitsDetail,
18 26
   savetCooperationUnits,
19 27
   updatetCooperationUnits,
20 28
   deletetCooperationUnits,
29
+  
30
+  getCooperationPersonList,
31
+  gettCooperationPersonDetail,
32
+  savetCooperationPerson,
33
+  updatetCooperationPerson,
34
+  deletetCooperationPerson,
21 35
 };