From 5c01ebbfddb6b8674430b47c22977bea2e350084 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 13 四月 2022 10:58:46 +0800
Subject: [PATCH] BackupPIPLFunction0413

---
 force-app/main/default/pages/SearchVisitor.page |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/pages/SearchVisitor.page b/force-app/main/default/pages/SearchVisitor.page
index 09049f0..5e1f93c 100644
--- a/force-app/main/default/pages/SearchVisitor.page
+++ b/force-app/main/default/pages/SearchVisitor.page
@@ -8,6 +8,10 @@
     <!-- 20220217 Li Jun for PIPL End -->
     <script type="text/javascript">
         AWSService.sfSessionId = '{!GETSESSIONID()}';
+        //鍍忓尰鐢熷尯鍒�(鑱屽姟)涓嬫媺鍒楄〃鍔犲叆****
+        // var o = new Option();
+        // o.text = '****';
+        // document.getElementById('Page:mainForm:idSearchVisitor:updateContactDoctorDivision').add(o);
         function addContact(){
             window.opener.showModal();
             
@@ -155,7 +159,7 @@
             //2. inovke aws service
             let contactAwsIds = new Set();
             for(var key in contactInfo){
-                if(contactInfo[key].lastName.includes(searchByLastName)){
+                if(contactInfo[key].lastName.indexOf(searchByLastName) != -1){
                     contactAwsIds.add(key);
                 }
             }
@@ -188,11 +192,29 @@
                 let y=window.event.y; 
                 createDiv.style.left=x;  
                 createDiv.style.top=y;  
+                createDiv.style.marginLeft='20px';
+                createDiv.style.marginTop='-40px';
+                createDiv.style.height='80px';  
+            	createDiv.style.width='120px';
                 createDiv.style.background = "#dddddd";
                 createDiv.style.position = "absolute";
                 parentNode.appendChild(createDiv);  
                 parentNode.style.position = "relative";
             }            
+        }
+
+
+        function showPITR(obj){
+            var awsDataId = obj.childNodes[1].childNodes[2].value;
+            if(awsDataId.length == 1){
+                let sfId = j$(escapeVfId('Page:mainForm:idSearchVisitor:idAddVisitor:' + awsDataId + ':idAddHiddenId')).val()
+                awsDataId = sfIdToAWSIdMapValue.get(sfId);聽
+            }
+            if(contactInfo[awsDataId]){
+                document.getElementById(obj.childNodes[1].childNodes[0].id).innerText = contactInfo[awsDataId].lastName;
+                document.getElementById(obj.childNodes[3].childNodes[0].id).innerText = contactInfo[awsDataId].doctorDivision1;
+                document.getElementById(obj.childNodes[4].childNodes[0].id).innerText = contactInfo[awsDataId].phone;
+            }
         }
 
         function hidePIDiv(obj){
@@ -269,6 +291,8 @@
             return JSON.stringify([{
                 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,
                 dataId:selectedAwsDataId
             }]);
         }
@@ -280,11 +304,26 @@
                 return;
             }
             blockme();
+            let es = document.getElementsByTagName('select')
+            for(let ei in es){
+                let e = es[ei];
+                for(let opi in e.options){
+                    let op = e.options[opi];
+                    if(!op)continue;
+                    if(op.value == "*****" && op.selected){
+                        unblockUI();
+                        alert('涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」')
+                        return;
+                    }
+                }
+            }
             ProcessPIForAWS({},GetEditObj());
         }
         function Trans(){
+            console.log('SFRcordId:'+document.getElementById('Page:mainForm:sfContactId').value);
             AWSService.postAWS(staticResources.transactionUrl,AWSService.confirmTrans, JSON.stringify({
                     "txId":aws_result.txId,
+                    "sfRecordId":document.getElementById('Page:mainForm:sfContactId').value,
                     "isSuccess":1
             }), function(result){
                 window.location.reload();
@@ -326,7 +365,7 @@
         <apex:actionFunction name="editVistor" action="{!editVistor}" rerender="idRegistration" oncomplete="assignDencrypted();setButtonDisable(document.getElementById('Page:mainForm:idSearchVisitor:idRegSave'), false);">
             <apex:param name="index" assignTo="{!index}" value=""/>
         </apex:actionFunction>
-        <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage" onComplete="Trans();">
+        <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}"/>
@@ -336,6 +375,7 @@
          <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/>
 
          <apex:inputHidden id="AWS_Data_Id__c" value="{!rc.AWS_Data_Id__c}"/>
+         <apex:inputHidden id="sfContactId" value="{!sfContactId}"/>
          <!-- Add By Li Jun for PIPL 20220221 End -->
             <apex:pageBlock id="idSearchVisitor" >
                 <table width="1060" height="50" border="0">
@@ -411,7 +451,7 @@
                     <tr>
                         <td>
                         <div id="iframelike">
-                        <apex:pageBlockTable id="idRezultVisitor" value="{!scwl}" var="scw" border="1" columns="8" columnsWidth="47px,90px,,90px,180x,90px,40px,200px">
+                        <apex:pageBlockTable id="idRezultVisitor" value="{!scwl}" var="scw" onRowMouseOver="showPITR(this)" border="1" columns="8" columnsWidth="47px,90px,,90px,180x,90px,40px,200px">
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Selected}</apex:facet>
                                 <input type="button" id="idSlt" value="{!$Label.Selected}" onclick="sltContact('{!scw.index}');"  class="btn" style="width:40px"/>
@@ -420,6 +460,7 @@
                                 <apex:facet name="header">{!$Label.Visitor_Name}</apex:facet>
                                 <apex:outputLink onmouseover="showPIDiv('{!scw.con.AWS_Data_Id__c}',this)"  onmouseout="hidePIDiv(this)" value="/{!scw.con.Id}" id="idName" target="_blank">{!scw.con.Name}</apex:outputLink>
                                 <apex:inputText id="idHiddenId" value="{!scw.conid}" style="display:none" />
+                                <apex:inputText id="AWSDataId" value="{!scw.con.AWS_Data_Id__c}" style="display:none" />
                             </apex:column>
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Department_Name}</apex:facet>
@@ -460,7 +501,7 @@
                     <tr>
                         <td>
                         <div id="iframelike2">
-                        <apex:pageBlockTable id="idAddVisitor" value="{!acwl}" var="acw" border="1" columns="7" columnsWidth="47px,90px,,90px,180x,90px,40px">
+                        <apex:pageBlockTable id="idAddVisitor" value="{!acwl}" var="acw" border="1" columns="7" onRowMouseOver="showPITR(this)" columnsWidth="47px,90px,,90px,180x,90px,40px">
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Back}</apex:facet>
                                 <input type="button" id="idDel" value="{!$Label.Back}" onclick="delContact('{!acw.index}');" class="btn" style="width:40px"/>
@@ -470,6 +511,7 @@
                                 <!-- <apex:outputText id="idAddName" value="{!IF(acw.con.Name==null,'銆�',acw.con.Name)}" /> -->
                                 <apex:outputLink onmouseover="showPIDiv('{!acw.index}',this)"  onmouseout="hidePIDiv(this)" value="/{!acw.conid}" id="idAddName" target="_blank">{!IF(acw.con.Name==null,'銆�',acw.con.Name)}</apex:outputLink>
                                 <apex:inputText id="idAddHiddenId" value="{!acw.conid}" style="display:none" />
+                                <apex:inputText id="AWSDataId" value="{!acw.index}" style="display:none" />
                             </apex:column>
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Department_Name}</apex:facet>

--
Gitblit v1.9.1