|  | @@ -1,28 +1,31 @@
 | 
	
		
			
				|  |  | -let JV = require('../jpc_value_define');
 | 
	
		
			
				|  |  | -let JpcCommonHelper = require('./jpc_helper_common');
 | 
	
		
			
				|  |  | +'use strict';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -let JpcBandHelper = {
 | 
	
		
			
				|  |  | +const JV = require('../jpc_value_define');
 | 
	
		
			
				|  |  | +const JpcCommonHelper = require('./jpc_helper_common');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const JpcBandHelper = {
 | 
	
		
			
				|  |  |      getBandTypeValByString: function(bandType) {
 | 
	
		
			
				|  |  |          let rst = JV.PAGE_STATUS.indexOf(bandType);
 | 
	
		
			
				|  |  |          if (rst < 0) rst = JV.STATUS_NORMAL;
 | 
	
		
			
				|  |  |          return rst;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      setBandArea: function(bands, rptTpl, pageStatus, isOnlyNormalStatus, isOnlyExStatus) {
 | 
	
		
			
				|  |  | -        let me = this;
 | 
	
		
			
				|  |  | +        const me = this;
 | 
	
		
			
				|  |  |          if (rptTpl[JV.NODE_BAND_COLLECTION]) {
 | 
	
		
			
				|  |  | -            isOnlyNormalStatus = isOnlyNormalStatus||false;
 | 
	
		
			
				|  |  | -            isOnlyExStatus = isOnlyExStatus||false;
 | 
	
		
			
				|  |  | +            isOnlyNormalStatus = isOnlyNormalStatus || false;
 | 
	
		
			
				|  |  | +            isOnlyExStatus = isOnlyExStatus || false;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
 | 
	
		
			
				|  |  | -            let orgArea = JpcCommonHelper.getReportArea(rptTpl, unitFactor);
 | 
	
		
			
				|  |  | +            const unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
 | 
	
		
			
				|  |  | +            const orgArea = JpcCommonHelper.getReportArea(rptTpl, unitFactor);
 | 
	
		
			
				|  |  |              for (let i = 0; i < rptTpl[JV.NODE_BAND_COLLECTION].length; i++) {
 | 
	
		
			
				|  |  |                  me.setBandPos(bands, rptTpl[JV.NODE_BAND_COLLECTION][i], orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      setBandPos: function(bands, bandNode, orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus) {
 | 
	
		
			
				|  |  | -        let me = this, band = bands[bandNode[JV.BAND_PROP_NAME]];
 | 
	
		
			
				|  |  | -        //0. for multi flow purpose
 | 
	
		
			
				|  |  | +        const me = this;
 | 
	
		
			
				|  |  | +        const band = bands[bandNode[JV.BAND_PROP_NAME]];
 | 
	
		
			
				|  |  | +        // 0. for multi flow purpose
 | 
	
		
			
				|  |  |          if (isOnlyNormalStatus) {
 | 
	
		
			
				|  |  |              if (bandNode.hasOwnProperty(JV.PROP_BAND_EX_ONLY) && JpcCommonHelper.getBoolean(bandNode[JV.PROP_BAND_EX_ONLY])) {
 | 
	
		
			
				|  |  |                  return;
 | 
	
	
		
			
				|  | @@ -33,12 +36,12 @@ let JpcBandHelper = {
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        //1. initialize
 | 
	
		
			
				|  |  | +        // 1. initialize
 | 
	
		
			
				|  |  |          band[JV.PROP_LEFT] = orgArea[JV.IDX_LEFT];
 | 
	
		
			
				|  |  |          band[JV.PROP_TOP] = orgArea[JV.IDX_TOP];
 | 
	
		
			
				|  |  |          band[JV.PROP_RIGHT] = orgArea[JV.IDX_RIGHT];
 | 
	
		
			
				|  |  |          band[JV.PROP_BOTTOM] = orgArea[JV.IDX_BOTTOM];
 | 
	
		
			
				|  |  | -        //2. set this band
 | 
	
		
			
				|  |  | +        // 2. set this band
 | 
	
		
			
				|  |  |          if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
 | 
	
		
			
				|  |  |              switch (band[JV.BAND_PROP_ALIGNMENT]) {
 | 
	
		
			
				|  |  |                  case JV.LAYOUT_TOP:
 | 
	
	
		
			
				|  | @@ -73,20 +76,23 @@ let JpcBandHelper = {
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      orgArea[JV.IDX_RIGHT] = band.Left;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  | +                default:
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            //3. set sub-bands
 | 
	
		
			
				|  |  | +            // 3. set sub-bands
 | 
	
		
			
				|  |  |              if (bandNode[JV.BAND_PROP_SUB_BANDS]) {
 | 
	
		
			
				|  |  | -                let bandArea = [band.Left, band.Top, band.Right, band.Bottom];
 | 
	
		
			
				|  |  | +                const bandArea = [band.Left, band.Top, band.Right, band.Bottom];
 | 
	
		
			
				|  |  |                  for (let i = 0; i < bandNode[JV.BAND_PROP_SUB_BANDS].length; i++) {
 | 
	
		
			
				|  |  |                      me.setBandPos(bands, bandNode[JV.BAND_PROP_SUB_BANDS][i], bandArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    resetBandPos: function (bandCollection, bands, contentBand, offsetX, offsetY) {
 | 
	
		
			
				|  |  | -        let orgX = contentBand.Right, orgY = contentBand.Bottom;
 | 
	
		
			
				|  |  | +    resetBandPos: function(bandCollection, bands, contentBand, offsetX, offsetY) {
 | 
	
		
			
				|  |  | +        const orgX = contentBand.Right;
 | 
	
		
			
				|  |  | +        const orgY = contentBand.Bottom;
 | 
	
		
			
				|  |  |          function chkAndResetPos(targetBand) {
 | 
	
		
			
				|  |  | -            let band = bands[targetBand.Name];
 | 
	
		
			
				|  |  | +            const band = bands[targetBand.Name];
 | 
	
		
			
				|  |  |              if (band) {
 | 
	
		
			
				|  |  |                  if (band === contentBand) {
 | 
	
		
			
				|  |  |                      band.Bottom += offsetY;
 | 
	
	
		
			
				|  | @@ -115,7 +121,7 @@ let JpcBandHelper = {
 | 
	
		
			
				|  |  |          for (let i = 0; i < bandCollection.length; i++) {
 | 
	
		
			
				|  |  |              chkAndResetPos(bandCollection[i]);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  module.exports = JpcBandHelper;
 |