From ead4df22dca33a867279471821ca675f91dec760 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期六, 14 五月 2022 18:44:54 +0800 Subject: [PATCH] FixIssue0514 --- force-app/main/default/pages/SWOPage.page | 144 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 126 insertions(+), 18 deletions(-) diff --git a/force-app/main/default/pages/SWOPage.page b/force-app/main/default/pages/SWOPage.page index 62aeeb0..f280d44 100644 --- a/force-app/main/default/pages/SWOPage.page +++ b/force-app/main/default/pages/SWOPage.page @@ -18,7 +18,59 @@ var isNew = {!isNew}; console.log('isNew: ' + isNew); - function Decrypt(r,dataIds,callback){ + function Decrypt1(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")]); + //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.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 Decrypt2(r,dataIds,callback){ if (!(dataIds && dataIds.length)) { if(callback)callback(); return; @@ -78,8 +130,7 @@ dataIds1.push(v); } }); - Decrypt(contactstaticResource,dataIds1,callback); - + Decrypt1(contactstaticResource,dataIds1,callback); } @@ -91,7 +142,7 @@ dataIds2.push(v); } }); - Decrypt(staticResources,dataIds2,callback); + Decrypt2(staticResources,dataIds2,callback); } j$(function(){ @@ -304,6 +355,7 @@ // doctorDivision1 : document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value, // dataId:selectedAwsDataId contactNameHidden: document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN__c").value, + contactNameHiddenEncrypt: document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN_Encrypted__c").value, dataId:'{!swoawsDataId}' }]); } @@ -314,6 +366,7 @@ console.log('Result from AWS:'+JSON.stringify(obj)); document.getElementById('Page:mainForm:AWS_Data_Id__c').value = obj.dataId; document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN__c").value = obj.contactNameHidden; + document.getElementById('Page:mainForm:CONTACT_NAME_HIDDEN_Encrypted__c').value = obj.contactNameHiddenEncrypt; // document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value = obj.lastName; // document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt; @@ -351,7 +404,13 @@ "sfRecordId":swoId, "isSuccess":1 }), function(result){ - let id = document.getElementById('Page:mainForm:frontSwoId').value + //let id = document.getElementById('Page:mainForm:frontSwoId').value + let id = j$(escapeVfId("swoid")).value(); + if(id == ''){ + unblockUI(); + alert('鏁版嵁楠岃瘉閿欒') + return + } window.location.href = '/apex/SWOPageRead?id=' + id +'&type='+'{!type}'; //window.location.reload(); }, staticResources.token); @@ -428,7 +487,7 @@ <apex:actionFunction name="uploadFile" action="{!uploadFile}"></apex:actionFunction> <!-- Add save method for PIPL 20220414 by Li Jun Start --> <apex:inputHidden id="frontSwoId" value="{!frontSwoId}" /> - <apex:actionFunction name="saveNew" action="{!save}" reRender="swoid,frontSwoId" onComplete="Trans()"> + <apex:actionFunction name="saveNew" action="{!save}" reRender="swoid,frontSwoId,mainForm" onComplete="Trans()"> <apex:param name="frontCaseId" assignto="{!caseId}" value="{!caseId}"/> </apex:actionFunction> <!-- Add save method for PIPL 20220414 by Li Jun End --> @@ -520,6 +579,7 @@ <!-- <td colspan="2"><apex:inputField value="{!swo.CONTACT_NAME_HIDDEN__c}"/></td> --> <td colspan="2" > <apex:inputHidden id="AWS_Data_Id__c" value="{!swo.AWS_Data_Id__c}"/> + <apex:inputHidden id="CONTACT_NAME_HIDDEN_Encrypted__c" value="{!swo.CONTACT_NAME_HIDDEN_Encrypted__c}"/> <apex:inputField html-aws-obj="SWO__c" html-aws-api="contactNameHidden" html-aws-id="{!swo.AWS_Data_Id__c}" id="CONTACT_NAME_HIDDEN__c" value="{!swo.CONTACT_NAME_HIDDEN__c }" /> </td> <!-- Update By Yanan --> @@ -721,24 +781,25 @@ <td>INTERNAL ONLY</td> </tr> <apex:repeat value="{!mailList}" var="mail" id="lines"> - <tr> + <!-- Update 20220513 By Chen Yanan Start --> + <tr class="row" id="{!mail.mm.AWS_Data_Id__c}" onmouseover="showPI('{!mail.mm.AWS_Data_Id__c}')"> <td><apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=SWO&typeid={!swoid}&openType=View">View</apex:outputLink> <apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=SWO&typeid={!swoid}&openType=Reply">Reply</apex:outputLink></td> - <td><apex:outputField value="{!mail.mm.DATE__c}" /></td> - <td><apex:outputField value="{!mail.mm.FROM__c}" /></td> - <td><apex:outputField value="{!mail.mm.MESSAGE__c}" /></td> - <td><apex:outputText value="{!mail.mm.EMAIL_SENT__c}" /></td> - <td><apex:outputField value="{!mail.mm.toName__c}" /></td> - <td><apex:outputField value="{!mail.mm.ccName__c}" /></td> + <td><apex:outputField value="{!mail.mm.DATE__c}"/></td> + <td id="{!mail.mm.AWS_Data_Id__c}_FROM"><apex:outputField value="{!mail.mm.FROM__c}" /></td> + <td><apex:outputField value="{!mail.mm.MESSAGE__c}"/></td> + <td><apex:outputText value="{!mail.mm.EMAIL_SENT__c}"/></td> + <td id="{!mail.mm.AWS_Data_Id__c}_toName"><apex:outputField value="{!mail.mm.toName__c}"/></td> + <td id="{!mail.mm.AWS_Data_Id__c}_ccName"><apex:outputField value="{!mail.mm.ccName__c}"/></td> <td><apex:outputText value="{!mail.haveAtt}" /></td> <td> <apex:repeat value="{!mail.attList}" var="att" id="lines"> - <apex:outputLink value="/{!att.Id}"><c:PDFWbr targetStr="{!att.Name}" /></apex:outputLink> + <apex:outputLink value="/{!att.Id}"><c:PDFWbr targetStr="{!att.FileName__c}" /></apex:outputLink> <br/> </apex:repeat> </td> <td><apex:outputText value="YES" /></td> </tr> - + <!-- Update 20220513 By Chen Yanan End --> </apex:repeat> </table> @@ -1616,10 +1677,11 @@ <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> + <!-- <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton> --> <!-- Before PIPL Update by Li Jun 20220414 End --> <!-- After PIPL Update by Li Jun 20220414 Start --> - <input class="btn" type="Button" value="PIPL Attach" onclick="window.open('/apex/SWOFileUploadPage')" /> + <apex:iframe src="/apex/SWOFileUploadPage?parentId={!swoid}" scrolling="true" height="300" id="fileUploadSection"/> + <!-- <input class="btn" type="Button" value="Attach" onclick="window.open('/apex/SWOFileUploadPage?parentId={!swoid}')" /> --> <!-- After PIPL Update by Li Jun 20220414 End --> <table class="tableCss" style="border:1px solid #000000;width: 80%"> <tr style="text-align:center;"> @@ -2015,8 +2077,54 @@ <!-- PIPL Update 20220414 By Chen Yanan --> <!-- <apex:commandButton onclick="blockme();" value="Save" action="{!save}" style="width: 5%;"/> --> <apex:commandButton id="saveSWOs" value="Save" style="width: 5%;" onclick="saveSWOToAWS();" rerender="dummy" /> + <script> + var mailListObj = JSON.parse('{!awsDataIdStr}'); + var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}') + var mailList = [] + var PIDataObjList = {} + + + function showPI(awsId){ + if(awsId){ + document.getElementById(awsId).children[2].children[0].children[0].innerText = PIDataObjList[awsId].author + document.getElementById(awsId).children[5].children[0].innerText = PIDataObjList[awsId].premaryRecipient + document.getElementById(awsId).children[6].children[0].innerText = PIDataObjList[awsId].cc + } + } + + + for(var i=0;i<mailListObj.length;i++){ + mailList.push(mailListObj[i]) + } + var queryBack = function queryBack(data){ + console.log(data) + if (data.object) { + for (var i=0;i<data.object.length;i++) { + // var PIDataObj = {}; + // var d = {}; + // PIDataObj.author = data.object[i].author + // PIDataObj.premaryRecipient = data.object[i].premaryRecipient + // PIDataObj.cc = data.object[i].cc + // d[data.object[i].dataId] = PIDataObj + // PIDataObjList.push(d) + var PIDataObj = {}; + PIDataObj.author = data.object[i].author + PIDataObj.premaryRecipient = data.object[i].premaryRecipient + PIDataObj.cc = data.object[i].cc + PIDataObjList[data.object[i].dataId] = PIDataObj; + } + } + unblockUI(); + }; + document.body.onload = function(){ + blockme(); + console.log('appendToOnloadQueue'); + let searchPayload = new Object(); + searchPayload.dataIds = mailList; + AWSService.search(staticResourceMailMerge.searchUrl,JSON.stringify(searchPayload),queryBack,staticResourceMailMerge.token); + } + </script> <!-- PIPL Update 20220414 By Chen Yanan --> - </apex:form> <br/> -- Gitblit v1.9.1