From 2f4492ee18f90274582fcc2bb06f5e9bf64136e8 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 13 五月 2022 17:32:14 +0800 Subject: [PATCH] ProdBackup0513 --- force-app/main/default/pages/DeliveryConfirmPDF.page | 191 +++-------------------------------------------- 1 files changed, 12 insertions(+), 179 deletions(-) diff --git a/force-app/main/default/pages/DeliveryConfirmPDF.page b/force-app/main/default/pages/DeliveryConfirmPDF.page index 55c0e28..b237c18 100644 --- a/force-app/main/default/pages/DeliveryConfirmPDF.page +++ b/force-app/main/default/pages/DeliveryConfirmPDF.page @@ -1,37 +1,16 @@ -<apex:page controller="DeliveryConfirmPDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" > <!-- renderAs="pdf" --> +<apex:page controller="DeliveryConfirmPDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf"> <!-- renderAs="pdf" --> <html> <head> <style> @page { margin: 1mm 1mm 1mm 1mm; } -/* 20220221 PI鏀归�� by 寰愪寒 start */ -body{margin: 0 auto; - width: 780px;} - #pdf-wrapper{position: relative;} - #title1{height: 30px;} - #title2{height: 110px;} - /* 20220221 PI鏀归�� by 寰愪寒 end */ </style> - <!-- 20220221 PI鏀归�� by 寰愪寒 start --> - <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> - <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> - <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> - <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> - <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> - - <apex:includeScript value="{!URLFOR($Resource.jspdf)}"/> - <apex:includeScript value="{!URLFOR($Resource.html2canvas)}"/> - - - <!-- 20220221 PI鏀归�� by 寰愪寒 end --> </head> <body style="font-family: Arial Unicode MS; page-break-inside: auto;font-size: 10px;"> - <div id="pdf-wrapper"> - <div id="title1"></div> <apex:image value="{!URLFOR($Resource.pdfSign)}" width="80" style="position:absolute; left:300px; top:100px;"/> - <p style="text-align: center; display: block;font-size: 25px;">濂ユ灄宸存柉鏍锋満鍊熺敤鍗�</p> + <p style="text-align: center; display: block;font-size: 25px;">浠櫙閫氭牱鏈哄�熺敤鍗�</p> <table style="border: 2px solid black; width: 100%;border-collapse:collapse;" border="solid"> <tr> <td align="right" width="100px"><apex:outputText value="鐢宠鏃ユ湡锛�" /></td> @@ -52,7 +31,7 @@ </apex:outputPanel> <td align="right">鍊熺敤鎷呭綋锛�</td> - <td><span aws-obj="loaner_application__c" aws-api="loanerSer" aws-id="{!la.AWS_Data_Id__c}">{!la.Loaner_Ser__c}</span></td> + <td><apex:outputText value="{!la.Loaner_Ser__c}"/></td> </tr> <tr> <td align="right">鍊熺敤鏃ユ湡锛�</td> @@ -114,15 +93,15 @@ <tr> <td align="right" width="90">瀵勯�佸湴鍧�锛�</td> - <td colspan="3"><span aws-obj="loaner_application__c" aws-api="directShippmentAddress" aws-id="{!la.AWS_Data_Id__c}">{!la.direct_shippment_address__c}</span> </td> + <td colspan="3"><apex:outputField value="{!la.direct_shippment_address__c}"/></td> </tr> <tr> <td align="right" width="90">鑱旂郴浜猴細</td> - <td><span aws-obj="loaner_application__c" aws-api="loanerReceiveStaff" aws-id="{!la.AWS_Data_Id__c}">{!la.Loaner_receive_staff__c}</span></td> + <td><apex:outputField value="{!la.Loaner_receive_staff__c}"/></td> <td align="right" width="90">鑱旂郴鐢佃瘽锛�</td> - <td width="200"><span aws-obj="loaner_application__c" aws-api="loanerReceiveStaffPhone" aws-id="{!la.AWS_Data_Id__c}">{!la.Loaner_receive_staff_phone__c}</span></td> + <td width="200"><apex:outputField value="{!la.Loaner_receive_staff_phone__c}"/></td> </tr> @@ -152,17 +131,17 @@ <apex:repeat value="{!luData}" var="luLine" id="lus"> <tr> <td class="dataCell" style="text-align: center;"> - <apex:outputText styleClass="Customer__r.Name" value="{!luLine.lu.Customer__r.Name}"/> + <apex:outputText value="{!luLine.lu.Customer__r.Name}"/> </td> <td class="dataCell" style="text-align: center;"> - <apex:outputText styleClass="Customer__r.DivisionName__c" value="{!luLine.lu.Customer__r.DivisionName__c}"/> + <apex:outputText value="{!luLine.lu.Customer__r.DivisionName__c}"/> </td> <td class="dataCell" style="text-align: center;"> - <span aws-obj="Contact" aws-api="lastName" aws-id="{!la.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Name}</span> + <apex:outputText value="{!luLine.lu.Contact__r.Name}"/> </td> <apex:outputPanel rendered="{!IF(la.Equipment_Type__c == 'BS', true , false)}" layout="none"> <td class="dataCell" style="text-align: center;"> - <span aws-obj="Contact" aws-api="phone" aws-id="{!la.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Phone}</span> + <apex:outputText value="{!luLine.lu.Contact__r.Phone}"/> </td> </apex:outputPanel> <apex:outputPanel rendered="{!IF(la.Equipment_Type__c == 'BS', false , true)}" layout="none"> @@ -282,155 +261,9 @@ <tr><td>3.濡傚�熺敤涔嬫牱鏈猴紙澶囧搧锛夊湪鍊熺敤鏈熼棿鎹熷潖锛屾垜鏂规湁鏉冭姹傝吹鏂规寜鐩稿簲閲戦璧斿伩鎴栨壙鎷呯淮淇垂鐢ㄣ��</td></tr> </apex:outputPanel> <tr><td>4.鍊熷嚭鏍锋満鍦ㄦ湭寰佸緱鎴戞柟鐨勮鍙紝璐垫柟涓嶅緱杞�熺涓夋柟浣跨敤锛屽惁鍒欏皢涓鍊熺敤骞惰拷绌惰矗浠汇��</td></tr> - <tr><td>5.濂ユ灄宸存柉鏈夋潈鏍规嵁闇�瑕侀殢鏃舵敹鍥炲�熷嚭鐨勬牱鏈恒��</td></tr> + <tr><td>5.浠櫙閫氭湁鏉冩牴鎹渶瑕侀殢鏃舵敹鍥炲�熷嚭鐨勬牱鏈恒��</td></tr> </table> - </div> + </body> -<!-- 20220221 PI鏀归�� by 寰愪寒 start --> -<script> - AWSService.sfSessionId = '{!GETSESSIONID()}'; - var staticResource = JSON.parse('{!staticResource}'); - - function Fun(pdf){ - var iframe = document.createElement('iframe'); - iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:100%'); - document.body.appendChild(iframe); - iframe.src = pdf.output('datauristring'); - for(let e of document.body.childNodes){ - if( e != iframe && e.style){ - e.style.display = 'none'; - } - } - } - - let id = "pdf-wrapper"; - var target = document.getElementById(id); - function jsPdfDownload(){ - let pdfName = "娴嬭瘯"; - let id = "pdf-wrapper"; - var target = document.getElementById(id); - target.style.background = "#FFFFFF"; - if(pdfName==''||pdfName==undefined) pdfName= getNowFormatDate(); - - html2canvas(target, { - scale: 2, - onrendered:function(canvas) { - let landscape = false; - let pw = 595.28; - let ph = 841.89; - const marginw = 40; - - let orientation = ''; - if (landscape) { - let temp =ph; - ph = pw; - pw = temp; - orientation = 'l'; - } - - - var contentWidth = canvas.width; - var contentHeight = canvas.height; - - //涓�椤祊df鏄剧ずhtml椤甸潰鐢熸垚鐨刢anvas楂樺害; - var pageHeight = contentWidth / pw * ph; - //鏈敓鎴恜df鐨刪tml椤甸潰楂樺害 - var leftHeight = contentHeight; - //椤甸潰鍋忕Щ - var position = 0; - //a4绾哥殑灏哄[595.28,841.89]锛宧tml椤甸潰鐢熸垚鐨刢anvas鍦╬df涓浘鐗囩殑瀹介珮 - var imgWidth = pw-2*marginw;//595.28//宸﹀彸杈硅窛20 - var imgHeight = imgWidth/contentWidth * contentHeight;//宸﹀彸杈硅窛20 - - var pageData = canvas.toDataURL('image/jpeg', 1.0); - - var pdf = new jsPDF(orientation, 'pt', 'a4');// 绗竴涓弬鏁板~瀛楁瘝l锛屾敞鎰忎笉鏄暟瀛�1锛屼负妯悜pdf - - //鏈変袱涓珮搴﹂渶瑕佸尯鍒嗭紝涓�涓槸html椤甸潰鐨勫疄闄呴珮搴︼紝鍜岀敓鎴恜df鐨勯〉闈㈤珮搴�(841.89) - //褰撳唴瀹规湭瓒呰繃pdf涓�椤垫樉绀虹殑鑼冨洿锛屾棤闇�鍒嗛〉 - if (leftHeight < pageHeight) { - pdf.addImage(pageData, 'JPEG', marginw, 0, imgWidth, imgHeight );//宸﹀彸杈硅窛20 - } else { - while(leftHeight > 0) { - pdf.addImage(pageData, 'JPEG', marginw, position, imgWidth, imgHeight)//宸﹀彸杈硅窛20 - leftHeight -= pageHeight; - position -= ph; - //閬垮厤娣诲姞绌虹櫧椤� - if(leftHeight > 0) { - pdf.addPage(); - } - } - } - Fun(pdf); - } - }) - } - - - var aws_data = {}; - - function Decrypt(r,dataIds){ - 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")]); - }); - //.find(".decrypt") - - } - } - unblockUI(); - } - let ids = []; - for (const id of dataIds) { - if (!aws_data.hasOwnProperty(id)) { - ids.push(id); - } - } - if (ids.length > 0) { - blockme(); - AWSService.search(r.searchUrl,JSON.stringify({ - "dataIds":ids - }),function(data){ - unblockUI(); - if(data.object && data.object.length > 0){ - - for(let d of data.object){ - if(d.dataId){ - aws_data[d.dataId] = d; - } - } - Foo(); - } - },r.token); - }else{ - Foo(); - } - } - - function DecryptAll(){ - let dataIds = []; - j$('[aws-id][aws-obj="loaner_application__c"]').each((i,e)=>{ - let v = j$(e).attr('aws-id'); - if (v) { - dataIds.push(v); - } - }); - Decrypt(staticResource,dataIds); - } - - j$(function(){ - //DecryptAll(); - - }) - - document.body.onclick = function(){ - jsPdfDownload(); - } -</script> -<!-- 20220221 PI鏀归�� by 寰愪寒 end --> </html> </apex:page> \ No newline at end of file -- Gitblit v1.9.1