| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748 | 
							- /**
 
-  * Created by Tony on 2017/6/26.
 
-  */
 
- 'use strict'
 
- const PRE_PAGE_OFFSET = 150;
 
- const NEXT_PAGE_OFFSET = 160;
 
- const FIRST_PAGE_OFFSET = 50;
 
- const LAST_PAGE_OFFSET = 60;
 
- const WAIT_TIME_EXPORT = 12000;
 
- let fontSuffixMapObj = {"表标题": "title", "列标题": "column", "正文内容": "content", "合计": "summary", "表眉/表脚": "header_footer"};
 
- let rptTplObj = {
 
-     hasInitialized: false,
 
-     iniPage: function() {
 
-         let me = this;
 
-         if (!me.hasInitialized) {
 
-             // zTreeOprObj.getCustomerCfg();
 
-             zTreeOprObj.getReportTemplateTree();
 
-             zTreeOprObj.selectedPrjIDs = [];
 
-             me.hasInitialized = true;
 
-             zTreeOprObj.canvas = document.getElementById("rptCanvas");
 
-             // canvas.onclick = canvasOprObj.canvasOnClick;
 
-             // canvas.onmousemove = canvasOprObj.canvasOnMouseMove;
 
-         }
 
-     }
 
- }
 
- let zTreeOprObj = {
 
-     treeObj: null,
 
-     prjFolderTreeObj: null,
 
-     currentNode: null,
 
-     checkedRptTplNodes: null,
 
-     currentRptPageRst: null,
 
-     defReportPageCfg: null,
 
-     currentPage: 1,
 
-     maxPages: 0,
 
-     canvas: null,
 
-     selectedPrjIDs: [],
 
-     countChkedRptTpl: function () {
 
-         let me = zTreeOprObj;
 
-         if (me.treeObj) {
 
-             me.checkedRptTplNodes = [];
 
-             let chkNodes = me.treeObj.getCheckedNodes(true), cnt = 0, hasCurrentNode = false;
 
-             for (let node of chkNodes) {
 
-                 if (node.nodeType === TPL_TYPE_TEMPLATE) {
 
-                     cnt++;
 
-                     me.checkedRptTplNodes.push(node);
 
-                     if (me.currentNode === node) hasCurrentNode = true;
 
-                 }
 
-             }
 
-             if (!hasCurrentNode && cnt === 0 && me.currentNode !== null) {
 
-                 //这里根据实际需求再做处理
 
-                 cnt++;
 
-                 me.checkedRptTplNodes.push(me.currentNode);
 
-             }
 
-             $("#print_div").find("span").each(function(cIdx,elementSpan){
 
-                 elementSpan.innerText = cnt;
 
-             });
 
-             $("#export_div").find("span").each(function(cIdx,elementSpan){
 
-                 elementSpan.innerText = cnt;
 
-             });
 
-         }
 
-     },
 
-     getReportTemplateTree: function() {
 
-         let me = zTreeOprObj;
 
-         let private_remove_hide_item = function (items, nlv) {
 
-             if (items && items.length > 0) {
 
-                 for (let i = items.length - 1; i >= 0; i--) {
 
-                     if (!(items[i].released) && items[i].nodeType === 2) {
 
-                         items.splice(i, 1);
 
-                     } else {
 
-                         if (items[i].items && items[i].items.length > 0) {
 
-                             private_remove_hide_item(items[i].items, nlv + 1);
 
-                             if (items[i].items.length === 0 && nlv > 0) {
 
-                                 items.splice(i, 1);
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         };
 
-         let nodeLv = 0;
 
-         private_remove_hide_item(topTreeNodesValue, nodeLv);
 
-         zTreeHelper.createTreeDirectly(topTreeNodesValue, rpt_tpl_setting, "rptTplTree", me);
 
-         me.refreshNodes();
 
-     },
 
-     iniFontCfgDom: function (cfg) {
 
-         for (let font of cfg.fonts) {
 
-             let domArrs = [];
 
-             let fontPropSuffix = fontSuffixMapObj[font.CfgDispName];
 
-             domArrs.push("<div class='row mb-1'>");
 
-             //1. label
 
-             domArrs.push("<div class='col-3'>" + font.CfgDispName + "</div>");
 
-             //2. font name
 
-             domArrs.push("<div class='col-3'>");
 
-             domArrs.push("<select class='form-control input-sm' id='fontName_" + fontPropSuffix + "' onchange='rptControlObj.changeFontMain(\"" + font.CfgDispName + "\", \"Name\", this)'>");
 
-             domArrs.push("<option>宋体</option><option>楷体</option><option>黑体</option>");
 
-             domArrs.push("</select>");
 
-             domArrs.push("</div>");
 
-             //3. font height
 
-             domArrs.push("<div class='col-3'>");
 
-             domArrs.push("<input class='form-control input-sm' id='fontHeight_" + fontPropSuffix + "' type='number' value='30' step='1' min='6' max='66' " +
 
-                 "onchange='rptControlObj.changeFontMain(\"" + font.CfgDispName + "\", \"FontHeight\", this)' " +
 
-                 "onkeyup='rptControlObj.changeFontMain(\"" + font.CfgDispName + "\", \"FontHeight\", this)'>");
 
-             domArrs.push("</div>");
 
-             //4. font bold italic underline
 
-             domArrs.push("<div class='col-3'>");
 
-             domArrs.push("<a id='font_bold_" + fontPropSuffix + "' class='btn btn-sm btn-outline-secondary' title='加粗' onclick='rptControlObj.changeFontAdhoc(\"" + font.CfgDispName + "\", \"FontBold\", this)'><i class='fa fa-bold'></i></a>");
 
-             domArrs.push("<a id='font_italic_" + fontPropSuffix + "' class='btn btn-sm btn-outline-secondary' title='斜体' onclick='rptControlObj.changeFontAdhoc(\"" + font.CfgDispName + "\", \"FontItalic\", this)'><i class='fa fa-italic'></i></a>");
 
-             domArrs.push("<a id='font_underline_" + fontPropSuffix + "' class='btn btn-sm btn-outline-secondary' title='下划线' onclick='rptControlObj.changeFontAdhoc(\"" + font.CfgDispName + "\", \"FontUnderline\", this)'><i class='fa fa-underline'></i></a>");
 
-             domArrs.push("</div>");
 
-             //
 
-             domArrs.push("</div>");
 
-             $(domArrs.join("")).insertBefore($("#font_cfg_blank_flag"));
 
-         }
 
-     },
 
-     renderRptCfg: function (cfg) {
 
-         $("#elementMargin_Left").get(0).value = cfg.margins.Left;
 
-         $("#elementMargin_Right").get(0).value = cfg.margins.Right;
 
-         $("#elementMargin_Top").get(0).value = cfg.margins.Top;
 
-         $("#elementMargin_Bottom").get(0).value = cfg.margins.Bottom;
 
-         for (let font of cfg.fonts) {
 
-             let fontPropSuffix = fontSuffixMapObj[font.CfgDispName];
 
-             document.getElementById("fontName_" + fontPropSuffix).value = font.Name;
 
-             document.getElementById("fontHeight_" + fontPropSuffix).value = font.FontHeight;
 
-             document.getElementById("font_bold_" + fontPropSuffix).className = (font.FontBold === "T")?"btn btn-sm btn-outline-secondary active":"btn btn-sm btn-outline-secondary";
 
-             document.getElementById("font_italic_" + fontPropSuffix).className = (font.FontItalic === "T")?"btn btn-sm btn-outline-secondary active":"btn btn-sm btn-outline-secondary";
 
-             document.getElementById("font_underline_" + fontPropSuffix).className = (font.FontUnderline === "T")?"btn btn-sm btn-outline-secondary active":"btn btn-sm btn-outline-secondary";
 
-         }
 
-         document.getElementById("rpt_vertical_line").checked = cfg.showVerticalLine;
 
-         document.getElementById("rpt_narrow").checked = cfg.isNarrow;
 
-         // document.getElementById("rpt_narrow").checked = false;
 
-         document.getElementById("rpt_fill_zero").checked = cfg.fillZero;
 
-     },
 
-     extractRptCfg: function (cfg) {
 
-         cfg.margins.Left = $("#elementMargin_Left").get(0).value;
 
-         cfg.margins.Right = $("#elementMargin_Right").get(0).value;
 
-         cfg.margins.Top = $("#elementMargin_Top").get(0).value;
 
-         cfg.margins.Bottom = $("#elementMargin_Bottom").get(0).value;
 
-         for (let font of cfg.fonts) {
 
-             let fontPropSuffix = fontSuffixMapObj[font.CfgDispName];
 
-             font.Name = document.getElementById("fontName_" + fontPropSuffix).value;
 
-             font.FontHeight = document.getElementById("fontHeight_" + fontPropSuffix).value;
 
-             font.FontBold = (document.getElementById("font_bold_" + fontPropSuffix).className === "btn btn-sm btn-outline-secondary active")?"T":"F";
 
-             font.FontItalic = (document.getElementById("font_italic_" + fontPropSuffix).className === "btn btn-sm btn-outline-secondary active")?"T":"F";
 
-             font.FontUnderline = (document.getElementById("font_underline_" + fontPropSuffix).className === "btn btn-sm btn-outline-secondary active")?"T":"F";
 
-         }
 
-         cfg.showVerticalLine = document.getElementById("rpt_vertical_line").checked;
 
-         cfg.isNarrow = document.getElementById("rpt_narrow").checked;
 
-         cfg.fillZero = document.getElementById("rpt_fill_zero").checked;
 
-     },
 
-     refreshNodes: function() {
 
-         let me = this;
 
-         let private_setupIsParent = function(node){
 
-             node.isParent = (node.nodeType === RT.NodeType.NODE || node.level === 0);
 
-             if (node.items && node.items.length) {
 
-                 for (let i = 0; i < node.items.length; i++) {
 
-                     private_setupIsParent(node.items[i]);
 
-                 }
 
-             }
 
-         };
 
-         let topNodes = me.treeObj.getNodes();
 
-         for (let i = 0; i < topNodes.length; i++) {
 
-             private_setupIsParent(topNodes[i]);
 
-         }
 
-         me.treeObj.refresh();
 
-     },
 
-     onCheck: function(event, treeId, treeNode) {
 
-         zTreeOprObj.countChkedRptTpl();
 
-     },
 
-     onClick: function(event,treeId,treeNode) {
 
-         let me = zTreeOprObj;
 
-         if (treeNode.nodeType === TPL_TYPE_TEMPLATE && treeNode.refId > 0) {
 
-             me.currentNode = treeNode;
 
-             let params = {};
 
-             let pageSize = rptControlObj.getCurrentPageSize();
 
-             params.pageSize = pageSize;
 
-             params.rpt_tpl_id = treeNode.refId;
 
-             params.project_id = PROJECT_ID;
 
-             params.tender_id = TENDER_ID;
 
-             params.stage_id = getStageId();
 
-             params.stage_order = getStageOrder();
 
-             params.stage_times = getStageTimes();
 
-             params.custCfg = CUST_CFG;
 
-             me.requestNormalReport(params);
 
-             me.countChkedRptTpl();
 
-         }
 
-     },
 
-     changePageSize: function(dom) {
 
-         let me = zTreeOprObj,
 
-             targetDom = document.getElementById("btnRptPageSize");
 
-         let tmpStr = targetDom.innerHTML.trim();
 
-         targetDom.innerHTML = dom.innerHTML.trim();
 
-         dom.innerHTML = tmpStr;
 
-         me.changeCfg();
 
-     },
 
-     changeOrientation: function(dom) {
 
-         let me = zTreeOprObj,
 
-             targetDom = document.getElementById("btnRptOrientation");
 
-         let tmpStr = targetDom.innerHTML.trim();
 
-         targetDom.innerHTML = dom.innerHTML.trim();
 
-         dom.innerHTML = tmpStr;
 
-         me.changeCfg();
 
-     },
 
-     changeCfg: function() {
 
-         let me = zTreeOprObj;
 
-         if (me.currentNode) {
 
-             let params = {};
 
-             params.pageSize = rptControlObj.getCurrentPageSize();
 
-             params.orientation = rptControlObj.getCurrentOrientation();
 
-             params.rpt_tpl_id = me.currentNode.refId;
 
-             params.custCfg = CUST_CFG;
 
-             params.project_id = PROJECT_ID;
 
-             params.tender_id = TENDER_ID;
 
-             params.stage_id = getStageId();
 
-             params.stage_order = getStageOrder();
 
-             params.stage_times = getStageTimes();
 
-             me.requestNormalReport(params);
 
-         }
 
-     },
 
-     resetAfter: function (pageRst) {
 
-         let size = pageRst[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE].slice(0);
 
-         if (size[0] > size[1]) {
 
-             document.getElementById("btnRptOrientation").innerHTML = "横向";
 
-             document.getElementById("hrefRptOrientation").innerHTML = "纵向";
 
-         } else {
 
-             document.getElementById("btnRptOrientation").innerHTML = "纵向";
 
-             document.getElementById("hrefRptOrientation").innerHTML = "横向";
 
-         }
 
-     },
 
-     requestNormalReport: function (params) {
 
-         let me = zTreeOprObj;
 
-         // hintBox.waitBox();
 
-         CommonAjax.postXsrfEx("/tender/report_api/getReport", params, 60000, true, getCookie('csrfToken'),
 
-             function(result){
 
-                 // hintBox.unWaitBox();
 
-                 let pageRst = result.data;
 
-                 if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
 
-                     CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
 
-                     ROLE_REL_LIST = JSON.parse(result.signatureRelInfo[0].rel_content);
 
-                     for (const page of pageRst.items) {
 
-                         if (page.signature_cells) {
 
-                             for (const sCell of page.signature_cells) {
 
-                                 for (const role_rel of ROLE_REL_LIST) {
 
-                                     if (role_rel.signature_name === sCell.signature_name) {
 
-                                         sCell.path = role_rel.sign_path;
 
-                                         sCell.pre_path = role_rel.sign_path;
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                 } else {
 
-                     CURRENT_ROLE_REL_ID = -1;
 
-                     ROLE_REL_LIST = [];
 
-                 }
 
-                 // if (ROLE_REL_LIST)
 
-                 let canvas = zTreeOprObj.canvas;
 
-                 if (pageRst && pageRst.items && pageRst.items.length > 0) {
 
-                     me.resetAfter(pageRst);
 
-                     me.currentRptPageRst = pageRst;
 
-                     me.maxPages = pageRst.items.length;
 
-                     me.currentPage = 1;
 
-                     me.displayPageValue();
 
-                     let size = JpcCanvasOutput.getReportSizeInPixel(me.currentRptPageRst, getScreenDPI());
 
-                     canvas.width = size[0] + 20;
 
-                     if (size[1] > size[0]) {
 
-                         canvas.height = size[1] + 100;
 
-                     } else {
 
-                         canvas.height = size[1] + 50;
 
-                     }
 
-                     // zTreeOprObj.resetESignature(zTreeOprObj.currentRptPageRst);
 
-                     rptSignatureHelper.buildSelectableAccount();
 
-                     rptSignatureHelper.buildRoleDom(ROLE_LIST);
 
-                     me.showPage(1, canvas);
 
-                 } else {
 
-                     //返回了无数据表
 
-                     JpcCanvasOutput.cleanCanvas(canvas);
 
-                     JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
 
-                 }
 
-             }, function(err){
 
-                 // hintBox.unWaitBox();
 
-             }, function(ex){
 
-                 // hintBox.unWaitBox();
 
-             }
 
-         );
 
-     },
 
-     scaleReport: function (accScale) {
 
-         let me = zTreeOprObj;
 
-         let canvas = zTreeOprObj.canvas;
 
-         if (accScale !== 0) {
 
-             JpcCanvasOutput.scaleFactor += accScale;
 
-             if (JpcCanvasOutput.scaleFactor < 0.5) JpcCanvasOutput.scaleFactor = 0.5;
 
-             if (JpcCanvasOutput.scaleFactor > 1.5) JpcCanvasOutput.scaleFactor = 1.5;
 
-         } else {
 
-             JpcCanvasOutput.scaleFactor = 1;
 
-         }
 
-         document.getElementById("btnNormalScale").innerText = (JpcCanvasOutput.scaleFactor * 100) + '%';
 
-         me.showPage(me.currentPage, canvas);
 
-     },
 
-     requestPrjFolderCommon: function () {
 
-         //
 
-     },
 
-     showPage: function (pageNum, canvas) {
 
-         let me = zTreeOprObj;
 
-         if (pageNum >= 1 && pageNum <= me.maxPages) {
 
-             me.currentPage = pageNum;
 
-             JpcCanvasOutput.cleanCanvas(canvas);
 
-             JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
 
-             JpcCanvasOutput.drawToCanvas(me.currentRptPageRst, canvas, me.currentPage);
 
-         }
 
-         me.displayPageValue();
 
-     },
 
-     displayPageValue: function() {
 
-         let me = zTreeOprObj;
 
-         $("#rpt_page_num").get(0).value = me.currentPage + "/" + me.maxPages;
 
-     }
 
- };
 
- let canvasOprObj = {
 
-     canvasOnMouseMove: function (event) {
 
-         if (zTreeOprObj.currentNode) {
 
-             let x = event.offsetX - JpcCanvasOutput.offsetX, canvas = event.originalTarget;
 
-             if (!(canvas)) canvas = event.target; //chrome浏览器不认event.originalTarget,只认event.target或event.currentTarget
 
-             if (x < FIRST_PAGE_OFFSET) {
 
-                 canvas.style.cursor = "url(/web/building_saas/img/FirstPageSimple.cur), auto";
 
-             } else if (x < PRE_PAGE_OFFSET) {
 
-                 canvas.style.cursor = "url(/web/building_saas/img/PreviousPageSimple.cur), auto";
 
-             } else if ((canvas.width - x) < LAST_PAGE_OFFSET) {
 
-                 canvas.style.cursor = "url(/web/building_saas/img/LastPageSimple.cur), auto";
 
-             } else if ((canvas.width - x) < NEXT_PAGE_OFFSET) {
 
-                 canvas.style.cursor = "url(/web/building_saas/img/NextPageSimple.cur), auto";
 
-             } else {
 
-                 canvas.style.cursor = "";
 
-             }
 
-         }
 
-     },
 
-     canvasOnClick: function(event){
 
-         if (zTreeOprObj.currentNode) {
 
-             let x = event.offsetX - JpcCanvasOutput.offsetX, canvas = event.originalTarget;
 
-             if (!(canvas)) canvas = event.target; //chrome浏览器不认event.originalTarget,只认event.target或event.currentTarget
 
-             if (x < FIRST_PAGE_OFFSET) {
 
-                 zTreeOprObj.showPage(1, canvas);
 
-             } else if (x < PRE_PAGE_OFFSET) {
 
-                 zTreeOprObj.showPage(zTreeOprObj.currentPage - 1, canvas);
 
-             } else if ((canvas.width - x) < LAST_PAGE_OFFSET) {
 
-                 zTreeOprObj.showPage(zTreeOprObj.maxPages, canvas);
 
-             } else if ((canvas.width - x) < NEXT_PAGE_OFFSET) {
 
-                 zTreeOprObj.showPage(zTreeOprObj.currentPage + 1, canvas);
 
-             }
 
-         }
 
-     }
 
- };
 
- let rptControlObj = {
 
-     currentOutputType: "Excel",
 
-     currentDownloadUrl: null,
 
-     currentDownloadIdx: 0,
 
-     getCurrentPageSize: function() {
 
-         // let rst = "A4";
 
-         let rst = document.getElementById("btnRptPageSize").innerHTML.trim();
 
-         //btnRptPageSize
 
-         return rst;
 
-     },
 
-     getCurrentOrientation: function() {
 
-         // let rst = "横向";
 
-         let rst = document.getElementById("btnRptOrientation").innerHTML.trim();
 
-         return rst;
 
-     },
 
-     getCurrentReportOption: function() {
 
-         //
 
-     },
 
-     changeType: function(newType) {
 
-         let me = rptControlObj;
 
-         let excelDom = document.getElementById("EXCEL_TYPE");
 
-         let pdfDom = document.getElementById("PDF_TYPE");
 
-         if (newType === "Excel") {
 
-             excelDom.className = "btn btn-block btn-primary";
 
-             pdfDom.className = "btn btn-block btn-outline-secondary";
 
-             me.currentOutputType = newType;
 
-         } else if (newType === "PDF") {
 
-             excelDom.className = "btn btn-block btn-outline-secondary";
 
-             pdfDom.className = "btn btn-block btn-primary";
 
-             me.currentOutputType = newType;
 
-         } else {
 
-             //me.currentOutputType = newType;
 
-         }
 
-     },
 
-     outputRpt: function() {
 
-         let me = rptControlObj;
 
-         if (me.currentOutputType === "Excel") {
 
-             me.getExcel();
 
-         } else if (me.currentOutputType === "PDF") {
 
-             me.getPDF();
 
-         } else {
 
-             //other types if needed.
 
-         }
 
-     },
 
-     getTplIdsCommon: function (refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds, rpt_names, bill_rpt_names, glj_rpt_names) {
 
-         for (let node of zTreeOprObj.checkedRptTplNodes) {
 
-             if (node.hasOwnProperty('flags') && node.flags.hasOwnProperty('reportType') && node['flags']['reportType'] !== 'NA') {
 
-                 if (node['flags']['reportType'] === 'billSummary') {
 
-                     refBillSumPrjsIds.push(node.refId);
 
-                     if (bill_rpt_names) bill_rpt_names.push(node.name);
 
-                 } else if (node['flags']['reportType'] === 'gljSummary') {
 
-                     refGljSumPrjsIds.push(node.refId);
 
-                     if (glj_rpt_names) glj_rpt_names.push(node.name);
 
-                 }
 
-             } else {
 
-                 refRptTplIds.push(node.refId);
 
-                 if (rpt_names) rpt_names.push(node.name);
 
-             }
 
-         }
 
-     },
 
-     creatCommonExportParam: function (refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds) {
 
-         let nodes = (zTreeOprObj.prjFolderTreeObj === null)?[]:zTreeOprObj.prjFolderTreeObj.getCheckedNodes(true);
 
-         let rst = {};
 
-         rst.prj_id = projectObj.project.projectInfo.ID;
 
-         rst.rpt_ids = refRptTplIds;
 
-         rst.rpt_bill_tpl_ids = refBillSumPrjsIds;
 
-         rst.rpt_glj_tpl_ids = refGljSumPrjsIds;
 
-         rst.prjIds = [];
 
-         zTreeOprObj.selectedPrjIDs = [];
 
-         for (let node of nodes) {
 
-             rst.prjIds.push(node.ID);
 
-             zTreeOprObj.selectedPrjIDs.push(node.ID);
 
-         }
 
-         // rst.sum_rpt_names = bill_rpt_names.concat(glj_rpt_names);
 
-         // rst.rpt_names = rpt_names;
 
-         // rst.isOneSheet = true;
 
-         rst.pageSize = rptControlObj.getCurrentPageSize();
 
-         rst.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:rptControlObj.getCurrentOrientation());
 
-         rst.custCfg = CUST_CFG;
 
-         rst.option = "normal";
 
-         return rst;
 
-     },
 
-     getAllInOneBook: function () {
 
-         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
 
-             let me = rptControlObj;
 
-             let orgRptName = projectObj.project.projectInfo.name;
 
-             let refRptTplIds = [], refBillSumPrjsIds = [], refGljSumPrjsIds = [];
 
-             rptControlObj.getTplIdsCommon(refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds);
 
-             if (zTreeOprObj.selectedPrjIDs.length > 0 && (refBillSumPrjsIds.length > 0 || refGljSumPrjsIds.length > 0)) {
 
-                 let params = rptControlObj.creatCommonExportParam(refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds);
 
-                 params.rptName = orgRptName;
 
-                 CommonAjax.postEx("report_api/createExcelFilesInOneBook", params, WAIT_TIME_EXPORT, true, function(result){
 
-                         if (result) {
 
-                             let uuIdUrls = [];
 
-                             let uuIdUrl =  "/report_api/getFileByUUID/" + result.uuid + "/" + stringUtil.replaceAll(result.reportName, "#", "_") + "/xlsx";
 
-                             uuIdUrls.push(uuIdUrl);
 
-                             downloadReport(uuIdUrls);
 
-                         } else {
 
-                             //
 
-                         }
 
-                     }, null, null
 
-                 );
 
-             } else {
 
-                 let params = {};
 
-                 params.prj_id = PROJECT_ID;
 
-                 params.rpt_ids = refRptTplIds;
 
-                 params.rptName = orgRptName;
 
-                 params.pageSize = me.getCurrentPageSize();
 
-                 params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
 
-                 params.custCfg = CUST_CFG;
 
-                 params.option = "normal";
 
-                 CommonAjax.postEx("report_api/createExcelFilesInOneBook", params, WAIT_TIME_EXPORT, true, function(result){
 
-                         if (result) {
 
-                             let uuIdUrls = [];
 
-                             let uuIdUrl =  "/report_api/getFileByUUID/" + result.uuid + "/" + stringUtil.replaceAll(result.reportName, "#", "_") + "/xlsx";
 
-                             uuIdUrls.push(uuIdUrl);
 
-                             downloadReport(uuIdUrls);
 
-                         } else {
 
-                             //
 
-                         }
 
-                     }, null, null
 
-                 );
 
-             }
 
-         }
 
-     },
 
-     getAllIndividualExcelBook: function () {
 
-         let me = rptControlObj;
 
-         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
 
-             let refRptTplIds = [], refBillSumPrjsIds = [], refGljSumPrjsIds = [];
 
-             let rpt_names = [], bill_rpt_names = [], glj_rpt_names = [];
 
-             rptControlObj.getTplIdsCommon(refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds, rpt_names, bill_rpt_names, glj_rpt_names);
 
-             if (zTreeOprObj.selectedPrjIDs.length > 0 && (glj_rpt_names.length > 0 || bill_rpt_names.length > 0)) {
 
-                 let params = rptControlObj.creatCommonExportParam(refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds);
 
-                 params.prj_id = PROJECT_ID;
 
-                 params.sum_rpt_names = bill_rpt_names.concat(glj_rpt_names);
 
-                 params.rpt_names = rpt_names;
 
-                 params.isOneSheet = true;
 
-                 params.rptName = projectObj.project.projectInfo.name;
 
-                 CommonAjax.postEx("report_api/createExcelFiles", params, WAIT_TIME_EXPORT, true, function(result){
 
-                         if (result) {
 
-                             let uuIdUrls = [];
 
-                             for (let uuIdObj of result) {
 
-                                 let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/xlsx";
 
-                                 uuIdUrls.push(uuIdUrl);
 
-                             }
 
-                             downloadReport(uuIdUrls);
 
-                         } else {
 
-                             //
 
-                         }
 
-                     }, null, null
 
-                 );
 
-             } else {
 
-                 if (refBillSumPrjsIds.length > 0 || refGljSumPrjsIds.length > 0) {
 
-                     $("#divReqBillSummary")[0].style.display = "none";
 
-                     $("#divReqGljSummary")[0].style.display = "none";
 
-                     $("#divReqCommonSummaryExcel")[0].style.display = "none";
 
-                     $("#divReqCommonSummaryMultiExcel")[0].style.display = "";
 
-                     $("#divReqCommonSummaryPDF")[0].style.display = "none";
 
-                     zTreeOprObj.requestPrjFolderCommon(); //先处理需要汇总的报表,走另外一个分支
 
-                 } else if (refRptTplIds.length > 0) {
 
-                     let params = {};
 
-                     params.prj_id = PROJECT_ID;
 
-                     params.rpt_ids = refRptTplIds;
 
-                     params.rpt_names = rpt_names;
 
-                     params.pageSize = me.getCurrentPageSize();
 
-                     params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
 
-                     params.isOneSheet = true;
 
-                     params.custCfg = CUST_CFG;
 
-                     params.option = "normal";
 
-                     CommonAjax.postEx("report_api/createExcelFiles", params, WAIT_TIME_EXPORT, true, function(result){
 
-                             if (result) {
 
-                                 let uuIdUrls = [];
 
-                                 for (let uuIdObj of result) {
 
-                                     let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/xlsx";
 
-                                     uuIdUrls.push(uuIdUrl);
 
-                                 }
 
-                                 downloadReport(uuIdUrls);
 
-                             } else {
 
-                                 //
 
-                             }
 
-                         }, null, null
 
-                     );
 
-                 }
 
-             }
 
-         }
 
-     },
 
-     checkAndGetExcel: function () {
 
-         if (zTreeOprObj.treeObj) {
 
-             let chkNodes = zTreeOprObj.treeObj.getCheckedNodes(true);
 
-             if (chkNodes.length > 0) {
 
-                 $("#show_excel_output_cfg").trigger("click");
 
-             } else {
 
-                 rptControlObj.getAllIndividualExcelBook();
 
-             }
 
-         }
 
-     },
 
-     getExcel: function () {
 
-         let me = rptControlObj;
 
-         if ($("#excelExportType_AllInOneBook").get(0).checked) {
 
-             me.getAllInOneBook();
 
-         } else if ($("#excelExportType_IndividualBook").get(0).checked) {
 
-             me.getAllIndividualExcelBook();
 
-         }
 
-     },
 
-     getPDF: function () {
 
-         let me = rptControlObj;
 
-         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
 
-             let refRptTplIds = [], refBillSumPrjsIds = [], refGljSumPrjsIds = [];
 
-             let rpt_names = [], bill_rpt_names = [], glj_rpt_names = [];
 
-             rptControlObj.getTplIdsCommon(refRptTplIds, refBillSumPrjsIds, refGljSumPrjsIds, rpt_names, bill_rpt_names, glj_rpt_names);
 
-             if (zTreeOprObj.selectedPrjIDs.length > 0 && (glj_rpt_names.length > 0 || bill_rpt_names.length > 0)) {
 
-                 let params = rptControlObj.creatCommonExportParam();
 
-                 params.prj_id = PROJECT_ID;
 
-                 params.sum_rpt_names = bill_rpt_names.concat(glj_rpt_names);
 
-                 params.rpt_ids = refRptTplIds;
 
-                 params.rpt_bill_tpl_ids = refBillSumPrjsIds;
 
-                 params.rpt_glj_tpl_ids = refGljSumPrjsIds;
 
-                 params.rpt_names = rpt_names;
 
-                 params.isOneSheet = true;
 
-                 params.rptName = projectObj.project.projectInfo.name;
 
-                 CommonAjax.postEx("report_api/createPdfFiles", params, WAIT_TIME_EXPORT, true, function(result){
 
-                         if (result) {
 
-                             let uuIdUrls = [];
 
-                             for (let uuIdObj of result) {
 
-                                 let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/pdf";
 
-                                 uuIdUrls.push(uuIdUrl);
 
-                             }
 
-                             downloadReport(uuIdUrls);
 
-                         } else {
 
-                             //
 
-                         }
 
-                     }, null, null
 
-                 );
 
-             } else {
 
-                 if (refBillSumPrjsIds.length > 0 || refGljSumPrjsIds.length > 0) {
 
-                     $("#divReqBillSummary")[0].style.display = "none";
 
-                     $("#divReqGljSummary")[0].style.display = "none";
 
-                     $("#divReqCommonSummaryExcel")[0].style.display = "none";
 
-                     $("#divReqCommonSummaryMultiExcel")[0].style.display = "none";
 
-                     $("#divReqCommonSummaryPDF")[0].style.display = "";
 
-                     zTreeOprObj.requestPrjFolderCommon(); //先处理需要汇总的报表,走另外一个分支
 
-                 } else if (refRptTplIds.length > 0) {
 
-                     let params = {};
 
-                     params.prj_id = PROJECT_ID;
 
-                     params.rpt_ids = refRptTplIds;
 
-                     params.rpt_names = rpt_names;
 
-                     params.pageSize = me.getCurrentPageSize();
 
-                     params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
 
-                     params.custCfg = CUST_CFG;
 
-                     params.option = "normal";
 
-                     CommonAjax.postEx("report_api/createPdfFiles", params, WAIT_TIME_EXPORT, true, function(result){
 
-                             if (result) {
 
-                                 let uuIdUrls = [];
 
-                                 for (let uuIdObj of result) {
 
-                                     let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + stringUtil.replaceAll(uuIdObj.reportName, "#", "_") + "/pdf";
 
-                                     uuIdUrls.push(uuIdUrl);
 
-                                 }
 
-                                 downloadReport(uuIdUrls);
 
-                             } else {
 
-                                 //
 
-                             }
 
-                         }, null, null
 
-                     );
 
-                 }
 
-             }
 
-         }
 
-     },
 
-     firstPage: function(dom) {
 
-         zTreeOprObj.showPage(1, zTreeOprObj.canvas);
 
-     },
 
-     prePage: function(dom) {
 
-         zTreeOprObj.showPage(zTreeOprObj.currentPage - 1, zTreeOprObj.canvas);
 
-     },
 
-     nextPage: function(dom) {
 
-         zTreeOprObj.showPage(zTreeOprObj.currentPage + 1, zTreeOprObj.canvas);
 
-     },
 
-     lastPage: function(dom) {
 
-         let me = zTreeOprObj;
 
-         zTreeOprObj.showPage(me.maxPages, zTreeOprObj.canvas);
 
-     },
 
-     onKeydown: function (event, dom) {
 
-         let me = zTreeOprObj, keyPressed = null;
 
-         if (window.event) {
 
-             keyPressed = window.event.keyCode; // IE/Chrome
 
-         } else {
 
-             keyPressed = event.which; // Firefox
 
-         }
 
-         if (keyPressed === 13) {
 
-             let pageNum = 1;
 
-             try {
 
-                 pageNum = parseInt(dom.value);
 
-             } catch (e) {
 
-                 pageNum = 1;
 
-             }
 
-             if (pageNum < 1) {
 
-                 pageNum = 1;
 
-             } else if (pageNum > me.maxPages) {
 
-                 pageNum = me.maxPages;
 
-             }
 
-             zTreeOprObj.showPage(pageNum, zTreeOprObj.canvas);
 
-             return false;
 
-         }
 
-     },
 
-     changeMargin: function(marginPropStr, marginDom) {
 
-         CUST_CFG.margins[marginPropStr] = marginDom.value;
 
-     },
 
-     changeFontMain: function(CfgDispName, fontProperty, fontDom) {
 
-         for (let font of CUST_CFG.fonts) {
 
-             if (font["CfgDispName"] === CfgDispName) {
 
-                 font[fontProperty] = fontDom.value;
 
-                 break;
 
-             }
 
-         }
 
-     },
 
-     changeCfgOption: function (optStr, dom) {
 
-         CUST_CFG[optStr] = dom.checked;
 
-     },
 
-     changeFontAdhoc: function(CfgDispName, fontProperty, fontDom) {
 
-         for (let font of CUST_CFG.fonts) {
 
-             if (font["CfgDispName"] === CfgDispName) {
 
-                 if (font[fontProperty] === 'T') {
 
-                     font[fontProperty] = 'F';
 
-                     fontDom.className = "btn btn-sm btn-outline-secondary";
 
-                 } else {
 
-                     font[fontProperty] = 'T';
 
-                     fontDom.className = "btn btn-sm btn-outline-secondary active";
 
-                 }
 
-                 break;
 
-             }
 
-         }
 
-     },
 
-     restoreCustCFG: function () {
 
-         let me = this;
 
-         zTreeOprObj.renderRptCfg(zTreeOprObj.defReportPageCfg);
 
-         zTreeOprObj.extractRptCfg(CUST_CFG);
 
-         me.saveCustCfg();
 
-     },
 
-     saveCustCfg: function() {
 
-         let params = {};
 
-         params.custCfg = CUST_CFG;
 
-         CommonAjax.postEx("report_tpl_api/saveCustomerCfg", params, 20000, true, function(result){
 
-                 // alert("Save successfully!");
 
-                 $("#update_msg_response")[0].style.color = "green";
 
-                 $("#update_msg_response")[0].innerHTML = " (保存成功!)";
 
-                 setTimeout(function(){
 
-                     $("#update_msg_response")[0].innerHTML = "";
 
-                 }, 1000);
 
-             }, function (failRst) {
 
-                 $("#update_msg_response")[0].style.color = "red";
 
-                 $("#update_msg_response")[0].innerHTML = " (保存失败!)";
 
-                 setTimeout(function(){
 
-                     $("#update_msg_response")[0].innerHTML = "";
 
-                 }, 1000);
 
-             }, null
 
-         );
 
-     },
 
-     confirmCfgChange: function() {
 
-         zTreeOprObj.changeCfg();
 
-     }
 
- };
 
- function downloadReport(urls) {
 
-     //考虑到多个报表下载,一些浏览器(如chrome)不允许一下子下载多个文件,得缓缓处理,统一在这处理
 
-     rptControlObj.currentDownloadUrl = null;
 
-     rptControlObj.currentDownloadIdx = 0;
 
-     let private_download = function() {
 
-         if (rptControlObj.currentDownloadIdx >= 0 && rptControlObj.currentDownloadIdx < urls.length) {
 
-             rptControlObj.currentDownloadUrl = urls[rptControlObj.currentDownloadIdx];
 
-             rptControlObj.currentDownloadIdx++;
 
-             window.location = rptControlObj.currentDownloadUrl;
 
-             setTimeout(private_download, 2000);
 
-         }
 
-     }
 
-     private_download();
 
- }
 
- function getStageId() {
 
-     return current_stage_id;
 
- }
 
- function getStageOrder() {
 
-     return current_stage_order;
 
- }
 
- function getStageTimes() {
 
-     return current_stage_times;
 
- }
 
 
  |