Browse Source

现场收方约定调整修改

TonyKang 3 years ago
parent
commit
b3d02aec60
2 changed files with 88 additions and 13 deletions
  1. 12 0
      app/public/report/js/rpt_print.js
  2. 76 13
      app/view/report/rpt_individual.ejs

+ 12 - 0
app/public/report/js/rpt_print.js

@@ -112,7 +112,19 @@ let rptPrintHelper = {
     individualPreview: function() {
         let params = rptControlObj.creatCommonExportParam([1784]);
         delete sessionStorage.req_params; //删除
+        params.rpt_tpl_id = 1784;
         sessionStorage.req_params = JSON.stringify(params);
+        sessionStorage.qrCodePath = '/public/upload/qr_code/icon-qrcode.png';
+        let replace_key_params = {};
+        replace_key_params['KEY_标段名称'] = '测试标段';
+        replace_key_params['KEY_总承包单位'] = '纵横建造';
+        replace_key_params['KEY_合同段'] = '测试合同段';
+        replace_key_params['KEY_监理单位'] = '纵横监理';
+        replace_key_params['KEY_编号'] = 'ABC_001';
+        replace_key_params['KEY_子目号及子目名称'] = '现场收方1';
+        replace_key_params['KEY_桩号及工程部位'] = '现场收方_桩号1';
+        replace_key_params['KEY_设计工程数量'] = '168668.88';
+        sessionStorage.replace_key_params = JSON.stringify(replace_key_params);
         window.open('/individualReport/A4');
     },
     buildSvgArr: function (pagesData, actAreaArr, offsetX, offsetY, closeWaterMark) {

+ 76 - 13
app/view/report/rpt_individual.ejs

@@ -36,7 +36,68 @@
     const current_stage_status = 3;
     const PAGE_SHOW = {closeWatermark: 0, closeExportPdf: 0, closeExportExcel: 0, showArchive: 0};
     const pdfFont = {'SmartSimsun': [], 'simhei': [], 'simkai': []};
-    let CUST_CFG = null;
+    const CUST_CFG = {
+        "fonts": [
+            {
+                "ID": "ReportTitle_Main",
+                "Name": "宋体",
+                "FontBold": "T",
+                "FontHeight": 32,
+                "FontItalic": "F",
+                "CfgDispName": "表标题",
+                "FontUnderline": "F"
+            },
+            {
+                "ID": "Column",
+                "Name": "宋体",
+                "FontBold": "F",
+                "FontHeight": 12,
+                "FontItalic": "F",
+                "CfgDispName": "列标题",
+                "FontUnderline": "F"
+            },
+            {
+                "ID": "Content",
+                "Name": "宋体",
+                "FontBold": "F",
+                "FontHeight": 12,
+                "FontItalic": "F",
+                "CfgDispName": "正文内容",
+                "FontUnderline": "F"
+            },
+            {
+                "ID": "Total",
+                "Name": "宋体",
+                "FontBold": "F",
+                "FontHeight": 12,
+                "FontItalic": "F",
+                "CfgDispName": "合计",
+                "FontUnderline": "F"
+            },
+            {
+                "ID": "Header",
+                "Name": "宋体",
+                "FontBold": "F",
+                "FontHeight": 12,
+                "FontItalic": "F",
+                "CfgDispName": "表眉/表脚",
+                "FontUnderline": "F"
+            }
+        ],
+        "margins": {
+            "Top": 12,
+            "Left": 15,
+            "Right": 15,
+            "Bottom": 15
+        },
+        "fillZero": false,
+        "isNarrow": false,
+        "borderThick": 2,
+        "showVerticalLine": true,
+        "closeWarterMark": true,
+        "continuousOutput": false
+    };
+    const PAGE_SIZE = '<%- size %>';
     let currentPageRst = null;
     let currentDownloadUrl = null;
     let currentDownloadIdx = 0;
@@ -49,22 +110,23 @@
     function pageLoading() {
         let req_params = JSON.parse(sessionStorage.req_params);
         let params = {};
-        params.pageSize = 'A4';
-        // params.rpt_tpl_id = req_params.refId;
-        params.rpt_tpl_id = 1784;
+         params.rpt_tpl_id = req_params.rpt_tpl_id;
+//        params.rpt_tpl_id = 1784;
+         params.pageSize = PAGE_SIZE;
+//        params.pageSize = 'A4';
         params.project_id = req_params.project_id;
         params.tender_id = req_params.tender_id;
         params.stage_id = req_params.stage_id;
         params.stage_status = 3;
         params.closeWatermark = 1;
-        params.custCfg = req_params.custCfg;
-        CUST_CFG = req_params.custCfg;
+        params.custCfg = CUST_CFG;
 
         CommonAjax.postXsrfEx("/tender/report_api/getReport", params, 300000, true, getCookie('csrfToken_j'),
             function(result){
                 currentPageRst = result.data;
                 _replaceKeyValue(currentPageRst);
-                _addQRCode(currentPageRst, '/public/upload/qr_code/icon-qrcode.png');
+                let qrCodePath = sessionStorage.qrCodePath;
+                _addQRCode(currentPageRst, qrCodePath);
                 let canvas = document.getElementById("rptIndividualCanvas");
 
                 if (currentPageRst && currentPageRst.items && currentPageRst.items.length > 0) {
@@ -94,12 +156,12 @@
     function _replaceKeyValue(pageRst) {
         if (sessionStorage.replace_key_params) {
             let replace_key_params = JSON.parse(sessionStorage.replace_key_params);
-            if (pageRst && pageRst.length > 0) {
-                for (let pageItem of pageRst) {
+            if (pageRst.items && pageRst.items.length > 0) {
+                for (let pageItem of pageRst.items) {
                     for (let cell of pageItem.cells) {
-                        for (let keyP of replace_key_params) {
-                            if (cell.Value === keyP.key) {
-                                cell.Value = keyP.Value;
+                        for (let keyP in replace_key_params) {
+                            if (cell.Value === keyP) {
+                                cell.Value = replace_key_params[keyP];
                             }
                         }
                     }
@@ -116,7 +178,8 @@
                     maxRight = (cell.area.Right > maxRight) ? cell.area.Right : maxRight;
                     minTop = (cell.area.Top < minTop) ? cell.area.Top : minTop;
                 }
-                let offset = pageRst.MergeBand.Top - minTop - 5;
+//                let offset = pageRst.MergeBand.Top - minTop - 5;
+                let offset = 86;
                 let left = maxRight - offset;
                 let bottom = minTop + offset;
                 let signCell = {area: {Left: left, Right: maxRight, Top: minTop, Bottom: bottom}, control: 'Column', path: qrCodePath, pic: null, signature_name: 'dummy_pic', style: 'Default_Normal'};