lisenzhou 2 vuotta sitten
vanhempi
commit
5246fb6d40

+ 10
- 1
src/pages/guarantee/personnel/edit/index.jsx Näytä tiedosto

@@ -4,6 +4,7 @@ import {
4 4
   ProFormSelect,
5 5
   ProFormText,
6 6
 } from "@ant-design/pro-components";
7
+import { queryDict } from "@/utils/request";
7 8
 import { useNavigate, useSearchParams } from "react-router-dom";
8 9
 import { Card, Col, Row, Space } from "antd";
9 10
 import { useEffect, useRef } from "react";
@@ -11,6 +12,7 @@ import {
11 12
   savetCooperationPerson,
12 13
   gettCooperationPersonDetail,
13 14
   updatetCooperationPerson,
15
+  getCooperationUnitsList,
14 16
 } from "@/services/cooperationUnits";
15 17
 
16 18
 export default (props) => {
@@ -41,7 +43,6 @@ export default (props) => {
41 43
     } else {
42 44
       savetCooperationPerson({
43 45
         ...values,
44
-        orgId,
45 46
       }).then((res) => {
46 47
         navigate(-1);
47 48
       });
@@ -80,6 +81,14 @@ export default (props) => {
80 81
             width={460}
81 82
             rules={[{ required: true, message: "请输入姓名" }]}
82 83
           />
84
+          <ProFormSelect
85
+            name="orgId"
86
+            label="机构"
87
+            request={() => queryDict(getCooperationUnitsList)()}
88
+            rules={[{ required: true, message: "请选择机构" }]}
89
+            width={460}
90
+          />
91
+
83 92
           <ProFormText name="idNo" label="身份证号" width={460} />
84 93
           <ProFormSelect
85 94
             name="sex"

+ 27
- 11
src/pages/guarantee/personnel/list/index.jsx Näytä tiedosto

@@ -1,13 +1,14 @@
1
-import { queryTable } from "@/utils/request";
1
+import { queryTable, queryDict } from "@/utils/request";
2 2
 import { PageContainer, ProTable } from "@ant-design/pro-components";
3 3
 import { useNavigate, useSearchParams } from "react-router-dom";
4 4
 import {
5 5
   getCooperationPersonList,
6 6
   deletetCooperationPerson,
7
+  getCooperationUnitsList,
7 8
 } from "@/services/cooperationUnits";
8 9
 
9 10
 import { Button, message, Popconfirm } from "antd";
10
-import { useRef, useState } from "react";
11
+import { useRef, useEffect } from "react";
11 12
 
12 13
 const GuaranteePersonnelList = (props) => {
13 14
   const [searchParams] = useSearchParams();
@@ -17,19 +18,34 @@ const GuaranteePersonnelList = (props) => {
17 18
   const actionRef = useRef();
18 19
   const formRef = useRef();
19 20
 
20
-  const handleDelete = (id) => {
21
+  useEffect(() => {
21 22
     if (id) {
22
-      deletetCooperationPerson(id).then((res) => {
23
-        actionRef.current.reload();
24
-      });
23
+      console.log(formRef, "formRefformRef");
24
+      formRef?.current?.setFieldValue('orgId', Number(id));
25
+      formRef?.current?.submit();
26
+      
27
+      // setTimeout(()=>{
28
+      //   actionRef.current.reload();
29
+      // },1000)
25 30
     }
31
+  }, [id]);
32
+
33
+  const handleDelete = (id) => {
34
+    console.log(formRef, "formRefformRef");
35
+    // if (id) {
36
+    //   deletetCooperationPerson(id).then((res) => {
37
+    //     actionRef.current.reload();
38
+    //   });
39
+    // }
26 40
   };
27 41
 
28 42
   const columns = [
29 43
     {
30 44
       title: "机构名称",
31
-      dataIndex: "orgIdName",
32
-      search: false,
45
+      dataIndex: "orgId",
46
+      valueType: "select",
47
+      request: () => queryDict(getCooperationUnitsList)(),
48
+      // search: false,
33 49
     },
34 50
     {
35 51
       title: "姓名",
@@ -105,10 +121,11 @@ const GuaranteePersonnelList = (props) => {
105 121
       <ProTable
106 122
         actionRef={actionRef}
107 123
         formRef={formRef}
108
-        params={{ orgId: id }}
124
+        manualRequest={id}
125
+        // params={{ orgId: id }}
109 126
         rowKey="id"
110 127
         toolBarRender={() => [
111
-          id ? (
128
+
112 129
             <Button
113 130
               key="2"
114 131
               type="primary"
@@ -118,7 +135,6 @@ const GuaranteePersonnelList = (props) => {
118 135
             >
119 136
               新增
120 137
             </Button>
121
-          ) : null,
122 138
         ]}
123 139
         request={queryTable(getCooperationPersonList)}
124 140
         columns={columns}