Browse Source

审核比对表打印补漏

TonyKang 4 năm trước cách đây
mục cha
commit
e0c8f477f3

+ 3 - 3
modules/reports/controllers/rpt_controller.js

@@ -444,7 +444,7 @@ module.exports = {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
             let id = rpt_ids[idx], r_flag = flags[idx];
             let id = rpt_ids[idx], r_flag = flags[idx];
             let f_prj_ids = prj_ids;
             let f_prj_ids = prj_ids;
-            if (r_flag.auditType === 'audit_compare') {
+            if (r_flag !== undefined && r_flag !== null && r_flag.auditType === 'audit_compare') {
                 f_prj_ids = compare_ids[idx];
                 f_prj_ids = compare_ids[idx];
             }
             }
             parallelFunctions.push((function (rpt_id, flag) {
             parallelFunctions.push((function (rpt_id, flag) {
@@ -516,7 +516,7 @@ module.exports = {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
             let r_id = rpt_ids[idx], r_flag = flags[idx];
             let r_id = rpt_ids[idx], r_flag = flags[idx];
             let f_prj_ids = prj_ids;
             let f_prj_ids = prj_ids;
-            if (r_flag.auditType === 'audit_compare') {
+            if (r_flag !== undefined && r_flag !== null && r_flag.auditType === 'audit_compare') {
                 f_prj_ids = compare_ids[idx];
                 f_prj_ids = compare_ids[idx];
             }
             }
             parallelFunctions.push((function (rpt_id, flag) {
             parallelFunctions.push((function (rpt_id, flag) {
@@ -563,7 +563,7 @@ module.exports = {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
         for (let idx = 0; idx < rpt_ids.length; idx++) {
             let r_id = rpt_ids[idx], r_flag = flags[idx];
             let r_id = rpt_ids[idx], r_flag = flags[idx];
             let f_prj_ids = prj_ids;
             let f_prj_ids = prj_ids;
-            if (r_flag.auditType === 'audit_compare') {
+            if (r_flag !== undefined && r_flag !== null && r_flag.auditType === 'audit_compare') {
                 f_prj_ids = compare_ids[idx];
                 f_prj_ids = compare_ids[idx];
             }
             }
             let r_name = rpt_names[idx];
             let r_name = rpt_names[idx];

+ 8 - 0
web/building_saas/report/js/rpt_main.js

@@ -470,6 +470,8 @@ let rptControlObj = {
                     } else {
                     } else {
                         compare_ids.push([]);
                         compare_ids.push([]);
                     }
                     }
+                } else {
+                    compare_ids.push([]);
                 }
                 }
                 flags.push(flag);
                 flags.push(flag);
             }
             }
@@ -528,6 +530,8 @@ let rptControlObj = {
                     } else {
                     } else {
                         compare_ids.push([]);
                         compare_ids.push([]);
                     }
                     }
+                } else {
+                    compare_ids.push([]);
                 }
                 }
                 flags.push(flag);
                 flags.push(flag);
             }
             }
@@ -605,6 +609,8 @@ let rptControlObj = {
                     } else {
                     } else {
                         compare_ids.push([]);
                         compare_ids.push([]);
                     }
                     }
+                } else {
+                    compare_ids.push([]);
                 }
                 }
                 flags.push(flag);
                 flags.push(flag);
             }
             }
@@ -680,6 +686,8 @@ let rptControlObj = {
                     } else {
                     } else {
                         compare_ids.push([]);
                         compare_ids.push([]);
                     }
                     }
+                } else {
+                    compare_ids.push([]);
                 }
                 }
                 flagsArr.push(flag);
                 flagsArr.push(flag);
             }
             }

+ 16 - 2
web/building_saas/report/js/rpt_print.js

@@ -3,9 +3,9 @@
  */
  */
 
 
 let rptPrintHelper = {
 let rptPrintHelper = {
-    preview: function () {
+    preview: async function () {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
-            let rptIds = [], flags = [];
+            let rptIds = [], flags = [], compare_ids = [];
             let params = {};
             let params = {};
             params.pageSize = rptControlObj.getCurrentPageSize();
             params.pageSize = rptControlObj.getCurrentPageSize();
             params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:rptControlObj.getCurrentOrientation());
             params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:rptControlObj.getCurrentOrientation());
@@ -17,10 +17,24 @@ let rptPrintHelper = {
                 if (tplNode.hasOwnProperty('flags')) {
                 if (tplNode.hasOwnProperty('flags')) {
                     flag = tplNode.flags;
                     flag = tplNode.flags;
                     params.prj_ids = rptTplObj.getAllPrjIds();
                     params.prj_ids = rptTplObj.getAllPrjIds();
+                    if (flag.auditType === 'audit_compare') {
+                        let pids = [];
+                        let comp_pid = await compareObject.getCompareID(); //返回单个对应的project ID
+                        if (comp_pid !== null) {
+                            pids.push(projectObj.project.projectInfo.ID);
+                            pids.push(comp_pid);
+                        }
+                        compare_ids.push(pids);
+                    } else {
+                        compare_ids.push([]);
+                    }
+                } else {
+                    compare_ids.push([]);
                 }
                 }
                 flags.push(flag);
                 flags.push(flag);
             }
             }
             params.rpt_ids = rptIds.join(",");
             params.rpt_ids = rptIds.join(",");
+            params.compare_ids = compare_ids;
             params.flags = flags;
             params.flags = flags;
             CommonAjax.postEx("report_api/getMultiReports", params, 10000, true,
             CommonAjax.postEx("report_api/getMultiReports", params, 10000, true,
                 function(result){
                 function(result){