|  | @@ -3,6 +3,7 @@
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  'use strict'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const PRE_PAGE_OFFSET = 150;
 | 
	
		
			
				|  |  |  const NEXT_PAGE_OFFSET = 160;
 | 
	
		
			
				|  |  |  const FIRST_PAGE_OFFSET = 50;
 | 
	
	
		
			
				|  | @@ -28,11 +29,18 @@ let rptTplObj = {
 | 
	
		
			
				|  |  |                  JpcJsPDFHelper.initialize('p', 'pt', 'a4');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //收集本单位工程所属的建设项目下所有单位工程id用
 | 
	
		
			
				|  |  | -            me.project_tree = tree_Data_Helper.buildTreeNodeDirectly(JSON.parse(sessionStorage.getItem('projects_tree_data')), false);
 | 
	
		
			
				|  |  | -            console.log(me.getAllPrjIds());
 | 
	
		
			
				|  |  | -            // projectObj.project.projectInfo.ID
 | 
	
		
			
				|  |  | -            // dynamicLoadJs('/lib/jspdf/SmartSimsun-normal.js');
 | 
	
		
			
				|  |  | -            // dynamicLoadJs('/lib/jspdf/SmartSimsun-bold.js', me.pdfFontSimsunCallBack);
 | 
	
		
			
				|  |  | +            // GetAllProjectData(function (datas) {
 | 
	
		
			
				|  |  | +            //     //
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  | +            let params = {
 | 
	
		
			
				|  |  | +                rootProjectID: projectObj.project.property.rootProjectID,
 | 
	
		
			
				|  |  | +                user_id: userID
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            CommonAjax.post("pm/api/getAllUnitProjects", params, function(result) {
 | 
	
		
			
				|  |  | +                // console.log(result);
 | 
	
		
			
				|  |  | +                me.project_tree = result;
 | 
	
		
			
				|  |  | +                // console.log(me.getAllPrjIds());
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      
 | 
	
	
		
			
				|  | @@ -40,32 +48,8 @@ let rptTplObj = {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  |          let rst = [];
 | 
	
		
			
				|  |  |          if (me.project_tree) {
 | 
	
		
			
				|  |  | -            const _chkIfHasCurrentPrjId = function(nodeItem) {
 | 
	
		
			
				|  |  | -                let chkRst = (nodeItem.ID === projectObj.project.projectInfo.ID);
 | 
	
		
			
				|  |  | -                if (!chkRst && nodeItem.items && nodeItem.items.length > 0) {
 | 
	
		
			
				|  |  | -                    for (const subItem of nodeItem.items) {
 | 
	
		
			
				|  |  | -                        chkRst = _chkIfHasCurrentPrjId(subItem);
 | 
	
		
			
				|  |  | -                        if (chkRst) {
 | 
	
		
			
				|  |  | -                            break;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                return chkRst;
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -            const _retrievAllDtlPrjIds = function(parentNode) {
 | 
	
		
			
				|  |  | -                if (parentNode.items === null || parentNode.items === undefined || parentNode.items.length === 0) {
 | 
	
		
			
				|  |  | -                    rst.push(parentNode.ID);
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    for (const subNode of parentNode.items) {
 | 
	
		
			
				|  |  | -                        _retrievAllDtlPrjIds(subNode);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -            for (let topNode of me.project_tree) {
 | 
	
		
			
				|  |  | -                if (_chkIfHasCurrentPrjId(topNode)) {
 | 
	
		
			
				|  |  | -                    _retrievAllDtlPrjIds(topNode);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +            for (let prj of me.project_tree) {
 | 
	
		
			
				|  |  | +                rst.push(prj.ID);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return rst;
 | 
	
	
		
			
				|  | @@ -262,7 +246,7 @@ let zTreeOprObj = {
 | 
	
		
			
				|  |  |      onCheck: function(event, treeId, treeNode) {
 | 
	
		
			
				|  |  |          zTreeOprObj.countChkedRptTpl();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    onClick: function(event,treeId,treeNode) {
 | 
	
		
			
				|  |  | +    onClick: async function(event,treeId,treeNode) {
 | 
	
		
			
				|  |  |          let me = zTreeOprObj;
 | 
	
		
			
				|  |  |          if (treeNode.nodeType === TPL_TYPE_TEMPLATE && treeNode.refId > 0) {
 | 
	
		
			
				|  |  |              let params = {};
 | 
	
	
		
			
				|  | @@ -273,9 +257,19 @@ let zTreeOprObj = {
 | 
	
		
			
				|  |  |              params.custCfg = me.reportPageCfg;
 | 
	
		
			
				|  |  |              params.flag = null;
 | 
	
		
			
				|  |  |              if (treeNode.hasOwnProperty('flags')) {
 | 
	
		
			
				|  |  | +                if (treeNode.flags.hasOwnProperty('auditType') && treeNode.flags.auditType === 'audit_compare') {
 | 
	
		
			
				|  |  | +                    let pids = await compareObject.getCompareID();
 | 
	
		
			
				|  |  | +                    if (pids !== null && pids.length > 0) {
 | 
	
		
			
				|  |  | +                        params.prj_ids = pids;
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        // params.prj_ids = [25062, 25082]; // hard code 测试项目:酉阳县东部沿海产业转移承接基地建设项目(一期)一标段 + 审定
 | 
	
		
			
				|  |  | +                        alert('未设置审核对比项目!');
 | 
	
		
			
				|  |  | +                        exit;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    params.prj_ids = rptTplObj.getAllPrjIds();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  params.flag = treeNode.flags;
 | 
	
		
			
				|  |  | -                params.prj_ids = rptTplObj.getAllPrjIds();
 | 
	
		
			
				|  |  | -                // params.prj_ids = [projectObj.project.projectInfo.ID]; //测试
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              me.currentNode = treeNode;
 | 
	
		
			
				|  |  |              me.requestReport(params);
 | 
	
	
		
			
				|  | @@ -612,10 +606,10 @@ let rptControlObj = {
 | 
	
		
			
				|  |  |              me.getPDFEx();
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              $("#ini_PDF_Btn").trigger("click");
 | 
	
		
			
				|  |  | -            dynamicLoadJs('/lib/jspdf/SmartSimsun-normal.js',"normal", me.getPdfFontCallback);
 | 
	
		
			
				|  |  | -            dynamicLoadJs('/lib/jspdf/SmartSimsun-bold.js',"bold", me.getPdfFontCallback);
 | 
	
		
			
				|  |  | -            // dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', me.getPdfFontCallback);
 | 
	
		
			
				|  |  | -            // dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', me.getPdfFontCallback);
 | 
	
		
			
				|  |  | +            // dynamicLoadJs('/lib/jspdf/SmartSimsun-normal.js',"normal", me.getPdfFontCallback);
 | 
	
		
			
				|  |  | +            // dynamicLoadJs('/lib/jspdf/SmartSimsun-bold.js',"bold", me.getPdfFontCallback);
 | 
	
		
			
				|  |  | +            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', me.getPdfFontCallback);
 | 
	
		
			
				|  |  | +            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', me.getPdfFontCallback);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getPDFEx: function () {
 | 
	
	
		
			
				|  | @@ -842,4 +836,28 @@ function dynamicLoadCss(url) {
 | 
	
		
			
				|  |  |      link.rel = 'stylesheet';
 | 
	
		
			
				|  |  |      link.href = url;
 | 
	
		
			
				|  |  |      head.appendChild(link);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function _getCommonParams(treeNode) {
 | 
	
		
			
				|  |  | +    let rstParmas = {};
 | 
	
		
			
				|  |  | +    rstParmas.pageSize = rptControlObj.getCurrentPageSize();
 | 
	
		
			
				|  |  | +    rstParmas.rpt_tpl_id = treeNode.refId;
 | 
	
		
			
				|  |  | +    if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
 | 
	
		
			
				|  |  | +        let refRptTplIds = [];
 | 
	
		
			
				|  |  | +        for (let node of zTreeOprObj.checkedRptTplNodes) {
 | 
	
		
			
				|  |  | +            refRptTplIds.push(node.refId);
 | 
	
		
			
				|  |  | +            let flag = null;
 | 
	
		
			
				|  |  | +            if (node.hasOwnProperty('flags')) {
 | 
	
		
			
				|  |  | +                flag = node.flags;
 | 
	
		
			
				|  |  | +                params.prj_ids = rptTplObj.getAllPrjIds();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            flags.push(flag);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        params.rpt_ids = refRptTplIds;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    params.prj_id = projectObj.project.projectInfo.ID;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    rstParmas.prj_id = projectObj.project.projectInfo.ID;
 | 
	
		
			
				|  |  | +    // rstParmas.custCfg = me.reportPageCfg;
 | 
	
		
			
				|  |  | +    return rstParmas;
 | 
	
		
			
				|  |  |  }
 |