|  | @@ -7,28 +7,32 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |      summaryParentNode: null,
 | 
	
		
			
				|  |  |      iniSpreadJs: function (summaryParentNode) {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  | -        if (me.summaryWorkBook === null) {
 | 
	
		
			
				|  |  | -            me.summaryWorkBook = new GC.Spread.Sheets.Workbook($('#rptTplSummaryWorkbook')[0], {sheetCount: 1});
 | 
	
		
			
				|  |  | -            me.summaryWorkBook.options.tabStripVisible = false;
 | 
	
		
			
				|  |  | -            me.summaryWorkBook.options.allowCopyPasteExcelStyle = false;
 | 
	
		
			
				|  |  | -            me.summaryWorkBook.options.allowUserDragDrop = false;
 | 
	
		
			
				|  |  | -            me.summaryWorkBook.options.allowContextMenu = false;
 | 
	
		
			
				|  |  | -            let sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | -            sheet.options.allowCellOverflow = false;
 | 
	
		
			
				|  |  | -            sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
 | 
	
		
			
				|  |  | -            sheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onCellEnter);
 | 
	
		
			
				|  |  | +        if (me.summaryWorkBook !== null) {
 | 
	
		
			
				|  |  | +            me.summaryWorkBook.destroy();
 | 
	
		
			
				|  |  | +            me.summaryWorkBook = null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        me.summaryWorkBook = new GC.Spread.Sheets.Workbook($('#rptTplSummaryWorkbook')[0], {sheetCount: 1});
 | 
	
		
			
				|  |  | +        me.summaryWorkBook.options.tabStripVisible = false;
 | 
	
		
			
				|  |  | +        me.summaryWorkBook.options.allowCopyPasteExcelStyle = false;
 | 
	
		
			
				|  |  | +        me.summaryWorkBook.options.allowUserDragDrop = false;
 | 
	
		
			
				|  |  | +        me.summaryWorkBook.options.allowContextMenu = false;
 | 
	
		
			
				|  |  | +        let sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | +        sheet.options.allowCellOverflow = false;
 | 
	
		
			
				|  |  | +        sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
 | 
	
		
			
				|  |  | +        sheet.bind(GC.Spread.Sheets.Events.CellClick, me.onCellEnter);
 | 
	
		
			
				|  |  |          me.summaryParentNode = summaryParentNode;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      restoreSummary: function () {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  |          let rptTpl = (zTreeOprObj.currentNode)?zTreeOprObj.currentNode.rptTpl:null;
 | 
	
		
			
				|  |  | +        me.private_setup_control_options(false);
 | 
	
		
			
				|  |  |          me.setupSummary(rptTpl, me.summaryParentNode);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      setupSummary: function (rptTpl, summaryParentNode) {
 | 
	
		
			
				|  |  |          let me = this, columnParentNode = null;
 | 
	
		
			
				|  |  |          let selectedBand = virtualCommonOprObj.getBandEx(summaryParentNode[JV.PROP_BAND_NAME], rptTpl);
 | 
	
		
			
				|  |  |          if (summaryParentNode && selectedBand) {
 | 
	
		
			
				|  |  | +            me.private_setup_control_options(false);
 | 
	
		
			
				|  |  |              let preNode = summaryParentNode.getPreNode();
 | 
	
		
			
				|  |  |              while (preNode) {
 | 
	
		
			
				|  |  |                  if (preNode[JV.PROP_NAME] === JV.NODE_FLOW_COLUMN) {
 | 
	
	
		
			
				|  | @@ -40,7 +44,9 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              let fieldNode = summaryParentNode.items[0], textNode = summaryParentNode.items[1];
 | 
	
		
			
				|  |  |              if (columnParentNode) {
 | 
	
		
			
				|  |  | -                let yColumnPos = [], xPos = [], ySummaryPos = [0], xSummaryPos = [0];
 | 
	
		
			
				|  |  | +                let yColumnPos = [], xPos = [], ySummaryPos = [0]
 | 
	
		
			
				|  |  | +                    // , xSummaryPos = [0]
 | 
	
		
			
				|  |  | +                ;
 | 
	
		
			
				|  |  |                  let sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  |                  let columnBand = virtualCommonOprObj.getBandEx(columnParentNode[JV.PROP_BAND_NAME], rptTpl);
 | 
	
		
			
				|  |  |                  let bandH = Math.round(parseFloat(columnBand[JV.BAND_PROP_HEIGHT]) / 2.54 * 96);
 | 
	
	
		
			
				|  | @@ -60,7 +66,8 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(itemNode, itemNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_TOP, bandH, yColumnPos);
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(itemNode, itemNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_BOTTOM, bandH, yColumnPos);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +                sheet.suspendPaint();
 | 
	
		
			
				|  |  | +                sheet.clearSelection();
 | 
	
		
			
				|  |  |                  sheet.setRowCount(yColumnPos.length - 1, GC.Spread.Sheets.SheetArea.colHeader);
 | 
	
		
			
				|  |  |                  sheet.setColumnCount(xPos.length - 1, GC.Spread.Sheets.SheetArea.viewport);
 | 
	
		
			
				|  |  |                  // sheet.clear();
 | 
	
	
		
			
				|  | @@ -79,56 +86,107 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |                      sheet.getRange(idx - 1, -1, 1, -1).backColor(undefined);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  for (let itemNode of columnParentNode.items) {
 | 
	
		
			
				|  |  | -                    let idx1 = xPos.indexOf(virtualCommonOprObj.getActPosEx(itemNode, itemNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_LEFT, bandW, xPos));
 | 
	
		
			
				|  |  | -                    let idx2 = xPos.indexOf(virtualCommonOprObj.getActPosEx(itemNode, itemNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_RIGHT, bandW, xPos));
 | 
	
		
			
				|  |  | -                    let idy1 = yColumnPos.indexOf(virtualCommonOprObj.getActPosEx(itemNode, itemNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_TOP, bandH, yColumnPos));
 | 
	
		
			
				|  |  | -                    let idy2 = yColumnPos.indexOf(virtualCommonOprObj.getActPosEx(itemNode, itemNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_BOTTOM, bandH, yColumnPos));
 | 
	
		
			
				|  |  | -                    if (idx2 - idx1 > 1 || idy2 - idy1 > 1) {
 | 
	
		
			
				|  |  | -                        sheet.addSpan(idy1, idx1, idy2 - idy1, idx2 - idx1, GC.Spread.Sheets.SheetArea.colHeader);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    me.private_setupCell(sheet.getCell(idy1, idx1, GC.Spread.Sheets.SheetArea.colHeader), rptTpl, itemNode);
 | 
	
		
			
				|  |  | +                    virtualCommonOprObj.addSpan(itemNode, sheet, bandW, bandH, xPos, yColumnPos, GC.Spread.Sheets.SheetArea.colHeader);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  //2. 设置已有的统计信息
 | 
	
		
			
				|  |  |                  let sumBandH = Math.round(parseFloat(selectedBand[JV.BAND_PROP_HEIGHT]) / 2.54 * 96);
 | 
	
		
			
				|  |  |                  for (let fNode of fieldNode.items) {
 | 
	
		
			
				|  |  | -                    virtualCommonOprObj.pushPos(fNode, fNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_LEFT, bandW, xSummaryPos);
 | 
	
		
			
				|  |  | -                    virtualCommonOprObj.pushPos(fNode, fNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_RIGHT, bandW, xSummaryPos);
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(fNode, fNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_TOP, sumBandH, ySummaryPos);
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(fNode, fNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_BOTTOM, sumBandH, ySummaryPos);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  for (let tNode of textNode.items) {
 | 
	
		
			
				|  |  | -                    virtualCommonOprObj.pushPos(tNode, tNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_LEFT, bandW, xSummaryPos);
 | 
	
		
			
				|  |  | -                    virtualCommonOprObj.pushPos(tNode, tNode[JV.PROP_AREA][JV.PROP_H_CALCULATION], JV.PROP_RIGHT, bandW, xSummaryPos);
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(tNode, tNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_TOP, sumBandH, ySummaryPos);
 | 
	
		
			
				|  |  |                      virtualCommonOprObj.pushPos(tNode, tNode[JV.PROP_AREA][JV.PROP_V_CALCULATION], JV.PROP_BOTTOM, sumBandH, ySummaryPos);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  sheet.setRowCount(ySummaryPos.length - 1, GC.Spread.Sheets.SheetArea.viewport);
 | 
	
		
			
				|  |  | +                for (let idx = 1; idx < ySummaryPos.length; idx++) {
 | 
	
		
			
				|  |  | +                    sheet.setRowHeight(idx - 1, ySummaryPos[idx] - ySummaryPos[idx - 1]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                for (let tNode of textNode.items) {
 | 
	
		
			
				|  |  | +                    virtualCommonOprObj.addSpan(tNode, sheet, bandW, sumBandH, xPos, ySummaryPos, GC.Spread.Sheets.SheetArea.viewport);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                for (let fNode of fieldNode.items) {
 | 
	
		
			
				|  |  | +                    virtualCommonOprObj.addSpan(fNode, sheet, bandW, sumBandH, xPos, ySummaryPos, GC.Spread.Sheets.SheetArea.viewport);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                sheet.resumePaint();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      addRow: function () {
 | 
	
		
			
				|  |  |          let me = this,
 | 
	
		
			
				|  |  |              sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | +        sheet.suspendPaint();
 | 
	
		
			
				|  |  |          sheet.addRows(sheet.getRowCount() - 1, 1);
 | 
	
		
			
				|  |  |          let rc = sheet.getRowCount();
 | 
	
		
			
				|  |  |          for (let cc = 0; cc < sheet.getColumnCount(); cc++) {
 | 
	
		
			
				|  |  | -            me.private_setupCellDft(sheet.getCell(rc - 2, cc));
 | 
	
		
			
				|  |  | +            virtualCommonOprObj.setupCellDft(sheet.getCell(rc - 2, cc));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        sheet.resumePaint();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      deleteRow: function () {
 | 
	
		
			
				|  |  |          let me = this,
 | 
	
		
			
				|  |  |              sheet = me.summaryWorkBook.getActiveSheet(),
 | 
	
		
			
				|  |  |              selectedRanges = sheet.getSelections()
 | 
	
		
			
				|  |  |          ;
 | 
	
		
			
				|  |  | +        sheet.suspendPaint();
 | 
	
		
			
				|  |  |          if (selectedRanges.length > 0) {
 | 
	
		
			
				|  |  |              sheet.deleteRows(selectedRanges[0].row, 1);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        sheet.resumePaint();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onCellEnter: function (sender, args) {
 | 
	
		
			
				|  |  |          let me = virtualSummaryOprObj,
 | 
	
		
			
				|  |  |              sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | -        if (args.row === sheet.getRowCount() - 1) {
 | 
	
		
			
				|  |  | +        me.setupCfg(sheet, args.row, args.col);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    setupCfg: function (sheet, row, col) {
 | 
	
		
			
				|  |  | +        let me = virtualSummaryOprObj, cell = sheet.getCell(row, col);
 | 
	
		
			
				|  |  | +        let font = cell.font();
 | 
	
		
			
				|  |  | +        // let style = sheet.getStyle(row, col);
 | 
	
		
			
				|  |  | +        // console.log('font: ' + font);
 | 
	
		
			
				|  |  | +        me.private_setup_control_options(true);
 | 
	
		
			
				|  |  | +        //1. 横向
 | 
	
		
			
				|  |  | +        switch (cell.hAlign()) {
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.HorizontalAlign.left:
 | 
	
		
			
				|  |  | +                $(`#hOptionLeftSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.HorizontalAlign.center:
 | 
	
		
			
				|  |  | +                $(`#hOptionCenterSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.HorizontalAlign.right:
 | 
	
		
			
				|  |  | +                $(`#hOptionRightSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            default:
 | 
	
		
			
				|  |  | +                $(`#hOptionLeftSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //2. 纵向
 | 
	
		
			
				|  |  | +        switch (cell.vAlign()) {
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.VerticalAlign.top:
 | 
	
		
			
				|  |  | +                $(`#vOptionUpSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.VerticalAlign.center:
 | 
	
		
			
				|  |  | +                $(`#vOptionCenterSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case GC.Spread.Sheets.VerticalAlign.bottom:
 | 
	
		
			
				|  |  | +                $(`#vOptionDownSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            default:
 | 
	
		
			
				|  |  | +                $(`#vOptionCenterSum`)[0].checked = true;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //3. cell type
 | 
	
		
			
				|  |  | +        if (cell.cellType().typeName === '1') {
 | 
	
		
			
				|  |  | +            $(`#rdIsText`)[0].checked = true;
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  | +            $(`#rdIsField`)[0].checked = true; //combo-box cell type name: `7`
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // console.log('cell type: ' + cell.cellType());
 | 
	
		
			
				|  |  | +        //4. 窄体
 | 
	
		
			
				|  |  | +        if (font.indexOf('Narrow') > 0) {
 | 
	
		
			
				|  |  | +            $(`#eleIsNarrowSumEx`)[0].checked = true;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $(`#eleIsNarrowSumEx`)[0].checked = false;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      mergeCells: function () {
 | 
	
	
		
			
				|  | @@ -145,8 +203,9 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |          let me = virtualSummaryOprObj,
 | 
	
		
			
				|  |  |              sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  |          let selectedRanges = sheet.getSelections();
 | 
	
		
			
				|  |  | -        let spans =sheet.getSpans();
 | 
	
		
			
				|  |  | +        let spans = sheet.getSpans();
 | 
	
		
			
				|  |  |          if (selectedRanges.length > 0 && spans.length > 0) {
 | 
	
		
			
				|  |  | +            sheet.suspendPaint();
 | 
	
		
			
				|  |  |              let selectedSpans = [];
 | 
	
		
			
				|  |  |              for(let i = 0; i < spans.length; i++)
 | 
	
		
			
				|  |  |              {
 | 
	
	
		
			
				|  | @@ -160,6 +219,40 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |              for (let span of selectedSpans) {
 | 
	
		
			
				|  |  |                  sheet.removeSpan(span.row, span.col, GC.Spread.Sheets.SheetArea.viewport);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            sheet.resumePaint();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    changeCellType: function (newType) {
 | 
	
		
			
				|  |  | +        let me = virtualSummaryOprObj,
 | 
	
		
			
				|  |  | +            sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | +        let selectedRanges = sheet.getSelections();
 | 
	
		
			
				|  |  | +        if (selectedRanges.length > 0) {
 | 
	
		
			
				|  |  | +            sheet.suspendPaint();
 | 
	
		
			
				|  |  | +            let cell = sheet.getCell(selectedRanges[0].row, selectedRanges[0].col);
 | 
	
		
			
				|  |  | +            virtualCommonOprObj.changeCellType(cell, newType);
 | 
	
		
			
				|  |  | +            sheet.resumePaint();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    changeCellCfg: function () {
 | 
	
		
			
				|  |  | +        let me = virtualSummaryOprObj,
 | 
	
		
			
				|  |  | +            sheet = me.summaryWorkBook.getActiveSheet();
 | 
	
		
			
				|  |  | +        let selectedRanges = sheet.getSelections();
 | 
	
		
			
				|  |  | +        if (selectedRanges.length > 0) {
 | 
	
		
			
				|  |  | +            sheet.suspendPaint();
 | 
	
		
			
				|  |  | +            let cell = sheet.getCell(selectedRanges[0].row, selectedRanges[0].col);
 | 
	
		
			
				|  |  | +            let hA = GC.Spread.Sheets.HorizontalAlign.left, vA = GC.Spread.Sheets.VerticalAlign.top;
 | 
	
		
			
				|  |  | +            if ($(`#hOptionCenterSum`)[0].checked) hA = GC.Spread.Sheets.HorizontalAlign.center;
 | 
	
		
			
				|  |  | +            if ($(`#hOptionRightSum`)[0].checked) hA = GC.Spread.Sheets.HorizontalAlign.right;
 | 
	
		
			
				|  |  | +            if ($(`#vOptionCenterSum`)[0].checked ) vA = GC.Spread.Sheets.VerticalAlign.center;
 | 
	
		
			
				|  |  | +            if ($(`#vOptionDownSum`)[0].checked ) vA = GC.Spread.Sheets.VerticalAlign.bottom;
 | 
	
		
			
				|  |  | +            cell.hAlign(hA);
 | 
	
		
			
				|  |  | +            cell.vAlign(vA);
 | 
	
		
			
				|  |  | +            if ($(`#eleIsNarrowSumEx`)[0].checked) {
 | 
	
		
			
				|  |  | +                cell.font('Arial Narrow');
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                cell.font('9pt 宋体');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            sheet.resumePaint();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      changeCtrl: function (dom) {
 | 
	
	
		
			
				|  | @@ -207,69 +300,66 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private_setupCellDft: function (cell) {
 | 
	
		
			
				|  |  | -        cell.font(`9pt 宋体`);
 | 
	
		
			
				|  |  | -        cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 | 
	
		
			
				|  |  | -        cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
 | 
	
		
			
				|  |  | -        cell.wordWrap(true);
 | 
	
		
			
				|  |  | -        cell.value(``);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    private_setupCell: function (cell, rptTpl, textNode) {
 | 
	
		
			
				|  |  | -        let me = this;
 | 
	
		
			
				|  |  | -        me.private_setCellFont(cell, textNode);
 | 
	
		
			
				|  |  | -        me.private_setCellControl(cell, textNode);
 | 
	
		
			
				|  |  | -        me.private_setCellStyle(cell, textNode);
 | 
	
		
			
				|  |  | -        let value = textNode[JV.PROP_NAME];
 | 
	
		
			
				|  |  | -        if (textNode[JV.PROP_NAME].indexOf(`|`) >= 0) {
 | 
	
		
			
				|  |  | -            value = textNode[JV.PROP_NAME].split('|').join('\n');
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        cell.wordWrap(true);
 | 
	
		
			
				|  |  | -        cell.value(value);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private_setCellControl: function (cell, textNode) {
 | 
	
		
			
				|  |  | -        let ctrl = null;
 | 
	
		
			
				|  |  | -        if (typeof textNode[JV.PROP_CONTROL] === 'string') {
 | 
	
		
			
				|  |  | -            let idx = rpt_tpl_cfg_helper.reportCfg.controlArr.indexOf(textNode[JV.PROP_CONTROL]);
 | 
	
		
			
				|  |  | -            ctrl = rpt_tpl_cfg_helper.reportCfg.ctrls[idx];
 | 
	
		
			
				|  |  | +    private_setup_control_options: function (enable) {
 | 
	
		
			
				|  |  | +        if (enable) {
 | 
	
		
			
				|  |  | +            $("#sumFieldControlDiv")[0].style.cursor = "";
 | 
	
		
			
				|  |  | +            $("#hOptionLeftSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#hOptionCenterSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#hOptionRightSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#vOptionUpSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#vOptionCenterSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#vOptionDownSum")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#rdIsText")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#rdIsField")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  | +            $("#eleIsNarrowSumEx")[0].removeAttribute("disabled");
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  | -            ctrl = textNode[JV.PROP_CONTROL];
 | 
	
		
			
				|  |  | +            $("#sumFieldControlDiv")[0].style.cursor = "not-allowed";
 | 
	
		
			
				|  |  | +            $("#hOptionLeftSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#hOptionCenterSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#hOptionRightSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#vOptionUpSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#vOptionCenterSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#vOptionDownSum")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#rdIsText")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#rdIsField")[0].disabled = "disabled" ;
 | 
	
		
			
				|  |  | +            $("#eleIsNarrowSumEx")[0].disabled = "disabled";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (ctrl) {
 | 
	
		
			
				|  |  | -            switch (ctrl.Horizon) {
 | 
	
		
			
				|  |  | -                case `center`:
 | 
	
		
			
				|  |  | -                    cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case `right`:
 | 
	
		
			
				|  |  | -                    cell.hAlign(GC.Spread.Sheets.HorizontalAlign.right);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                default:
 | 
	
		
			
				|  |  | -                    cell.hAlign(GC.Spread.Sheets.HorizontalAlign.left);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    private_create_field_node: function (sheet, colWidthArr, rowHeightArr, text, rptTpl) {
 | 
	
		
			
				|  |  | +        let cellValue = text[`text`].toString().slice(1, -1);
 | 
	
		
			
				|  |  | +        let rst = {"Name": cellValue, "Title": '', "FieldID": -1, "font": "GrandTotal", "control": "Column_Right", "style" : "Default_Normal", "isAutoHeight" : false,
 | 
	
		
			
				|  |  | +            "area" : {"Left" : 0, "Right" : 100, "Top" : 0, "Bottom" : 100, "H_CalculationType" : "percentage", "V_CalculationType" : "percentage"}
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        //1. 设置FieldID
 | 
	
		
			
				|  |  | +        let hasChkField = false;
 | 
	
		
			
				|  |  | +        if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS] !== undefined && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS].length > 0) {
 | 
	
		
			
				|  |  | +            for (let field of rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS]) {
 | 
	
		
			
				|  |  | +                if (field[JV.PROP_NAME] === cellValue) {
 | 
	
		
			
				|  |  | +                    rst.FieldID = field[JV.PROP_ID];
 | 
	
		
			
				|  |  | +                    rst["Title"] = "ID: " + field[JV.PROP_ID];
 | 
	
		
			
				|  |  | +                    hasChkField = true;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            switch (ctrl.Vertical) {
 | 
	
		
			
				|  |  | -                case `center`:
 | 
	
		
			
				|  |  | -                    cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                case `bottom`:
 | 
	
		
			
				|  |  | -                    cell.vAlign(GC.Spread.Sheets.VerticalAlign.bottom);
 | 
	
		
			
				|  |  | -                    break;
 | 
	
		
			
				|  |  | -                default:
 | 
	
		
			
				|  |  | -                    cell.vAlign(GC.Spread.Sheets.VerticalAlign.top);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!hasChkField && rptTpl[JV.NODE_NO_MAPPING_FIELDS] !== undefined && rptTpl[JV.NODE_NO_MAPPING_FIELDS].length > 0) {
 | 
	
		
			
				|  |  | +            for (let field of rptTpl[JV.NODE_NO_MAPPING_FIELDS]) {
 | 
	
		
			
				|  |  | +                if (field[JV.PROP_NAME] === cellValue) {
 | 
	
		
			
				|  |  | +                    rst.FieldID = field[JV.PROP_ID];
 | 
	
		
			
				|  |  | +                    rst["Title"] = "ID: " + field[JV.PROP_ID];
 | 
	
		
			
				|  |  | +                    hasChkField = true;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    private_setCellStyle: function (cell, textNode) {
 | 
	
		
			
				|  |  | -        //默认是normal,暂时不管
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    private_setCellFont: function (cell, textNode) {
 | 
	
		
			
				|  |  | -        for (let font of rpt_tpl_cfg_helper.reportCfg.fonts) {
 | 
	
		
			
				|  |  | -            if (font.ID === textNode[JV.PROP_FONT]) {
 | 
	
		
			
				|  |  | -                cell.font(Math.round(font[JV.FONT_PROPS[JV.FONT_PROP_IDX_HEIGHT]] * 3 / 4) + 'pt ' + font[JV.FONT_PROPS[JV.FONT_PROP_IDX_NAME]]);
 | 
	
		
			
				|  |  | -                break;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        let cell = sheet.getCell(text.row, text.col);
 | 
	
		
			
				|  |  | +        //2. 字体
 | 
	
		
			
				|  |  | +        if (cell.font().indexOf('Narrow') > 0) {
 | 
	
		
			
				|  |  | +            rst[JV.PROP_FONT] = "Content_Narrow";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        //3. 上下左右位置
 | 
	
		
			
				|  |  | +        virtualCommonOprObj.setupHeightWidth(rst, text, colWidthArr, rowHeightArr);
 | 
	
		
			
				|  |  | +        return rst;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      applySummaryBack: function () {
 | 
	
	
		
			
				|  | @@ -280,25 +370,45 @@ let virtualSummaryOprObj = {
 | 
	
		
			
				|  |  |              let rAmt = sheet.getRowCount(), pixH = [0];
 | 
	
		
			
				|  |  |              if (rAmt > 0) {
 | 
	
		
			
				|  |  |                  let texts = [], colWidthArr = [], rowHeightArr = [];
 | 
	
		
			
				|  |  | -                virtualCommonOprObj.collectSheetTxt(sheet, texts, colWidthArr, rowHeightArr);
 | 
	
		
			
				|  |  | -                for (let node of summaryParentNode.items) {
 | 
	
		
			
				|  |  | +                //1. 收集text信息
 | 
	
		
			
				|  |  | +                virtualCommonOprObj.collectSheetTxt(sheet, texts, 0, colWidthArr, rowHeightArr);
 | 
	
		
			
				|  |  | +                for (let node of me.summaryParentNode.items) {
 | 
	
		
			
				|  |  |                      dataInfoMapTreeOprObj.treeObj.removeChildNodes(node);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                //2. 重新创建文本及统计指标
 | 
	
		
			
				|  |  |                  let txtNodes = [], fieldNodes = [];
 | 
	
		
			
				|  |  |                  for (let text of texts) {
 | 
	
		
			
				|  |  |                      if (!stringUtil.isEmptyString(text[`text`]) && text[`text`].indexOf(`{`) === 0) {
 | 
	
		
			
				|  |  |                          //创建指标
 | 
	
		
			
				|  |  | +                        fieldNodes.push(me.private_create_field_node(sheet, colWidthArr, rowHeightArr, text, rptTpl));
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          //创建文本
 | 
	
		
			
				|  |  | -                        let node = virtualCommonOprObj.createTxtNode(text, me.columnParentNode, colWidthArr, rowHeightArr);
 | 
	
		
			
				|  |  | -                        txtNodes.push(node);
 | 
	
		
			
				|  |  | +                        let textNode = virtualCommonOprObj.createTxtNode(text, me.columnParentNode, colWidthArr, rowHeightArr);
 | 
	
		
			
				|  |  | +                        let cell = sheet.getCell(text.row, text.col);
 | 
	
		
			
				|  |  | +                        if (cell.font().indexOf('Narrow') < 0) {
 | 
	
		
			
				|  |  | +                            textNode[JV.PROP_FONT] = "GrandTotal";
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            textNode[JV.PROP_FONT] = "Content_Narrow";
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        textNode[JV.PROP_CONTROL] = "Column";
 | 
	
		
			
				|  |  | +                        textNode[JV.PROP_STYLE] = "Default_Normal";
 | 
	
		
			
				|  |  | +                        txtNodes.push(textNode);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                //....
 | 
	
		
			
				|  |  | -                let selectedBand = virtualCommonOprObj.getBandEx(summaryParentNode[JV.PROP_BAND_NAME], rptTpl);
 | 
	
		
			
				|  |  | -                selectedBand[JV.BAND_PROP_HEIGHT] = (rowHeightArr[rowHeightArr.length - 1] / 96 * 2.54).toFixed(2);
 | 
	
		
			
				|  |  | +                let fieldNode = me.summaryParentNode.items[0], textNode = me.summaryParentNode.items[1];
 | 
	
		
			
				|  |  | +                if (txtNodes.length > 0) {
 | 
	
		
			
				|  |  | +                    dataInfoMapTreeOprObj.treeObj.addNodes(textNode, -1, txtNodes, true);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (fieldNodes.length > 0) {
 | 
	
		
			
				|  |  | +                    dataInfoMapTreeOprObj.treeObj.addNodes(fieldNode, -1, fieldNodes, true);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                //3. 重新设置band高度
 | 
	
		
			
				|  |  | +                // let selectedBand = virtualCommonOprObj.getBandEx(me.summaryParentNode[JV.PROP_BAND_NAME], rptTpl);
 | 
	
		
			
				|  |  | +                // selectedBand[JV.BAND_PROP_HEIGHT] = (rowHeightArr[rowHeightArr.length - 1] / 96 * 2.54).toFixed(2);
 | 
	
		
			
				|  |  | +                virtualCommonOprObj.changeBandHeight(me.summaryParentNode[JV.PROP_BAND_NAME], (rowHeightArr[rowHeightArr.length - 1] / 96 * 2.54).toFixed(2));
 | 
	
		
			
				|  |  | +                displayMessage("应用提交成功!", "green", 5000, "id_summary_setup_lbl");
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                displayMessage("模板行数量不足!", "red", 2000, "id_summary_setup_lbl");
 | 
	
		
			
				|  |  | +                displayMessage("模板行数量不足!", "red", 5000, "id_summary_setup_lbl");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 |