From b54f1c796595671bd753a9161eccad074d444273 Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期三, 16 三月 2022 17:45:36 +0800
Subject: [PATCH] 询价失单预留产品无效
---
force-app/main/default/pages/InsReportPDF.page | 125 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 120 insertions(+), 5 deletions(-)
diff --git a/force-app/main/default/pages/InsReportPDF.page b/force-app/main/default/pages/InsReportPDF.page
index 3dd8854..a58c973 100644
--- a/force-app/main/default/pages/InsReportPDF.page
+++ b/force-app/main/default/pages/InsReportPDF.page
@@ -1,4 +1,4 @@
-<apex:page controller="InsReportPDFController" showHeader="false" sidebar="false" renderAs="PDF" action="{!init}" applyHtmlTag="false">
+<apex:page controller="InsReportPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false">
<html>
<apex:stylesheet value="{!URLFOR($Resource.BeforeOPDPDF)}"/>
@@ -14,18 +14,38 @@
}
}
- table {border-collapse: collapse;}
+ table {border-collapse: collapse;border: 0px;}
th {text-align: center;}
th.border-thick-title { border-width: 1pt 0pt 1pt 0pt; border-style: solid; border-color: black; text-align: center;}
td.middle {text-align: center;}
td.topClear {border-top-color: white;}
+
+ /* 20220221 PI鏀归�� by 寰愪寒 start */
+ body{margin: 0 auto;
+ width: 780px;}
+ #title1{height: 30px;}
+ #title2{height: 80px;}
+ .dianjian td{border: 1px #000 solid}
+ /* 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 -->
<script>
</script>
</head>
<body style="font-family: Arial Unicode MS;">
+ <div id="pdf-wrapper">
+ <div id="title1"></div>
<table border="0" style="width:100%;">
<tr>
<!-- update by rentx 20210707 start -->
@@ -52,7 +72,7 @@
<td>鐐规浜�</td>
</tr>
<tr>
- <td width="70%">闄㈡柟璐熻矗浜� {!ir.Responsible_Person__c}</td>
+ <td width="70%">闄㈡柟璐熻矗浜� <span id="Responsible_Person__c">{!ir.Responsible_Person__c}</span></td>
<td width="15%"><apex:outputField value="{!ir.Inspection_Date__c}" /></td>
<td width="15%">{!usr.Alias__c}</td>
</tr>
@@ -72,7 +92,7 @@
<td> 鏈鐐规瀵硅薄鏁� {!ir.Inspection_asset_number__c}</td>
</tr>
<tr>
- <td width="70%"> 闄㈡柟璐熻矗浜� {!ir.Responsible_Person__c}</td>
+ <td width="70%"> 闄㈡柟璐熻矗浜� <span id="Responsible_Person__c">{!ir.Responsible_Person__c}</span></td>
<td > 鏈鐐规鏃ユ湡 <apex:outputField value="{!ir.Inspection_Date__c}" /></td>
</tr>
<tr>
@@ -82,7 +102,7 @@
</apex:outputText>
</table>
<br/>
- <table border="1" style="width:100%;">
+ <table class="dianjian" border="0" style="width:100%;border-collapse: collapse;border: 0px;">
<!-- update by rentx 20210707 start -->
<apex:outputText rendered="{!ir.Contract__c = null}">
<tr>
@@ -199,6 +219,101 @@
<table border="0" width="100%">
<tr><td style="text-align: right"><apex:image value="{!ir.SignUrl__c}" width="300px" height="150px" rendered="{!NOT(ISBLANK(ir.SignUrl__c))}" /></td></tr>
</table>
+ </div>
</body>
+ <!-- 20220221 PI鏀归�� by 寰愪寒 start -->
+<script>
+ AWSService.sfSessionId = '{!GETSESSIONID()}';
+ var staticResources = 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 = true;
+ 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);
+ }
+ })
+ }
+
+ blockme();
+ document.body.onload = function(){
+
+ AWSService.query(staticResources.queryUrl, '{!ir.AWS_Data_Id__c}', function(data){
+ unblockUI();
+ document.getElementById("Responsible_Person__c").innerHTML = data.object.responsiblePerson;
+
+ setTimeout(() => {
+ jsPdfDownload();
+ }, 1500);
+ }, staticResources.token);
+
+ }
+</script>
+<!-- 20220221 PI鏀归�� by 寰愪寒 end -->
</html>
</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1