|
@@ -1,5 +1,36 @@
|
|
|
-layui.use(['_$'], function() {
|
|
|
-
|
|
|
+let printType = ''
|
|
|
+layui.use(['_$','rightMenu'], function() {
|
|
|
+ var queryParams = new URLSearchParams(window.location.search);
|
|
|
+ // 例如获取查询参数中的key
|
|
|
+ printType = queryParams.get("printType");
|
|
|
+ if(printType && printType === 'task'){
|
|
|
+ let reportId = queryParams.get("id");
|
|
|
+ let serverUrl = queryParams.get("serverUrl");
|
|
|
+ localStorage.setItem('url', serverUrl)
|
|
|
+ indexFn.initPage({
|
|
|
+ reportId: reportId
|
|
|
+ },() =>{
|
|
|
+ let data = {
|
|
|
+ orientation: 2,// 1横向, 2纵向 (前端上传、后端使用)
|
|
|
+ leftMargin: 10,// mm (前端上传、后端使用)
|
|
|
+ rightMargin: 10,// mm (前端上传、后端使用)
|
|
|
+ topMargin: 10,// mm (前端上传、后端使用)
|
|
|
+ bottomMargin: 10,// mm (前端上传、后端使用)
|
|
|
+ printScale: 1,// 1无缩放, 2所有列在一页, 3所有行在一页, 4自定义缩放 (前端上传、后端使用)
|
|
|
+ scale: 100,// 自定义缩放的比例 0-100 (前端上传、后端使用)
|
|
|
+ paperSize: 9,//1 letter, 3 tabloid, 4 ledger, 5 legal, 6 statement, 7 excutive, 8 A3, 9 A4, 11 A5, 12 B4, 13 B5 (前端上传)
|
|
|
+ printArea: '',// B1:B2 (前端上传、后端使用)
|
|
|
+ printQuality: 1,// 1-10 (前端使用,生成Excel)
|
|
|
+ wordQuality: null,// 300 300dpi, 600 600dpi, 1200 1200dpi (前端未上传,后端使用)
|
|
|
+ }
|
|
|
+ layui.excelUtil.xlsxToPdf({
|
|
|
+ data,
|
|
|
+ success: (json) => {
|
|
|
+ console.info("xlsxToPdf", json.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
window.onload = function() {
|
|
@@ -23,7 +54,7 @@ window.onbeforeunload = function() {
|
|
|
}
|
|
|
|
|
|
const indexFn = {
|
|
|
- initPage: (data) => {
|
|
|
+ initPage: (data, callback) => {
|
|
|
luckysheet.destroy()
|
|
|
layui._$.get({
|
|
|
url: '/reportTable/getReportTableById',
|
|
@@ -101,6 +132,7 @@ const indexFn = {
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
+ if(callback) callback()
|
|
|
}
|
|
|
})
|
|
|
}
|