|
@@ -38,83 +38,70 @@
|
|
|
<script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
|
|
|
<SCRIPT type="text/javascript">
|
|
|
function loading() {
|
|
|
- if (sessionStorage.currentPageData) {
|
|
|
- let pageData = JSON.parse(sessionStorage.currentPageData);
|
|
|
+ if (sessionStorage.multiRptsData) {
|
|
|
+ let multiRptData = JSON.parse(sessionStorage.multiRptsData);
|
|
|
let scaleFactor = parseInt(sessionStorage.scaleFactor);
|
|
|
- $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
|
|
|
- let orgHeight = 793, orgWidth = 1122;
|
|
|
- let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
|
|
|
- if (sessionStorage.pageSize === 'A3') {
|
|
|
- pageHeight = orgWidth * scaleFactor;
|
|
|
- pageWidth = orgHeight * 2 * scaleFactor;
|
|
|
- orgHeight = 1122;
|
|
|
- orgWidth = 793 * 2;
|
|
|
- } else if (sessionStorage.pageSize === '自定义') {
|
|
|
- //自定义
|
|
|
- }
|
|
|
- if (sessionStorage.orientation === "纵向") {
|
|
|
- let tmpInt = pageHeight;
|
|
|
- pageHeight = pageWidth;
|
|
|
- pageWidth = tmpInt;
|
|
|
-
|
|
|
- tmpInt = orgWidth;
|
|
|
- orgWidth = orgHeight;
|
|
|
- orgHeight = tmpInt;
|
|
|
+ let svgArr = [];
|
|
|
+ for (let idx = 0; idx < multiRptData.length; idx++) {
|
|
|
+ let pageData = multiRptData[idx];
|
|
|
+ if (idx === 0) {
|
|
|
+ $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
|
|
|
+ }
|
|
|
+ svgArr = svgArr.concat(rptPrintHelper.buildSvgArr(pageData, -30, -30));
|
|
|
}
|
|
|
-
|
|
|
+ showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
|
|
|
+ window.print();
|
|
|
+ } else if (sessionStorage.currentPageData) {
|
|
|
+ let pageData = JSON.parse(sessionStorage.currentPageData);
|
|
|
+ let scaleFactor = parseInt(sessionStorage.scaleFactor);
|
|
|
let svgArr = rptPrintHelper.buildSvgArr(pageData, -30, -30);
|
|
|
- for (let i = 0; i < pageData.items.length; i++) {
|
|
|
- let div = $('<div class="pageBreak"></div>');
|
|
|
- div.append($(svgArr[i].join("")));
|
|
|
- $("body").append(div);
|
|
|
- }
|
|
|
- $(document.body).find("div").each(function(index,element){
|
|
|
- $(element).find("svg").each(function(cIdx,elementSvg){
|
|
|
- elementSvg.setAttribute('height', pageHeight);
|
|
|
- elementSvg.setAttribute('width', pageWidth);
|
|
|
- });
|
|
|
- });
|
|
|
+ $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
|
|
|
+ showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
|
|
|
window.print();
|
|
|
- } if (sessionStorage.currentPageSvgData) {
|
|
|
+ } else if (sessionStorage.currentPageSvgData) {
|
|
|
let svgArr = JSON.parse(sessionStorage.currentPageSvgData);
|
|
|
let scaleFactor = 1;
|
|
|
- let orgHeight = 793, orgWidth = 1122;
|
|
|
- let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
|
|
|
- if (sessionStorage.pageSize === 'A3') {
|
|
|
- pageHeight = orgWidth * scaleFactor;
|
|
|
- pageWidth = orgHeight * 2 * scaleFactor;
|
|
|
- orgHeight = 1122;
|
|
|
- orgWidth = 793 * 2;
|
|
|
- } else if (sessionStorage.pageSize === '自定义') {
|
|
|
- //自定义
|
|
|
- }
|
|
|
- if (sessionStorage.orientation === "纵向") {
|
|
|
- let tmpInt = pageHeight;
|
|
|
- pageHeight = pageWidth;
|
|
|
- pageWidth = tmpInt;
|
|
|
-
|
|
|
- tmpInt = orgWidth;
|
|
|
- orgWidth = orgHeight;
|
|
|
- orgHeight = tmpInt;
|
|
|
- }
|
|
|
-
|
|
|
- for (let i = 0; i < svgArr.length; i++) {
|
|
|
- let div = $('<div class="pageBreak"></div>');
|
|
|
- div.append($(svgArr[i].join("")));
|
|
|
- $("body").append(div);
|
|
|
- }
|
|
|
- $(document.body).find("div").each(function(index,element){
|
|
|
- $(element).find("svg").each(function(cIdx,elementSvg){
|
|
|
- elementSvg.setAttribute('height', pageHeight);
|
|
|
- elementSvg.setAttribute('width', pageWidth);
|
|
|
- });
|
|
|
- });
|
|
|
+ showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
|
|
|
window.print();
|
|
|
} else {
|
|
|
//alert("没有报表数据!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function showPreviewData(svgArr, scaleFactor, pageSize, orientation) {
|
|
|
+ let orgHeight = 793, orgWidth = 1122;
|
|
|
+ let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
|
|
|
+ if (pageSize === 'A3') {
|
|
|
+ pageHeight = orgWidth * scaleFactor;
|
|
|
+ pageWidth = orgHeight * 2 * scaleFactor;
|
|
|
+ orgHeight = 1122;
|
|
|
+ orgWidth = 793 * 2;
|
|
|
+ } else if (pageSize === '自定义') {
|
|
|
+ //自定义
|
|
|
+ }
|
|
|
+ if (orientation === "纵向") {
|
|
|
+ let tmpInt = pageHeight;
|
|
|
+ pageHeight = pageWidth;
|
|
|
+ pageWidth = tmpInt;
|
|
|
+
|
|
|
+ tmpInt = orgWidth;
|
|
|
+ orgWidth = orgHeight;
|
|
|
+ orgHeight = tmpInt;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (let i = 0; i < svgArr.length; i++) {
|
|
|
+ let div = $('<div class="pageBreak"></div>');
|
|
|
+ div.append($(svgArr[i].join("")));
|
|
|
+ $("body").append(div);
|
|
|
+ }
|
|
|
+ $(document.body).find("div").each(function(index,element){
|
|
|
+ $(element).find("svg").each(function(cIdx,elementSvg){
|
|
|
+ elementSvg.setAttribute('height', pageHeight);
|
|
|
+ elementSvg.setAttribute('width', pageWidth);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function closing() {
|
|
|
//
|
|
|
}
|