Procházet zdrojové kódy

fix(report): 1.合并多余的interface

lishihao před 5 roky
rodič
revize
4011387ddf

+ 5 - 5
report/src/core/helper/jpc_helper_common_output.ts

@@ -1,6 +1,6 @@
 'use strict';
 
-import { Fields, ICell, IControlCollection, INode } from '../../interface/basic';
+import { Fields, ICell, IControlCollection } from '../../interface/basic';
 import JV from '../jpc_value_define';
 import JpcFieldHelper from './jpc_helper_field';
 const OFFSET_FLOAT = 0.0000000001;
@@ -14,7 +14,7 @@ let JpcCommonOutputHelper = {
                 control: node.control as string,
                 style: node.style,
                 Value: value
-            } as INode;
+            } as ICell;
         //2. value
         me.formatCell(node.Format, rst);
         // innerFormat(node.Format, rst);
@@ -33,12 +33,12 @@ let JpcCommonOutputHelper = {
     createCommonOutput: function (node: Fields, value: number | string | null, controls: IControlCollection | null) {
         let me = this,
             //1. font/style/control
-            rst: INode = {
+            rst: ICell = {
                 font: node.font,
                 control: node.control as string,
                 style: node.style,
                 Value: value
-            } as INode;
+            } as ICell;
         //2. value
         JpcFieldHelper.decorateValue(rst, controls);
         me.formatCell(node.Format, rst);
@@ -51,7 +51,7 @@ let JpcCommonOutputHelper = {
         }
         return rst;
     },
-    formatCell: function (formatStr: string, rstCell: INode) {
+    formatCell: function (formatStr: string, rstCell: ICell) {
         if (formatStr) {
             const rstCellFloatVal = parseFloat(rstCell.Value as string);
             if (!(isNaN(rstCellFloatVal))) {

+ 3 - 3
report/src/core/helper/jpc_helper_field.ts

@@ -2,7 +2,7 @@
 
 import JV from '../jpc_value_define';
 import strUtil from '../../public/stringUtil';
-import { Fields, ICell, IControlCollection, ICustomizeCfg, IGroupField, INode, IOrgGroupField, IRptTpl } from '../../interface/basic';
+import { Fields, IControlCollection, ICustomizeCfg, IGroupField, ICell, IOrgGroupField, IRptTpl } from '../../interface/basic';
 
 let JpcFieldHelper = {
     getValue: function (dataField: string[] | null, valueIdx: number) {
@@ -72,9 +72,9 @@ let JpcFieldHelper = {
             tab_field.Format = formatStrs.join("");
         }
     },
-    decorateValue: function (cell: INode, controls: IControlCollection | null) {
+    decorateValue: function (cell: ICell, controls: IControlCollection | null) {
         if (controls) {
-            const showZero = controls[cell.control].ShowZero;
+            const showZero = controls[cell.control as string].ShowZero;
             if (showZero && showZero === 'F') {
                 const val = parseFloat(cell.Value as string);
                 if (val === 0) {

+ 3 - 1
report/src/core/jpc_ex.ts

@@ -177,7 +177,9 @@ class JpcExClass {
                 return null;
             }
             //1.
-            let rstPage: IRstPage = {};
+            let rstPage: IRstPage = {
+                cells:[]
+            };
             rstPage.page_seq = 1;
             if (me.flowTab) {
                 rstPage.cells = me.flowTab.outputAsPreviewPage(rptTpl, bands, rst.control_collection, me);

+ 2 - 3
report/src/core/jpc_flow_tab.ts

@@ -34,7 +34,6 @@ import {
     IPageCellObj,
     IPageAreaObj,
     IControlSubCollection,
-    INode,
 
 } from '../interface/basic'
 import { IControlProps, IPositionProps } from '../index';
@@ -1439,7 +1438,7 @@ function _addPageValue(ValuedIdxLst: number[][][], sortedSequence: number[], grp
     return nextPageAutoHeightRecAmt;
 }
 
-function push_cell(pageCellObj: IPageCellObj, cell: INode, cellIdx: number) {
+function push_cell(pageCellObj: IPageCellObj, cell: ICell, cellIdx: number) {
     let key = cell.area.Left; + '_' + cell.area.Right;
     if (!pageCellObj[key]) {
         pageCellObj[key] = [];
@@ -1448,7 +1447,7 @@ function push_cell(pageCellObj: IPageCellObj, cell: INode, cellIdx: number) {
     cellArr.push({ "cellIdx": cellIdx, "cell": cell });
 }
 
-function prepareAutoHeightCells(prepareObj: IPageAreaObj | {}, cellItem: INode, cellIdx: number, cellsArr: ICell[]) {
+function prepareAutoHeightCells(prepareObj: IPageAreaObj | {}, cellItem: ICell, cellIdx: number, cellsArr: ICell[]) {
     if (prepareObj) {
         if ((prepareObj as IPageAreaObj).cellsArr === undefined) {
             (prepareObj as IPageAreaObj).cellsArr = cellsArr;

+ 3 - 11
report/src/interface/basic.ts

@@ -124,14 +124,6 @@ export interface IPositionExtent {
     Top: IPositionExtentDetail;
 }
 
-export interface INode {
-    font: string;
-    control: string;
-    style: string;
-    Value: number | string | null;
-    area: IArea;
-    isAutoHeight: boolean;
-}
 export interface IPageAreaObj {
     cellsArr: ICell[];
     pageCellObj: IPageCellObj;
@@ -140,7 +132,7 @@ export interface IPageAreaObj {
 export interface IPageCellObj {
     [key: string]: {
         cellIdx: number;
-        cell: INode;
+        cell: ICell;
     }[];
 }
 export interface ICell {
@@ -167,7 +159,7 @@ export interface IPreviewPage {
     打印页面_信息: {
         报表名称: string;
         纸张宽高: number[];
-        页边距: [number, number];
+        页边距: IPosition;
     };
     control_collection: IControlCollection;
     font_collection: IFontCollection;
@@ -593,7 +585,7 @@ interface IFlowGroup {
 
 export interface IRstPage {
     page_seq?: number;
-    cells?: INode[];
+    cells: ICell[];
     page_merge_border?: IMergeBand;
 }
 

+ 8 - 8
report/src/interface/classType.ts

@@ -1,4 +1,4 @@
-import { Fields, IBandDetail, IBands, ICell, IControlCollection, ICrossTab, ICurrent_DATA, ICurrent_RPT, ICustomizeCfg, IDataObj, IDefProperties, IGrpLine, IMergePos, INode, IPreviewPage, IRptTpl, ITab } from "./basic";
+import { Fields, IBandDetail, IBands, ICell, IControlCollection, ICrossTab, ICurrent_DATA, ICurrent_RPT, ICustomizeCfg, IDataObj, IDefProperties, IGrpLine, IMergePos, IPreviewPage, IRptTpl, ITab } from "./basic";
 
 export interface IFlowTabClass {
     auto_height_fields_idx: [number, Fields][];
@@ -80,11 +80,11 @@ export interface ICostTabClass {
     preSetupPages: (rptTpl: IRptTpl, defProperties: IDefProperties, option: string) => number;
     outputAsPreviewPage: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any; //最后一个参数其实没作用,方法中定义了,但是在实际使用并没有传值
     outputPreviewContent: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, maxColRec: number, unitFactor: number) => any;
-    outputPreviewRowTab: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, unitFactor: number) => INode[];
-    outputPreviewColTab: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxColRec: number, unitFactor: number) => INode[];
-    outputPreviewTabExt: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxColRec: number, unitFactor: number) => INode[];
-    outputPreviewSumTabExt: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, unitFactor: number) => INode[];
-    outputPreviewTabSum: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, tabNodeName: string, unitFactor: number) => INode[];
+    outputPreviewRowTab: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, unitFactor: number) => ICell[];
+    outputPreviewColTab: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxColRec: number, unitFactor: number) => ICell[];
+    outputPreviewTabExt: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxColRec: number, unitFactor: number) => ICell[];
+    outputPreviewSumTabExt: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, unitFactor: number) => ICell[];
+    outputPreviewTabSum: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, tabNodeName: string, unitFactor: number) => ICell[];
     private_OutputPreviewCommon: (rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg, maxRowRec: number, maxColRec: number, tab: ICrossTab, unitFactor: number) => any
     outputAsSimpleJSONPage: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any;
     outputTabSum: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, unitFactor: number, tabNodeName: string, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any
@@ -92,8 +92,8 @@ export interface ICostTabClass {
     outputSumTabExt: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, unitFactor: number, segIdx: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any
     outputContent: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, unitFactor: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any;
     outputColTab: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, unitFactor: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => any
-    outputRowTabCommon: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, tabStr: string, rowFieldsIdxArr: any[], unitFactor: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => INode[];
-    outputTabField: (band: IBandDetail, tab_field: Fields, data_field: any, valueIdx: number, serialIdx: number, rows: number, rowIdx: number, cols: number, colIdx: number, unitFactor: number, isRow: boolean, controls: IControlCollection) => INode;
+    outputRowTabCommon: (rptTpl: IRptTpl, dataObj: IDataObj, page: number, bands: IBands, tabStr: string, rowFieldsIdxArr: any[], unitFactor: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) => ICell[];
+    outputTabField: (band: IBandDetail, tab_field: Fields, data_field: any, valueIdx: number, serialIdx: number, rows: number, rowIdx: number, cols: number, colIdx: number, unitFactor: number, isRow: boolean, controls: IControlCollection) => ICell;
 
 
 }