Przeglądaj źródła

fix(report): 更新报表模块ts

lishihao 5 lat temu
rodzic
commit
6422c43e39

+ 2 - 0
report/.eslintrc.js

@@ -11,6 +11,7 @@ module.exports = {
     sourceType: 'module',
     sourceType: 'module',
   },
   },
   plugins: ['@typescript-eslint', 'prettier'],
   plugins: ['@typescript-eslint', 'prettier'],
+  camelcase: ['error', { properties: 'never' }],//去除驼峰验证
   rules: {
   rules: {
     'prettier/prettier': 'error',
     'prettier/prettier': 'error',
     'import/extensions': [
     'import/extensions': [
@@ -23,6 +24,7 @@ module.exports = {
         json: 'always',
         json: 'always',
       },
       },
     ],
     ],
+
     'import/no-unresolved': 'off',
     'import/no-unresolved': 'off',
     'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
     'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
   },
   },

Plik diff jest za duży
+ 6973 - 9
report/dist/index.cjs.js


+ 2 - 1
report/dist/index.d.ts

@@ -1 +1,2 @@
-export default function justTest(): string;
+export { default as core } from './core/jpc_ex';
+export { default as excel_util } from './excel_util/rpt_excel_util';

+ 16 - 14
report/src/core/helper/jpc_helper_band.ts

@@ -1,6 +1,6 @@
 'use strict';
 'use strict';
 
 
-import { IBandDetail, IBands, IRptTpl } from '../../interface/basic';
+import { IBandDetail, IBands, IOrgBandDetail, IRptTpl } from '../../interface/basic';
 import JV from '../jpc_value_define';
 import JV from '../jpc_value_define';
 import JpcCommonHelper from './jpc_helper_common';
 import JpcCommonHelper from './jpc_helper_common';
 
 
@@ -10,39 +10,41 @@ let JpcBandHelper = {
         if (rst < 0) rst = JV.STATUS_NORMAL;
         if (rst < 0) rst = JV.STATUS_NORMAL;
         return rst;
         return rst;
     },
     },
