<apex:page controller="InsReportPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false">
|
<html>
|
<apex:stylesheet value="{!URLFOR($Resource.BeforeOPDPDF)}"/>
|
|
<head>
|
<meta name="viewport" content="width=860,user-scalable=yes" />
|
<style>
|
@page {
|
size: A4 landscape;
|
margin: 5mm 12mm 5mm 12mm;
|
|
@bottom-center {
|
content: counter(page) " / " counter(pages);
|
}
|
}
|
|
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 -->
|
<!-- <td colspan="3" style="text-align: center; font-size: 16pt; font-weight: bold;">点检报告书</td> -->
|
<apex:outputText rendered="{!ir.Contract__c = null}">
|
<td colspan="3" style="text-align: center; font-size: 16pt; font-weight: bold;">点检报告书</td>
|
</apex:outputText>
|
<apex:outputText rendered="{!ir.Contract__c != null}">
|
<td colspan="3" style="text-align: center; font-size: 16pt; font-weight: bold;">合同点检报告书</td>
|
</apex:outputText>
|
|
<!-- update by rentx 20210707 end -->
|
|
</tr>
|
<tr><td colspan="3" height="20px"></td></tr>
|
<apex:outputText rendered="{!ir.Contract__c = null}">
|
<tr>
|
<td>医院名 {!ir.Hospital__r.Name}</td>
|
<td colspan="2">点检报告书号码 {!ir.Name}</td>
|
</tr>
|
<tr>
|
<td>科室名 {!ir.Department_name_formula__c}</td>
|
<td>点检日期</td>
|
<td>点检人</td>
|
</tr>
|
<tr>
|
<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>
|
</apex:outputText>
|
<tr><td colspan="3" height="20px"></td></tr>
|
<apex:outputText rendered="{!ir.Contract__c != null}">
|
<tr>
|
<td />
|
<td colspan="2">合同号 {!ir.Contract__r.Maintenance_Contract_No__c} </td>
|
</tr>
|
<tr>
|
<td> 医院名 {!ir.Hospital__r.Name}</td>
|
<td> 预定点检对象总数 {!ir.Contract__r.dianjiansum__c}</td>
|
</tr>
|
<tr>
|
<td> 科室名 {!ir.Department_name_formula__c}</td>
|
<td> 本次点检对象数 {!ir.Inspection_asset_number__c}</td>
|
</tr>
|
<tr>
|
<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>
|
<td />
|
<td colspan="2"> 本次点检时间 {!ir.StartHour_Page__c}:{!startfen} - {!ir.EndHour_Page__c}:{!endfen} </td>
|
</tr>
|
</apex:outputText>
|
</table>
|
<br/>
|
<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>
|
<td width="50%">点检设备总数 {!ir.Inspection_asset_number__c}</td>
|
<td width="50%">发现异常设备数 {!ir.Failourassetnumber__c}</td>
|
</tr>
|
<tr>
|
<td>维修合同点检设备数 {!ir.Contract_product_number__c}</td>
|
<td>OER点检设备数 {!ir.OER_inspection_number__c}</td>
|
</tr>
|
<tr>
|
<td>本次点检对象数 {!ir.Inspection_asset_number__c}</td>
|
<td/>
|
</tr>
|
</apex:outputText>
|
<apex:outputText rendered="{!ir.Contract__c != null}">
|
<tr>
|
<td width="50%">点检人 {!usr.Alias__c}</td>
|
<td width="50%">发现异常设备数 {!ir.Failourassetnumber__c}</td>
|
</tr>
|
<tr>
|
<td>OER点检设备数 {!ir.OER_inspection_number__c}</td>
|
<td>本次点检对象数 {!ir.Inspection_asset_number__c}</td>
|
</tr>
|
</apex:outputText>
|
<!-- update by rentx 20210707 end -->
|
</table>
|
<br/>
|
|
<apex:variable value="{!1}" var="cnt" />
|
<apex:repeat value="{!itemList}" var="t">
|
<table cellspacing="0" cellpadding="0" border="1" style="width:100%; table-layout: fixed;">
|
<tr>
|
<th width="3%" >No</th>
|
<th >产品名</th>
|
<th width="8%" >机身号</th>
|
<th width="10%" >维修合同对象</th>
|
<th width="12%" >上次修理结束日</th>
|
<th width="8%" >点检结果</th>
|
<th width="25%" >故障描述</th>
|
<!-- add by rentx 20210831 start -->
|
<apex:outputText rendered="{!ir.Contract__c != null}">
|
<th>是否送修</th>
|
</apex:outputText>
|
<!-- add by rentx 20210831 end -->
|
</tr>
|
<apex:variable value="{!1}" var="cnt2" />
|
<apex:repeat value="{!t.detailList}" var="d">
|
<tr>
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.lineNo}</td>
|
<td class="{!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">
|
<table border="0" style="width:100%; table-layout: fixed;">
|
<tr>
|
<td width="30%" style="text-align: right;">{!d.productNo}</td>
|
<td width="1%">{!d.delimiter}</td>
|
<td style="text-align: left;">{!d.productName}</td>
|
</tr>
|
</table>
|
</td>
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.serialNo}</td>
|
<!-- update by rentx 20210903 start 点检报告书上'维修合同'不为空 显示'是' 否则显示 '否' -->
|
<!-- <td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.rec.AssetId__r.Service_Agreement_formula__c}</td> -->
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.isHTsb}</td>
|
|
<!-- update by rentx 20210903 end 点检报告书上'维修合同'不为空 显示'是' 否则显示 '否' -->
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}"><apex:outputText value="{0,date,yyyy/MM/dd}"><apex:param value="{!d.lastRepair}" /></apex:outputText></td>
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.isNormal}</td>
|
<td class="{!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.diagnosis}</td>
|
<!-- add by rentx 20210831 start -->
|
<apex:outputText rendered="{!ir.Contract__c != null}">
|
<td class="middle {!IF(!d.isRecord && cnt2 != 1, 'topClear', '')}">{!d.isSongxiu}</td>
|
</apex:outputText>
|
<!-- add by rentx 20210831 end -->
|
</tr>
|
<apex:variable value="{!cnt2 + 1}" var="cnt2" />
|
</apex:repeat>
|
</table>
|
|
<!-- 改ページ -->
|
<apex:outputPanel layout="none" rendered="{!cnt < itemCount}">
|
<div style="page-break-after: always;"></div>
|
<br/>
|
</apex:outputPanel>
|
|
<apex:variable value="{!cnt + 1}" var="cnt" />
|
</apex:repeat>
|
|
<br/>
|
|
<table style="font-family: Arial Unicode MS;" width="100%">
|
<tr>
|
<th style="text-align: right;" >清洗液</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.CleaningFluid__c}</th>
|
<!-- add by rentx 20210927 start -->
|
<th style="text-align: right;">方式</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.Mode__c}</th>
|
<!-- add by rentx 20210927 end -->
|
<th style="text-align: right;">灭菌方式</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.SterilizationMethod__c}</th>
|
<th style="text-align: right;">其他备注</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.Remarks__c}</th>
|
</tr>
|
<tr>
|
<th style="text-align: right;">消毒液</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.Disinfectant__c}</th>
|
<th style="text-align: right;">使用机器</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.UsedMachine__c}</th>
|
<th style="text-align: right;">使用ET</th>
|
<th style="border:1px solid #000000; width: 15%;text-align: left;">{!ir.Used_ET__c}</th>
|
</tr>
|
</table>
|
|
<!-- サイン -->
|
<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}');
|
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) {
|
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;
|
|
//一页pdf显示html页面生成的canvas高度;
|
var pageHeight = contentWidth / pw * ph;
|
//未生成pdf的html页面高度
|
var leftHeight = contentHeight;
|
//页面偏移
|
var position = 0;
|
//a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
|
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页面的实际高度,和生成pdf的页面高度(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;
|
|
jsPdfDownload();
|
}, staticResources.token);
|
|
}
|
</script>
|
<!-- 20220221 PI改造 by 徐亮 end -->
|
</html>
|
</apex:page>
|