GWY
2022-04-15 b823c7f3569cf9368e2245846e918f78f32e903a
force-app/main/default/pages/SWOPageRead.page
@@ -5,8 +5,96 @@
   <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
   <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
   <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
   <!-- Update 20220315 By Chen Yanan -->
   <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
   <script>
      // 20220315 PI改造 by Chen Yanan start
        var staticResources = JSON.parse('{!staticResource}');
      var contactstaticResource = JSON.parse('{!contactstaticResource}');
      var aws_data = {};
      console.log('AWS' + {!contactAWSDataId});
      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)=>{
                     j$(e).html(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.search(r.searchUrl,JSON.stringify({
            //    "dataIds":ids
            // }),function(data){
            AWSService.query(r.queryUrl,ids[0],function(data){
               console.log('data: ' + JSON.stringify(data));
               // if(data.object && data.object.length > 0){
               if(data.object){
                  // for(let d of data.object){
                  //    if(d.dataId){
                  //       aws_data[d.dataId] = d;
                  //    }
                  // }
                  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="Contact"]').each((i,e)=>{
            let v = j$(e).attr('aws-id');
            if (v) {
               dataIds1.push(v);
            }
         });
         Decrypt(contactstaticResource,dataIds1,callback);
      }
      function DecryptSWOAll(callback) {
         let dataIds2 = [];
         j$('[aws-id][aws-obj="SWO__c"]').each((i,e)=>{
            let v = j$(e).attr('aws-id');
            if (v) {
               dataIds2.push(v);
            }
         });
         Decrypt(staticResources,dataIds2,callback);
      }
      j$(function(){
         DecryptSWOAll();
         DecryptAll();
      })
        // 20220315 PI改造 by Chen Yanan end
      j$(document).ready(function() {
         var type = j$(escapeVfId("type")).value();
         clickColorChange(type);
@@ -252,7 +340,10 @@
            <tr>
              <td colspan="2"><apex:outputField value="{!swo.OFFICE__c}"/></td>
              <td></td>
              <td colspan="2"><apex:outputField value="{!swo.CONTACT_NAME_HIDDEN__c}"/></td>
            <!-- 20220315 PI改造 by Chen Yanan start -->
              <!-- <td colspan="2"><apex:outputField value="{!swo.CONTACT_NAME_HIDDEN__c}"/></td> -->
            <td colspan="2" align="left" ><apex:outputField html-aws-obj="SWO__C" html-aws-api="contactName" html-aws-id="{!swo.CONTACT_NAME_HIDDEN__c}" id="CONTACT_NAME_HIDDEN__c" value="{!swo.CONTACT_NAME_HIDDEN__c}"/></td>
            <!-- 20220315 PI改造 by Chen Yanan End -->
           </tr>
           <tr>
@@ -403,8 +494,12 @@
       <table style="width: 100%;border-collapse: collapse;">
          <tr class="title">
             <td id="titleProduct" class="title1"><apex:commandLink oncomplete="clickColorChange('Product')" action="{!setProduct}" reRender="table" value="Product Info" /></td>
             <td id="titleCase" class="title1"><apex:commandLink oncomplete="clickColorChange('Case')" action="{!setCase}" reRender="table" value="Case Info" /></td>
             <td id="titlemail" class="title1"><apex:commandLink oncomplete="clickColorChange('mail')" action="{!setMail}" reRender="table" value="Mail Merge" /></td>
             <!-- PIPL Update 20220414 By Chen Yanan Start -->
            <!-- <td id="titleCase" class="title1"><apex:commandLink oncomplete="clickColorChange('Case')" action="{!setCase}" reRender="table" value="Case Info" /></td> -->
             <!-- After -->
            <td id="titleCase" class="title1"><apex:commandLink oncomplete="clickColorChange('Case');DecryptAll();" action="{!setCase}" reRender="table" value="Case Info" /></td>
             <!-- PIPL Update 20220414 By Chen Yanan End -->
            <td id="titlemail" class="title1"><apex:commandLink oncomplete="clickColorChange('mail')" action="{!setMail}" reRender="table" value="Mail Merge" /></td>
             <td id="titleTracking" class="title1"><apex:commandLink oncomplete="clickColorChange('Tracking')" action="{!setTracking}" reRender="table" value="Tracking" /></td>
             <td id="titleTechnical" class="title1"><apex:commandLink oncomplete="clickColorChange('Technical')" action="{!setTechnical}" reRender="table" value="Technical Info" /></td>
             <td id="titleEstimation" class="title1"><apex:commandLink oncomplete="clickColorChange('Estimation')" action="{!setEstimation}" reRender="table" value="Estimation" /></td>
@@ -648,7 +743,13 @@
                 </tr>
                 <tr>
                    <td><apex:outputField value="{!swo.CASE_NUMBER__c}" ></apex:outputField></td>
                    <td><apex:outputField value="{!swo.EMAIL__c}"/></td>
                  <!-- PIPL Update 20220414 By Chen Yanan Start -->
                    <!-- <td><apex:inputField value="{!swo.EMAIL__c}"/></td> -->
                  <td colspan="2" align="left" >
                     <apex:inputField html-aws-obj="Contact" html-aws-api="email" html-aws-id="{!contactAWSDataId}" value="{!swo.EMAIL__c}" />
                  </td>
                  <!-- PIPL Update 20220414 By Chen Yanan End -->
                 </tr>
                 <tr>
                    <td class="hand">{!$ObjectType.SWO__c.fields.COMPANY__c.label}</td>
@@ -663,7 +764,12 @@
                    <td class="hand">{!$ObjectType.SWO__c.fields.TRAN__c.label}</td>
                 </tr>
                 <tr>
                    <td><apex:outputField value="{!swo.CONTACT__c}" ></apex:outputField></td>
                  <!-- 20220315 PI改造 by Chen Yanan start -->
                    <!-- <td><apex:outputField value="{!swo.CONTACT__c}" ></apex:outputField></td> -->
                  <td colspan="2" align="left" >
                     <a href="/{!swo.CONTACT__c}" aws-obj="Contact" aws-api="lastName" aws-id="{!contactAWSDataId}">{!swo.CONTACT__r.Name}</a>
                  </td>
                  <!-- 20220315 PI改造 by Chen Yanan End -->
                    <td><apex:outputField value="{!swo.TRAN__c}"/></td>
                 </tr>
             </table>
@@ -1329,9 +1435,10 @@
          </apex:outputPanel>
          <apex:outputPanel rendered="{!IF(type = 'General' || type = 'All',true,false)}">
            <!-- Before PIPL Update by Li Jun 20220414 Start -->
             <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton>
            <!-- Before PIPL Update by Li Jun 20220414 End -->
             <input class="btn" type="Button" value="PIPL Attach" onclick="window.open('/apex/SWOFileUploadPage')" />
             <table class="tableCss" style="border:1px solid #000000;width: 80%">   
                <tr style="text-align:center;">
                   <th style="text-align:center;width: 33%;">File Name</th>