Browse Source

code sync

TonyKang 7 năm trước cách đây
mục cha
commit
6f041a9337
1 tập tin đã thay đổi với 22 bổ sung4 xóa
  1. 22 4
      web/building_saas/report/js/rpt_print.js

+ 22 - 4
web/building_saas/report/js/rpt_print.js

@@ -37,6 +37,16 @@ let rptPrintHelper = {
     }
 };
 
+function getActualBorderStyle(cell, styles, mergeBorderStyle, pageBorderArea, borderStr) {
+    let rst = styles[cell[JV.PROP_STYLE]][borderStr];
+    if (mergeBorderStyle) {
+        if (parseFloat(cell[JV.PROP_AREA][borderStr]) === parseFloat(pageBorderArea[borderStr])) {
+            rst = mergeBorderStyle[borderStr];
+        }
+    }
+    return rst;
+}
+
 function buildCellSvg(cell, fonts, styles, controls, pageMergeBorder, rptMergeBorder, offsetX, offsetY) {
     let rst = [];
     let style = styles[cell[JV.PROP_STYLE]];
@@ -52,22 +62,30 @@ function buildCellSvg(cell, fonts, styles, controls, pageMergeBorder, rptMergeBo
         text_anchor = "start"
     ;
     if (style) {
-        if (style[JV.PROP_LEFT] && parseFloat(style[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]) > 0) {
+        let leftBS = getActualBorderStyle(cell, styles, mergeBandStyle, (pageMergeBorder)?pageMergeBorder:rptMergeBorder[JV.PROP_AREA], JV.PROP_LEFT);
+        // if (style[JV.PROP_LEFT] && parseFloat(style[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]) > 0) {
+        if (leftBS && parseFloat(leftBS[JV.PROP_LINE_WEIGHT]) > 0) {
             rst.push("<line x1='" + left + "' y1='" + top +
                 "' x2='" + left + "' y2='" + bottom +
                 "' style='stroke:rgb(0,0,0);stroke-width:1'/>")
         }
-        if (style[JV.PROP_RIGHT] && parseFloat(style[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]) > 0) {
+        let rightBS = getActualBorderStyle(cell, styles, mergeBandStyle, (pageMergeBorder)?pageMergeBorder:rptMergeBorder[JV.PROP_AREA], JV.PROP_RIGHT);
+        // if (style[JV.PROP_RIGHT] && parseFloat(style[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]) > 0) {
+        if (rightBS && parseFloat(rightBS[JV.PROP_LINE_WEIGHT]) > 0) {
             rst.push("<line x1='" + right + "' y1='" + top +
                 "' x2='" + right + "' y2='" + bottom +
                 "' style='stroke:rgb(0,0,0);stroke-width:1'/>")
         }
-        if (style[JV.PROP_TOP] && parseFloat(style[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]) > 0) {
+        let topBS = getActualBorderStyle(cell, styles, mergeBandStyle, (pageMergeBorder)?pageMergeBorder:rptMergeBorder[JV.PROP_AREA], JV.PROP_TOP);
+        // if (style[JV.PROP_TOP] && parseFloat(style[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]) > 0) {
+        if (topBS && parseFloat(topBS[JV.PROP_LINE_WEIGHT]) > 0) {
             rst.push("<line x1='" + left + "' y1='" + top +
                 "' x2='" + right + "' y2='" + top +
                 "' style='stroke:rgb(0,0,0);stroke-width:1'/>")
         }
-        if (style[JV.PROP_BOTTOM] && parseFloat(style[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]) > 0) {
+        let bottomBS = getActualBorderStyle(cell, styles, mergeBandStyle, (pageMergeBorder)?pageMergeBorder:rptMergeBorder[JV.PROP_AREA], JV.PROP_BOTTOM);
+        // if (style[JV.PROP_BOTTOM] && parseFloat(style[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]) > 0) {
+        if (bottomBS && parseFloat(bottomBS[JV.PROP_LINE_WEIGHT]) > 0) {
             rst.push("<line x1='" + left + "' y1='" + bottom +
                 "' x2='" + right + "' y2='" + bottom +
                 "' style='stroke:rgb(0,0,0);stroke-width:1'/>")