From 2d4a8d2dcad5a17127d2c73c48ddc4b67ec79448 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期三, 06 四月 2022 11:51:58 +0800 Subject: [PATCH] PIPLDeploy0405 --- force-app/main/default/pages/QISPDF.page | 206 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 159 insertions(+), 47 deletions(-) diff --git a/force-app/main/default/pages/QISPDF.page b/force-app/main/default/pages/QISPDF.page index 789c796..073c274 100644 --- a/force-app/main/default/pages/QISPDF.page +++ b/force-app/main/default/pages/QISPDF.page @@ -1,31 +1,51 @@ -<apex:page controller="QISPDFController" showHeader="false" sidebar="false" renderAs="pdf" action="{!init}" applyHtmlTag="false"> -<!-- <apex:page controller="QISPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false"> --> +<!-- <apex:page controller="QISPDFController" showHeader="false" sidebar="false" renderAs="pdf" action="{!init}" applyHtmlTag="false"> --> +<apex:page controller="QISPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false"> <html> <head> <style> - @page { - size: A4 portrait; - margin: 5mm 12mm 5mm 12mm; + @page { + size: A4 portrait; + margin: 5mm 12mm 5mm 12mm; + + /* @bottom-center { */ + /* content: counter(page) " / " counter(pages); */ + /* } */ + } -/* @bottom-center { */ -/* content: counter(page) " / " counter(pages); */ -/* } */ - } - - table {border-collapse: collapse;} - -/* td {padding: 0px 0px 0px 0px;} */ - td.title {text-align: center; font-weight: bold; background-color: #BDBDBD;} - td.middle {text-align: center; font-size:120%; font-weight: bold;} - td.label {padding-left: 10px;} - + table {border-collapse: collapse;} + + /* td {padding: 0px 0px 0px 0px;} */ + td.title {text-align: center; font-weight: bold; background-color: #BDBDBD;} + td.middle {text-align: center; font-size:120%; font-weight: bold;} + td.label {padding-left: 10px;} + + /* 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 style="font-family: Arial Unicode MS;"> +<body style="font-family: MS Gothic;"> + <div id="pdf-wrapper"> + <div id="title1"></div> <table width="100%" border="0"> <tr> - <td width="15%"> + <td width="25%"> <!-- <apex:image value="{!$Resource.swmLOGO}" /> --> <table width="100%" border="1" cellspacing="0" style="border-color: red;"> <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">OLYMPUS</td></tr> @@ -47,7 +67,7 @@ </tr> </table> <div style="height:3px;"></div> - <table width="100%" border="1" cellspacing="2" style="font-size: 8pt;"> + <table width="100%" border="0" cellspacing="2" style="font-size: 8pt;"> <tr> <td> <table width="100%" border="1" cellspacing="0"> @@ -60,8 +80,8 @@ <tr> <td class="label" height="23px">鏈哄櫒鍙�/鎵瑰彿</td> <td class="middle">{!qr.lot_or_serial__c}</td> -<!-- <td class="label">OCM绠$悊鍙风爜</td> --> -<!-- <td class="middle">{!qr.OCM_control_no__c}</td> --> + <!-- <td class="label">OCM绠$悊鍙风爜</td> --> + <!-- <td class="middle">{!qr.OCM_control_no__c}</td> --> </tr> <tr > <td class="label" height="23px">闂鐜拌薄</td> @@ -102,13 +122,13 @@ <td width="25%" class="label" height="23px">鎻愪氦鑰呬笂鍙�</td> <td width="25%" class="middle">{!usr.Manager.Name}</td> <td width="10%" class="label">鐢佃瘽鍙风爜</td> - <td colspan="2" class="middle">{!qr.Caller_phone__c}</td> + <td colspan="2" class="middle" id="Caller_phone__c">{!qr.Caller_phone__c}</td> </tr> <tr> <td width="25%" class="label" height="23px">鎻愪氦鏃ユ湡</td> <td width="25%" class="middle"><apex:outputField value="{!qr.QIS_Submit_day__c}" /></td> <td width="10%" class="label">鑱旂郴浜�</td> - <td colspan="2" class="middle">{!qr.Responsible_Person_HP__c}</td> + <td colspan="2" class="middle" id="Responsible_Person_HP__c">{!qr.Responsible_Person_HP__c}</td> </tr> </table> </td> @@ -161,10 +181,10 @@ </apex:outputPanel>鍐� <apex:outputPanel layout="none" - rendered="{!if(Not(inGuarantee) && Not(outOfGuarantee) , 'true', 'false')}" - >✔</apex:outputPanel> + rendered="{!if(Not(inGuarantee) && Not(outOfGuarantee) , 'true', 'false')}" + >✔</apex:outputPanel> <apex:outputPanel layout="none" - + rendered="{!if(inGuarantee || outOfGuarantee , 'true', 'false')}" >□</apex:outputPanel>澶� </td> @@ -203,7 +223,7 @@ <td colspan="3" class="middle">{!qr.Set_usage_product__c}</td> </tr> <tr> - <td colspan="4" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;">闂鍐呭鎻忚堪</td> + <td colspan="4" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;border-bottom: none;">闂鍐呭鎻忚堪</td> </tr> <tr> <td colspan="4" style="height:40px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.problem_detail__c}" /></td> @@ -240,13 +260,13 @@ <td colspan="13" class="title">OCSM鏈嶅姟鏈儴</td> </tr> <tr> - <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;">妫�娴�/鍒嗘瀽鎯呭喌璇﹁堪</td> + <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">妫�娴�/鍒嗘瀽鎯呭喌璇﹁堪</td> </tr> <tr> <td colspan="13" style="height:42px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.QIS_Reply_Comment__c}" /></td> </tr> <tr> - <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;">鍘熷洜</td> + <td colspan="13" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">鍘熷洜</td> </tr> <tr> <td colspan="13" style="height:42px; border-top-color: white; font-size:120%; font-weight: bold; vertical-align: top;"><c:PDFWbr targetStr="{!qr.Reason_bloken__c}" /></td> @@ -279,28 +299,28 @@ </td> </tr> <tr> -<!-- <td colspan="4" style="text-align: center;" height="23px">鐜板搧鏀跺埌鏃�</td> --> -<!-- <td colspan="4" style="text-align: center;">纭鏃�</td> --> + <!-- <td colspan="4" style="text-align: center;" height="23px">鐜板搧鏀跺埌鏃�</td> --> + <!-- <td colspan="4" style="text-align: center;">纭鏃�</td> --> <td colspan="3" style="text-align: center;" height="23px">鐜板搧鏀跺埌鏃�</td> <td colspan="3" style="text-align: center;">CDS鏃�</td> <td colspan="3" style="text-align: center;">妫�鏌ユ棩</td> <td colspan="4" style="text-align: center;">纭鏃�</td> </tr> <tr> -<!-- <td colspan="4" class="middle" style="height:30px;"><apex:outputField value="{!qr.OCM_RC_RecievedDate__c}" /></td> --> -<!-- <td colspan="4" class="middle"><apex:outputField value="{!qr.QIS_Reply_day__c}" /></td> --> + <!-- <td colspan="4" class="middle" style="height:30px;"><apex:outputField value="{!qr.OCM_RC_RecievedDate__c}" /></td> --> + <!-- <td colspan="4" class="middle"><apex:outputField value="{!qr.QIS_Reply_day__c}" /></td> --> <td colspan="3" class="middle" style="height:30px;"><apex:outputField value="{!qr.OCM_RC_RecievedDate__c}" /></td> <td colspan="3" class="middle"><apex:outputField value="{!qr.CDS_date__c}" /></td> <td colspan="3" class="middle"><apex:outputField value="{!qr.RC_inspection_date__c}" /></td> <td colspan="4" class="middle"><apex:outputField value="{!qr.QIS_Reply_day__c}" /></td> </tr> <tr> -<!-- <td style="text-align: center; height:40px;">纭鑰�</td> --> -<!-- <td colspan="2" width="24%" class="middle">{!qr.RC__r.Alias__c}</td> --> -<!-- <td style="text-align: center; color: #D8D8D8">鐩栫珷</td> --> -<!-- <td style="text-align: center;">纭鑰�</td> --> -<!-- <td colspan="2" width="24%" class="middle">{!qr.RC_manager__r.Alias__c}</td> --> -<!-- <td style="text-align: center; color: #D8D8D8">鐩栫珷</td> --> + <!-- <td style="text-align: center; height:40px;">纭鑰�</td> --> + <!-- <td colspan="2" width="24%" class="middle">{!qr.RC__r.Alias__c}</td> --> + <!-- <td style="text-align: center; color: #D8D8D8">鐩栫珷</td> --> + <!-- <td style="text-align: center;">纭鑰�</td> --> + <!-- <td colspan="2" width="24%" class="middle">{!qr.RC_manager__r.Alias__c}</td> --> + <!-- <td style="text-align: center; color: #D8D8D8">鐩栫珷</td> --> <td width="6%" style="height:40px;">纭鑰�</td> <td width="13%" class="middle">{!qr.RC__r.Alias__c}</td> <td width="6%" style="text-align: center; color: #D8D8D8">鐩栫珷</td> @@ -324,7 +344,7 @@ <td colspan="10" class="title">OSH 鍖荤枟鍝佽川淇濋殰閮�</td> </tr> <tr> - <td colspan="9" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;">妫�娴�/鍒嗘瀽鎯呭喌璇﹁堪<br/></td> + <td colspan="9" style="height:18px; padding-top: 0px; padding-bottom: 0px; padding-left: 10px;border-bottom: none;">妫�娴�/鍒嗘瀽鎯呭喌璇﹁堪<br/></td> <td style="text-align: center;">璐ㄩ噺鍒ゅ畾</td> </tr> <tr> @@ -368,7 +388,7 @@ <td width="6%" style="text-align: center; color: #D8D8D8">鐩栫珷</td> <td width="6%">璐熻矗浜�</td> <td width="13%" class="middle">{!qr.OSH_Manager__r.Alias__c} -<!-- {!IF(Isblank(qr.OSH_Manager__r.BuchangApprovalManager__c), qr.OSH_Manager__r.Alias__c, qr.OSH_Manager__r.BuchangApprovalManager__r.Alias__c)} --> + <!-- {!IF(Isblank(qr.OSH_Manager__r.BuchangApprovalManager__c), qr.OSH_Manager__r.Alias__c, qr.OSH_Manager__r.BuchangApprovalManager__r.Alias__c)} --> </td> <td width="6%" style="text-align: center; color: #D8D8D8">鐩栫珷</td> <td width="25%" class="middle">{!qr.QIS_no_for_m_BC__c}</td> @@ -380,9 +400,10 @@ <div style="page-break-after: always;"></div> + <div id="title2"></div> <table width="100%" border="0"> <tr> - <td width="15%"> + <td width="25%"> <table width="100%" border="1" cellspacing="0" style="border-color: red;"> <tr><td colspan="2" style="font-size: 6px; font-weight: bold; color: red; text-align: center; padding: 0px 0px 0px 0px;">OLYMPUS</td></tr> <tr> @@ -403,7 +424,7 @@ </tr> </table> <div style="height:3px;"></div> - <table width="100%" border="1" cellspacing="2" style="font-size: 8pt;"> + <table width="100%" border="0" cellspacing="2" style="font-size: 8pt;"> <tr> <td> <table width="100%" border="1" cellspacing="0"> @@ -416,8 +437,8 @@ <tr> <td class="label" height="23px">鏈哄櫒鍙�/鎵瑰彿</td> <td class="middle">{!qr.lot_or_serial__c}</td> -<!-- <td class="label">OCM绠$悊鍙风爜</td> --> -<!-- <td class="middle">{!qr.OCM_control_no__c}</td> --> + <!-- <td class="label">OCM绠$悊鍙风爜</td> --> + <!-- <td class="middle">{!qr.OCM_control_no__c}</td> --> </tr> <tr > <td class="label" height="23px">闂鐜拌薄</td> @@ -460,6 +481,97 @@ </td> </tr> </table> - </body> + </div> +</body> + +<!-- 20220221 PI鏀归�� by 寰愪寒 start --> +<script> + AWSService.sfSessionId = '{!GETSESSIONID()}'; + var staticResources = JSON.parse('{!staticResource}'); + var staticResourceFile = JSON.parse('{!staticResourceFile}'); + function Fun(pdf){ + + var form = jQuery("<form method='post'></form>"); + jQuery(document.body).append(form); + let href = window.location.href + let arr = href.split('/') + form.attr({"action":staticResourceFile.viewUnifiedContactUrl+"?from="+encodeURIComponent(href)+"&fileName="+encodeURIComponent(arr[arr.length-1].split('?')[0])}); + // form.attr({"action":"http://127.0.0.1:8080/a/d?from="+encodeURIComponent(window.location.href)}); + let input = jQuery("<input type='hidden'/>"); + input.attr({"name":"base64Str"}); + input.val(pdf.output('datauristring').substr(28)); + form.append(input); + form.submit(); + + // jQuery("body > *").each(function(){ + // jQuery(this).css('display','none'); + // }) + // jQuery("body").append('<embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="'+pdf.output('datauristring')+'" type="application/pdf"/>') + + } + + 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) { + var contentWidth = canvas.width; + var contentHeight = canvas.height; + + //涓�椤祊df鏄剧ずhtml椤甸潰鐢熸垚鐨刢anvas楂樺害; + var pageHeight = contentWidth / 592.28 * 841.89; + //鏈敓鎴恜df鐨刪tml椤甸潰楂樺害 + var leftHeight = contentHeight; + //椤甸潰鍋忕Щ + var position = 0; + //a4绾哥殑灏哄[595.28,841.89]锛宧tml椤甸潰鐢熸垚鐨刢anvas鍦╬df涓浘鐗囩殑瀹介珮 + var imgWidth = 515.28;//595.28//宸﹀彸杈硅窛20 + var imgHeight = 515.28/contentWidth * contentHeight;//宸﹀彸杈硅窛20 + + var pageData = canvas.toDataURL('image/jpeg', 1.0); + + var pdf = new jsPDF('', 'pt', 'a4'); + + //鏈変袱涓珮搴﹂渶瑕佸尯鍒嗭紝涓�涓槸html椤甸潰鐨勫疄闄呴珮搴︼紝鍜岀敓鎴恜df鐨勯〉闈㈤珮搴�(841.89) + //褰撳唴瀹规湭瓒呰繃pdf涓�椤垫樉绀虹殑鑼冨洿锛屾棤闇�鍒嗛〉 + if (leftHeight < pageHeight) { + pdf.addImage(pageData, 'JPEG', 40, 0, imgWidth, imgHeight );//宸﹀彸杈硅窛20 + } else { + while(leftHeight > 0) { + pdf.addImage(pageData, 'JPEG', 40, position, imgWidth, imgHeight)//宸﹀彸杈硅窛20 + leftHeight -= pageHeight; + position -= 841.89; + //閬垮厤娣诲姞绌虹櫧椤� + if(leftHeight > 0) { + pdf.addPage(); + } + } + } + Fun(pdf); + } + }) + } + + //blockme(); + document.body.onload = function(){ + + AWSService.query(staticResources.queryUrl, '{!qr.AWS_Data_Id__c}', function(data){ + //unblockUI(); + document.getElementById("Responsible_Person_HP__c").innerHTML = data.object.responsiblePersonHP; + document.getElementById("Caller_phone__c").innerHTML = data.object.callerPhone; + + jsPdfDownload(); + }, staticResources.token); + + } +</script> +<!-- 20220221 PI鏀归�� by 寰愪寒 end --> </html> </apex:page> \ No newline at end of file -- Gitblit v1.9.1