张涛 1 gadu atpakaļ
vecāks
revīzija
0ab76f12e7
1 mainītis faili ar 21 papildinājumiem un 9 dzēšanām
  1. 21
    9
      src/pages/authentication/components/EveryoneInfo.jsx

+ 21
- 9
src/pages/authentication/components/EveryoneInfo.jsx Parādīt failu

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