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/QuotesPDF.page | 157 ++--------------------------------------------------
1 files changed, 7 insertions(+), 150 deletions(-)
diff --git a/force-app/main/default/pages/QuotesPDF.page b/force-app/main/default/pages/QuotesPDF.page
index 8e6ec01..bafe58d 100644
--- a/force-app/main/default/pages/QuotesPDF.page
+++ b/force-app/main/default/pages/QuotesPDF.page
@@ -1,4 +1,4 @@
-<apex:page controller="QuotesPDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" >
+<apex:page controller="QuotesPDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf">
<!-- renderAs="pdf" -->
<html>
@@ -8,30 +8,11 @@
size: A4 landscape;
margin: 12mm 12mm 5mm 12mm;
}
- /* 20220221 PI鏀归�� by 寰愪寒 start */
- body{margin: 0 auto;
- width: 780px;}
- #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>
- <div id="pdf-wrapper">
- <div id="title1"></div>
<table border="0" style="font-family: Arial Unicode MS; page-break-inside: auto" width="100%">
<colgroup>
<col width="60%"/>
@@ -73,14 +54,14 @@
<td>
<!-- <c:PDFWbr targetStr="{!conName}"/><br/>
<c:PDFWbr targetStr="{!quo.COMPANYName__c}"/><br/> -->
- <p style="line-height:15px;"><apex:outputField id="BILL_TO__c" value="{!quo.BILL_TO__c}"/><br/>
+ <p style="line-height:15px;"><apex:outputField value="{!quo.BILL_TO__c}"/><br/>
CHINA
</p>
</td>
<td>
<!-- <c:PDFWbr targetStr="{!conName}"/><br/>
<c:PDFWbr targetStr="{!quo.COMPANYName__c}"/><br/> -->
- <p style="line-height:15px;"><apex:outputField id="SHIP_TO__c" value="{!quo.SHIP_TO__c}"/><br/>
+ <p style="line-height:15px;"><apex:outputField value="{!quo.SHIP_TO__c}"/><br/>
CHINA
</p>
</td>
@@ -127,14 +108,14 @@
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!IF(conName != null, true, false)}">
- <td style="border-bottom-width: 0;" id="conName">{!conName} </td>
+ <td style="border-bottom-width: 0;">{!conName} </td>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!IF(conName != null, false, true)}">
<td style="border-bottom-width: 0;"> </td>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_PHONE__c != null, true, false)}">
- <td style="border-bottom-width: 0;" id="CONTACT_PHONE__c">{!quo.CONTACT_PHONE__c} </td>
+ <td style="border-bottom-width: 0;">{!quo.CONTACT_PHONE__c} </td>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_PHONE__c != null, false, true)}">
<td style="border-bottom-width: 0;"> </td>
@@ -317,132 +298,8 @@
</apex:outputText></td>
</tr>
</table>
- </div>
+
</body>
- <!-- 20220221 PI鏀归�� by 寰愪寒 start -->
-<script>
- AWSService.sfSessionId = '{!GETSESSIONID()}';
- var staticResources = JSON.parse('{!staticResource}');
- var contactStaticResource = JSON.parse('{!contactStaticResource}');
-
- function Fun(pdf){
- let uri = pdf.output('datauristring');
- let matches = /(?<=addFile=)[^&]*/.exec(window.location.href);
- if (matches && matches.length) {
- eval('top.'+matches[0]+'("'+uri+'")');
- return;
- }
- 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 = uri;
- 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);
- }
- })
- }
-
-
- document.body.onload = function(){
- let i = 0;
- let Foo = function(){
- if(i == 2){
- jsPdfDownload();
- }
- }
- if('{!quo.AWS_Data_Id__c}'){
- AWSService.query(staticResources.queryUrl, '{!quo.AWS_Data_Id__c}', function(data){
- let e = document.getElementById("allPage:BILL_TO__c");if(e)e.innerHTML = data.object.billTo;
- e =document.getElementById("allPage:SHIP_TO__c");if(e)e.innerHTML = data.object.shipTo;
- e =document.getElementById("CONTACT_PHONE__c");if(e)e.innerHTML = data.object.contactPhone;
- i++;
- Foo();
-
- }, staticResources.token);
- }else{
- i++;
- Foo();
- }
-
- if('{!quo.CONTACT_NAME__r.AWS_Data_Id__c}'){
- AWSService.query(contactStaticResource.queryUrl, '{!quo.CONTACT_NAME__r.AWS_Data_Id__c}', function(data){
- let e = document.getElementById("conName");if(e)e.innerHTML = data.object.lastName;
- i++;
- Foo();
- }, staticResources.token);
- }else{
- i++;
- Foo();
- }
-
-
- }
-</script>
-<!-- 20220221 PI鏀归�� by 寰愪寒 end -->
</html>
</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1