张涛 hace 1 año
padre
commit
0ab76f12e7
Se han modificado 1 ficheros con 21 adiciones y 9 borrados
  1. 21
    9
      src/pages/authentication/components/EveryoneInfo.jsx

+ 21
- 9
src/pages/authentication/components/EveryoneInfo.jsx Ver fichero

@@ -22,6 +22,11 @@ export default (props) => {
22 22
   const onFinish = (values) => {
23 23
     console.log("----------->", values);
24 24
     const authorizedPersonId = "authorizedPerson-beneficiaryId";
25
+
26
+    const conpanyDirectorId = "conpanyDirector-beneficiaryId";
27
+
28
+    const id = values[authorizedPersonId] || values[conpanyDirectorId];
29
+
25 30
     // 被授权人
26 31
     let authorizedPerson = {},
27 32
       //企业董事
@@ -45,14 +50,21 @@ export default (props) => {
45 50
         otherBeneficiary[parseInt(prefix) - 1][prefix1] = values[key];
46 51
       }
47 52
     }
48
-    // const data = [, otherBeneficiary];
53
+    let beneficiaryInfoList = [];
54
+    if ((authorizedPerson = {})) {
55
+      beneficiaryInfoList = [conpanyDirector];
56
+    } else if ((conpanyDirector = {})) {
57
+      beneficiaryInfoList = [authorizedPerson];
58
+    } else {
59
+      beneficiaryInfoList = [authorizedPerson, conpanyDirector];
60
+    }
61
+
49 62
     const data = {
50
-      beneficiaryInfoList: [authorizedPerson, conpanyDirector],
63
+      beneficiaryInfoList: beneficiaryInfoList,
51 64
       beneficiaryItemList: otherBeneficiary,
52 65
     };
53
-    console.log(data);
54 66
 
55
-    putTaCompanyBeneficiaryInfo(values[authorizedPersonId], data).then(
67
+    putTaCompanyBeneficiaryInfo(id, data).then(
56 68
       (res) => {
57 69
         setIndex(index + 1);
58 70
       }
@@ -71,9 +83,9 @@ export default (props) => {
71 83
     getTaCompanyBeneficiaryInfoTenantId()
72 84
       .then((res) => {
73 85
         if (res) {
74
-          const BeneficiaryNum = res[1]?.length||0;
86
+          const BeneficiaryNum = res[1]?.length || 0;
75 87
 
76
-          setOtherBeneficiaryNum(BeneficiaryNum||1)
88
+          setOtherBeneficiaryNum(BeneficiaryNum || 1);
77 89
           const isOtherBeneficiary = BeneficiaryNum > 0 ? "1" : "0";
78 90
 
79 91
           const data = (res[0] || [])
@@ -103,7 +115,7 @@ export default (props) => {
103 115
           // console.log(data);
104 116
           form.setFieldsValue({
105 117
             ...data,
106
-            otherBeneficiaryNum: BeneficiaryNum||1,
118
+            otherBeneficiaryNum: BeneficiaryNum || 1,
107 119
             isOtherBeneficiary: isOtherBeneficiary,
108 120
             ...data1,
109 121
           });
@@ -142,9 +154,9 @@ export default (props) => {
142 154
               );
143 155
               return (
144 156
                 <>
145
-                  {authorizedPerson ? (
157
+                  {authorizedPerson && (
146 158
                     <RadioTitle identity="authorizedPerson" />
147
-                  ) : null}
159
+                  )}
148 160
                   {conpanyDirector ? (
149 161
                     <RadioTitle identity="conpanyDirector" />
150 162
                   ) : null}