FUYU
2023-05-19 559771a80cf779dc13a84ecd2f178e6ca5a8353a
force-app/main/default/pages/SearchVisitor.page
@@ -4,10 +4,14 @@
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <!-- 20220217 Li Jun for PIPL start -->
    <apex:includeScript value="{!URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <!-- 20220217 Li Jun for PIPL End -->
    <script type="text/javascript">
        AWSService.sfSessionId = '{!GETSESSIONID()}';
        //zhj 新方案改造 2022-12-06 start
        var accountName = '';
        var dataIdManageCodeMap = {};
        //zhj 新方案改造 2022-12-06 end
        //像医生区分(职务)下拉列表加入****
        // var o = new Option();
        // o.text = '****';
@@ -195,7 +199,7 @@
                createDiv.style.marginLeft='20px';
                createDiv.style.marginTop='-40px';
                createDiv.style.height='80px';  
               createDiv.style.width='120px';
                createDiv.style.width='120px';
                createDiv.style.background = "#dddddd";
                createDiv.style.position = "absolute";
                parentNode.appendChild(createDiv);  
@@ -258,16 +262,16 @@
                document.getElementById('Page:mainForm:AWS_Data_Id__c').value = obj.dataId;
                
                document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value = obj.lastName;
                document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt;
                //document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt;   //zhj 新方案改造 2022-12-05
                document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value = obj.phone;
                document.getElementById("Page:mainForm:Phone_Encrypted__c").value = obj.phoneEncrypt;
                document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value = obj.phone;
                //document.getElementById("Page:mainForm:Phone_Encrypted__c").value = obj.phoneEncrypt; //zhj 新方案改造 2022-12-05
                document.getElementById("Page:mainForm:idSearchVisitor:updateContactType").value = obj.type;
                document.getElementById("Page:mainForm:Type_Encrypted__c").value = obj.typeEncrypt;
                //document.getElementById("Page:mainForm:Type_Encrypted__c").value = obj.typeEncrypt;   //zhj 新方案改造 2022-12-05
                document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value = obj.doctorDivision1;
                document.getElementById("Page:mainForm:Doctor_Division1_Encrypted__c").value = obj.doctorDivision1Encrypt;
                //document.getElementById("Page:mainForm:Doctor_Division1_Encrypted__c").value = obj.doctorDivision1Encrypt;    //zhj 新方案改造 2022-12-05
            }
            
        }
@@ -277,14 +281,58 @@
            let moduleName = AWSService.insertModule;
            if (selectedAwsDataId) {
                moduleName = AWSService.updateModule;
               url = staticResources.updateUrl
                url = staticResources.updateUrl
            }
            console.log('Payload for AWS:'+payloadForNewPI + ' Module Name:'+moduleName);
            AWSService.postAWS(url,moduleName, payloadForNewPI, function(result){
            //zhj 新方案改造 2022-12-06 判断更新或创建的contact是否重复 start
            // var accountId = '{!vp}';
            // debugger
            // Visualforce.remoting.Manager.invokeAction(
            //     'SearchVisitorController.searchContactByAccountId',
            //     accountId,
            //     function (result, event) {
            //         if(result.status == 'fail'){
            //             //alert(result.message);
            //             document.getElementById("errorMsg").innerHTML = result.message;
            //             unblockUI();
            //             return
            //         }
            //         accountName = result.accountName;
            //         dataIdManageCodeMap = result.dataIdManageCodeMap;
            //         var contactList = '';
            //         for(var i = 0; i<result.contactList.length; i++){
            //             if(result.contactList[i].AWS_Data_Id__c)
            //                 contactList += ',' + result.contactList[i].AWS_Data_Id__c;
            //         }
            //         contactList = contactList.substring(1);
            //         payloadForNewPI = JSON.parse(payloadForNewPI);
            //         payloadForNewPI[0].contactIds = contactList;
            //         payloadForNewPI = JSON.stringify(payloadForNewPI);
            //         AWSService.postAWS(url+'V2',moduleName, payloadForNewPI, function(result){
            //             aws_result = result;
            //             if(result.status == '129'){
            //                 unblockUI();
            //                 alert('客户 [ '+accountName+ ' ],已存在相同名字的联系人 人员管理编码 ['+dataIdManageCodeMap[result.object[0].dataId]+' ] ,不能重复创建,请了解');
            //                 return
            //             }
            //             SetEditObj();
            //             saveNew();
            //         }, staticResources.token);
            //     },
            //     { escape: true }
            // );
            payloadForNewPI = JSON.parse(payloadForNewPI);
            payloadForNewPI[0].contactIds = '';
            payloadForNewPI[0].isMobileVerif = false;
            payloadForNewPI[0].isNameMobileVerif = false;
            payloadForNewPI = JSON.stringify(payloadForNewPI);
             AWSService.postAWS(url+'V2',moduleName, payloadForNewPI, function(result){
                aws_result = result;
                SetEditObj();
                saveNew();
            }, staticResources.token);
             }, staticResources.token);
            //zhj 新方案改造 2022-12-06 end
        }
        function GetEditObj(){
@@ -292,7 +340,7 @@
                lastName : document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value,
                phone : document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value,
                type : document.getElementById("Page:mainForm:idSearchVisitor:updateContactType").value,
                doctorDivision1 : document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value,
                doctorDivision1 : document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value == '_\x01_'?'':document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value,
                dataId:selectedAwsDataId
            }]);
        }
@@ -368,11 +416,13 @@
        <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage,sfContactId" onComplete="Trans()">
        </apex:actionFunction>
         <!-- Add By Li Jun for PIPL 20220228 Start -->
         <apex:inputHidden id="LastName_Encrypted__c" value="{!rc.LastName_Encrypted__c}"/>
         <!-- zhj 新方案改造 2022-12-19 start -->
         <!-- <apex:inputHidden id="LastName_Encrypted__c" value="{!rc.LastName_Encrypted__c}"/>
         <apex:inputHidden id="Phone_Encrypted__c" value="{!rc.Phone_Encrypted__c}"/>
         <apex:inputHidden id="Type_Encrypted__c" value="{!rc.Type_Encrypted__c}"/>
         <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/>
         <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/> -->
         <!-- zhj 新方案改造 2022-12-19 end -->
         <apex:inputHidden id="AWS_Data_Id__c" value="{!rc.AWS_Data_Id__c}"/>
         <apex:inputHidden id="sfContactId" value="{!sfContactId}"/>
@@ -569,7 +619,9 @@
                        <th width= "80" style="text-align:right">{!$ObjectType.Lead.fields.Phone.Label}</th>
                        <td width= "80"><apex:inputField id="updateContactPhone" value="{!rc.phone}" style="width:110px" /></td>
                        <th width= "80" style="text-align:right">{!$ObjectType.Contact.fields.Supplement__c.Label}</th>
                        <th width= "130" colspan="2" rowspan="3"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th>
                        <!-- 将rowspan="3"改为rowspan="1" zhj 2022-12-29-->
                        <!-- <th width= "130" colspan="2" rowspan="3"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th> -->
                        <th width= "130" colspan="2" rowspan="1"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th>
                        
                    </tr>
                    <tr></tr>