Browse Source

change the position of downloadExcel

sunyj 8 năm trước cách đây
mục cha
commit
1c75a1d6f0
1 tập tin đã thay đổi với 36 bổ sung36 xóa
  1. 36 36
      src/main/webapp/resources/js/preview/app.js

+ 36 - 36
src/main/webapp/resources/js/preview/app.js

@@ -134,39 +134,6 @@ $("#downloadExcelData").click(function () {
 	downloadExcel(true);
 });
 
-/**
- * 下载 excel
- * @param onlyData 是否仅下载数据
- */
-function downloadExcel(onlyData) {
-	$.ajax({
-		type: "get",
-		async: true,
-		url: "print/isUseXlsx",
-		success: function (isUseXlsx) {
-			var excelType;
-			// 根据结果决定使用 xls 还是 xlsx
-			if (isUseXlsx) {
-				if (onlyData) {
-					excelType = "xlsx_data";
-				} else {
-					excelType = "xlsx";
-				}
-			} else {
-				if (onlyData) {
-					excelType = "xls_data";
-				} else {
-					excelType = "xls";
-				}
-			}
-			window.open(downloadUrl(excelType));
-		},
-		error: function (XMLHttpRequest) {
-			showError(XMLHttpRequest);
-		}
-	});
-}
-
 //下载text
 $("#downloadText").click(function() {
 	if (!pdfDoc) {
@@ -287,7 +254,7 @@ function renderPage(pageIndex) {
 
 /**
  * 获取缩放级别(将pdf显示的宽度调整为窗口宽度的multipleOfWindowWidth倍,获取该情况下pdf宽度为原宽度的倍数)
- * 
+ *
  * @param page
  *            pdf数据
  * @param multipleOfWindowWidth
@@ -352,7 +319,7 @@ function printPdf() {
 
 /**
  * 下载报表
- * 
+ *
  * @param exportFileType
  *            导出文件的格式
  * @returns {String} 下载链接
@@ -365,6 +332,39 @@ function downloadUrl(exportFileType) {
 	return downloadUrl;
 }
 
+/**
+ * 下载 excel
+ * @param onlyData 是否仅下载数据
+ */
+function downloadExcel(onlyData) {
+    $.ajax({
+        type: "get",
+        async: true,
+        url: "print/isUseXlsx",
+        success: function (isUseXlsx) {
+            var excelType;
+            // 根据结果决定使用 xls 还是 xlsx
+            if (isUseXlsx) {
+                if (onlyData) {
+                    excelType = "xlsx_data";
+                } else {
+                    excelType = "xlsx";
+                }
+            } else {
+                if (onlyData) {
+                    excelType = "xls_data";
+                } else {
+                    excelType = "xls";
+                }
+            }
+            window.open(downloadUrl(excelType));
+        },
+        error: function (XMLHttpRequest) {
+            showError(XMLHttpRequest);
+        }
+    });
+}
+
 /**
  * 检查浏览器并提示
  */
@@ -379,7 +379,7 @@ function checkBrowser() {
 
 /**
  * 展示错误信息
- * 
+ *
  * @param XMLHttpRequest
  */
 function showError(XMLHttpRequest) {