Browse Source

预览时预先生成的pdf由5页改为3页

sunyj 9 years ago
parent
commit
039e8bfb25

+ 2 - 2
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -107,8 +107,8 @@ public class PrintServiceImpl implements PrintService {
 		new Thread(new Runnable() {
 		new Thread(new Runnable() {
 			@Override
 			@Override
 			public void run() {
 			public void run() {
-				// 生成之后2~5页的pdf,防止数据量较大的情况下,卡在生成总的pdf阶段,此时查看前5页也不会卡顿
-				for (int i = 2; i <= Math.min(pageSize, 5); i++) {
+				// 生成之后2~3页的pdf,防止数据量较大的情况下,卡在生成总的pdf阶段,此时查看前3页也不会卡顿
+				for (int i = 2; i <= Math.min(pageSize, 3); i++) {
 					createPdfFile(userName, profile, reportName, whereCondition, otherParameters,
 					createPdfFile(userName, profile, reportName, whereCondition, otherParameters,
 							pdfFilePath.replace(".pdf", "_" + i + ".pdf"), i);
 							pdfFilePath.replace(".pdf", "_" + i + ".pdf"), i);
 				}
 				}

+ 2 - 1
src/main/webapp/resources/js/preview2/app.js

@@ -288,7 +288,7 @@ function loadData() {
 	if (!printType || printType == "PREVIEW") {
 	if (!printType || printType == "PREVIEW") {
 		loadPdfDataUrl = loadPdfDataUrl + "&pageIndex=" + 1;
 		loadPdfDataUrl = loadPdfDataUrl + "&pageIndex=" + 1;
 	}
 	}
-	
+	showLoading();
 	$.ajax({
 	$.ajax({
 		type : "get",
 		type : "get",
 		async : false,
 		async : false,
@@ -312,6 +312,7 @@ function loadData() {
 		},
 		},
 		error : function(XMLHttpRequest) {
 		error : function(XMLHttpRequest) {
 			$("#theCanvas").remove();
 			$("#theCanvas").remove();
+			hideLoading();
 			$("#errorMessageContainer").removeAttr("hidden");
 			$("#errorMessageContainer").removeAttr("hidden");
 
 
 			// 处理后台传输的自定义的换行标志
 			// 处理后台传输的自定义的换行标志