Просмотр исходного кода

fix: TASK #5329 调整 增加默认行高

Tony Kang 4 дней назад
Родитель
Сommit
1513d389c1
1 измененных файлов с 38 добавлено и 7 удалено
  1. 38 7
      app/public/report/js/rpt_format_setup.js

+ 38 - 7
app/public/report/js/rpt_format_setup.js

@@ -37,7 +37,8 @@ const reportFormatSetupObj = {
         // 增加表眉、表脚层次项
         console.log(dom);
         let maxCnt = 0;
-        for (const td of dom.parentElement.parentElement.nextElementSibling.children[0].children[1].children) {
+        // for (const td of dom.parentElement.parentElement.nextElementSibling.children[0].children[1].children) {
+        for (const td of dom.parentElement.parentElement.parentElement.nextElementSibling.children[0].children[1].children) {
             if (td.cells[0].innerText !== '') {
                 const lv = parseInt(td.cells[0].innerText) || 0;
                 if (lv > maxCnt) maxCnt = lv;
@@ -55,7 +56,7 @@ const reportFormatSetupObj = {
         lvDtl.push('<td></td>');
         lvDtl.push('<td><a href="#" onclick="reportFormatSetupObj.onAddInfo(this)" class="text-primary mr-2" title="新增插入子项">新增</a></td>');
         lvDtl.push('</tr>');
-        $(dom.parentElement.parentElement.nextElementSibling.children[0].children[1]).append(lvDtl.join(''));
+        $(dom.parentElement.parentElement.parentElement.nextElementSibling.children[0].children[1]).append(lvDtl.join(''));
     },
     onTypeChange: (dom) => {
         const me = reportFormatSetupObj;
@@ -117,12 +118,32 @@ const reportFormatSetupObj = {
     clearTplProperties: () => {
         // 表眉
         $("#rpt_header_div").empty();
-        const str1 = '<div>表眉</div><div><a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a></div>';
+        // const str1 = '<div>表眉</div><div><input id="header_band_height_input" class="form-control form-control-sm" value="" type="text"></input></div><div><a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a></div>';
+        const str1Arr = [];
+        str1Arr.push('<div>表眉');
+        str1Arr.push('</div>');
+        str1Arr.push('<div>');
+        str1Arr.push('<div>默认行高: ');
+        str1Arr.push('<input id="header_band_height_input" value="" type="number" step="0.1" width="10"></input>');
+        str1Arr.push('<a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a>');
+        str1Arr.push('</div>');
+        str1Arr.push('</div>');
+        const str1 = str1Arr.join('');
         $("#rpt_header_div").append(str1);
         $("#rpt_header_table_div").empty();
         // 表脚
         $("#rpt_footer_div").empty();
-        const str2 = '<div>表脚</div><div><a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a></div>';
+        // const str2 = '<div>表脚</div><div><input id="footer_band_height_input" class="form-control form-control-sm" value="" type="text"></input></div><div><a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a></div>';
+        const str2Arr = [];
+        str2Arr.push('<div>表脚');
+        str2Arr.push('</div>');
+        str2Arr.push('<div>');
+        str2Arr.push('<div>默认行高: ');
+        str2Arr.push('<input id="footer_band_height_input" value="" type="number" step="0.1" width="10"></input>');
+        str2Arr.push('<a href="#" onclick="reportFormatSetupObj.onAddLvInfo(this)" class="btn btn-sm btn-light text-primary">新增行</a>');
+        str2Arr.push('</div>');
+        str2Arr.push('</div>');
+        const str2 = str2Arr.join('');
         $("#rpt_footer_div").append(str2);
         $("#rpt_footer_table_div").empty();
         // 表标题
@@ -134,6 +155,9 @@ const reportFormatSetupObj = {
         if (bandInfo) {
             const posArr = me._checkLevelInfo(bandInfo);
             const html = me._buildHeaderFooterHTML(rptTpl, bandInfo, posArr);
+            const actBand = rptTpl['布局框_集合'].find(band => band.Name === 'HeaderBand');
+            const dftRowHeight = +(actBand.Height || 0.6) / (posArr.length || 1);
+            $("#header_band_height_input")[0].value = dftRowHeight;
             // console.log(html);
             // $("#rpt_header_parent_div").empty();
             $("#rpt_header_table_div").append(html.join(''));
@@ -146,7 +170,10 @@ const reportFormatSetupObj = {
         if (bandInfo) {
             const posArr = me._checkLevelInfo(bandInfo);
             const html = me._buildHeaderFooterHTML(rptTpl, bandInfo, posArr);
-            console.log(html);
+            const actBand = rptTpl['布局框_集合'].find(band => band.Name === 'FooterBand');
+            const dftRowHeight = +(actBand.Height || 0.6) / (posArr.length || 1);
+            $("#footer_band_height_input")[0].value = dftRowHeight;
+            // console.log(html);
             // $("#rpt_header_parent_div").empty();
             $("#rpt_footer_table_div").append(html.join(''));
             // rpt_header_div
@@ -550,7 +577,9 @@ const reportFormatSetupObj = {
             const headerBand = rptTpl['布局框_集合'].find(item => item.Name === 'HeaderBand');
             // 1. 高度
             if (headerBand) {
-                headerBand.Height = 0.6 * headersInfo.levels;
+                let dftHeight = $("#header_band_height_input")[0].value || 0.6;
+                if (dftHeight === '') dftHeight = 0.6;
+                headerBand.Height = dftHeight * headersInfo.levels;
             }
             // 2.
             headerBandInfo.text_s = headersInfo.texts;
@@ -561,7 +590,9 @@ const reportFormatSetupObj = {
             const footerBand = rptTpl['布局框_集合'].find(item => item.Name === 'FooterBand');
             // 1. 高度
             if (footerBand) {
-                footerBand.Height = 0.6 * footersInfo.levels;
+                let dftHeight = $("#footer_band_height_input")[0].value || 1;
+                if (dftHeight === '') dftHeight = 1; // 计量的表脚默认高度给1(签名缘故)
+                footerBand.Height = dftHeight * footersInfo.levels;
             }
             // 2.
             footerBandInfo.text_s = footersInfo.texts;