+    //
     setBandArea: function (bands: IBands, rptTpl: IRptTpl, pageStatus: boolean[], isOnlyNormalStatus: boolean, isOnlyExStatus: boolean) {
     setBandArea: function (bands: IBands, rptTpl: IRptTpl, pageStatus: boolean[], isOnlyNormalStatus: boolean, isOnlyExStatus: boolean) {
         let me = this;
         let me = this;
         if (rptTpl.布局框_集合) {
         if (rptTpl.布局框_集合) {
             isOnlyNormalStatus = isOnlyNormalStatus || false;
             isOnlyNormalStatus = isOnlyNormalStatus || false;
             isOnlyExStatus = isOnlyExStatus || false;
             isOnlyExStatus = isOnlyExStatus || false;
-
+            // 把模板中的单位转化为px数值
             let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
             let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
+            // 用上面求出的单位重新计算位置
             let orgArea = JpcCommonHelper.getReportArea(rptTpl, unitFactor);
             let orgArea = JpcCommonHelper.getReportArea(rptTpl, unitFactor);
             for (let i = 0; i < rptTpl.布局框_集合.length; i++) {
             for (let i = 0; i < rptTpl.布局框_集合.length; i++) {
                 me.setBandPos(bands, rptTpl.布局框_集合[i], orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
                 me.setBandPos(bands, rptTpl.布局框_集合[i], orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
             }
             }
         }
         }
     },
     },
-    setBandPos: function (bands: IBands, bandNode: IBandDetail, orgArea: any, unitFactor: number, pageStatus: boolean[], isOnlyNormalStatus: boolean, isOnlyExStatus: boolean) {
+    setBandPos: function (bands: IBands, bandNode: IOrgBandDetail, orgArea: number[], unitFactor: number, pageStatus: boolean[], isOnlyNormalStatus: boolean, isOnlyExStatus: boolean) {
         let me = this, band = bands[bandNode.Name];
         let me = this, band = bands[bandNode.Name];
         //0. for multi flow purpose
         //0. for multi flow purpose
-        if (isOnlyNormalStatus) {
-            if (bandNode.hasOwnProperty(JV.PROP_BAND_EX_ONLY) && JpcCommonHelper.getBoolean(bandNode.exOnly)) {
+        if (isOnlyNormalStatus) {    //??
+            if (bandNode.exOnly && JpcCommonHelper.getBoolean(bandNode.exOnly)) {
                 return;
                 return;
             }
             }
         }
         }
-        if (isOnlyExStatus) {
-            if (bandNode.hasOwnProperty(JV.PROP_BAND_NORMAL_ONLY) && !(JpcCommonHelper.getBoolean(bandNode.normalOnly))) {
+        if (isOnlyExStatus) {    //??
+            if (bandNode.normalOnly && !(JpcCommonHelper.getBoolean(bandNode.normalOnly))) {
                 return;
                 return;
             }
             }
         }
         }
         //1. initialize
         //1. initialize
-        band.Left = orgArea[JV.IDX_LEFT];
-        band.Top = orgArea[JV.IDX_TOP];
-        band.Right = orgArea[JV.IDX_RIGHT];
-        band.Bottom = orgArea[JV.IDX_BOTTOM];
+        band.Left = orgArea[0];
+        band.Top = orgArea[1];
+        band.Right = orgArea[2];
+        band.Bottom = orgArea[3];
         //2. set this band
         //2. set this band
-        if (pageStatus[(band.BDisplayType) as number]) {
+        if (pageStatus[(band.DisplayType) as number]) {
             switch (band.Alignment) {
             switch (band.Alignment) {
                 case JV.LAYOUT_TOP:
                 case JV.LAYOUT_TOP:
                     if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
                     if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
@@ -86,9 +88,9 @@ let JpcBandHelper = {
             }
             }
         }
         }
     },
     },
-    resetBandPos: function (bandCollection: IBandDetail[], bands: IBands, contentBand: IBandDetail, offsetX: number, offsetY: number) {
+    resetBandPos: function (bandCollection: IOrgBandDetail[], bands: IBands, contentBand: IBandDetail, offsetX: number, offsetY: number) {
         let orgX = contentBand.Right, orgY = contentBand.Bottom;
         let orgX = contentBand.Right, orgY = contentBand.Bottom;
-        function _chkAndResetPos(targetBand: IBandDetail) {
+        function _chkAndResetPos(targetBand: IOrgBandDetail) {
             let band = bands[targetBand.Name];
             let band = bands[targetBand.Name];
             if (band) {
             if (band) {
                 if (band === contentBand) {
                 if (band === contentBand) {

+ 9 - 8
report/src/core/helper/jpc_helper_common.ts

@@ -6,7 +6,7 @@ import JV from '../jpc_value_define';
 const RESOLUTION = [96, 96];
 const RESOLUTION = [96, 96];
 
 
 const JpcCommonHelper = {
 const JpcCommonHelper = {
-    getResultByID(KeyID: string, collectionList: IStyles[][] | IControlCollection[]) {
+    getResultByID(KeyID: string, collectionList: IStyles[][] | IControlSubCollection[][]) {
         let rst = null;
         let rst = null;
         if (KeyID) {
         if (KeyID) {
             for (let i = 0; i < collectionList.length; i++) {
             for (let i = 0; i < collectionList.length; i++) {
@@ -40,20 +40,21 @@ const JpcCommonHelper = {
         list.push(dftStyles);
         list.push(dftStyles);
         return me.getResultByID(styleName, list);
         return me.getResultByID(styleName, list);
     },
     },
-    getControl(controlName: string, dftControls: IControlCollection, rptTpl?: IRptTpl) {
-        let me = this, list = [] as IControlCollection[];
-        if (rptTpl) list.push(rptTpl.control_collection);
+    getControl(controlName: string, dftControls: IControlSubCollection[], rptTpl?: IRptTpl) {
+        let me = this, list: IControlSubCollection[][] = [];
+        if (rptTpl) debugger;
+        //  list.push(rptTpl.control_collection);
         list.push(dftControls);
         list.push(dftControls);
         return me.getResultByID(controlName, list);
         return me.getResultByID(controlName, list);
     },
     },
     getLayoutAlignment(alignStr: string) {
     getLayoutAlignment(alignStr: string) {
         let rst = JV.LAYOUT.indexOf(alignStr);
         let rst = JV.LAYOUT.indexOf(alignStr);
-        if (rst < 0) rst = JV.LAYOUT_FULFILL;
+        if (rst < 0) rst = 4; //JV.LAYOUT_FULFILL;
         return rst;
         return rst;
     },
     },
     getPosCalculationType(typeStr: string) {
     getPosCalculationType(typeStr: string) {
         let rst = JV.CAL_TYPE.indexOf(typeStr);
         let rst = JV.CAL_TYPE.indexOf(typeStr);
-        if (rst < 0) rst = JV.CAL_TYPE_ABSTRACT;
+        if (rst < 0) rst = 1;// JV.CAL_TYPE_ABSTRACT;
         return rst;
         return rst;
     },
     },
     getBoolean(bStr: any) {  //暂定
     getBoolean(bStr: any) {  //暂定
@@ -98,11 +99,11 @@ const JpcCommonHelper = {
         let sizeIdx = JV.PAGES_SIZE_STR.indexOf(sizeStr);
         let sizeIdx = JV.PAGES_SIZE_STR.indexOf(sizeStr);
         if (sizeIdx >= 0) {
         if (sizeIdx >= 0) {
             size = JV.PAGES_SIZE[sizeIdx].slice(0);
             size = JV.PAGES_SIZE[sizeIdx].slice(0);
-        } else if (sizeStr === JV.PAGE_SELF_DEFINE) {
+        } else if (sizeStr === '自定义') {
             //自定义规格,如实际业务需要则后期补充
             //自定义规格,如实际业务需要则后期补充
         }
         }
         let page_orientation = rptTpl.主信息.打印页面_信息.方向;
         let page_orientation = rptTpl.主信息.打印页面_信息.方向;
-        if (page_orientation === JV.ORIENTATION_LANDSCAPE || page_orientation === JV.ORIENTATION_LANDSCAPE_CHN) {
+        if (page_orientation === 'LANDSCAPE' || page_orientation === '横向') {
             //swap x,y
             //swap x,y
             let tmp = size[0];
             let tmp = size[0];
             size[0] = size[1];
             size[0] = size[1];

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

@@ -83,7 +83,14 @@ let JpcFieldHelper = {
             }
             }
         }
         }
     },
     },
-    findAndPutDataFieldIdx: function (rptTpl: IRptTpl, tab_fields: { FieldID: number }[] | null, rstFields: { FieldID: number }[] | null, rstFieldsIdx: any[] | null, isEx: boolean) {
+
+    findAndPutDataFieldIdx: (
+        rptTpl: IRptTpl,
+        tab_fields: { FieldID: number }[] | null,
+        rstFields: { FieldID: number }[] | null,
+        rstFieldsIdx: (number | IOrgGroupField)[] | null,
+        isEx: boolean
+    ) => {
         //通过FieldID找到相关映射指标的位置IDX并记录下来,方便后续引用
         //通过FieldID找到相关映射指标的位置IDX并记录下来,方便后续引用
         if (tab_fields) {
         if (tab_fields) {
             let DTL_STR = isEx ? '从数据指标_拓展集合' : '从数据指标_集合';
             let DTL_STR = isEx ? '从数据指标_拓展集合' : '从数据指标_集合';
@@ -91,7 +98,7 @@ let JpcFieldHelper = {
             for (let i = 0; i < tab_fields.length; i++) {
             for (let i = 0; i < tab_fields.length; i++) {
                 let isFounded = false;
                 let isFounded = false;
                 for (let j = 0; j < detail_fields.length; j++) {
                 for (let j = 0; j < detail_fields.length; j++) {
-                    if (tab_fields[i]["FieldID"] === detail_fields[j]["ID"]) {
+                    if (tab_fields[i].FieldID === detail_fields[j].ID) {
                         isFounded = true;
                         isFounded = true;
                         if (rstFields) rstFields.push(tab_fields[i]);
                         if (rstFields) rstFields.push(tab_fields[i]);
                         if (rstFieldsIdx) rstFieldsIdx.push(j);
                         if (rstFieldsIdx) rstFieldsIdx.push(j);
@@ -103,7 +110,7 @@ let JpcFieldHelper = {
                     if (rstFieldsIdx) {
                     if (rstFieldsIdx) {
                         if (rptTpl.无映射离散指标_集合 && rptTpl.无映射离散指标_集合.length > 0) {
                         if (rptTpl.无映射离散指标_集合 && rptTpl.无映射离散指标_集合.length > 0) {
                             for (let discretField of rptTpl.无映射离散指标_集合) {
                             for (let discretField of rptTpl.无映射离散指标_集合) {
-                                if (discretField.ID === tab_fields[i]["FieldID"]) {
+                                if (discretField.ID === tab_fields[i].FieldID) {
                                     rstFieldsIdx.push(discretField);
                                     rstFieldsIdx.push(discretField);
                                     isFounded = true;
                                     isFounded = true;
                                     break;
                                     break;

+ 8 - 7
report/src/core/jpc_band.ts

@@ -2,11 +2,11 @@
 
 
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 import JpcCommonHelper from './helper/jpc_helper_common';
 import JpcCommonHelper from './helper/jpc_helper_common';
-import { IBandDetail, IRptTpl, } from '../interface/basic';
+import { IBandDetail, IBands, IDefProperties, IOrgBandDetail, IRptTpl, } from '../interface/basic';
 import JpcBandHelper from './helper/jpc_helper_band';
 import JpcBandHelper from './helper/jpc_helper_band';
 
 
 const JpcBand = {
 const JpcBand = {
-    createNew(rptTpl: IRptTpl, defProperties: any) {
+    createNew(rptTpl: IRptTpl, defProperties: IDefProperties) {
         let me = this;
         let me = this;
         let JpcBandResult: any = {};
         let JpcBandResult: any = {};
         if (rptTpl.布局框_集合) {
         if (rptTpl.布局框_集合) {
@@ -16,7 +16,8 @@ const JpcBand = {
         }
         }
         return JpcBandResult;
         return JpcBandResult;
     },
     },
-    createSingle(bandNode: any, parentObj: any, rptTpl: any, defProperties: any) {
+    //根据模板信息生成大板块的数据
+    createSingle(bandNode: IOrgBandDetail, parentObj: IBands, rptTpl: IRptTpl, defProperties: IDefProperties) {
         let me = this;
         let me = this;
         if (bandNode && bandNode.Name) {
         if (bandNode && bandNode.Name) {
             let item = {
             let item = {
@@ -26,16 +27,16 @@ const JpcBand = {
                 Bottom: 0,
                 Bottom: 0,
                 style: JpcCommonHelper.getStyle(bandNode.style, defProperties.styles),
                 style: JpcCommonHelper.getStyle(bandNode.style, defProperties.styles),
                 control: JpcCommonHelper.getControl(bandNode.control, defProperties.ctrls),
                 control: JpcCommonHelper.getControl(bandNode.control, defProperties.ctrls),
-                Height: (bandNode.Height) ? (1.0 * bandNode.Height) : 0,
-                Width: (bandNode.Width) ? 1.0 * bandNode.Width : 0,
+                Height: (bandNode.Height) ? parseFloat(bandNode.Height) : 0,
+                Width: (bandNode.Width) ? parseFloat(bandNode.Width) : 0,
                 DisplayType: JpcBandHelper.getBandTypeValByString(bandNode.DisplayType),
                 DisplayType: JpcBandHelper.getBandTypeValByString(bandNode.DisplayType),
                 Alignment: JpcCommonHelper.getLayoutAlignment(bandNode.Alignment),
                 Alignment: JpcCommonHelper.getLayoutAlignment(bandNode.Alignment),
                 CalculationType: JpcCommonHelper.getPosCalculationType(bandNode.CalculationType),
                 CalculationType: JpcCommonHelper.getPosCalculationType(bandNode.CalculationType),
             } as IBandDetail;
             } as IBandDetail;
-            if (bandNode.hasOwnProperty(JV.PROP_BAND_NORMAL_ONLY)) {
+            if (bandNode.normalOnly) {
                 item.normalOnly = JpcCommonHelper.getBoolean(bandNode.normalOnly);
                 item.normalOnly = JpcCommonHelper.getBoolean(bandNode.normalOnly);
             }
             }
-            if (bandNode.hasOwnProperty(JV.PROP_BAND_EX_ONLY)) {
+            if (bandNode.exOnly) {
                 item.exOnly = JpcCommonHelper.getBoolean(bandNode.exOnly);
                 item.exOnly = JpcCommonHelper.getBoolean(bandNode.exOnly);
             }
             }
 
 

+ 12 - 10
report/src/core/jpc_bill_tab.ts

@@ -15,21 +15,23 @@ import {
     IRptTpl,
     IRptTpl,
     IDataObj,
     IDataObj,
 } from '../interface/basic';
 } from '../interface/basic';
-import { IDataObj_props } from '../interface/enum'
+import { IDataObjProps } from '../interface/enum'
 class JpcBillTabSrvClass {
 class JpcBillTabSrvClass {
-    disp_fields_idx: any[];
+    disp_fields_idx: number[];
 
 
     constructor() {
     constructor() {
         this.disp_fields_idx = []; // typescript的class属性初始化都要放constructor里,不然总报错
         this.disp_fields_idx = []; // typescript的class属性初始化都要放constructor里,不然总报错
     };
     };
 
 
+    // 该方法主要是通过账单报表的信息,获取相对应于报表模板信息中的数据信息的数组的序号,以便后面取值计算
     sorting(rptTpl: IRptTpl) {
     sorting(rptTpl: IRptTpl) {
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.账单式表_信息.账单式表_数据.bill_field_s, [], this.disp_fields_idx, false);
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.账单式表_信息.账单式表_数据.bill_field_s, [], this.disp_fields_idx, false);
     };
     };
-
+    // 获取总页数
+    //问题:为什么dataFields第一个元素就可以确定总页数
     paging(rptTpl: IRptTpl, dataObj: IDataObj) {
     paging(rptTpl: IRptTpl, dataObj: IDataObj) {
         let rst = 0;
         let rst = 0;
-        function _getDataLength(fields_str: IDataObj_props) {
+        function _getDataLength(fields_str: IDataObjProps) {
             let dataFields = dataObj[fields_str];
             let dataFields = dataObj[fields_str];
             if (dataFields && dataFields.length > 0) {
             if (dataFields && dataFields.length > 0) {
                 rst = dataFields[0].length;
                 rst = dataFields[0].length;
@@ -37,11 +39,11 @@ class JpcBillTabSrvClass {
         }
         }
         if (rptTpl.指标_数据_映射) {
         if (rptTpl.指标_数据_映射) {
             if (rptTpl.指标_数据_映射.从数据指标_集合) {
             if (rptTpl.指标_数据_映射.从数据指标_集合) {
-                _getDataLength(IDataObj_props.detail_data);
+                _getDataLength(IDataObjProps.detail_data);
             } else if (rptTpl.指标_数据_映射.主数据指标_集合) {
             } else if (rptTpl.指标_数据_映射.主数据指标_集合) {
-                _getDataLength(IDataObj_props.master_data);
+                _getDataLength(IDataObjProps.master_data);
             } else if (rptTpl.指标_数据_映射.离散指标_集合) {
             } else if (rptTpl.指标_数据_映射.离散指标_集合) {
-                _getDataLength(IDataObj_props.discrete_data);
+                _getDataLength(IDataObjProps.discrete_data);
             } else if (rptTpl.指标_数据_映射.离散参数_集合) {
             } else if (rptTpl.指标_数据_映射.离散参数_集合) {
                 rst = 1;
                 rst = 1;
             }
             }
@@ -52,7 +54,7 @@ class JpcBillTabSrvClass {
     outputAsPreviewPage(rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT) {
     outputAsPreviewPage(rptTpl: IRptTpl, bands: IBands, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT) {
         let me = this, rst: any[] = [], vIdx = [];
         let me = this, rst: any[] = [], vIdx = [];
         //只预览第一页的数据
         //只预览第一页的数据
-        let pageStatus = [true, true, false, true, false, false, false, false];
+        let pageStatus = [true, true, false, true, false, false, false, false];//??
         JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
         JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
         let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
         let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
         rst = rst.concat(me.outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus));
         rst = rst.concat(me.outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus));
@@ -119,9 +121,9 @@ class JpcBillTabSrvClass {
                 // let data_details = null;//bylish
                 // let data_details = null;//bylish
                 let data_details = [];
                 let data_details = [];
                 if (rptTpl.指标_数据_映射.从数据指标_集合) {
                 if (rptTpl.指标_数据_映射.从数据指标_集合) {
-                    data_details = dataObj[IDataObj_props.detail_data];
+                    data_details = dataObj[IDataObjProps.detail_data];
                 } else if (rptTpl.指标_数据_映射.主数据指标_集合) {
                 } else if (rptTpl.指标_数据_映射.主数据指标_集合) {
-                    data_details = dataObj[IDataObj_props.master_data];
+                    data_details = dataObj[IDataObjProps.master_data];
                 }
                 }
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 for (let i = 0; i < tab_fields.length; i++) {
                 for (let i = 0; i < tab_fields.length; i++) {

+ 7 - 7
report/src/core/jpc_cross_tab.ts

@@ -24,7 +24,7 @@ import {
     ICrossTab,
     ICrossTab,
     IGroupField
     IGroupField
 } from '../interface/basic';
 } from '../interface/basic';
-import { IDataObj_props } from '../interface/enum'
+import { IDataObjProps } from '../interface/enum'
 class JpcCrossTabClass {
 class JpcCrossTabClass {
     dispValueIdxLst_Row: number[][];
     dispValueIdxLst_Row: number[][];
     dispValueIdxLst_Col: any[];
     dispValueIdxLst_Col: any[];
@@ -381,7 +381,7 @@ class JpcCrossTabClass {
             let pageStatus = me.pageStatusLst[page - 1];
             let pageStatus = me.pageStatusLst[page - 1];
             if (pageStatus[(band.DisplayType) as number] === true) {
             if (pageStatus[(band.DisplayType) as number] === true) {
                 let tab_fields = tab.cross_field_s,
                 let tab_fields = tab.cross_field_s,
-                    data_details = dataObj[IDataObj_props.detail_data],
+                    data_details = dataObj[IDataObjProps.detail_data],
                     valuesIdx = me.dispValueIdxLst_Col[page - 1];
                     valuesIdx = me.dispValueIdxLst_Col[page - 1];
                 for (let i = 0; i < me.row_extension_fields_idx.length; i++) {
                 for (let i = 0; i < me.row_extension_fields_idx.length; i++) {
                     let tab_field = tab_fields[i];
                     let tab_field = tab_fields[i];
@@ -427,7 +427,7 @@ class JpcCrossTabClass {
             let pageStatus = me.pageStatusLst[page - 1];
             let pageStatus = me.pageStatusLst[page - 1];
             if (pageStatus[(band.DisplayType) as number] === true && pageStatus[6] === true) {
             if (pageStatus[(band.DisplayType) as number] === true && pageStatus[6] === true) {
                 let tab_fields = tab.cross_field_s,
                 let tab_fields = tab.cross_field_s,
-                    data_details = dataObj[IDataObj_props.detail_data],
+                    data_details = dataObj[IDataObjProps.detail_data],
                     data_fields = [];
                     data_fields = [];
                 for (let i = 0; i < me.row_sum_extension_fields_idx.length; i++) {
                 for (let i = 0; i < me.row_sum_extension_fields_idx.length; i++) {
                     // let data_field = data_details[me.row_sum_extension_fields_idx[i]];
                     // let data_field = data_details[me.row_sum_extension_fields_idx[i]];
@@ -485,7 +485,7 @@ class JpcCrossTabClass {
             let pageStatus = me.pageStatusLst[page - 1];
             let pageStatus = me.pageStatusLst[page - 1];
             if (pageStatus[(band.DisplayType) as number] === true) {
             if (pageStatus[(band.DisplayType) as number] === true) {
                 let tab_fields = tab.cross_field_s;
                 let tab_fields = tab.cross_field_s;
-                let data_details = dataObj[IDataObj_props.detail_data];
+                let data_details = dataObj[IDataObjProps.detail_data];
                 let contentValuesIdx = me.dispValueIdxLst_Content[page - 1];
                 let contentValuesIdx = me.dispValueIdxLst_Content[page - 1];
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 for (let i = 0; i < tab_fields.length; i++) {
                 for (let i = 0; i < tab_fields.length; i++) {
@@ -534,7 +534,7 @@ class JpcCrossTabClass {
             let pageStatus = me.pageStatusLst[page - 1];
             let pageStatus = me.pageStatusLst[page - 1];
             if (pageStatus[(band.DisplayType) as number] === true) {
             if (pageStatus[(band.DisplayType) as number] === true) {
                 let tab_fields = tab.cross_field_s;
                 let tab_fields = tab.cross_field_s;
-                let data_details = dataObj[IDataObj_props.detail_data];
+                let data_details = dataObj[IDataObjProps.detail_data];
                 let valuesIdx = me.dispValueIdxLst_Col[page - 1];
                 let valuesIdx = me.dispValueIdxLst_Col[page - 1];
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 for (let i = 0; i < me.col_fields_idx.length; i++) {
                 for (let i = 0; i < me.col_fields_idx.length; i++) {
@@ -608,7 +608,7 @@ class JpcCrossTabClass {
             let pageStatus = me.pageStatusLst[page - 1];
             let pageStatus = me.pageStatusLst[page - 1];
             if (pageStatus[(band.DisplayType) as number] === true) {
             if (pageStatus[(band.DisplayType) as number] === true) {
                 let tab_fields = tab.cross_field_s;
                 let tab_fields = tab.cross_field_s;
-                let data_details = dataObj[IDataObj_props.detail_data];
+                let data_details = dataObj[IDataObjProps.detail_data];
                 let valuesIdx = me.dispValueIdxLst_Row[page - 1];
                 let valuesIdx = me.dispValueIdxLst_Row[page - 1];
                 let serialsIdx = me.dispSerialIdxLst_Row[page - 1];
                 let serialsIdx = me.dispSerialIdxLst_Row[page - 1];
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
                 let flexiblePrecisionRefObj: any = null, flexibleRefField = null, precision_ref_data = null;
@@ -766,7 +766,7 @@ function _SortAndOptimize(rptTpl: IRptTpl, dataObj: IDataObj, dataSeq: number[][
         //1. prepare and sort by tab-field
         //1. prepare and sort by tab-field
         let fields: any[] = [];
         let fields: any[] = [];
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, tab.cross_field_s, fields, rstFieldsIdx, false);
         JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, tab.cross_field_s, fields, rstFieldsIdx, false);
-        let data_details = dataObj[IDataObj_props.detail_data];
+        let data_details = dataObj[IDataObjProps.detail_data];
         JpcCrossTabHelper.sortTabFields(fields, rstFieldsIdx, data_details, dataSeq, $CURRENT_RPT);
         JpcCrossTabHelper.sortTabFields(fields, rstFieldsIdx, data_details, dataSeq, $CURRENT_RPT);
         //2. distinguish sort tab fields value
         //2. distinguish sort tab fields value
         let b1 = false;
         let b1 = false;

+ 3 - 3
report/src/core/jpc_data.ts

@@ -3,7 +3,7 @@
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 import jpc_common_helper from './helper/jpc_helper_common';
 import jpc_common_helper from './helper/jpc_helper_common';
 import { IDataObj, IRptTpl } from '../interface/basic';
 import { IDataObj, IRptTpl } from '../interface/basic';
-import { IDataObj_props } from '../interface/enum';
+import { IDataObjProps } from '../interface/enum';
 
 
 const JpcData = {
 const JpcData = {
     createNew() {
     createNew() {
@@ -104,9 +104,9 @@ const JpcData = {
                     }
                     }
                 };
                 };
                 if ((rptTpl) && (dataObj)) {
                 if ((rptTpl) && (dataObj)) {
-                    _analyse('主数据指标_集合', '从数据指标_集合', IDataObj_props.master_data, IDataObj_props.detail_data, me.dataSeq);
+                    _analyse('主数据指标_集合', '从数据指标_集合', IDataObjProps.master_data, IDataObjProps.detail_data, me.dataSeq);
                     if (rptTpl.流水式表_拓展信息) {
                     if (rptTpl.流水式表_拓展信息) {
-                        _analyse('主数据指标_拓展集合', '从数据指标_拓展集合', IDataObj_props.master_data_ex, IDataObj_props.detail_data_ex, me.exDataSeq);
+                        _analyse('主数据指标_拓展集合', '从数据指标_拓展集合', IDataObjProps.master_data_ex, IDataObjProps.detail_data_ex, me.exDataSeq);
                     }
                     }
                 }
                 }
             }
             }

+ 2 - 2
report/src/core/jpc_event.ts

@@ -4,7 +4,7 @@
 'use strict';
 'use strict';
 
 
 import { IRptTpl } from '../interface/basic';
 import { IRptTpl } from '../interface/basic';
-import { IEvent_type } from '../interface/enum';
+import { IEventType } from '../interface/enum';
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 
 
 const JpcEvent = {
 const JpcEvent = {
@@ -20,7 +20,7 @@ const JpcEvent = {
                 // for (let key of propArr) {
                 // for (let key of propArr) {
                 //     item[key] = rptTpl[JV.NODE_EVENTS][i][key];
                 //     item[key] = rptTpl[JV.NODE_EVENTS][i][key];
                 // }
                 // }
-                const event_type = [IEvent_type.GRP_ON_CREATE, IEvent_type.FLOW_CONTENT_ON_CREATE]
+                const event_type = [IEventType.GRP_ON_CREATE, IEventType.FLOW_CONTENT_ON_CREATE]
                 switch (event_type.indexOf(item.type)) {
                 switch (event_type.indexOf(item.type)) {
                     case JV.EVENT_IDX_GRP_ON_CREATE:
                     case JV.EVENT_IDX_GRP_ON_CREATE:
                         rst.FLOW_CONTENT_ON_CREATE = item;
                         rst.FLOW_CONTENT_ON_CREATE = item;

+ 72 - 43
report/src/core/jpc_ex.ts

@@ -1,5 +1,5 @@
-'use strict';
 
 
+import JE from './jpc_rte'; //Important: for self-define function execution purpose
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 import JpcBand from './jpc_band';
 import JpcBand from './jpc_band';
 import JpcFlowTab from './jpc_flow_tab';
 import JpcFlowTab from './jpc_flow_tab';
@@ -12,9 +12,12 @@ import JpcFunc from './jpc_function';
 import JpcEvent from './jpc_event';
 import JpcEvent from './jpc_event';
 import JpcData from './jpc_data';
 import JpcData from './jpc_data';
 import JpcCommonHelper from './helper/jpc_helper_common';
 import JpcCommonHelper from './helper/jpc_helper_common';
-import $JE from './jpc_rte'; //Important: for self-define function execution purpose
+import useReportDate from '../public/ReportDate'
+
 import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICurrent_DATA, ICustomizeCfg, ITargetFields, IRptTpl, IDataObj, IBands, IControlCollection, IStyles, BorderStyle, IFontSubCollection, IControlSubCollection, IPreviewPage, IRstPage, IMergeBand } from '../interface/basic'
 import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICurrent_DATA, ICustomizeCfg, ITargetFields, IRptTpl, IDataObj, IBands, IControlCollection, IStyles, BorderStyle, IFontSubCollection, IControlSubCollection, IPreviewPage, IRstPage, IMergeBand } from '../interface/basic'
 import { IFlowTabClass, IBillTabClass, ICostTabClass } from '../interface/classType';
 import { IFlowTabClass, IBillTabClass, ICostTabClass } from '../interface/classType';
+import { IControlProps, IFontProps, IPagingOption } from '../interface/enum';
+import { Key } from 'readline';
 
 
 class JpcExClass {
 class JpcExClass {
     flowTab!: IFlowTabClass;
     flowTab!: IFlowTabClass;
@@ -56,12 +59,14 @@ class JpcExClass {
     };
     };
 
 
     analyzeData(rptTpl: IRptTpl, dataObj: IDataObj, defProperties: IDefProperties, option: string, outputType: string) {
     analyzeData(rptTpl: IRptTpl, dataObj: IDataObj, defProperties: IDefProperties, option: string, outputType: string) {
-        let me = this, dftPagingOption = option || JV.PAGING_OPTION_NORMAL;
+        let me = this, dftPagingOption = option || IPagingOption.normal;
         //1. data object
         //1. data object
         let dataHelper: any = JpcData.createNew();
         let dataHelper: any = JpcData.createNew();
-        me.executeFormulas(JV.RUN_TYPE_BEFORE_ANALYZING, rptTpl, dataObj, me); //在分析前运行,主要是增加灵活性,比如:重新编排数据的主从关系
+
+        // 主要是通过计算rptTpl参数里面的 指标_数据_映射 属性中的公式,赋值于dataObj中的相对应(根据)的属性
+        me.executeFormulas('before_analyzing', rptTpl, dataObj, me); //在分析前运行,主要是增加灵活性,比如:重新编排数据的主从关系
         if (me.crossTab) {
         if (me.crossTab) {
-            me.executeFormulas(JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me);
+            me.executeFormulas('before_paging', rptTpl, dataObj, me);
             dataHelper.analyzeData(rptTpl, dataObj);
             dataHelper.analyzeData(rptTpl, dataObj);
             me.crossTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
             me.crossTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
         } else {
         } else {
@@ -75,24 +80,28 @@ class JpcExClass {
                     me.flowTabEx.sorting(rptTpl, dataObj, dataHelper.exDataSeq.slice(0), me);
                     me.flowTabEx.sorting(rptTpl, dataObj, dataHelper.exDataSeq.slice(0), me);
                 }
                 }
             }
             }
+
             if (me.billTab) {
             if (me.billTab) {
+                // 先记录下账单式表_信息.账单式表_数据中的数据相对应于从 数据指标_集合 中的相对应的数组序号,后面便于计算
                 // me.billTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
                 // me.billTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
-                me.billTab.sorting(rptTpl);//edit by lish,方法中需要的参数只有一个,但是这里存入了4个
+                //edit by lish,方法中需要的参数只有一个,但是这里存入了4个
+                me.billTab.sorting(rptTpl);
+
             }
             }
-            //let dt2 = new Date();
-            //alert(dt2 - dt1);
             //3. formulas
             //3. formulas
-            me.executeFormulas(JV.RUN_TYPE_BEFORE_PAGING, rptTpl, dataObj, me);
+            // 主要是通过计算rptTpl参数里面的 指标_数据_映射 属性中的公式,赋值于dataObj中的相对应(根据)的属性
+            me.executeFormulas('before_paging', rptTpl, dataObj, me);
         }
         }
         //4. paging
         //4. paging
+        //获取总页数
         me.paging(rptTpl, dataObj, defProperties, dftPagingOption);
         me.paging(rptTpl, dataObj, defProperties, dftPagingOption);
         //alert('analyzeData was completed!');
         //alert('analyzeData was completed!');
         //for garbage collection:
         //for garbage collection:
-        // dataHelper = null;
+        dataHelper = null;
     };
     };
-
+    //获取总页数
     paging(rptTpl: IRptTpl, dataObj: IDataObj, defProperties: IDefProperties, option: string) {
     paging(rptTpl: IRptTpl, dataObj: IDataObj, defProperties: IDefProperties, option: string) {
-        let me = this, dftPagingOption = option || JV.PAGING_OPTION_NORMAL;
+        let me = this, dftPagingOption = option || IPagingOption.normal;
         if (me.flowTab) {
         if (me.flowTab) {
             if (me.isFollowMode) {
             if (me.isFollowMode) {
                 me.totalPages = me.flowTab.preSetupPages(rptTpl, dataObj, defProperties, dftPagingOption, me, me.flowTabEx);
                 me.totalPages = me.flowTab.preSetupPages(rptTpl, dataObj, defProperties, dftPagingOption, me, me.flowTabEx);
@@ -106,24 +115,36 @@ class JpcExClass {
             }
             }
         } else if (me.crossTab) {
         } else if (me.crossTab) {
             //me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, dftPagingOption);
             //me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, dftPagingOption);
-            me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, JV.PAGING_OPTION_NORMAL); //infinity对交叉表来说无意义
+            me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, IPagingOption.normal); //infinity对交叉表来说无意义
         } else if (me.billTab) {
         } else if (me.billTab) {
             me.totalPages = me.billTab.paging(rptTpl, dataObj);
             me.totalPages = me.billTab.paging(rptTpl, dataObj);
         }
         }
     };
     };
 
 
-    executeFormulas(runType: string, $CURRENT_TEMPLATE: any, $CURRENT_DATA: ICurrent_DATA, $CURRENT_RPT: ICurrent_RPT) {
+    //根据步骤,对formulas中的计算式进行处理,并赋值到相应属性中
+    executeFormulas(runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_RPT) {
         let execFmlMe = this;
         let execFmlMe = this;
         for (let execFmlIdx = 0; execFmlIdx < execFmlMe.formulas.length; execFmlIdx++) {
         for (let execFmlIdx = 0; execFmlIdx < execFmlMe.formulas.length; execFmlIdx++) {
             //remark: 搞这么复杂的变量名是为了防止与表达式起冲突(如循环变量i,j,k,容易造成变量冲突且不容易看出问题)
             //remark: 搞这么复杂的变量名是为了防止与表达式起冲突(如循环变量i,j,k,容易造成变量冲突且不容易看出问题)
             if (execFmlMe.formulas[execFmlIdx].run_type === runType) {
             if (execFmlMe.formulas[execFmlIdx].run_type === runType) {
                 let expression = execFmlMe.formulas[execFmlIdx].expression;
                 let expression = execFmlMe.formulas[execFmlIdx].expression;
                 if (expression) {
                 if (expression) {
+                    // 计算式集合,目前是放置打印信息的,用于配置属性的计算
                     let $ME = execFmlMe.formulas[execFmlIdx];
                     let $ME = execFmlMe.formulas[execFmlIdx];
                     // console.log("current expression idx: " + execFmlIdx);
                     // console.log("current expression idx: " + execFmlIdx);
                     // console.log(expression);
                     // console.log(expression);
+
                     try {
                     try {
-                        eval(expression);
+                        const $JE = JE;
+                        const ReportDate = useReportDate;
+                        console.log(expression);
+                        //临时处理
+                        if (expression.indexOf('Date()') > -1) {
+                            eval(expression.replace('Date()', 'ReportDate()'));
+                        } else {
+                            eval(expression);
+                        }
+
                     } catch (ex) {
                     } catch (ex) {
                         console.log(ex);
                         console.log(ex);
                     }
                     }
@@ -145,7 +166,7 @@ class JpcExClass {
         let bands = JpcBand.createNew(rptTpl, defProperties);
         let bands = JpcBand.createNew(rptTpl, defProperties);
         try {
         try {
             function getPageMergeBorder() {
             function getPageMergeBorder() {
-                let mergeRst: IMergeBand = {};
+                let mergeRst = {} as IMergeBand;
                 if (bands.MergeBand) {
                 if (bands.MergeBand) {
                     let mergedBand = bands.MergeBand;
                     let mergedBand = bands.MergeBand;
                     mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
                     mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
@@ -172,12 +193,14 @@ class JpcExClass {
             rst.items.push(rstPage);
             rst.items.push(rstPage);
             //2.
             //2.
             if (bands.MergeBand) {
             if (bands.MergeBand) {
-                let mergedBand: IMergeBand = {}, band = bands.MergeBand;
-                mergedBand.Left = parseInt(band.Left.toFixed(0));
-                mergedBand.Right = parseInt(band.Right.toFixed(0));
-                mergedBand.Top = parseInt(band.Top.toFixed(0));
-                mergedBand.Bottom = parseInt(band.Bottom.toFixed(0));
-                mergedBand.style = band.style;
+                let band = bands.MergeBand;
+                let mergedBand :IMergeBand= {
+                    Left : parseInt(band.Left.toFixed(0)),
+                    Right: parseInt(band.Right.toFixed(0)),
+                    Top : parseInt(band.Top.toFixed(0)),
+                    Bottom :parseInt(band.Bottom.toFixed(0)),
+                    style: band.style,
+                } ;
                 rst.MergeBand = mergedBand;
                 rst.MergeBand = mergedBand;
             }
             }
         } catch (exception) {
         } catch (exception) {
@@ -193,26 +216,31 @@ class JpcExClass {
         if ((startPage > 0) && (startPage <= endPage) && (endPage <= me.totalPages)) {
         if ((startPage > 0) && (startPage <= endPage) && (endPage <= me.totalPages)) {
             rst.control_collection = private_buildDftControls(rptTpl, (defProperties === null) ? null : defProperties.ctrls);
             rst.control_collection = private_buildDftControls(rptTpl, (defProperties === null) ? null : defProperties.ctrls);
             rst.style_collection = private_buildDftStyles(rptTpl, (defProperties === null) ? null : defProperties.styles);
             rst.style_collection = private_buildDftStyles(rptTpl, (defProperties === null) ? null : defProperties.styles);
-            rst[JV.NODE_FONT_COLLECTION] = private_buildDftFonts(rptTpl, (defProperties === null) ? null : defProperties.fonts);
+            rst.font_collection = private_buildDftFonts(rptTpl, (defProperties === null) ? null : defProperties.fonts);
             rst.打印页面_信息 = {};
             rst.打印页面_信息 = {};
             rst.打印页面_信息.报表名称 = rptTpl.主信息.报表名称;
             rst.打印页面_信息.报表名称 = rptTpl.主信息.报表名称;
             rst.打印页面_信息.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
             rst.打印页面_信息.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
             rst.打印页面_信息.页边距 = rptTpl.主信息.页边距;
             rst.打印页面_信息.页边距 = rptTpl.主信息.页边距;
             rst.items = [];
             rst.items = [];
+            //初始化band(每个大板块的属性)
             let bands = JpcBand.createNew(rptTpl, defProperties);
             let bands = JpcBand.createNew(rptTpl, defProperties);
             try {
             try {
                 for (let page = startPage; page <= endPage; page++) {
                 for (let page = startPage; page <= endPage; page++) {
                     me.runTimePageData.currentPage = page;
                     me.runTimePageData.currentPage = page;
-                    me.executeFormulas(JV.RUN_TYPE_BEFORE_OUTPUT, rptTpl, dataObj, me);
+                    me.executeFormulas('before_output', rptTpl, dataObj, me);
+                    console.log('=======================');
                     rst.items.push(me.outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, rst.control_collection, customizeCfg));
                     rst.items.push(me.outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, rst.control_collection, customizeCfg));
                 }
                 }
                 if (bands.MergeBand) {
                 if (bands.MergeBand) {
-                    let mergedBand: IMergeBand = {}, band = bands.MergeBand;
-                    mergedBand.Left = parseInt(band.Left.toFixed(0));
-                    mergedBand.Right = parseInt(band.Right.toFixed(0));
-                    mergedBand.Top = parseInt(band.Top.toFixed(0));
-                    mergedBand.Bottom = parseInt(band.Bottom.toFixed(0));
-                    mergedBand.style = band.style;
+                    let band = bands.MergeBand;
+                    let mergedBand: IMergeBand = {
+                        Left : parseInt(band.Left.toFixed(0)),
+                        Right: parseInt(band.Right.toFixed(0)),
+                        Top : parseInt(band.Top.toFixed(0)),
+                        Bottom : parseInt(band.Bottom.toFixed(0)),
+                        style : band.style,
+                    };
+                   
                     rst.MergeBand = mergedBand;
                     rst.MergeBand = mergedBand;
                 }
                 }
             } catch (exception) {
             } catch (exception) {
@@ -228,10 +256,9 @@ class JpcExClass {
         let me = this, rst: any = null;
         let me = this, rst: any = null;
         function getPageMergeBorder() {
         function getPageMergeBorder() {
             // let mergeRst = null;
             // let mergeRst = null;
-            let mergeRst: IMergeBand = {};
+            let mergeRst  = {} as IMergeBand;
             if (bands.MergeBand) {
             if (bands.MergeBand) {
                 let mergedBand = bands.MergeBand;
                 let mergedBand = bands.MergeBand;
-                mergeRst = {};
                 mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
                 mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
                 mergeRst.Right = parseInt(mergedBand.Right.toFixed(0));
                 mergeRst.Right = parseInt(mergedBand.Right.toFixed(0));
                 mergeRst.Top = parseInt(mergedBand.Top.toFixed(0));
                 mergeRst.Top = parseInt(mergedBand.Top.toFixed(0));
@@ -253,7 +280,7 @@ class JpcExClass {
                     rst.cells = me.flowTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, adHocMergePos, me, customizeCfg);
                     rst.cells = me.flowTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, adHocMergePos, me, customizeCfg);
                     if (adHocMergePos) {
                     if (adHocMergePos) {
                         adHocMergePos.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
                         adHocMergePos.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
-                        rst[JV.PAGE_SPECIAL_MERGE_POS] = adHocMergePos;
+                        rst.page_merge_pos = adHocMergePos;
                     }
                     }
 
 
                 } else {
                 } else {
@@ -266,7 +293,7 @@ class JpcExClass {
             } else if (me.billTab) {
             } else if (me.billTab) {
                 rst.cells = me.billTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, me, customizeCfg);
                 rst.cells = me.billTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, me, customizeCfg);
             }
             }
-            if (!(me.flowTab && me.flowTab.paging_option === JV.PAGING_OPTION_INFINITY)) {
+            if (!(me.flowTab && me.flowTab.paging_option === IPagingOption.infinity)) {
                 let pageMergeBorder = getPageMergeBorder();
                 let pageMergeBorder = getPageMergeBorder();
                 if (pageMergeBorder) {
                 if (pageMergeBorder) {
                     rst.page_merge_border = pageMergeBorder;
                     rst.page_merge_border = pageMergeBorder;
@@ -278,17 +305,19 @@ class JpcExClass {
 }
 }
 
 
 //暂定
 //暂定
-function private_buildDftItems(rptTpl: any, dftCollection: any, propArray: any, nodeName: any) {
+const private_buildDftItems = (
+    rptTpl: any,
+    dftCollection: IControlSubCollection[] | IFontSubCollection[] | null,
+    nodeName: string
+) => {
     const rst: any = {};
     const rst: any = {};
     if (dftCollection) {
     if (dftCollection) {
         for (let i = 0; i < dftCollection.length; i++) {
         for (let i = 0; i < dftCollection.length; i++) {
-            const item: any = {};
-            for (let j = 0; j < propArray.length; j++) {
-                item[propArray[j]] = dftCollection[i][propArray[j]];
-            }
-            rst[dftCollection[i].ID] = item;
+            const { ID, ...dftCollectionProps } = dftCollection[i];
+            rst[dftCollection[i].ID] = { ...dftCollectionProps };
         }
         }
-        if (rptTpl && rptTpl[nodeName] && rptTpl[nodeName].length > 0) {
+        const propArray = (nodeName === 'control_collection') ? JV.CONTROL_PROPS : JV.FONT_PROPS;
+        if (rptTpl && rptTpl[nodeName] && rptTpl[nodeName].length) {
             for (let i = 0; i < rptTpl[nodeName].length; i++) {
             for (let i = 0; i < rptTpl[nodeName].length; i++) {
                 const rptDftItem = rptTpl[nodeName][i];
                 const rptDftItem = rptTpl[nodeName][i];
                 if (rst[rptDftItem.ID] === undefined) {
                 if (rst[rptDftItem.ID] === undefined) {
@@ -305,11 +334,11 @@ function private_buildDftItems(rptTpl: any, dftCollection: any, propArray: any,
 }
 }
 
 
 function private_buildDftControls(rptTpl: IRptTpl, dftControlCollection: IControlSubCollection[] | null) {
 function private_buildDftControls(rptTpl: IRptTpl, dftControlCollection: IControlSubCollection[] | null) {
-    return private_buildDftItems(rptTpl, dftControlCollection, JV.CONTROL_PROPS, JV.NODE_CONTROL_COLLECTION);
+    return private_buildDftItems(rptTpl, dftControlCollection, 'control_collection');
 }
 }
 
 
 function private_buildDftFonts(rptTpl: IRptTpl, dftFontCollection: IFontSubCollection[] | null) {
 function private_buildDftFonts(rptTpl: IRptTpl, dftFontCollection: IFontSubCollection[] | null) {
-    return private_buildDftItems(rptTpl, dftFontCollection, JV.FONT_PROPS, JV.NODE_FONT_COLLECTION);
+    return private_buildDftItems(rptTpl, dftFontCollection, 'font_collection');
 }
 }
 
 
 function private_buildDftStyles(rptTpl: IRptTpl, dftStyleCollection: IStyles[] | null) {
 function private_buildDftStyles(rptTpl: IRptTpl, dftStyleCollection: IStyles[] | null) {

+ 7 - 7
report/src/core/jpc_field.ts

@@ -2,7 +2,7 @@
 
 
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 import { IRptTpl, IGroupField, IOrgGroupField } from '../interface/basic'
 import { IRptTpl, IGroupField, IOrgGroupField } from '../interface/basic'
-import { IDataObj_props } from '../interface/enum'
+import { IDataObjProps } from '../interface/enum'
 const JpcField = {
 const JpcField = {
     createNew(rptTpl: IRptTpl) {
     createNew(rptTpl: IRptTpl) {
         let me = this;
         let me = this;
@@ -16,17 +16,17 @@ const JpcField = {
         };
         };
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.离散指标_集合) {
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.离散指标_集合) {
             for (let i = 0; i < rptTpl.指标_数据_映射.离散指标_集合.length; i++) {
             for (let i = 0; i < rptTpl.指标_数据_映射.离散指标_集合.length; i++) {
-                me.createSingle(rptTpl.指标_数据_映射.离散指标_集合[i], JpcFieldResult.离散指标_集合, IDataObj_props.discrete_data, i);
+                me.createSingle(rptTpl.指标_数据_映射.离散指标_集合[i], JpcFieldResult.离散指标_集合, IDataObjProps.discrete_data, i);
             }
             }
         }
         }
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_集合) {
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_集合) {
             for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_集合.length; i++) {
             for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_集合.length; i++) {
-                me.createSingle(rptTpl.指标_数据_映射.主数据指标_集合[i], JpcFieldResult.主数据指标_集合, IDataObj_props.master_data, i);
+                me.createSingle(rptTpl.指标_数据_映射.主数据指标_集合[i], JpcFieldResult.主数据指标_集合, IDataObjProps.master_data, i);
             }
             }
         }
         }
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_集合) {
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_集合) {
             for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_集合.length; i++) {
             for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_集合.length; i++) {
-                me.createSingle(rptTpl.指标_数据_映射.从数据指标_集合[i], JpcFieldResult.从数据指标_集合, IDataObj_props.detail_data, i);
+                me.createSingle(rptTpl.指标_数据_映射.从数据指标_集合[i], JpcFieldResult.从数据指标_集合, IDataObjProps.detail_data, i);
             }
             }
         }
         }
         if (rptTpl.无映射离散指标_集合) {
         if (rptTpl.无映射离散指标_集合) {
@@ -36,18 +36,18 @@ const JpcField = {
         }
         }
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_拓展集合) {
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_拓展集合) {
             for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_拓展集合.length; i++) {
             for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_拓展集合.length; i++) {
-                me.createSingle(rptTpl.指标_数据_映射.主数据指标_拓展集合[i], JpcFieldResult.主数据指标_拓展集合, IDataObj_props.master_data_ex, i);
+                me.createSingle(rptTpl.指标_数据_映射.主数据指标_拓展集合[i], JpcFieldResult.主数据指标_拓展集合, IDataObjProps.master_data_ex, i);
             }
             }
         }
         }
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_拓展集合) {
         if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_拓展集合) {
             for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_拓展集合.length; i++) {
             for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_拓展集合.length; i++) {
-                me.createSingle(rptTpl.指标_数据_映射.从数据指标_拓展集合[i], JpcFieldResult.从数据指标_拓展集合, IDataObj_props.detail_data_ex, i);
+                me.createSingle(rptTpl.指标_数据_映射.从数据指标_拓展集合[i], JpcFieldResult.从数据指标_拓展集合, IDataObjProps.detail_data_ex, i);
             }
             }
         }
         }
         //NODE_MASTER_FIELDS_EX
         //NODE_MASTER_FIELDS_EX
         return JpcFieldResult;
         return JpcFieldResult;
     },
     },
-    createSingle(fieldNode: IOrgGroupField, parentObj: Record<string, IOrgGroupField>, dataNodeName: IDataObj_props | string, sequence: number) {
+    createSingle(fieldNode: IOrgGroupField, parentObj: Record<string, IOrgGroupField>, dataNodeName: IDataObjProps | string, sequence: number) {
         if (fieldNode && fieldNode.ID) {
         if (fieldNode && fieldNode.ID) {
             let item = {
             let item = {
                 ID: fieldNode.ID,
                 ID: fieldNode.ID,

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

@@ -1516,13 +1516,17 @@ function combineAutoHeightCells(prepareObj: IPageAreaObj | {}, page: number, con
                         //如果到了最后一条数据,得判断firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
                         //如果到了最后一条数据,得判断firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
                         //不满格的cell的Vertical强制设置为 'center'
                         //不满格的cell的Vertical强制设置为 'center'
                         if (i === sameColCells.length - 1 && validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
                         if (i === sameColCells.length - 1 && validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
-                            firstMergeCell.control.VerticalForExcel = 'center';
+                            if (typeof firstMergeCell.control !== 'string') {
+                                firstMergeCell.control.VerticalForExcel = 'center';
+                            }
                         }
                         }
                     } else {
                     } else {
                         //碰到新开始的自动行高行,判断原先的firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
                         //碰到新开始的自动行高行,判断原先的firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
                         //不满格的cell的Vertical强制设置为 'center'
                         //不满格的cell的Vertical强制设置为 'center'
                         if (validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
                         if (validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
-                            firstMergeCell.control.VerticalForExcel = 'center';
+                            if (typeof firstMergeCell.control !== 'string') {
+                                firstMergeCell.control.VerticalForExcel = 'center';
+                            }
                         }
                         }
                         //强制把已为对象的control属性还原成为字符串,by lish
                         //强制把已为对象的control属性还原成为字符串,by lish
                         firstMergeCell = sameColCells[i].cell as unknown as ICell;
                         firstMergeCell = sameColCells[i].cell as unknown as ICell;

+ 18 - 13
report/src/core/jpc_rte.ts

@@ -7,12 +7,12 @@ import strUtil from '../public/stringUtil';
 import scMathUtil from '../public/scMathUtil';
 import scMathUtil from '../public/scMathUtil';
 import JV from './jpc_value_define';
 import JV from './jpc_value_define';
 import { Fields, ICurrent_RPT, IDataObj } from '../interface/basic';
 import { Fields, ICurrent_RPT, IDataObj } from '../interface/basic';
-import { IDataObj_props } from '../interface/enum';
-
+import { IDataObjProps } from '../interface/enum';
 const JE = {
 const JE = {
     $STR_UTIL: strUtil,
     $STR_UTIL: strUtil,
     $SC_MATH_UTIL: scMathUtil,
     $SC_MATH_UTIL: scMathUtil,
-    F: function (fID: number, $CURRENT_RPT: ICurrent_RPT) {
+     //获取把数据中fields的相关对象,并准备赋值到该对象中的某个属性
+    F:  (fID: number, $CURRENT_RPT: ICurrent_RPT)=> {
         let rst = null;
         let rst = null;
         if ($CURRENT_RPT && ($CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID])) {
         if ($CURRENT_RPT && ($CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID])) {
             rst = $CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID];
             rst = $CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID];
@@ -33,13 +33,13 @@ const JE = {
         }
         }
         return rst;
         return rst;
     },
     },
-    P: function (pID: number, $CURRENT_RPT: any) {//暂定
+       //获取把数据中params的相关对象,并准备赋值到该对象中的某个属性
+    P:  (pID: number, $CURRENT_RPT: ICurrent_RPT)=> {
         let rst = null;
         let rst = null;
         if ($CURRENT_RPT && ($CURRENT_RPT.params[JV.PROP_ID + "_" + pID])) {
         if ($CURRENT_RPT && ($CURRENT_RPT.params[JV.PROP_ID + "_" + pID])) {
-            rst = $CURRENT_RPT.params[JV.PROP_ID + "_" + pID];
-        } else {
+            rst = $CURRENT_RPT.params["ID_" + pID];
+        } 
             // rst = {msg: "the Param-ID is not valid, no result was found!"}; by lish
             // rst = {msg: "the Param-ID is not valid, no result was found!"}; by lish
-        }
         return rst;
         return rst;
     },
     },
     getCurrentPage: function ($CURRENT_RPT: ICurrent_RPT) {
     getCurrentPage: function ($CURRENT_RPT: ICurrent_RPT) {
@@ -74,6 +74,7 @@ const JE = {
         }
         }
         return rst;
         return rst;
     },
     },
+    //向目标对象赋值
     setFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number, newValue: number) {
     setFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number, newValue: number) {
         if (field.DataNodeName === "NA") {
         if (field.DataNodeName === "NA") {
             if (!field.data_field) {
             if (!field.data_field) {
@@ -82,9 +83,9 @@ const JE = {
             field.data_field[valIdx] = newValue;
             field.data_field[valIdx] = newValue;
         } else if (!field.DataNodeName) {
         } else if (!field.DataNodeName) {
             //that means this is a self-defined discrete field!
             //that means this is a self-defined discrete field!
-            field.DataNodeName = IDataObj_props.discrete_data;
-            field.DataSeq = dataObj[JV.DATA_DISCRETE_DATA].length;
-            dataObj[JV.DATA_DISCRETE_DATA].push([]);
+            field.DataNodeName = IDataObjProps.discrete_data;
+            field.DataSeq = dataObj[IDataObjProps.discrete_data].length;
+            dataObj[IDataObjProps.discrete_data].push([]);
             dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
             dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
         } else {
         } else {
             dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
             dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
@@ -106,9 +107,9 @@ const JE = {
         } else {
         } else {
             if (!field.DataNodeName) {
             if (!field.DataNodeName) {
                 //that means this is a self-defined discrete field!
                 //that means this is a self-defined discrete field!
-                field.DataNodeName = JV.DATA_DISCRETE_DATA;
-                field.DataSeq = dataObj[JV.DATA_DISCRETE_DATA];
-                dataObj[JV.DATA_DISCRETE_DATA].push([]);
+                field.DataNodeName = IDataObjProps.discrete_data;
+                field.DataSeq = dataObj[IDataObjProps.discrete_data];
+                dataObj[IDataObjProps.discrete_data].push([]);
             }
             }
             if (dataObj[field.DataNodeName][field.DataSeq].length > valIdx) {
             if (dataObj[field.DataNodeName][field.DataSeq].length > valIdx) {
                 rst = dataObj[field.DataNodeName][field.DataSeq][valIdx];
                 rst = dataObj[field.DataNodeName][field.DataSeq][valIdx];
@@ -122,6 +123,7 @@ const JE = {
         return rst;
         return rst;
     },
     },
     getFieldValueArray: function (field: Fields, dataObj: IDataObj) {
     getFieldValueArray: function (field: Fields, dataObj: IDataObj) {
+        console.log('===================getFieldValueArray')
         let rst = null;
         let rst = null;
         if (field.DataNodeName === 'NA') {
         if (field.DataNodeName === 'NA') {
             if (!field.data_field) {
             if (!field.data_field) {
@@ -141,6 +143,7 @@ const JE = {
         return rst;
         return rst;
     },
     },
     setFieldValueArray: function (field: Fields, dataObj: IDataObj, newArr: number[]) {
     setFieldValueArray: function (field: Fields, dataObj: IDataObj, newArr: number[]) {
+        console.log('===================setFieldValueArray')
         if (newArr instanceof Array) {
         if (newArr instanceof Array) {
             if (field.DataNodeName === 'NA') {
             if (field.DataNodeName === 'NA') {
                 field.data_field = newArr;
                 field.data_field = newArr;
@@ -156,6 +159,7 @@ const JE = {
         }
         }
     },
     },
     removeFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number) {
     removeFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number) {
+        console.log('===================removeFieldValue')
         if (field.DataNodeName === "NA") {
         if (field.DataNodeName === "NA") {
             if (field.data_field.length > valIdx && valIdx >= 0) {
             if (field.data_field.length > valIdx && valIdx >= 0) {
                 field.data_field.splice(valIdx, 1);
                 field.data_field.splice(valIdx, 1);
@@ -167,6 +171,7 @@ const JE = {
         }
         }
     },
     },
     insertFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number, newValue: number) {
     insertFieldValue: function (field: Fields, dataObj: IDataObj, valIdx: number, newValue: number) {
+        console.log('===================insertFieldValue')
         if (field.DataNodeName === "NA") {
         if (field.DataNodeName === "NA") {
             if (field.data_field.length > valIdx && valIdx >= 0) {
             if (field.data_field.length > valIdx && valIdx >= 0) {
                 field.data_field.splice(valIdx, 0, newValue);
                 field.data_field.splice(valIdx, 0, newValue);

+ 58 - 26
report/src/interface/basic.ts

@@ -1,6 +1,6 @@
 // import { IFlowTabClass, IBillTabClass, ICostTabClass } from './classType';
 // import { IFlowTabClass, IBillTabClass, ICostTabClass } from './classType';
 // eslint-disable-next-line camelcase
 // eslint-disable-next-line camelcase
-import { IDataObj_props, IEvent_type } from './enum';
+import { IDataObjProps, IEventType } from './enum';
 
 
 export interface IArea {
 export interface IArea {
     Left: number;
     Left: number;
@@ -59,7 +59,7 @@ export interface IFormula {
 
 
 export interface BorderStyle {
 export interface BorderStyle {
     Position: string;
     Position: string;
-    LineWeight: string;
+    LineWeight: number;
     DashStyle: string;
     DashStyle: string;
     Color: string;
     Color: string;
 }
 }
@@ -81,17 +81,19 @@ export interface IControlCollection {
     [key: string]: IControlSubCollection;
     [key: string]: IControlSubCollection;
 }
 }
 export interface IFontSubCollection {
 export interface IFontSubCollection {
-    FontAngle: string;
-    FontBold: string;
-    FontColor: string;
-    FontHeight: string;
+    CfgDispName: string
+    FontAngle?: string;
+    FontBold?: string;
+    FontColor?: string;
+    FontHeight: number;
     FontItalic: string;
     FontItalic: string;
-    FontStrikeOut: string;
+    FontStrikeOut?: string;
     FontUnderline: string;
     FontUnderline: string;
     Name: string;
     Name: string;
     ID: string;
     ID: string;
+    [key: string]: string | number | undefined
 }
 }
-interface IFontCollection {
+export interface IFontCollection {
     [key: string]: IFontSubCollection;
     [key: string]: IFontSubCollection;
 }
 }
 
 
@@ -115,7 +117,7 @@ interface IPositionExtentDetail {
     LineWeight: string;
     LineWeight: string;
 }
 }
 
 
-interface IPositionExtent {
+export interface IPositionExtent {
     Bottom: IPositionExtentDetail;
     Bottom: IPositionExtentDetail;
     Left: IPositionExtentDetail;
     Left: IPositionExtentDetail;
     Right: IPositionExtentDetail;
     Right: IPositionExtentDetail;
@@ -143,7 +145,7 @@ export interface IPageCellObj {
 }
 }
 export interface ICell {
 export interface ICell {
     font: string;
     font: string;
-    control: IControlSubCollection;
+    control: IControlSubCollection|string;
     style: string;
     style: string;
     Value: number | string | null;
     Value: number | string | null;
     area: IPosition;
     area: IPosition;
@@ -156,7 +158,7 @@ export interface ICell {
 export interface IPreviewPage {
 export interface IPreviewPage {
     打印页面_信息: {
     打印页面_信息: {
         报表名称: string;
         报表名称: string;
-        纸张宽高: IPosition;
+        纸张宽高: number[];
         页边距: [number, number];
         页边距: [number, number];
     };
     };
     control_collection: IControlCollection;
     control_collection: IControlCollection;
@@ -166,6 +168,9 @@ export interface IPreviewPage {
             page_seq: number;
             page_seq: number;
             cells: ICell[];
             cells: ICell[];
             page_merge_border: IPosition;
             page_merge_border: IPosition;
+            page_merge_pos:{
+                纸张宽高:number[]
+            }
         }
         }
     ];
     ];
     MergeBand: {
     MergeBand: {
@@ -197,7 +202,7 @@ export interface IGroupField {
     ID: number;
     ID: number;
     DataType: string;
     DataType: string;
     DataSeq: number;
     DataSeq: number;
-    DataNodeName: IDataObj_props;
+    DataNodeName: IDataObjProps;
     data_field: number | any; // 暂定
     data_field: number | any; // 暂定
     Precision?: {
     Precision?: {
         type?: string;
         type?: string;
@@ -290,7 +295,7 @@ export interface IFlowTab {
         multiColIdx: number
         multiColIdx: number
     ) => Fields[];
     ) => Fields[];
 }
 }
-interface IParam {
+export interface IParam {
     DataSeq: number;
     DataSeq: number;
     DataType: string;
     DataType: string;
     ID: string;
     ID: string;
@@ -371,6 +376,20 @@ export interface ICustomizeCfg {
     margins: IPosition;
     margins: IPosition;
     showVerticalLine: boolean;
     showVerticalLine: boolean;
 }
 }
+export interface IOrgBandDetail {
+    Alignment: string;
+    DisplayType:  string;
+    Height:  string;
+    MergeBorder:  string;
+    Name:  string;
+    control: string;
+    style:  string;
+    Width?:string;
+    CalculationType:string;
+    normalOnly?:boolean;
+    exOnly?:boolean;
+    band_s?:IOrgBandDetail[]
+}
 
 
 export interface IBandDetail {
 export interface IBandDetail {
     Alignment: number;
     Alignment: number;
@@ -384,9 +403,8 @@ export interface IBandDetail {
     MergeBorder: string;
     MergeBorder: string;
     Left: number;
     Left: number;
     Height: number;
     Height: number;
-    DisplayType?: number;
+    DisplayType: number;
     Name: string;
     Name: string;
-    BDisplayType: number;
     exOnly?: boolean;
     exOnly?: boolean;
     normalOnly?: boolean;
     normalOnly?: boolean;
     band_s?: any[];
     band_s?: any[];
@@ -400,6 +418,7 @@ export interface IGrpLine {
     text_s: any[];
     text_s: any[];
     discrete_field_s: any[];
     discrete_field_s: any[];
     param_s: any;
     param_s: any;
+    sum_field_s: any;
 }
 }
 export interface ITab {
 export interface ITab {
     text?: string;
     text?: string;
@@ -413,11 +432,12 @@ export interface IGrpPageInfo {
     group_lines_amt: number;
     group_lines_amt: number;
 }
 }
 
 
+//模板信息
 export interface IRptTpl {
 export interface IRptTpl {
     事件_集合: {
     事件_集合: {
-        type: IEvent_type;
+        type: IEventType;
     }[];
     }[];
-    布局框_集合: IBandDetail[];
+    布局框_集合: IOrgBandDetail[];
     计算式_集合: IFormula[];
     计算式_集合: IFormula[];
     离散参数_集合: IOrgGroupField[];
     离散参数_集合: IOrgGroupField[];
     账单式表_信息: {
     账单式表_信息: {
@@ -466,6 +486,15 @@ export interface IRptTpl {
         排序键值集: any[];
         排序键值集: any[];
         映射数据对象: string;
         映射数据对象: string;
         预处理类型: string;
         预处理类型: string;
+        过滤键值集: {
+            compareObjKey: string
+        }[];
+        分组键值集: {
+            seeking_parent: string
+        }[];
+        父子排序键: {
+            父映射数据对象: string
+        }[]
     }[];
     }[];
     指标_数据_映射: {
     指标_数据_映射: {
         离散参数_集合: IOrgGroupField[];
         离散参数_集合: IOrgGroupField[];
@@ -495,19 +524,21 @@ export interface IRptTpl {
     ID: number;
     ID: number;
     ID_KEY: string;
     ID_KEY: string;
     style_collection?: any[];
     style_collection?: any[];
-    control_collection: IControlCollection;
+    control_collection: any;
 }
 }
 // 以后会跟 IGroupField合并
 // 以后会跟 IGroupField合并
 export interface IOrgGroupField {
 export interface IOrgGroupField {
     DataType: string;
     DataType: string;
     descr?: string;
     descr?: string;
     ID: number;
     ID: number;
-    mapExpression?: string;
+    mapExpression: string;
     Name: string;
     Name: string;
     Title?: string;
     Title?: string;
     Precision?: {
     Precision?: {
-        type: string;
+        type?: string;
         flexibleRefFieldID?: number;
         flexibleRefFieldID?: number;
+        fixedMapExpression?: string;
+        flexibleMapExpression?: string;
     };
     };
     fixedPrecisionNum?: number;
     fixedPrecisionNum?: number;
     flexiblePrecisionRefObj?: { [key: string]: number }[];
     flexiblePrecisionRefObj?: { [key: string]: number }[];
@@ -518,9 +549,10 @@ export interface IOrgGroupField {
 
 
 export interface IDataObj {
 export interface IDataObj {
     DecimalObj: {
     DecimalObj: {
-        prjDecimal: undefined;
+        prjDecimal: number;
         unitDecimal: {
         unitDecimal: {
-            default_decimal: 2;
+            default_decimal?: number;
+            unitDecimal?: any
         };
         };
     };
     };
     detail_data: (number | string)[][];
     detail_data: (number | string)[][];
@@ -571,9 +603,9 @@ export interface IRstPage {
 }
 }
 
 
 export interface IMergeBand {
 export interface IMergeBand {
-    Bottom?: number;
-    Left?: number;
-    Right?: number;
-    Top?: number;
+    Bottom: number;
+    Left: number;
+    Right: number;
+    Top: number;
     style?: any;
     style?: any;
 }
 }

+ 52 - 7
report/src/interface/enum.ts

@@ -1,13 +1,58 @@
-export enum IDataObj_props {
-    detail_data = 'detail_data',
-    detail_data_ex = 'detail_data_ex',
-    discrete_data = 'discrete_data',
-    master_data = 'master_data',
-    master_data_ex = 'master_data_ex',
+//数据类型
+export enum IDataObjProps {
+    detail_data = 'detail_data',         //从数据指标_集合
+    detail_data_ex = 'detail_data_ex',   //从数据指标_拓展集合
+    discrete_data = 'discrete_data',    // 离散指标_集合
+    master_data = 'master_data',        //主数据指标_集合
+    master_data_ex = 'master_data_ex',  //主数据指标_拓展集合
 }
 }
 
 
-export enum IEvent_type {
+export enum IEventType {
     GRP_ON_CREATE = 'GRP_ON_CREATE',
     GRP_ON_CREATE = 'GRP_ON_CREATE',
     FLOW_CONTENT_ON_CREATE = 'FLOW_CONTENT_ON_CREATE',
     FLOW_CONTENT_ON_CREATE = 'FLOW_CONTENT_ON_CREATE',
 }
 }
+
+//操作的步骤
+export enum IRunType {
+    beforeAnalyzing = 'before_analyzing',
+    beforePaging = 'before_paging',
+    beforeOutput = 'before_output',
+    beforeCombine = 'before_combine',
+    afterCombine = 'after_combine',
+}
+
+export enum IPagingOption {
+    normal = 'normal',
+    infinity = 'infinity'
+}
+
+export enum IControlProps {
+    Shrink,
+    ShowZero,
+    Horizon,
+    Vertical,
+    Wrap,
+    VerticalForExcel,
+    ShrinkFirst,
+    CloseOutput
+}
+export enum IFontProps {
+    Name,
+    FontHeight,
+    FontColor,
+    FontBold,
+    FontItalic,
+    FontUnderline,
+    FontStrikeOut,
+    FontAngle
+}
+
+export enum IPositionProps {
+   TOP,
+   Bottom,
+   Left,
+   Right
+}
+
+
 export default {};
 export default {};

+ 87 - 0
report/src/interface/projectConstsEnum.ts

@@ -0,0 +1,87 @@
+let projectConst = {
+    PROJECT: 'project',
+    BILLS: 'bills',
+    RATION: 'ration',
+    GLJ: 'GLJ',
+    RATION_GLJ:'ration_glj',
+    RATION_COE:'ration_coe',
+    RATION_ASS:'ration_ass',
+    RATION_INSTALLATION:'ration_installation',
+    RATION_TEMPLATE:'ration_template',
+    QUANTITY_DETAIL:'quantity_detail',
+    PROJECTGLJ: 'projectGLJ',
+    GLJLIST: 'GLJList',
+    UNITPRICEFILE: 'unitPriceFile',
+    PROPERTIES: 'properties',
+    // VOLUMEPRICE: 'volume_price',
+    FEERATE:'feeRate',
+    LABOUR_COE:'labour_coe',
+    CALC_PROGRAM:'calc_program',
+    INSTALLATION_FEE:'installation_fee',
+    PROJECT_INFO: 'project_info',
+    EVALUATE_LIST:'evaluate_list',
+    CONTRACTOR_LIST:'contractor_list',
+    BID_EVALUATION_LIST:'bid_evaluation_list'
+};
+
+let projectConstList = [
+    'bills',
+    'ration',
+    'GLJ',
+    'ration_glj',
+    'ration_coe',
+    'ration_ass',
+    'quantity_detail',
+    'projectGLJ',
+    'GLJList',
+    'unitPriceFile',
+    'properties',
+    // 'volume_price',
+    'feeRate',
+    'labour_coe',
+    'contractor_list',
+    'calc_program'
+];
+
+let summaryConstList = [
+    `Construct`,
+    `ConstructDetail`,
+    `Segment`,
+    `SegmentDetail`
+];
+
+let projectFieldConstList = [
+    `ProjectInfoFields`,        //工程信息指标
+    `ProjectFeatureFields`,     //工程特征指标
+    `ProjectCostFields`,        //工程造价指标
+    `ProjectEcoFields`,         //工程(主要)经济指标
+    `ProjectLabMaterialFields`, //主要工料指标
+    `ProjectQtyFields`          //主要工程量指标
+];
+
+let commonConst = {
+    UT_UPDATE: 'ut_update',
+    UT_CREATE: 'ut_create',
+    UT_DELETE: 'ut_delete'
+};
+
+const gljKeyArray =['code','name','specs','unit','type'];
+const rationKeyArray =['code','name','specs','unit','subType'];
+const rationType = {
+    ration: 1,
+    volumePrice: 2,
+    gljRation: 3,
+    install:4,
+    overHeight: 5, // 超高子目
+    itemIncrease: 6//子目增加
+};
+export default {
+    projectConst,
+    commonConst,
+    projectConstList,
+    gljKeyArray,
+    rationKeyArray,
+    rationType,
+    summaryConstList,
+    projectFieldConstList
+};

+ 30 - 0
report/src/public/ReportDate.ts

@@ -0,0 +1,30 @@
+import { set } from 'lodash';
+
+export default class ReportDate extends Date {
+ 
+  prototype: any;
+
+  constructor() {
+    super();
+   
+    set(this.prototype, 'Format', this.Format);
+    Object.assign(Date, this);
+  }
+
+  Format = (fmt: string) => {
+    const o: Record<string, any> = {
+      'M+': this.getMonth() + 1, // 月份
+      'd+': this.getDate(), // 日
+      'h+': this.getHours(), // 小时
+      'm+': this.getMinutes(), // 分
+      's+': this.getSeconds(), // 秒
+      'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
+      S: this.getMilliseconds(), // 毫秒
+    };
+    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, `${this.getFullYear()}`.substr(4 - RegExp.$1.length));
+    for (const k in o)
+      if (new RegExp(`(${k})`).test(fmt))
+        fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : `00${o[k]}`.substr(`${o[k]}`.length));
+    return fmt;
+  };
+}