|
@@ -18,13 +18,17 @@ let rptTplObj = {
|
|
|
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;
|
|
|
+ dynamicLoadJs('/public/jspdf/Arial Narrow-normal.js');
|
|
|
+ dynamicLoadJs('/public/jspdf/Arial Narrow-bold.js');
|
|
|
+ dynamicLoadJs('/public/jspdf/Arial Narrow-italic.js');
|
|
|
+ dynamicLoadJs('/public/jspdf/Arial Narrow-bolditalic.js');
|
|
|
+
|
|
|
dynamicLoadJs('/public/jspdf/SmartSimsun-normal.js');
|
|
|
dynamicLoadJs('/public/jspdf/SmartSimsun-bold.js', me.pdfFontSimsunCallBack);
|
|
|
}
|
|
@@ -102,6 +106,18 @@ let zTreeOprObj = {
|
|
|
zTreeHelper.createTreeDirectly(topTreeNodesValue, rpt_tpl_setting, "rptTplTree", me);
|
|
|
me.refreshNodes();
|
|
|
},
|
|
|
+ getCustomerCfg: function() {
|
|
|
+ let me = zTreeOprObj;
|
|
|
+ me.defReportPageCfg = {};
|
|
|
+ Object.assign(me.defReportPageCfg, CUST_CFG);
|
|
|
+ me.defReportPageCfg.margins = {};
|
|
|
+ Object.assign(me.defReportPageCfg.margins, CUST_CFG.margins);
|
|
|
+ me.defReportPageCfg.fonts = [];
|
|
|
+ for (let fi = 0; fi < CUST_CFG.fonts.length; fi++) {
|
|
|
+ me.defReportPageCfg.fonts.push({});
|
|
|
+ Object.assign(me.defReportPageCfg.fonts[fi], CUST_CFG.fonts[fi]);
|
|
|
+ }
|
|
|
+ },
|
|
|
iniFontCfgDom: function (cfg) {
|
|
|
for (let font of cfg.fonts) {
|
|
|
let domArrs = [];
|
|
@@ -112,7 +128,8 @@ let zTreeOprObj = {
|
|
|
//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("<option>宋体</option>");
|
|
|
+ // <option>楷体</option><option>黑体</option> // 因导出PDF调整到前端输出,字体文件大,支持的字体要谨慎些,不轻易多加字体
|
|
|
domArrs.push("</select>");
|
|
|
domArrs.push("</div>");
|
|
|
//3. font height
|
|
@@ -133,11 +150,16 @@ let zTreeOprObj = {
|
|
|
}
|
|
|
},
|
|
|
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;
|
|
|
-
|
|
|
+ this.renderMargin(cfg);
|
|
|
+ this.renderFormat(cfg);
|
|
|
+ },
|
|
|
+ renderMargin: function (cfg) {
|
|
|
+ $("#elementMargin_Left")[0].value = cfg.margins.Left;
|
|
|
+ $("#elementMargin_Right")[0].value = cfg.margins.Right;
|
|
|
+ $("#elementMargin_Top")[0].value = cfg.margins.Top;
|
|
|
+ $("#elementMargin_Bottom")[0].value = cfg.margins.Bottom;
|
|
|
+ },
|
|
|
+ renderFormat: function (cfg) {
|
|
|
for (let font of cfg.fonts) {
|
|
|
let fontPropSuffix = fontSuffixMapObj[font.CfgDispName];
|
|
|
document.getElementById("fontName_" + fontPropSuffix).value = font.Name;
|
|
@@ -146,16 +168,16 @@ let zTreeOprObj = {
|
|
|
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;
|
|
|
+ document.getElementById("cfg_border_thick").value = cfg.borderThick;
|
|
|
+ document.getElementById("cfg_rpt_vertical_line").checked = cfg.showVerticalLine;
|
|
|
+ document.getElementById("cfg_rpt_fill_zero").checked = cfg.fillZero;
|
|
|
+ document.getElementById("cfg_rpt_narrow").checked = cfg.isNarrow;
|
|
|
},
|
|
|
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;
|
|
|
+ cfg.margins.Left = $("#elementMargin_Left")[0].value;
|
|
|
+ cfg.margins.Right = $("#elementMargin_Right")[0].value;
|
|
|
+ cfg.margins.Top = $("#elementMargin_Top")[0].value;
|
|
|
+ cfg.margins.Bottom = $("#elementMargin_Bottom")[0].value;
|
|
|
|
|
|
for (let font of cfg.fonts) {
|
|
|
let fontPropSuffix = fontSuffixMapObj[font.CfgDispName];
|
|
@@ -165,9 +187,10 @@ let zTreeOprObj = {
|
|
|
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;
|
|
|
+ cfg.showVerticalLine = document.getElementById("cfg_rpt_vertical_line").checked;
|
|
|
+ cfg.isNarrow = document.getElementById("cfg_rpt_narrow").checked;
|
|
|
+ cfg.fillZero = document.getElementById("cfg_rpt_fill_zero").checked;
|
|
|
+ cfg.borderThick = document.getElementById("cfg_border_thick").value;
|
|
|
},
|
|
|
refreshNodes: function() {
|
|
|
let me = this;
|
|
@@ -337,7 +360,7 @@ let zTreeOprObj = {
|
|
|
},
|
|
|
displayPageValue: function() {
|
|
|
let me = zTreeOprObj;
|
|
|
- $("#rpt_page_num").get(0).value = me.currentPage + "/" + me.maxPages;
|
|
|
+ $("#rpt_page_num")[0].value = me.currentPage + "/" + me.maxPages;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -391,9 +414,6 @@ let rptControlObj = {
|
|
|
let rst = document.getElementById("btnRptOrientation").innerHTML.trim();
|
|
|
return rst;
|
|
|
},
|
|
|
- getCurrentReportOption: function() {
|
|
|
- //
|
|
|
- },
|
|
|
changeType: function(newType) {
|
|
|
let me = rptControlObj;
|
|
|
let excelDom = document.getElementById("EXCEL_TYPE");
|
|
@@ -410,16 +430,6 @@ let rptControlObj = {
|
|
|
//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, rpt_names) {
|
|
|
for (let node of zTreeOprObj.checkedRptTplNodes) {
|
|
|
if (node.hasOwnProperty('flags') && node.flags.hasOwnProperty('reportType') && node['flags']['reportType'] !== 'NA') {
|
|
@@ -525,9 +535,9 @@ let rptControlObj = {
|
|
|
},
|
|
|
getExcel: function () {
|
|
|
let me = rptControlObj;
|
|
|
- if ($("#excelExportType_AllInOneBook").get(0).checked) {
|
|
|
+ if ($("#excelExportType_AllInOneBook")[0].checked) {
|
|
|
me.getAllInOneBook();
|
|
|
- } else if ($("#excelExportType_IndividualBook").get(0).checked) {
|
|
|
+ } else if ($("#excelExportType_IndividualBook")[0].checked) {
|
|
|
me.getAllIndividualExcelBook();
|
|
|
}
|
|
|
},
|
|
@@ -609,6 +619,9 @@ let rptControlObj = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ changeBorderWeight: function (dom) {
|
|
|
+ CUST_CFG.borderThick = dom.value;
|
|
|
+ },
|
|
|
changeCfgOption: function (optStr, dom) {
|
|
|
CUST_CFG[optStr] = dom.checked;
|
|
|
},
|
|
@@ -626,11 +639,19 @@ let rptControlObj = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ restoreMargine: function () {
|
|
|
+ zTreeOprObj.renderMargin(zTreeOprObj.defReportPageCfg);
|
|
|
+ zTreeOprObj.extractRptCfg(CUST_CFG);
|
|
|
+ },
|
|
|
+ restoreFormat: function () {
|
|
|
+ zTreeOprObj.renderFormat(zTreeOprObj.defReportPageCfg);
|
|
|
+ zTreeOprObj.extractRptCfg(CUST_CFG);
|
|
|
+ },
|
|
|
restoreCustCFG: function () {
|
|
|
let me = this;
|
|
|
zTreeOprObj.renderRptCfg(zTreeOprObj.defReportPageCfg);
|
|
|
zTreeOprObj.extractRptCfg(CUST_CFG);
|
|
|
- me.saveCustCfg();
|
|
|
+ // me.saveCustCfg();
|
|
|
},
|
|
|
saveCustCfg: function() {
|
|
|
let params = {};
|