|
@@ -8,6 +8,8 @@ const NEXT_PAGE_OFFSET = 160;
|
|
|
const FIRST_PAGE_OFFSET = 50;
|
|
|
const LAST_PAGE_OFFSET = 60;
|
|
|
|
|
|
+let fontSuffixMapObj = {"表标题": "title", "列标题": "column", "正文内容": "content", "合计": "summary", "表眉/表脚": "header_footer"};
|
|
|
+
|
|
|
let rptTplObj = {
|
|
|
hasInitialized: false,
|
|
|
iniPage: function() {
|
|
@@ -93,6 +95,7 @@ let zTreeOprObj = {
|
|
|
if (result) {
|
|
|
me.defReportPageCfg = result[0];
|
|
|
me.reportPageCfg = result[1];
|
|
|
+ me.iniFontCfgDom(me.reportPageCfg);
|
|
|
me.renderRptCfg(result[1]);
|
|
|
} else {
|
|
|
me.reportPageCfg = null;
|
|
@@ -101,6 +104,36 @@ let zTreeOprObj = {
|
|
|
}, null, null
|
|
|
);
|
|
|
},
|
|
|
+ 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><option>Arial</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;
|
|
@@ -108,18 +141,7 @@ let zTreeOprObj = {
|
|
|
$("#elementMargin_Bottom").get(0).value = cfg.margins.Bottom;
|
|
|
|
|
|
for (let font of cfg.fonts) {
|
|
|
- let fontPropSuffix = "title";
|
|
|
- if (font.CfgDispName === "表标题") {
|
|
|
- fontPropSuffix = "title";
|
|
|
- } else if (font.CfgDispName === "列标题") {
|
|
|
- fontPropSuffix = "column";
|
|
|
- } else if (font.CfgDispName === "正文内容") {
|
|
|
- fontPropSuffix = "content";
|
|
|
- } else if (font.CfgDispName === "合计") {
|
|
|
- fontPropSuffix = "summary";
|
|
|
- } else if (font.CfgDispName === "表眉/表脚") {
|
|
|
- fontPropSuffix = "header_footer";
|
|
|
- }
|
|
|
+ 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";
|
|
@@ -137,18 +159,7 @@ let zTreeOprObj = {
|
|
|
cfg.margins.Bottom = $("#elementMargin_Bottom").get(0).value;
|
|
|
|
|
|
for (let font of cfg.fonts) {
|
|
|
- let fontPropSuffix = "title";
|
|
|
- if (font.CfgDispName === "表标题") {
|
|
|
- fontPropSuffix = "title";
|
|
|
- } else if (font.CfgDispName === "列标题") {
|
|
|
- fontPropSuffix = "column";
|
|
|
- } else if (font.CfgDispName === "正文内容") {
|
|
|
- fontPropSuffix = "content";
|
|
|
- } else if (font.CfgDispName === "合计") {
|
|
|
- fontPropSuffix = "summary";
|
|
|
- } else if (font.CfgDispName === "表眉/表脚") {
|
|
|
- fontPropSuffix = "header_footer";
|
|
|
- }
|
|
|
+ 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";
|