From 0953b3b5fcf19c627c6479a6b86648df653c40db Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 09 五月 2022 17:50:33 +0800
Subject: [PATCH] SF PIPL Page Fix Lookup Required issue

---
 force-app/main/default/pages/LoanerPortionReturn.page |   74 ++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 1 deletions(-)

diff --git a/force-app/main/default/pages/LoanerPortionReturn.page b/force-app/main/default/pages/LoanerPortionReturn.page
index 38b205b..dd7021f 100644
--- a/force-app/main/default/pages/LoanerPortionReturn.page
+++ b/force-app/main/default/pages/LoanerPortionReturn.page
@@ -2,8 +2,75 @@
 <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
 <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
 <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<!-- Update PIPL 20220425 By Chen Yanan Start -->
+<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
+<!-- Update PIPL 20220425 By Chen Yanan End -->
 <style type="text/css"> td>div{display: inline-block;}</style>
 <script>
+    // Update PIPL 20220425 By Chen Yanan start
+    AWSService.sfSessionId = '{!GETSESSIONID()}';
+    var staticResource = JSON.parse('{!staticResource}');
+    var aws_data = {};
+
+    function Decrypt(r,dataIds,callback){
+        if (!(dataIds && dataIds.length)) {
+            if(callback)callback();
+            return;
+        }
+
+        let Foo = function(){
+            for (const id of dataIds) {
+                if (aws_data.hasOwnProperty(id)) {
+                    let d = aws_data[id];
+                    let $e =j$("[aws-id='"+d.dataId+ "']");
+                    $e.each((i,e)=>{
+                        if (d[j$(e).attr("aws-api")] != '') {
+                            j$(e).attr('value',d[j$(e).attr("aws-api")]);
+                        }
+                    })
+                }
+            }
+            if(callback)callback();
+        }
+        let ids = [];
+        for (const id of dataIds) {
+            if (!aws_data.hasOwnProperty(id)) {
+                ids.push(id);
+            }
+        }
+        if (ids.length > 0) {
+            
+            AWSService.query(r.queryUrl,ids[0],function(data){	
+                console.log('data: ' + JSON.stringify(data));
+                if(data.object){
+                    aws_data[data.object.dataId] = data.object;
+                    Foo();
+                }else{
+                    if(callback)callback();
+                }
+            },r.token);
+        }else{
+            Foo();
+        }
+    }
+
+    function DecryptAll(callback){
+        let dataIds1 = [];
+        j$('[aws-id][aws-obj="loaner_application__c"]').each((i,e)=>{
+            let v = j$(e).attr('aws-id');
+            if (v) {
+                dataIds1.push(v);
+            }
+        });
+        Decrypt(staticResource,dataIds1,callback);
+    }
+
+    j$(function(){
+        DecryptAll();
+        
+    })
+    // Update PIPL 20220425 By Chen Yanan end
 function test1(){
       getIsOk();
 }
@@ -71,7 +138,12 @@
                     <tr>
                         <td>
                              <label for="user">{!$ObjectType.loaner_application_detail__c.fields.Return_Trake_Staff__c.label}: </label>
-                            <apex:inputField value="{!lac.Return_Trake_Staff__c}" id="user"></apex:inputField>
+                             <!-- Update PIPL 20220425 By Chen Yanan Start -->
+                            <!-- <apex:inputField value="{!lac.Return_Trake_Staff__c}" id="user"></apex:inputField> -->
+                            <!-- PIPL 鏀归�犲悗 -->
+                            <apex:inputField html-aws-obj="loaner_application__c" html-aws-api="returnTrakeStaff" html-aws-id="{!lac.AWS_Data_Id__c}" id="Return_Trake_Staff__c" value="{!lac.Return_Trake_Staff__c}"></apex:inputField>
+                            <!-- Update PIPL 20220425 By Chen Yanan  -->
+
                         </td>
                         <td>
                              <apex:commandButton onclick="test1();" value="鍥炲瘎" rerender="dummy" style="width: 70px;float: right;"/>  

--
Gitblit v1.9.1