'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var scMathUtil = require('@sc/util');
var lodash = require('lodash');

function _interopNamespace(e) {
    if (e && e.__esModule) return e;
    var n = Object.create(null);
    if (e) {
        Object.keys(e).forEach(function (k) {
            if (k !== 'default') {
                var d = Object.getOwnPropertyDescriptor(e, k);
                Object.defineProperty(n, k, d.get ? d : {
                    enumerable: true,
                    get: function () { return e[k]; }
                });
            }
        });
    }
    n["default"] = e;
    return Object.freeze(n);
}

var scMathUtil__namespace = /*#__PURE__*/_interopNamespace(scMathUtil);

// VAL_DEF
const JV = {
    NODE_CROSS_INFO: '交叉表_信息',
    NODE_CROSS_ROW: '交叉行',
    NODE_CROSS_COL: '交叉列',
    NODE_CROSS_CONTENT: '交叉数据',
    NODE_CROSS_ROW_SUM: '交叉行合计',
    NODE_CROSS_COL_SUM: '交叉列合计',
    NODE_CROSS_ROW_EXT: '交叉行拓展',
    NODE_CROSS_ROW_SUM_EXT: '交叉行拓展合计',
    NODE_CROSS_ROW_AD_HOC: '交叉行AD_HOC',
    NODE_FIELD_MAP: '指标_数据_映射',
    NODE_DISCRETE_FIELDS: '离散指标_集合',
    NODE_NO_MAPPING_FIELDS: '无映射离散指标_集合',
    NODE_DISCRETE_PARAMS: '离散参数_集合',
    NODE_MASTER_FIELDS: '主数据指标_集合',
    NODE_MASTER_FIELDS_EX: '主数据指标_拓展集合',
    NODE_DETAIL_FIELDS: '从数据指标_集合',
    NODE_DETAIL_FIELDS_EX: '从数据指标_拓展集合',
    NODE_BAND_COLLECTION: '布局框_集合',
    NODE_FORMULAS: '计算式_集合',
    NODE_EVENTS: '事件_集合',
    NODE_DISCRETE_INFO: '离散信息',
    NODE_BILL_INFO: '账单式表_信息',
    NODE_BILL_CONTENT: '账单式表_数据',
    NODE_FLOW_INFO: '流水式表_信息',
    NODE_FLOW_INFO_EX: '流水式表_拓展信息',
    NODE_FLOW_GROUP: '流水式表_分组信息',
    NODE_FLOW_SEG_SUM: '流水式表_段统计信息',
    NODE_FLOW_PAGE_SUM: '流水式表_页统计信息',
    NODE_FLOW_COLUMN: '流水式表_列',
    NODE_FLOW_CONTENT: '流水式表_数据',
    PROP_MULTI_COLUMN: '多列显示数量',
    PROP_FLOW_EX_DISPLAY_MODE: '流水拓展显示模式',
    DISPLAY_MODE_INDEPENDENT: '单独模式',
    DISPLAY_MODE_FOLLOW: '紧随模式',
    NODE_MAIN_INFO: '主信息',
    NODE_MAIN_INFO_RPT_NAME: '报表名称',
    NODE_PAGE_INFO: '打印页面_信息',
    NODE_PAGE_SIZE: '纸张宽高',
    NODE_MARGINS: '页边距',
    NODE_RPT_BIZ_TYPE: '报表业务类型',
    NODE_BIZ_TYPE_AUDI: '审核类型',
    NODE_BIZ_TYPE_SUM: '汇总类型',
    NODE_BIZ_TYPE_DETAIL: '明细类型',
    NODE_MAP_DATA_HANDLE_INFO: '映射数据预处理',
    PROP_DATA_KEY: '映射数据对象',
    PROP_PARENT_DATA_KEY: '父映射数据对象',
    PROP_PARENT_CHILD_SORT_KEY: '父子排序键',
    PROP_PARENT_SORT_KEYS: '父排序键值集',
    PROP_CHILD_SORT_KEYS: '子排序键值集',
    PROP_OTHER_SUB_SORT: '其他子排序',
    PROP_OTHER_SUB_FILTER: '其他子过滤',
    PROP_HANDLE_TYPE: '预处理类型',
    PROP_FILTER_KEYS: '过滤键值集',
    PROP_FILTER_TOP_BILLS_NODES: '清单顶节点集',
    PROP_FILTER_OTHER_BILLS_NODES: '其他清单节点集',
    PROP_FILTER_COMPARE_OBJ: 'compareObjKey',
    PROP_FILTER_COMPARE_OBJ_KEY: 'compareObjIdKey',
    PROP_FILTER_COMPARE_VAL: 'compareValue',
    PROP_FILTER_CONDITION: '判断条件',
    PROP_HANDLE_TYPE_FILTER: '过滤',
    PROP_HANDLE_TYPE_SUM: '合计',
    PROP_HANDLE_TYPE_SORT: '排序',
    PROP_HANDLE_TYPE_ADD_DUMMY: '增加Dummy数据',
    PROP_HANDLE_TYPE_ADJUST: '数据调整',
    PROP_HANDLE_TYPE_BILLS_DATA_MOVE: '量材数据转移',
    PROP_HANDLE_TYPE_COMPONENT_MOVE: '组成物数据转移',
    PROP_HANDLE_TYPE_COMPONENT_REPLACEMENT: '组成物替换',
    PROP_HANDLE_TYPE_PRECISION: '合计精度',
    PROP_ADJUST_COLLECTION: '数据调整集',
    PROP_ADJUST_ACTION: 'action',
    PROP_ADJUST_ACTION_VAL: 'actionValue',
    PROP_DUMMY_COLLECTION: 'Dummy数据集',
    PROP_DUMMY_VAL: 'Dummy数据对象值',
    PROP_FREQUENCY: '频率',
    PROP_GRP_KEYS: 'GrpKeyIds',
    PROP_SORT_TYPE: '排序方式',
    PROP_SORT_TYPE_SELF_DEFINE_LOGIC: '自定义逻辑',
    PROP_SORT_KEYS: '排序键值集',
    PROP_SUM_GROUP_KEYS: '分组键值集',
    PROP_SUM_SUM_KEYS: '统计键值集',
    PROP_SUM_CALC_AHEAD: '统计前计算',
    PROP_SUM_CACL_TYPE: '计算类型',
    PROP_FIELD_EXP_MAP: 'mapExpression',
    PROP_PRECISION: 'Precision',
    PROP_FIXED_PRECISION_AMT: 'fixedPrecisionNum',
    PROP_FIELD_EXP_FIXED_MAP: 'fixedMapExpression',
    PROP_FIELD_EXP_FLEXIBLE_MAP: 'flexibleMapExpression',
    PROP_FLEXIBLE_REF_FILED_ID: 'flexibleRefFieldID',
    NODE_FONT_COLLECTION: 'font_collection',
    NODE_STYLE_COLLECTION: 'style_collection',
    NODE_CONTROL_COLLECTION: 'control_collection',
    PROP_ID: 'ID',
    PROP_AD_HOC_DATA: 'data_field',
    PROP_CMN_HEIGHT: 'CommonHeight',
    PROP_CMN_WIDTH: 'CommonWidth',
    PROP_BAND_NAME: 'BandName',
    PROP_BAND_NORMAL_ONLY: 'normalOnly',
    PROP_BAND_EX_ONLY: 'exOnly',
    PROP_BAND_EX_JOIN_AFTER: 'isJoinAfter',
    PROP_UNITS: '单位',
    PROP_PAGE_SIZE: '页规格',
    PROP_ORIENTATION: '方向',
    PROP_LEFT: 'Left',
    PROP_RIGHT: 'Right',
    PROP_TOP: 'Top',
    PROP_BOTTOM: 'Bottom',
    PROP_DATA_TYPE: 'DataType',
    PROP_NAME: 'Name',
    PROP_DFT_VALUE: 'Default_Value',
    PROP_EXPRESSION: 'expression',
    PROP_RUN_TYPE: 'run_type',
    PROP_BORDER_STYLE: 'border_style',
    PROP_POSITION: 'Position',
    PROP_HIDDEN: 'Hidden',
    PROP_IS_SERIAL: 'isSerial',
    PROP_IS_MERGE: 'isMerge',
    PROP_COMBINE_TYPE: 'combineType',
    PROP_IS_AUTO_HEIGHT: 'isAutoHeight',
    PROP_FONT: 'font',
    PROP_CONTROL: 'control',
    PROP_STYLE: 'style',
    PROP_VALUE: 'Value',
    PROP_LABEL: 'Label',
    PROP_AREA: 'area',
    PROP_DISCRETE_FIELDS: 'discrete_field_s',
    PROP_FLOW_FIELDS: 'flow_field_s',
    PROP_BILL_FIELDS: 'bill_field_s',
    PROP_CROSS_FIELDS: 'cross_field_s',
    PROP_CROSS_DISPLAY_ORDER: 'cross_display_order',
    PROP_GROUP_FIELDS: 'group_field_s',
    PROP_GROUP_LINES: 'group_lines',
    PROP_GROUP_SUM_KEYS: 'SumKey_S',
    PROP_SUM_KEY: 'SumKey',
    PROP_SUM_FIELDS: 'sum_field_s',
    PROP_TEXTS: 'text_s',
    PROP_TEXT: 'text',
    PROP_PARAMS: 'param_s',
    PROP_FIELD_ID: 'FieldID',
    PROP_PARAM_ID: 'ParamID',
    PROP_PREFIX: 'Prefix',
    PROP_SUFFIX: 'Suffix',
    PROP_FORMAT: 'Format',
    PROP_SHOW_ZERO: 'ShowZero',
    PROP_EXTENSION_TYPE: 'ExtType',
    PROP_CALCULATION: 'CalculationType',
    PROP_H_CALCULATION: 'H_CalculationType',
    PROP_V_CALCULATION: 'V_CalculationType',
    PROP_FIT_AREA: 'isFitArea',
    IDX_LEFT: 0,
    IDX_TOP: 1,
    IDX_RIGHT: 2,
    IDX_BOTTOM: 3,
    BAND_PROP_NAME: 'Name',
    BAND_PROP_MERGE_BAND: 'MergeBand',
    BAND_PROP_STYLE: 'style',
    BAND_PROP_CONTROL: 'control',
    BAND_PROP_HEIGHT: 'Height',
    BAND_PROP_WIDTH: 'Width',
    BAND_PROP_DISPLAY_TYPE: 'DisplayType',
    BAND_PROP_ALIGNMENT: 'Alignment',
    BAND_PROP_MERGE_BORDER: 'MergeBorder',
    BAND_PROP_SUB_BANDS: 'band_s',
    MEASUREMENT: {
        PIXEL: ['像素点', '象素点', 'PIXEL'],
        CM: ['厘米', 'CM'],
        INCH: ['英寸', 'INCH'],
    },
    PROP_IS_ID: 'isID',
    PROP_ID_SEQ: 'IDSeq',
    TAB_FIELD_PROP_SORT: 'Sort',
    TAB_FIELD_PROP_SORT_VAL_NOSORT: 'no_sort',
    TAB_FIELD_PROP_SORT_VAL_ASC: 'ascend',
    TAB_FIELD_PROP_SORT_VAL_DESC: 'descend',
    DATA_DISCRETE_DATA: 'discrete_data',
    DATA_MASTER_DATA: 'master_data',
    DATA_DETAIL_DATA: 'detail_data',
    DATA_MASTER_DATA_EX: 'master_data_ex',
    DATA_DETAIL_DATA_EX: 'detail_data_ex',
    BLANK_FIELD_INDEX: -10,
    BLANK_VALUE_INDEX: -100,
    BLANK_PAGE_VALUE_INDEX: -200,
    PROP_SEG_GRP_IDX: 'segGrpRecStartIdx',
    PROP_PRE_ADD_GRP_REC_INFO: 'preAddPageGrpInfo',
    PROP_INSERTED_GRP_REC: 'insertedGrpRecAmt',
    PROP_GRP_LINES: 'group_lines_amt',
    RUN_TYPE_BEFORE_ANALYZING: 'before_analyzing',
    RUN_TYPE_BEFORE_PAGING: 'before_paging',
    RUN_TYPE_BEFORE_OUTPUT: 'before_output',
    RUN_TYPE_BEFORE_COMBINE: 'before_combine',
    RUN_TYPE_AFTER_COMBINE: 'after_combine',
    RUN_TYPE_BEFORE_GROUP_TEXT_OUT: 'before_group_text_output',
    PAGE_STATUS: [
        'EveryPage',
        'FirstPage',
        'LastPage',
        'SegmentStart',
        'SegmentEnd',
        'Group',
        'CrossRowEnd',
        'CrossColEnd',
    ],
    CONTROL_PROPS: [
        'Shrink',
        'ShowZero',
        'Horizon',
        'Vertical',
        'Wrap',
        'VerticalForExcel',
        'ShrinkFirst',
        'CloseOutput',
    ],
    CONTROL_PROP_IDX_SHRINK: 0,
    CONTROL_PROP_IDX_SHOW_ZERO: 1,
    CONTROL_PROP_IDX_HORIZON: 2,
    CONTROL_PROP_IDX_VERTICAL: 3,
    CONTROL_PROP_IDX_WRAP: 4,
    CONTROL_PROP_IDX_VERTICAL_EXCEL: 5,
    CONTROL_PROP_IDX_SHRINK_FIRST: 6,
    CONTROL_PROP_IDX_CLOSE_OUTPUT: 7,
    CLOSE_OUTPUT_ROW_BUFFER: 4,
    BORDER_STYLE_PROPS: ['LineWeight', 'DashStyle', 'Color'],
    PROP_LINE_WEIGHT: 'LineWeight',
    PROP_DASH_STYLE: 'DashStyle',
    PROP_COLOR: 'Color',
    FONT_PROPS: [
        'Name',
        'FontHeight',
        'FontColor',
        'FontBold',
        'FontItalic',
        'FontUnderline',
        'FontStrikeOut',
        'FontAngle',
    ],
    FONT_PROP_IDX_NAME: 0,
    FONT_PROP_IDX_HEIGHT: 1,
    FONT_PROP_IDX_COLOR: 2,
    FONT_PROP_IDX_BOLD: 3,
    FONT_PROP_IDX_ITALIC: 4,
    FONT_PROP_IDX_UNDERLINE: 5,
    FONT_PROP_IDX_STRIKEOUT: 6,
    FONT_PROP_IDX_ANGLE: 7,
    STATUS_NORMAL: 0,
    STATUS_REPORT_START: 1,
    STATUS_REPORT_END: 2,
    STATUS_SEGMENT_START: 3,
    STATUS_SEGMENT_END: 4,
    STATUS_GROUP: 5,
    STATUS_CROSS_ROW_END: 6,
    STATUS_CROSS_COL_END: 7,
    LAYOUT: ['Top', 'Bottom', 'Left', 'Right', 'Fulfill'],
    LAYOUT_TOP: 0,
    LAYOUT_BOTTOM: 1,
    LAYOUT_LEFT: 2,
    LAYOUT_RIGHT: 3,
    LAYOUT_FULFILL: 4,
    OUTPUT_ALIGN: {
        H: ['left', 'center', 'right'],
        V: ['top', 'center', 'bottom'],
    },
    H_ALIGN_IDX_LEFT: 0,
    H_ALIGN_IDX_CENTER: 1,
    H_ALIGN_IDX_RIGHT: 2,
    V_ALIGN_IDX_TOP: 0,
    V_ALIGN_IDX_CENTER: 1,
    V_ALIGN_IDX_BOTTOM: 2,
    CAL_TYPE: ['percentage', 'abstract'],
    CAL_TYPE_PERCENTAGE: 0,
    CAL_TYPE_ABSTRACT: 1,
    EVENT_TYPE: ['GRP_ON_CREATE', 'FLOW_CONTENT_ON_CREATE'],
    EVENT_IDX_GRP_ON_CREATE: 0,
    EVENT_IDX_FLOW_CONTENT_ON_CREATE: 1,
    PAGE_ORIENTATION_V_FIRST: 0,
    PAGE_ORIENTATION_H_FIRST: 1,
    ORIENTATION_PORTRAIT: 'PORTRAIT',
    ORIENTATION_LANDSCAPE: 'LANDSCAPE',
    ORIENTATION_PORTRAIT_CHN: '纵向',
    ORIENTATION_LANDSCAPE_CHN: '横向',
    SIZE_A3: [11.69, 16.54],
    SIZE_A4: [8.27, 11.69],
    SIZE_A5: [5.83, 8.27],
    SIZE_B5: [6.93, 9.84],
    SIZE_LETTER: [8.5, 11.0],
    SIZE_LEGAL: [8.5, 14.0],
    SIZE_16K: [7.75, 10.75],
    SIZE_EXECUTIVE: [7.25, 10.5],
    OUTPUT_OFFSET: [1, 1, 1, 1],
    OFFSET_IDX_LEFT: 0,
    OFFSET_IDX_RIGHT: 1,
    OFFSET_IDX_TOP: 2,
    OFFSET_IDX_BOTTOM: 3,
    PROP_PAGE_SEQ: 'page_seq',
    PROP_PAGE_MERGE_BORDER: 'page_merge_border',
    PROP_CELLS: 'cells',
    PAGING_OPTION_NORMAL: 'normal',
    PAGING_OPTION_INFINITY: 'infinity',
    OUTPUT_TYPE_NORMAL: 'normal',
    OUTPUT_TYPE_SVG: 'svg',
    OUTPUT_TYPE_PDF: 'pdf',
    OUTPUT_TYPE_EXCEL: 'excel',
    DISPLAY_VAL_TYPE_NORMAL: 0,
    DISPLAY_VAL_TYPE_GROUP: 1,
    DISPLAY_VAL_TYPE_AUTO_HEIGHT: 2,
    TYPE_FOLLOW_MODE: 1,
    PAGE_SELF_DEFINE: '自定义',
    PAGE_SPECIAL_MERGE_POS: 'page_merge_pos',
    PAGES_SIZE_STR: [
        'A3',
        'A4',
        'A5',
        'B5',
        'LETTER',
        'LEGAL',
        'EXECUTIVE',
        '16K',
    ],
    PAGES_SIZE_IDX: [8, 9, 11, 13, 1, 5, 7, 93],
    PAGES_SIZE: [
        [11.69, 16.54],
        [8.27, 11.69],
        [5.83, 8.27],
        [6.93, 9.84],
        [8.5, 11.0],
        [8.5, 14.0],
        [7.25, 10.5],
        [7.25, 10.5],
    ],
    HUNDRED_PERCENT: 100.0,
    VERTICAL_ANGLE: '90',
    ANTI_VERTICAL_ANGLE: '-90',
    VERTICAL_ANGLE_INT: 90,
    ANTI_VERTICAL_ANGLE_INT: -90,
    LAST_DEF: '',
};

const RESOLUTION = [96, 96];
const JpcCommonHelper = {
    getResultByID(KeyID, collectionList) {
        let rst = null;
        if (KeyID) {
            for (let i = 0; i < collectionList.length; i++) {
                let collection = collectionList[i];
                if (collection && collection instanceof Array) {
                    for (let j = 0; j < collection.length; j++) {
                        if (collection[j].ID === KeyID) {
                            rst = collection[j];
                            break;
                        }
                    }
                    if (rst)
                        break;
                }
            }
        }
        return rst;
    },
    //by lish ,多余参数，
    // getFont(fontName: string, dftFonts: any[], rptTpl: IRptTpl) {
    getFont(fontName, dftFonts) {
        let me = this, list = [];
        // if (rptTpl) list.push(rptTpl.control_collection); //by lish ,多余参数，
        list.push(dftFonts);
        return me.getResultByID(fontName, list);
    },
    //by lish ,多余参数，
    // getStyle(styleName: string, dftStyles: IStyles[], rptTpl?: IRptTpl) {
    getStyle(styleName, dftStyles) {
        let me = this, list = [];
        // if (rptTpl) list.push(rptTpl.control_collection);   //by lish ,多余参数，
        list.push(dftStyles);
        return me.getResultByID(styleName, list);
    },
    getControl(controlName, dftControls, rptTpl) {
        let me = this, list = [];
        //  list.push(rptTpl.control_collection);
        list.push(dftControls);
        return me.getResultByID(controlName, list);
    },
    getLayoutAlignment(alignStr) {
        let rst = JV.LAYOUT.indexOf(alignStr);
        if (rst < 0)
            rst = 4; //JV.LAYOUT_FULFILL;
        return rst;
    },
    getPosCalculationType(typeStr) {
        let rst = JV.CAL_TYPE.indexOf(typeStr);
        if (rst < 0)
            rst = 1; // JV.CAL_TYPE_ABSTRACT;
        return rst;
    },
    getBoolean(bStr) {
        let rst = false;
        if (bStr !== null && bStr !== undefined) {
            let valType = typeof (bStr);
            if (valType === 'boolean') {
                rst = bStr;
            }
            else if (valType === 'string') {
                let tS = bStr.toUpperCase();
                rst = (tS === 'T' || tS === 'TRUE' || tS === 'YES' || tS === 'Y');
            }
            else if (valType === 'number') {
                rst = (bStr === 1);
            }
        }
        return rst;
    },
    getScreenDPI() {
        return RESOLUTION.slice(0);
    },
    getUnitFactor(rptTpl) {
        let me = this;
        return me.translateUnit(rptTpl.主信息.单位);
    },
    translateUnit(unitStr) {
        let me = this, rst = 1.0;
        if (unitStr) {
            let sdpi = me.getScreenDPI();
            if (JV.MEASUREMENT.PIXEL.indexOf(unitStr) >= 0) {
                rst = 1.0;
            }
            else if (JV.MEASUREMENT.CM.indexOf(unitStr) >= 0) {
                rst = 1.0 * sdpi[0] / 2.54;
            }
            else if (JV.MEASUREMENT.INCH.indexOf(unitStr) >= 0) {
                rst = 1.0 * sdpi[0];
            }
        }
        return rst;
    },
    getPageSize(rptTpl) {
        let size = JV.SIZE_A4.slice(0);
        let sizeStr = rptTpl.主信息.打印页面_信息.页规格;
        let sizeIdx = JV.PAGES_SIZE_STR.indexOf(sizeStr);
        if (sizeIdx >= 0) {
            size = JV.PAGES_SIZE[sizeIdx].slice(0);
        }
        let page_orientation = rptTpl.主信息.打印页面_信息.方向;
        if (page_orientation === 'LANDSCAPE' || page_orientation === '横向') {
            //swap x,y
            let tmp = size[0];
            size[0] = size[1];
            size[1] = tmp;
        }
        return size;
    },
    getReportArea(rptTpl, unitFactor) {
        let me = this, sdpi = me.getScreenDPI(), rst = [], size = me.getPageSize(rptTpl);
        size[0] = sdpi[0] * size[0];
        size[1] = sdpi[0] * size[1];
        rst.push(unitFactor * rptTpl.主信息.页边距.Left);
        rst.push(unitFactor * rptTpl.主信息.页边距.Top);
        rst.push(size[0] - unitFactor * rptTpl.主信息.页边距.Right);
        rst.push(size[1] - unitFactor * rptTpl.主信息.页边距.Bottom);
        return rst;
    },
    getSegIdxByPageIdx(page, page_seg_map) {
        let rst = -1;
        for (let pIdx = 0; pIdx < page_seg_map.length; pIdx++) {
            if (page_seg_map[pIdx][0] === page) {
                rst = page_seg_map[pIdx][1];
                break;
            }
        }
        return rst;
    },
    getStringLinesInArea(area, strVal, chnW, otherW) {
        //备注： 因后台的pdf kit判断字符串长度与前端的不一样，需要做些调整，不一次性地判断字符串长度。
        //      分2种字符：中文与非中文，按照各种字符的数量分别乘以相关一个字符的宽度再累计。
        //      另判断行数还不能直接用总长度除以宽度来计算，因每一行都会有不同的余量，所以得一行行走过来判断。
        let rst = 0;
        if (strVal) {
            let areaWidth = area.Right - area.Left - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_RIGHT] - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_LEFT] - 1;
            let txtWidth = 0, currentW = 0;
            // 这里是一个一个字获取宽度，然后在对比区域宽度，算出最后有多少行
            for (let sIdx = 0; sIdx < strVal.length; sIdx++) {
                //大于127为中文字
                currentW = (strVal.charCodeAt(sIdx) > 127) ? chnW : otherW;
                txtWidth += currentW;
                if (txtWidth > (areaWidth - 4)) {
                    //减4个像素是考虑到导出excel的情况
                    rst++;
                    txtWidth = currentW;
                }
                if (sIdx === strVal.length - 1) {
                    rst++;
                }
            }
        }
        if (rst === 0)
            rst = 1; //即使是空字符串，也得有一行啊
        return rst;
    },
    splitString(area, strVal, chnW, otherW) {
        let rst = [];
        if (strVal) {
            let areaWidth = area.Right - area.Left - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_RIGHT] - JV.OUTPUT_OFFSET[JV.OFFSET_IDX_LEFT] - 1;
            let preSIdx = 0, txtWidth = 0;
            let currentW = 0;
            for (let sIdx = 0; sIdx < strVal.length; sIdx++) {
                currentW = (strVal.charCodeAt(sIdx) > 127) ? chnW : otherW;
                txtWidth += currentW;
                if (txtWidth > (areaWidth - 4)) {
                    //减4个像素是考虑到导出excel的情况
                    if (preSIdx < sIdx) {
                        rst.push(strVal.substr(preSIdx, sIdx - preSIdx));
                        preSIdx = sIdx;
                    }
                    else {
                        rst.push(strVal.substr(preSIdx, 1));
                        preSIdx = sIdx + 1;
                    }
                    txtWidth = currentW;
                }
                if (sIdx === strVal.length - 1) {
                    rst.push(strVal.substr(preSIdx, strVal.length - preSIdx));
                }
            }
        }
        if (rst.length === 0)
            rst.push(''); //什么都没有，也得整个空串
        return rst;
    }
};

const JpcBandHelper = {
    getBandTypeValByString: function (bandType) {
        let rst = JV.PAGE_STATUS.indexOf(bandType);
        if (rst < 0)
            rst = JV.STATUS_NORMAL;
        return rst;
    },
    //
    setBandArea: function (bands, rptTpl, pageStatus, isOnlyNormalStatus, isOnlyExStatus) {
        let me = this;
        if (rptTpl.布局框_集合) {
            isOnlyNormalStatus = isOnlyNormalStatus || false;
            isOnlyExStatus = isOnlyExStatus || false;
            // 把模板中的单位转化为px数值
            let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
            // 用上面求出的单位重新计算位置
            let orgArea = JpcCommonHelper.getReportArea(rptTpl, unitFactor);
            for (let i = 0; i < rptTpl.布局框_集合.length; i++) {
                me.setBandPos(bands, rptTpl.布局框_集合[i], orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
            }
        }
    },
    setBandPos: function (bands, bandNode, orgArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus) {
        let me = this, band = bands[bandNode.Name];
        //0. for multi flow purpose
        if (isOnlyNormalStatus) { //？？
            if (bandNode.exOnly && JpcCommonHelper.getBoolean(bandNode.exOnly)) {
                return;
            }
        }
        if (isOnlyExStatus) { //？？
            if (bandNode.normalOnly && !(JpcCommonHelper.getBoolean(bandNode.normalOnly))) {
                return;
            }
        }
        //1. initialize
        band.Left = orgArea[0];
        band.Top = orgArea[1];
        band.Right = orgArea[2];
        band.Bottom = orgArea[3];
        //2. set this band
        if (pageStatus[(band.DisplayType)]) {
            switch (band.Alignment) {
                case JV.LAYOUT_TOP:
                    if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
                        band.Bottom = band.Top + unitFactor * band.Height;
                    }
                    else {
                        band.Bottom = band.Top + (band.Bottom - band.Top) * band.Height / 100;
                    }
                    orgArea[JV.IDX_TOP] = band.Bottom;
                    break;
                case JV.LAYOUT_BOTTOM:
                    if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
                        band.Top = band.Bottom - unitFactor * band.Height;
                    }
                    else {
                        band.Top = band.Bottom - (band.Bottom - band.Top) * band.Height / 100;
                    }
                    orgArea[JV.IDX_BOTTOM] = band.Top;
                    break;
                case JV.LAYOUT_LEFT:
                    if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
                        band.Right = band.Left + unitFactor * band.Width;
                    }
                    else {
                        band.Right = band.Left + (band.Right - band.Left) * band.Width / 100;
                    }
                    orgArea[JV.IDX_LEFT] = band.Right;
                    break;
                case JV.LAYOUT_RIGHT:
                    if (band.CalculationType === JV.CAL_TYPE_ABSTRACT) {
                        band.Left = band.Right - unitFactor * band.Width;
                    }
                    else {
                        band.Left = band.Right - (band.Right - band.Left) * band.Width / 100;
                    }
                    orgArea[JV.IDX_RIGHT] = band.Left;
                    break;
            }
            //3. set sub-bands
            if (bandNode.band_s) {
                let bandArea = [band.Left, band.Top, band.Right, band.Bottom];
                for (let i = 0; i < bandNode.band_s.length; i++) {
                    me.setBandPos(bands, bandNode.band_s[i], bandArea, unitFactor, pageStatus, isOnlyNormalStatus, isOnlyExStatus);
                }
            }
        }
    },
    resetBandPos: function (bandCollection, bands, contentBand, offsetX, offsetY) {
        let orgX = contentBand.Right, orgY = contentBand.Bottom;
        function _chkAndResetPos(targetBand) {
            let band = bands[targetBand.Name];
            if (band) {
                if (band === contentBand) {
                    band.Bottom += offsetY;
                    band.Right += offsetX;
                }
                else {
                    if (band.Top >= orgY) {
                        band.Top += offsetY;
                        band.Bottom += offsetY;
                    }
                    else if (band.Bottom >= orgY && band.Top < orgY) {
                        band.Bottom += offsetY;
                    }
                    if (band.Left >= orgX) {
                        band.Left += offsetX;
                        band.Right += offsetX;
                    }
                    else if (band.Le && band.Right >= orgX && band.Le < orgX) {
                        band.Right += offsetX;
                    }
                }
                if (targetBand.band_s) {
                    for (let i = 0; i < targetBand.band_s.length; i++) {
                        _chkAndResetPos(targetBand.band_s[i]);
                    }
                }
            }
        }
        for (let i = 0; i < bandCollection.length; i++) {
            _chkAndResetPos(bandCollection[i]);
        }
    }
};

const JpcBand = {
    createNew(rptTpl, defProperties) {
        let me = this;
        let JpcBandResult = {};
        if (rptTpl.布局框_集合) {
            for (let i = 0; i < rptTpl.布局框_集合.length; i++) {
                me.createSingle(rptTpl.布局框_集合[i], JpcBandResult, rptTpl, defProperties);
            }
        }
        return JpcBandResult;
    },
    //根据模板信息生成大板块的数据
    createSingle(bandNode, parentObj, rptTpl, defProperties) {
        let me = this;
        if (bandNode && bandNode.Name) {
            let item = {
                Left: 0,
                Right: 0,
                Top: 0,
                Bottom: 0,
                style: JpcCommonHelper.getStyle(bandNode.style, defProperties.styles),
                control: JpcCommonHelper.getControl(bandNode.control, defProperties.ctrls),
                Height: (bandNode.Height) ? parseFloat(bandNode.Height) : 0,
                Width: (bandNode.Width) ? parseFloat(bandNode.Width) : 0,
                DisplayType: JpcBandHelper.getBandTypeValByString(bandNode.DisplayType),
                Alignment: JpcCommonHelper.getLayoutAlignment(bandNode.Alignment),
                CalculationType: JpcCommonHelper.getPosCalculationType(bandNode.CalculationType),
            };
            if (bandNode.normalOnly) {
                item.normalOnly = JpcCommonHelper.getBoolean(bandNode.normalOnly);
            }
            if (bandNode.exOnly) {
                item.exOnly = JpcCommonHelper.getBoolean(bandNode.exOnly);
            }
            if (bandNode.MergeBorder) {
                item.MergeBorder = bandNode.MergeBorder;
            }
            if (bandNode.band_s) {
                for (let i = 0; i < bandNode.band_s.length; i++) {
                    me.createSingle(bandNode.band_s[i], parentObj, rptTpl, defProperties);
                }
            }
            parentObj[bandNode.Name] = item;
            if (item.MergeBorder !== null && item.MergeBorder !== undefined && item.MergeBorder === 'T') {
                parentObj.MergeBand = item;
            }
        }
    }
};

// 主要是各种字符转换
const extend = (dst, src) => {
    for (const property in src) {
        if (src[property])
            dst[property] = src[property];
    }
    return dst;
};
class Pinyin {
    static getCamelChars(value) {
        throw new Error('Method not implemented.');
    }
    static getFullChars(value) {
        throw new Error('Method not implemented.');
    }
    options;
    charDict = '';
    fullDict = {};
    polyphone = {};
    constructor() {
        this.options = {};
    }
    init(ops) {
        this.options = extend(this.options, ops);
    }
    initialize(ops) {
        this.init(ops);
        this.charDict =
            ' ';
        this.fullDict = {
            a: '\u554a\u963f\u9515',
            ai: '\u57c3\u6328\u54ce\u5509\u54c0\u7691\u764c\u853c\u77ee\u827e\u788d\u7231\u9698\u8bf6\u6371\u55f3\u55cc\u5ad2\u7477\u66a7\u7839\u953f\u972d',
            an: '\u978d\u6c28\u5b89\u4ffa\u6309\u6697\u5cb8\u80fa\u6848\u8c19\u57ef\u63de\u72b4\u5eb5\u6849\u94f5\u9e4c\u9878\u9eef',
            ang: '\u80ae\u6602\u76ce',
            ao: '\u51f9\u6556\u71ac\u7ff1\u8884\u50b2\u5965\u61ca\u6fb3\u5773\u62d7\u55f7\u5662\u5c99\u5ed2\u9068\u5aaa\u9a9c\u8071\u87af\u93ca\u9ccc\u93d6',
            ba: '\u82ad\u634c\u6252\u53ed\u5427\u7b06\u516b\u75a4\u5df4\u62d4\u8dcb\u9776\u628a\u8019\u575d\u9738\u7f62\u7238\u8307\u83dd\u8406\u636d\u5c9c\u705e\u6777\u94af\u7c91\u9c85\u9b43',
            bai: '\u767d\u67cf\u767e\u6446\u4f70\u8d25\u62dc\u7a17\u859c\u63b0\u97b4',
            ban: '\u6591\u73ed\u642c\u6273\u822c\u9881\u677f\u7248\u626e\u62cc\u4f34\u74e3\u534a\u529e\u7eca\u962a\u5742\u8c73\u94a3\u7622\u764d\u8228',
            bang: '\u90a6\u5e2e\u6886\u699c\u8180\u7ed1\u68d2\u78c5\u868c\u9551\u508d\u8c24\u84a1\u8783',
            bao: '\u82de\u80de\u5305\u8912\u96f9\u4fdd\u5821\u9971\u5b9d\u62b1\u62a5\u66b4\u8c79\u9c8d\u7206\u52f9\u8446\u5b80\u5b62\u7172\u9e28\u8913\u8db5\u9f85',
            bo: '\u5265\u8584\u73bb\u83e0\u64ad\u62e8\u94b5\u6ce2\u535a\u52c3\u640f\u94c2\u7b94\u4f2f\u5e1b\u8236\u8116\u818a\u6e24\u6cca\u9a73\u4eb3\u8543\u5575\u997d\u6a97\u64d8\u7934\u94b9\u9e41\u7c38\u8ddb',
            bei: '\u676f\u7891\u60b2\u5351\u5317\u8f88\u80cc\u8d1d\u94a1\u500d\u72c8\u5907\u60eb\u7119\u88ab\u5b5b\u9642\u90b6\u57e4\u84d3\u5457\u602b\u6096\u789a\u9e4e\u8919\u943e',
            ben: '\u5954\u82ef\u672c\u7b28\u755a\u574c\u951b',
            beng: '\u5d29\u7ef7\u752d\u6cf5\u8e66\u8ff8\u552a\u5623\u750f',
            bi: '\u903c\u9f3b\u6bd4\u9119\u7b14\u5f7c\u78a7\u84d6\u853d\u6bd5\u6bd9\u6bd6\u5e01\u5e87\u75f9\u95ed\u655d\u5f0a\u5fc5\u8f9f\u58c1\u81c2\u907f\u965b\u5315\u4ef3\u4ffe\u8298\u835c\u8378\u5421\u54d4\u72f4\u5eb3\u610e\u6ed7\u6fde\u5f3c\u59a3\u5a62\u5b16\u74a7\u8d32\u7540\u94cb\u79d5\u88e8\u7b5a\u7b85\u7be6\u822d\u895e\u8df8\u9ac0',
            bian: '\u97ad\u8fb9\u7f16\u8d2c\u6241\u4fbf\u53d8\u535e\u8fa8\u8fa9\u8fab\u904d\u533e\u5f01\u82c4\u5fed\u6c74\u7f0f\u7178\u782d\u78a5\u7a39\u7a86\u8759\u7b3e\u9cca',
            biao: '\u6807\u5f6a\u8198\u8868\u5a4a\u9aa0\u98d1\u98d9\u98da\u706c\u9556\u9573\u762d\u88f1\u9cd4',
            bie: '\u9cd6\u618b\u522b\u762a\u8e69\u9cd8',
            bin: '\u5f6c\u658c\u6fd2\u6ee8\u5bbe\u6448\u50a7\u6d5c\u7f24\u73a2\u6ba1\u8191\u9554\u9acc\u9b13',
            bing: '\u5175\u51b0\u67c4\u4e19\u79c9\u997c\u70b3\u75c5\u5e76\u7980\u90b4\u6452\u7ee0\u678b\u69df\u71f9',
            bu: '\u6355\u535c\u54fa\u8865\u57e0\u4e0d\u5e03\u6b65\u7c3f\u90e8\u6016\u62ca\u535f\u900b\u74ff\u6661\u949a\u91ad',
            ca: '\u64e6\u5693\u7924',
            cai: '\u731c\u88c1\u6750\u624d\u8d22\u776c\u8e29\u91c7\u5f69\u83dc\u8521',
            can: '\u9910\u53c2\u8695\u6b8b\u60ed\u60e8\u707f\u9a96\u74a8\u7cb2\u9eea',
            cang: '\u82cd\u8231\u4ed3\u6ca7\u85cf\u4f27',
            cao: '\u64cd\u7cd9\u69fd\u66f9\u8349\u8279\u5608\u6f15\u87ac\u825a',
            ce: '\u5395\u7b56\u4fa7\u518c\u6d4b\u5202\u5e3b\u607b',
            ceng: '\u5c42\u8e6d\u564c',
            cha: '\u63d2\u53c9\u832c\u8336\u67e5\u78b4\u643d\u5bdf\u5c94\u5dee\u8be7\u7339\u9987\u6c4a\u59f9\u6748\u6942\u69ce\u6aab\u9497\u9538\u9572\u8869',
            chai: '\u62c6\u67f4\u8c7a\u4faa\u8308\u7625\u867f\u9f87',
            chan: '\u6400\u63ba\u8749\u998b\u8c17\u7f20\u94f2\u4ea7\u9610\u98a4\u5181\u8c04\u8c36\u8487\u5edb\u5fcf\u6f7a\u6fb6\u5b71\u7fbc\u5a75\u5b17\u9aa3\u89c7\u7985\u9561\u88e3\u87fe\u8e94',
            chang: '\u660c\u7316\u573a\u5c1d\u5e38\u957f\u507f\u80a0\u5382\u655e\u7545\u5531\u5021\u4f25\u9b2f\u82cc\u83d6\u5f9c\u6005\u60dd\u960a\u5a3c\u5ae6\u6636\u6c05\u9cb3',
            chao: '\u8d85\u6284\u949e\u671d\u5632\u6f6e\u5de2\u5435\u7092\u600a\u7ec9\u6641\u8016',
            che: '\u8f66\u626f\u64a4\u63a3\u5f7b\u6f88\u577c\u5c6e\u7817',
            chen: '\u90f4\u81e3\u8fb0\u5c18\u6668\u5ff1\u6c89\u9648\u8d81\u886c\u79f0\u8c0c\u62bb\u55d4\u5bb8\u741b\u6987\u809c\u80c2\u789c\u9f80',
            cheng: '\u6491\u57ce\u6a59\u6210\u5448\u4e58\u7a0b\u60e9\u6f84\u8bda\u627f\u901e\u9a8b\u79e4\u57d5\u5d4a\u5fb5\u6d48\u67a8\u67fd\u6a18\u665f\u584d\u77a0\u94d6\u88ce\u86cf\u9172',
            chi: '\u5403\u75f4\u6301\u5319\u6c60\u8fdf\u5f1b\u9a70\u803b\u9f7f\u4f88\u5c3a\u8d64\u7fc5\u65a5\u70bd\u50ba\u5880\u82aa\u830c\u640b\u53f1\u54e7\u557b\u55e4\u5f73\u996c\u6cb2\u5ab8\u6555\u80dd\u7719\u7735\u9e31\u761b\u892b\u86a9\u87ad\u7b1e\u7bea\u8c49\u8e05\u8e1f\u9b51',
            chong: '\u5145\u51b2\u866b\u5d07\u5ba0\u833a\u5fe1\u61a7\u94f3\u825f',
            chou: '\u62bd\u916c\u7574\u8e0c\u7a20\u6101\u7b79\u4ec7\u7ef8\u7785\u4e11\u4fe6\u5733\u5e31\u60c6\u6eb4\u59af\u7633\u96e0\u9c8b',
            chu: '\u81ed\u521d\u51fa\u6a71\u53a8\u8e87\u9504\u96cf\u6ec1\u9664\u695a\u7840\u50a8\u77d7\u6410\u89e6\u5904\u4e8d\u520d\u61b7\u7ecc\u6775\u696e\u6a17\u870d\u8e70\u9edc',
            chuan: '\u63e3\u5ddd\u7a7f\u693d\u4f20\u8239\u5598\u4e32\u63be\u821b\u60f4\u9044\u5ddb\u6c1a\u948f\u9569\u8221',
            chuang: '\u75ae\u7a97\u5e62\u5e8a\u95ef\u521b\u6006',
            chui: '\u5439\u708a\u6376\u9524\u5782\u9672\u68f0\u69cc',
            chun: '\u6625\u693f\u9187\u5507\u6df3\u7eaf\u8822\u4fc3\u83bc\u6c8c\u80ab\u6710\u9e51\u877d',
            chuo: '\u6233\u7ef0\u851f\u8fb6\u8f8d\u955e\u8e14\u9f8a',
            ci: '\u75b5\u8328\u78c1\u96cc\u8f9e\u6148\u74f7\u8bcd\u6b64\u523a\u8d50\u6b21\u8360\u5472\u5d6f\u9e5a\u8785\u7ccd\u8d91',
            cong: '\u806a\u8471\u56f1\u5306\u4ece\u4e1b\u506c\u82c1\u6dd9\u9aa2\u742e\u7481\u679e',
            cu: '\u51d1\u7c97\u918b\u7c07\u731d\u6b82\u8e59',
            cuan: '\u8e7f\u7be1\u7a9c\u6c46\u64ba\u6615\u7228',
            cui: '\u6467\u5d14\u50ac\u8106\u7601\u7cb9\u6dec\u7fe0\u8403\u60b4\u7480\u69b1\u96b9',
            cun: '\u6751\u5b58\u5bf8\u78cb\u5fd6\u76b4',
            cuo: '\u64ae\u6413\u63aa\u632b\u9519\u539d\u811e\u9509\u77ec\u75e4\u9e7e\u8e49\u8e9c',
            da: '\u642d\u8fbe\u7b54\u7629\u6253\u5927\u8037\u54d2\u55d2\u601b\u59b2\u75b8\u8921\u7b2a\u977c\u9791',
            dai: '\u5446\u6b79\u50a3\u6234\u5e26\u6b86\u4ee3\u8d37\u888b\u5f85\u902e\u6020\u57ed\u7519\u5454\u5cb1\u8fe8\u902f\u9a80\u7ed0\u73b3\u9edb',
            dan: '\u803d\u62c5\u4e39\u5355\u90f8\u63b8\u80c6\u65e6\u6c2e\u4f46\u60ee\u6de1\u8bde\u5f39\u86cb\u4ebb\u510b\u5369\u840f\u5556\u6fb9\u6a90\u6b9a\u8d55\u7708\u7605\u8043\u7baa',
            dang: '\u5f53\u6321\u515a\u8361\u6863\u8c20\u51fc\u83ea\u5b95\u7800\u94db\u88c6',
            dao: '\u5200\u6363\u8e48\u5012\u5c9b\u7977\u5bfc\u5230\u7a3b\u60bc\u9053\u76d7\u53e8\u5541\u5fc9\u6d2e\u6c18\u7118\u5fd1\u7e9b',
            de: '\u5fb7\u5f97\u7684\u951d',
            deng: '\u8e6c\u706f\u767b\u7b49\u77aa\u51f3\u9093\u5654\u5d9d\u6225\u78f4\u956b\u7c26',
            di: '\u5824\u4f4e\u6ef4\u8fea\u654c\u7b1b\u72c4\u6da4\u7fdf\u5ae1\u62b5\u5e95\u5730\u8482\u7b2c\u5e1d\u5f1f\u9012\u7f14\u6c10\u7c74\u8bcb\u8c1b\u90b8\u577b\u839c\u837b\u5600\u5a23\u67e2\u68e3\u89cc\u7825\u78b2\u7747\u955d\u7f9d\u9ab6',
            dian: '\u98a0\u6382\u6ec7\u7898\u70b9\u5178\u975b\u57ab\u7535\u4f43\u7538\u5e97\u60e6\u5960\u6dc0\u6bbf\u4e36\u963d\u576b\u57dd\u5dc5\u73b7\u765c\u766b\u7c1f\u8e2e',
            diao: '\u7889\u53fc\u96d5\u51cb\u5201\u6389\u540a\u9493\u8c03\u8f7a\u94de\u8729\u7c9c\u8c82',
            die: '\u8dcc\u7239\u789f\u8776\u8fed\u8c0d\u53e0\u4f5a\u57a4\u581e\u63f2\u558b\u6e2b\u8f76\u7252\u74de\u8936\u800b\u8e40\u9cbd\u9cce',
            ding: '\u4e01\u76ef\u53ee\u9489\u9876\u9f0e\u952d\u5b9a\u8ba2\u4e22\u4ec3\u5576\u738e\u815a\u7887\u753a\u94e4\u7594\u8035\u914a',
            dong: '\u4e1c\u51ac\u8463\u61c2\u52a8\u680b\u4f97\u606b\u51bb\u6d1e\u578c\u549a\u5cbd\u5cd2\u5902\u6c21\u80e8\u80f4\u7850\u9e2b',
            dou: '\u515c\u6296\u6597\u9661\u8c46\u9017\u75d8\u8538\u94ad\u7aa6\u7aac\u86aa\u7bfc\u9161',
            du: '\u90fd\u7763\u6bd2\u728a\u72ec\u8bfb\u5835\u7779\u8d4c\u675c\u9540\u809a\u5ea6\u6e21\u5992\u828f\u561f\u6e0e\u691f\u6a50\u724d\u8839\u7b03\u9ad1\u9ee9',
            duan: '\u7aef\u77ed\u953b\u6bb5\u65ad\u7f0e\u5f56\u6934\u7145\u7c16',
            dui: '\u5806\u5151\u961f\u5bf9\u603c\u619d\u7893',
            dun: '\u58a9\u5428\u8e72\u6566\u987f\u56e4\u949d\u76fe\u9041\u7096\u7818\u7905\u76f9\u9566\u8db8',
            duo: '\u6387\u54c6\u591a\u593a\u579b\u8eb2\u6735\u8dfa\u8235\u5241\u60f0\u5815\u5484\u54da\u7f0d\u67c1\u94ce\u88f0\u8e31',
            e: '\u86fe\u5ce8\u9e45\u4fc4\u989d\u8bb9\u5a25\u6076\u5384\u627c\u904f\u9102\u997f\u5669\u8c14\u57a9\u57ad\u82ca\u83aa\u843c\u5443\u6115\u5c59\u5a40\u8f6d\u66f7\u816d\u786a\u9507\u9537\u9e57\u989a\u9cc4',
            en: '\u6069\u84bd\u6441\u5514\u55ef',
            er: '\u800c\u513f\u8033\u5c14\u9975\u6d31\u4e8c\u8d30\u8fe9\u73e5\u94d2\u9e38\u9c95',
            fa: '\u53d1\u7f5a\u7b4f\u4f10\u4e4f\u9600\u6cd5\u73d0\u57a1\u781d',
            fan: '\u85e9\u5e06\u756a\u7ffb\u6a0a\u77fe\u9492\u7e41\u51e1\u70e6\u53cd\u8fd4\u8303\u8d29\u72af\u996d\u6cdb\u8629\u5e61\u72ad\u68b5\u6535\u71d4\u7548\u8e6f',
            fang: '\u574a\u82b3\u65b9\u80aa\u623f\u9632\u59a8\u4eff\u8bbf\u7eba\u653e\u531a\u90a1\u5f77\u94ab\u822b\u9c82',
            fei: '\u83f2\u975e\u5561\u98de\u80a5\u532a\u8bfd\u5420\u80ba\u5e9f\u6cb8\u8d39\u82be\u72d2\u60b1\u6ddd\u5983\u7ecb\u7eef\u69a7\u8153\u6590\u6249\u7953\u7829\u9544\u75f1\u871a\u7bda\u7fe1\u970f\u9cb1',
            fen: '\u82ac\u915a\u5429\u6c1b\u5206\u7eb7\u575f\u711a\u6c7e\u7c89\u594b\u4efd\u5fff\u6124\u7caa\u507e\u7035\u68fc\u610d\u9cbc\u9f22',
            feng: '\u4e30\u5c01\u67ab\u8702\u5cf0\u950b\u98ce\u75af\u70fd\u9022\u51af\u7f1d\u8bbd\u5949\u51e4\u4ff8\u9146\u8451\u6ca3\u781c',
            fu: '\u4f5b\u5426\u592b\u6577\u80a4\u5b75\u6276\u62c2\u8f90\u5e45\u6c1f\u7b26\u4f0f\u4fd8\u670d\u6d6e\u6daa\u798f\u88b1\u5f17\u752b\u629a\u8f85\u4fef\u91dc\u65a7\u812f\u8151\u5e9c\u8150\u8d74\u526f\u8986\u8d4b\u590d\u5085\u4ed8\u961c\u7236\u8179\u8d1f\u5bcc\u8ba3\u9644\u5987\u7f1a\u5490\u5310\u51eb\u90db\u8299\u82fb\u832f\u83a9\u83d4\u544b\u5e5e\u6ecf\u8274\u5b5a\u9a78\u7ec2\u6874\u8d59\u9efb\u9efc\u7f58\u7a03\u99a5\u864d\u86a8\u8709\u8760\u876e\u9eb8\u8dba\u8dd7\u9cc6',
            ga: '\u5676\u560e\u86e4\u5c2c\u5477\u5c15\u5c1c\u65ee\u9486',
            gai: '\u8be5\u6539\u6982\u9499\u76d6\u6e89\u4e10\u9654\u5793\u6224\u8d45\u80f2',
            gan: '\u5e72\u7518\u6746\u67d1\u7aff\u809d\u8d76\u611f\u79c6\u6562\u8d63\u5769\u82f7\u5c34\u64c0\u6cd4\u6de6\u6f89\u7ec0\u6a44\u65f0\u77f8\u75b3\u9150',
            gang: '\u5188\u521a\u94a2\u7f38\u809b\u7eb2\u5c97\u6e2f\u6206\u7f61\u9883\u7b7b',
            gong: '\u6760\u5de5\u653b\u529f\u606d\u9f9a\u4f9b\u8eac\u516c\u5bab\u5f13\u5de9\u6c5e\u62f1\u8d21\u5171\u857b\u5efe\u54a3\u73d9\u80b1\u86a3\u86e9\u89e5',
            gao: '\u7bd9\u768b\u9ad8\u818f\u7f94\u7cd5\u641e\u9550\u7a3f\u544a\u777e\u8bf0\u90dc\u84bf\u85c1\u7f1f\u69d4\u69c1\u6772\u9506',
            ge: '\u54e5\u6b4c\u6401\u6208\u9e3d\u80f3\u7599\u5272\u9769\u845b\u683c\u9601\u9694\u94ec\u4e2a\u5404\u9b32\u4ee1\u54ff\u5865\u55dd\u7ea5\u643f\u8188\u784c\u94ea\u9549\u88bc\u988c\u867c\u8238\u9abc\u9ac2',
            gei: '\u7ed9',
            gen: '\u6839\u8ddf\u4e98\u831b\u54cf\u826e',
            geng: '\u8015\u66f4\u5e9a\u7fb9\u57c2\u803f\u6897\u54fd\u8d53\u9ca0',
            gou: '\u94a9\u52fe\u6c9f\u82df\u72d7\u57a2\u6784\u8d2d\u591f\u4f5d\u8bdf\u5ca3\u9058\u5abe\u7f11\u89cf\u5f40\u9e32\u7b31\u7bdd\u97b2',
            gu: '\u8f9c\u83c7\u5495\u7b8d\u4f30\u6cbd\u5b64\u59d1\u9f13\u53e4\u86ca\u9aa8\u8c37\u80a1\u6545\u987e\u56fa\u96c7\u560f\u8bc2\u83f0\u54cc\u5d2e\u6c69\u688f\u8f71\u726f\u727f\u80cd\u81cc\u6bc2\u77bd\u7f5f\u94b4\u9522\u74e0\u9e2a\u9e44\u75fc\u86c4\u9164\u89da\u9cb4\u9ab0\u9e58',
            gua: '\u522e\u74dc\u5250\u5be1\u6302\u8902\u5366\u8bd6\u5471\u681d\u9e39',
            guai: '\u4e56\u62d0\u602a\u54d9',
            guan: '\u68fa\u5173\u5b98\u51a0\u89c2\u7ba1\u9986\u7f50\u60ef\u704c\u8d2f\u500c\u839e\u63bc\u6dab\u76e5\u9e73\u9ccf',
            guang: '\u5149\u5e7f\u901b\u72b7\u6844\u80f1\u7592',
            gui: '\u7470\u89c4\u572d\u7845\u5f52\u9f9f\u95fa\u8f68\u9b3c\u8be1\u7678\u6842\u67dc\u8dea\u8d35\u523d\u5326\u523f\u5e8b\u5b84\u59ab\u6867\u7085\u6677\u7688\u7c0b\u9c91\u9cdc',
            gun: '\u8f8a\u6eda\u68cd\u4e28\u886e\u7ef2\u78d9\u9ca7',
            guo: '\u9505\u90ed\u56fd\u679c\u88f9\u8fc7\u9998\u8803\u57da\u63b4\u5459\u56d7\u5e3c\u5d1e\u7313\u6901\u8662\u951e\u8052\u872e\u873e\u8748',
            ha: '\u54c8',
            hai: '\u9ab8\u5b69\u6d77\u6c26\u4ea5\u5bb3\u9a87\u54b4\u55e8\u988f\u91a2',
            han: '\u9163\u61a8\u90af\u97e9\u542b\u6db5\u5bd2\u51fd\u558a\u7f55\u7ff0\u64bc\u634d\u65f1\u61be\u608d\u710a\u6c57\u6c49\u9097\u83e1\u6496\u961a\u701a\u6657\u7113\u9894\u86b6\u9f3e',
            hen: '\u592f\u75d5\u5f88\u72e0\u6068',
            hang: '\u676d\u822a\u6c86\u7ed7\u73e9\u6841',
            hao: '\u58d5\u568e\u8c6a\u6beb\u90dd\u597d\u8017\u53f7\u6d69\u8585\u55e5\u5686\u6fe0\u704f\u660a\u7693\u98a2\u869d',
            he: '\u5475\u559d\u8377\u83cf\u6838\u79be\u548c\u4f55\u5408\u76d2\u8c89\u9602\u6cb3\u6db8\u8d6b\u8910\u9e64\u8d3a\u8bc3\u52be\u58d1\u85ff\u55d1\u55ec\u9616\u76cd\u86b5\u7fee',
            hei: '\u563f\u9ed1',
            heng: '\u54fc\u4ea8\u6a2a\u8861\u6052\u8a07\u8605',
            hong: '\u8f70\u54c4\u70d8\u8679\u9e3f\u6d2a\u5b8f\u5f18\u7ea2\u9ec9\u8ba7\u836d\u85a8\u95f3\u6cd3',
            hou: '\u5589\u4faf\u7334\u543c\u539a\u5019\u540e\u5820\u5f8c\u9005\u760a\u7bcc\u7cc7\u9c8e\u9aba',
            hu: '\u547c\u4e4e\u5ffd\u745a\u58f6\u846b\u80e1\u8774\u72d0\u7cca\u6e56\u5f27\u864e\u552c\u62a4\u4e92\u6caa\u6237\u51b1\u553f\u56eb\u5cb5\u7322\u6019\u60da\u6d52\u6ef9\u7425\u69f2\u8f77\u89f3\u70c0\u7173\u623d\u6248\u795c\u9e55\u9e71\u7b0f\u9190\u659b',
            hua: '\u82b1\u54d7\u534e\u733e\u6ed1\u753b\u5212\u5316\u8bdd\u5290\u6d4d\u9a85\u6866\u94e7\u7a1e',
            huai: '\u69d0\u5f8a\u6000\u6dee\u574f\u8fd8\u8e1d',
            huan: '\u6b22\u73af\u6853\u7f13\u6362\u60a3\u5524\u75ea\u8c62\u7115\u6da3\u5ba6\u5e7b\u90c7\u5942\u57b8\u64d0\u571c\u6d39\u6d63\u6f36\u5bf0\u902d\u7f33\u953e\u9ca9\u9b1f',
            huang: '\u8352\u614c\u9ec4\u78fa\u8757\u7c27\u7687\u51f0\u60f6\u714c\u6643\u5e4c\u604d\u8c0e\u968d\u5fa8\u6e5f\u6f62\u9051\u749c\u8093\u7640\u87e5\u7bc1\u9cc7',
            hui: '\u7070\u6325\u8f89\u5fbd\u6062\u86d4\u56de\u6bc1\u6094\u6167\u5349\u60e0\u6666\u8d3f\u79fd\u4f1a\u70e9\u6c47\u8bb3\u8bf2\u7ed8\u8bd9\u8334\u835f\u8559\u54d5\u5599\u96b3\u6d04\u5f57\u7f0b\u73f2\u6656\u605a\u867a\u87ea\u9ebe',
            hun: '\u8364\u660f\u5a5a\u9b42\u6d51\u6df7\u8be8\u9984\u960d\u6eb7\u7f17',
            huo: '\u8c41\u6d3b\u4f19\u706b\u83b7\u6216\u60d1\u970d\u8d27\u7978\u6509\u56af\u5925\u94ac\u952a\u956c\u8020\u8816',
            ji: '\u51fb\u573e\u57fa\u673a\u7578\u7a3d\u79ef\u7b95\u808c\u9965\u8ff9\u6fc0\u8ba5\u9e21\u59ec\u7ee9\u7f09\u5409\u6781\u68d8\u8f91\u7c4d\u96c6\u53ca\u6025\u75be\u6c72\u5373\u5ac9\u7ea7\u6324\u51e0\u810a\u5df1\u84df\u6280\u5180\u5b63\u4f0e\u796d\u5242\u60b8\u6d4e\u5bc4\u5bc2\u8ba1\u8bb0\u65e2\u5fcc\u9645\u5993\u7ee7\u7eaa\u5c45\u4e0c\u4e69\u525e\u4f76\u4f74\u8114\u58bc\u82a8\u82b0\u8401\u84ba\u857a\u638e\u53fd\u54ad\u54dc\u5527\u5c8c\u5d74\u6d0e\u5f50\u5c50\u9aa5\u757f\u7391\u696b\u6b9b\u621f\u6222\u8d4d\u89ca\u7284\u9f51\u77f6\u7f81\u5d47\u7a37\u7620\u7635\u866e\u7b08\u7b04\u66a8\u8dfb\u8dfd\u9701\u9c9a\u9cab\u9afb\u9e82',
            jia: '\u5609\u67b7\u5939\u4f73\u5bb6\u52a0\u835a\u988a\u8d3e\u7532\u94be\u5047\u7a3c\u4ef7\u67b6\u9a7e\u5ac1\u4f3d\u90cf\u62ee\u5cac\u6d43\u8fe6\u73c8\u621b\u80db\u605d\u94d7\u9553\u75c2\u86f1\u7b33\u8888\u8dcf',
            jian: '\u6b7c\u76d1\u575a\u5c16\u7b3a\u95f4\u714e\u517c\u80a9\u8270\u5978\u7f04\u8327\u68c0\u67ec\u78b1\u7877\u62e3\u6361\u7b80\u4fed\u526a\u51cf\u8350\u69db\u9274\u8df5\u8d31\u89c1\u952e\u7bad\u4ef6\u5065\u8230\u5251\u996f\u6e10\u6e85\u6da7\u5efa\u50ed\u8c0f\u8c2b\u83c5\u84b9\u641b\u56dd\u6e54\u8e47\u8b07\u7f23\u67a7\u67d9\u6957\u620b\u622c\u726e\u728d\u6bfd\u8171\u7751\u950f\u9e63\u88e5\u7b15\u7bb4\u7fe6\u8dbc\u8e3a\u9ca3\u97af',
            jiang: '\u50f5\u59dc\u5c06\u6d46\u6c5f\u7586\u848b\u6868\u5956\u8bb2\u5320\u9171\u964d\u8333\u6d1a\u7edb\u7f30\u729f\u7913\u8029\u7ce8\u8c47',
            jiao: '\u8549\u6912\u7901\u7126\u80f6\u4ea4\u90ca\u6d47\u9a84\u5a07\u56bc\u6405\u94f0\u77eb\u4fa5\u811a\u72e1\u89d2\u997a\u7f34\u7ede\u527f\u6559\u9175\u8f7f\u8f83\u53eb\u4f7c\u50ec\u832d\u6322\u564d\u5ce4\u5fbc\u59e3\u7e9f\u656b\u768e\u9e6a\u86df\u91ae\u8de4\u9c9b',
            jie: '\u7a96\u63ed\u63a5\u7686\u79f8\u8857\u9636\u622a\u52ab\u8282\u6854\u6770\u6377\u776b\u7aed\u6d01\u7ed3\u89e3\u59d0\u6212\u85c9\u82a5\u754c\u501f\u4ecb\u75a5\u8beb\u5c4a\u5048\u8ba6\u8bd8\u5588\u55df\u736c\u5a55\u5b51\u6840\u7352\u78a3\u9534\u7596\u88b7\u9889\u86a7\u7faf\u9c92\u9ab1\u9aeb',
            jin: '\u5dfe\u7b4b\u65a4\u91d1\u4eca\u6d25\u895f\u7d27\u9526\u4ec5\u8c28\u8fdb\u9773\u664b\u7981\u8fd1\u70ec\u6d78\u5c3d\u537a\u8369\u5807\u5664\u9991\u5ed1\u5997\u7f19\u747e\u69ff\u8d46\u89d0\u9485\u9513\u887f\u77dc',
            jing: '\u52b2\u8346\u5162\u830e\u775b\u6676\u9cb8\u4eac\u60ca\u7cbe\u7cb3\u7ecf\u4e95\u8b66\u666f\u9888\u9759\u5883\u656c\u955c\u5f84\u75c9\u9756\u7adf\u7ade\u51c0\u522d\u5106\u9631\u83c1\u734d\u61ac\u6cfe\u8ff3\u5f2a\u5a67\u80bc\u80eb\u8148\u65cc',
            jiong: '\u70af\u7a98\u5182\u8fe5\u6243',
            jiu: '\u63ea\u7a76\u7ea0\u7396\u97ed\u4e45\u7078\u4e5d\u9152\u53a9\u6551\u65e7\u81fc\u8205\u548e\u5c31\u759a\u50e6\u557e\u9604\u67e9\u6855\u9e6b\u8d73\u9b0f',
            ju: '\u97a0\u62d8\u72d9\u75bd\u9a79\u83ca\u5c40\u5480\u77e9\u4e3e\u6cae\u805a\u62d2\u636e\u5de8\u5177\u8ddd\u8e1e\u952f\u4ff1\u53e5\u60e7\u70ac\u5267\u5028\u8bb5\u82e3\u82f4\u8392\u63ac\u907d\u5c66\u741a\u67b8\u6910\u6998\u6989\u6a58\u728b\u98d3\u949c\u9514\u7aad\u88fe\u8d84\u91b5\u8e3d\u9f83\u96ce\u97ab',
            juan: '\u6350\u9e43\u5a1f\u5026\u7737\u5377\u7ee2\u9104\u72f7\u6d93\u684a\u8832\u9529\u954c\u96bd',
            jue: '\u6485\u652b\u6289\u6398\u5014\u7235\u89c9\u51b3\u8bc0\u7edd\u53a5\u5282\u8c32\u77cd\u8568\u5658\u5d1b\u7357\u5b53\u73cf\u6877\u6a5b\u721d\u9562\u8e76\u89d6',
            jun: '\u5747\u83cc\u94a7\u519b\u541b\u5cfb\u4fca\u7ae3\u6d5a\u90e1\u9a8f\u6343\u72fb\u76b2\u7b60\u9e87',
            ka: '\u5580\u5496\u5361\u4f67\u5494\u80e9',
            ke: '\u54af\u5777\u82db\u67ef\u68f5\u78d5\u9897\u79d1\u58f3\u54b3\u53ef\u6e34\u514b\u523b\u5ba2\u8bfe\u5ca2\u606a\u6e98\u9a92\u7f02\u73c2\u8f72\u6c2a\u778c\u94b6\u75b4\u7aa0\u874c\u9ac1',
            kai: '\u5f00\u63e9\u6977\u51ef\u6168\u5240\u57b2\u8488\u5ffe\u607a\u94e0\u950e',
            kan: '\u520a\u582a\u52d8\u574e\u780d\u770b\u4f83\u51f5\u83b0\u83b6\u6221\u9f9b\u77b0',
            kang: '\u5eb7\u6177\u7ce0\u625b\u6297\u4ea2\u7095\u5751\u4f09\u95f6\u94aa',
            kao: '\u8003\u62f7\u70e4\u9760\u5c3b\u6832\u7292\u94d0',
            ken: '\u80af\u5543\u57a6\u6073\u57a0\u88c9\u9880',
            keng: '\u542d\u5fd0\u94ff',
            kong: '\u7a7a\u6050\u5b54\u63a7\u5025\u5d06\u7b9c',
            kou: '\u62a0\u53e3\u6263\u5bc7\u82a4\u853b\u53e9\u770d\u7b58',
            ku: '\u67af\u54ed\u7a9f\u82e6\u9177\u5e93\u88e4\u5233\u5800\u55be\u7ed4\u9ab7',
            kua: '\u5938\u57ae\u630e\u8de8\u80ef\u4f89',
            kuai: '\u5757\u7b77\u4fa9\u5feb\u84af\u90d0\u8489\u72ef\u810d',
            kuan: '\u5bbd\u6b3e\u9acb',
            kuang: '\u5321\u7b50\u72c2\u6846\u77ff\u7736\u65f7\u51b5\u8bd3\u8bf3\u909d\u5739\u593c\u54d0\u7ea9\u8d36',
            kui: '\u4e8f\u76d4\u5cbf\u7aa5\u8475\u594e\u9b41\u5080\u9988\u6127\u6e83\u9997\u532e\u5914\u9697\u63c6\u55b9\u559f\u609d\u6126\u9615\u9035\u668c\u777d\u8069\u8770\u7bd1\u81fe\u8dec',
            kun: '\u5764\u6606\u6346\u56f0\u6083\u9603\u7428\u951f\u918c\u9cb2\u9ae1',
            kuo: '\u62ec\u6269\u5ed3\u9614\u86de',
            la: '\u5783\u62c9\u5587\u8721\u814a\u8fa3\u5566\u524c\u647a\u908b\u65ef\u782c\u760c',
            lai: '\u83b1\u6765\u8d56\u5d03\u5f95\u6d9e\u6fd1\u8d49\u7750\u94fc\u765e\u7c41',
            lan: '\u84dd\u5a6a\u680f\u62e6\u7bee\u9611\u5170\u6f9c\u8c30\u63fd\u89c8\u61d2\u7f06\u70c2\u6ee5\u5549\u5c9a\u61d4\u6f24\u6984\u6593\u7f71\u9567\u8934',
            lang: '\u7405\u6994\u72fc\u5eca\u90ce\u6717\u6d6a\u83a8\u8497\u5577\u9606\u9512\u7a02\u8782',
            lao: '\u635e\u52b3\u7262\u8001\u4f6c\u59e5\u916a\u70d9\u6d9d\u5520\u5d02\u6833\u94d1\u94f9\u75e8\u91aa',
            le: '\u52d2\u4e50\u808b\u4ec2\u53fb\u561e\u6cd0\u9cd3',
            lei: '\u96f7\u956d\u857e\u78ca\u7d2f\u5121\u5792\u64c2\u7c7b\u6cea\u7fb8\u8bd4\u837d\u54a7\u6f2f\u5ad8\u7f27\u6a91\u8012\u9179',
            ling: '\u68f1\u51b7\u62ce\u73b2\u83f1\u96f6\u9f84\u94c3\u4f36\u7f9a\u51cc\u7075\u9675\u5cad\u9886\u53e6\u4ee4\u9143\u5844\u82d3\u5464\u56f9\u6ce0\u7eeb\u67c3\u68c2\u74f4\u8046\u86c9\u7fce\u9cae',
            leng: '\u695e\u6123',
            li: '\u5398\u68a8\u7281\u9ece\u7bf1\u72f8\u79bb\u6f13\u7406\u674e\u91cc\u9ca4\u793c\u8389\u8354\u540f\u6817\u4e3d\u5389\u52b1\u783e\u5386\u5229\u5088\u4f8b\u4fd0\u75e2\u7acb\u7c92\u6ca5\u96b6\u529b\u7483\u54e9\u4fea\u4fda\u90e6\u575c\u82c8\u8385\u84e0\u85dc\u6369\u5456\u5533\u55b1\u7301\u6ea7\u6fa7\u9026\u5a0c\u5ae0\u9a8a\u7f21\u73de\u67a5\u680e\u8f79\u623e\u783a\u8a48\u7f79\u9502\u9e42\u75a0\u75ac\u86ce\u870a\u8821\u7b20\u7be5\u7c9d\u91b4\u8dde\u96f3\u9ca1\u9ce2\u9ee7',
            lian: '\u4fe9\u8054\u83b2\u8fde\u9570\u5ec9\u601c\u6d9f\u5e18\u655b\u8138\u94fe\u604b\u70bc\u7ec3\u631b\u8539\u5941\u6f4b\u6fc2\u5a08\u740f\u695d\u6b93\u81c1\u81a6\u88e2\u880a\u9ca2',
            liang: '\u7cae\u51c9\u6881\u7cb1\u826f\u4e24\u8f86\u91cf\u667e\u4eae\u8c05\u589a\u690b\u8e09\u9753\u9b49',
            liao: '\u64a9\u804a\u50da\u7597\u71ce\u5be5\u8fbd\u6f66\u4e86\u6482\u9563\u5ed6\u6599\u84fc\u5c25\u5639\u7360\u5bee\u7f2d\u948c\u9e69\u8022',
            lie: '\u5217\u88c2\u70c8\u52a3\u730e\u51bd\u57d2\u6d0c\u8d94\u8e90\u9b23',
            lin: '\u7433\u6797\u78f7\u9716\u4e34\u90bb\u9cde\u6dcb\u51db\u8d41\u541d\u853a\u5d99\u5eea\u9074\u6aa9\u8f9a\u77b5\u7cbc\u8e8f\u9e9f',
            liu: '\u6e9c\u7409\u69b4\u786b\u998f\u7559\u5218\u7624\u6d41\u67f3\u516d\u62a1\u507b\u848c\u6cd6\u6d4f\u905b\u9a9d\u7efa\u65d2\u7198\u950d\u954f\u9e68\u938f',
            long: '\u9f99\u804b\u5499\u7b3c\u7abf\u9686\u5784\u62e2\u9647\u5f04\u5785\u830f\u6cf7\u73d1\u680a\u80e7\u783b\u7643',
            lou: '\u697c\u5a04\u6402\u7bd3\u6f0f\u964b\u55bd\u5d5d\u9542\u7618\u8027\u877c\u9ac5',
            lu: '\u82a6\u5362\u9885\u5e90\u7089\u63b3\u5364\u864f\u9c81\u9e93\u788c\u9732\u8def\u8d42\u9e7f\u6f5e\u7984\u5f55\u9646\u622e\u5786\u6445\u64b8\u565c\u6cf8\u6e0c\u6f09\u7490\u680c\u6a79\u8f73\u8f82\u8f98\u6c07\u80ea\u9565\u9e2c\u9e6d\u7c0f\u823b\u9c88',
            lv: '\u9a74\u5415\u94dd\u4fa3\u65c5\u5c65\u5c61\u7f15\u8651\u6c2f\u5f8b\u7387\u6ee4\u7eff\u634b\u95fe\u6988\u8182\u7a06\u891b',
            luan: '\u5ce6\u5b6a\u6ee6\u5375\u4e71\u683e\u9e3e\u92ae',
            lue: '\u63a0\u7565\u950a',
            lun: '\u8f6e\u4f26\u4ed1\u6ca6\u7eb6\u8bba\u56f5',
            luo: '\u841d\u87ba\u7f57\u903b\u9523\u7ba9\u9aa1\u88f8\u843d\u6d1b\u9a86\u7edc\u502e\u8366\u645e\u7321\u6cfa\u6924\u8136\u9559\u7630\u96d2',
            ma: '\u5988\u9ebb\u739b\u7801\u8682\u9a6c\u9a82\u561b\u5417\u551b\u72b8\u5b37\u6769\u9ebd',
            mai: '\u57cb\u4e70\u9ea6\u5356\u8fc8\u8109\u52a2\u836c\u54aa\u973e',
            man: '\u7792\u9992\u86ee\u6ee1\u8513\u66fc\u6162\u6f2b\u8c29\u5881\u5e54\u7f26\u71b3\u9558\u989f\u87a8\u9cd7\u9794',
            mang: '\u8292\u832b\u76f2\u5fd9\u83bd\u9099\u6f2d\u6726\u786d\u87d2',
            meng: '\u6c13\u840c\u8499\u6aac\u76df\u9530\u731b\u68a6\u5b5f\u52d0\u750d\u77a2\u61f5\u791e\u867b\u8722\u8813\u824b\u8268\u9efe',
            miao: '\u732b\u82d7\u63cf\u7784\u85d0\u79d2\u6e3a\u5e99\u5999\u55b5\u9088\u7f08\u7f2a\u676a\u6dfc\u7707\u9e4b\u8731',
            mao: '\u8305\u951a\u6bdb\u77db\u94c6\u536f\u8302\u5192\u5e3d\u8c8c\u8d38\u4f94\u88a4\u52d6\u8306\u5cc1\u7441\u6634\u7266\u8004\u65c4\u61cb\u7780\u86d1\u8765\u87ca\u9ae6',
            me: '\u4e48',
            mei: '\u73ab\u679a\u6885\u9176\u9709\u7164\u6ca1\u7709\u5a92\u9541\u6bcf\u7f8e\u6627\u5bd0\u59b9\u5a9a\u5776\u8393\u5d4b\u7338\u6d7c\u6e44\u6963\u9545\u9e5b\u8882\u9b45',
            men: '\u95e8\u95f7\u4eec\u626a\u739f\u7116\u61d1\u9494',
            mi: '\u772f\u919a\u9761\u7cdc\u8ff7\u8c1c\u5f25\u7c73\u79d8\u89c5\u6ccc\u871c\u5bc6\u5e42\u8288\u5196\u8c27\u863c\u5627\u7315\u736f\u6c68\u5b93\u5f2d\u8112\u6549\u7cf8\u7e3b\u9e8b',
            mian: '\u68c9\u7720\u7ef5\u5195\u514d\u52c9\u5a29\u7f05\u9762\u6c94\u6e4e\u817c\u7704',
            mie: '\u8511\u706d\u54a9\u881b\u7bfe',
            min: '\u6c11\u62bf\u76bf\u654f\u60af\u95fd\u82e0\u5cb7\u95f5\u6cef\u73c9',
            ming: '\u660e\u879f\u9e23\u94ed\u540d\u547d\u51a5\u8317\u6e9f\u669d\u7791\u9169',
            miu: '\u8c2c',
            mo: '\u6478\u6479\u8611\u6a21\u819c\u78e8\u6469\u9b54\u62b9\u672b\u83ab\u58a8\u9ed8\u6cab\u6f20\u5bde\u964c\u8c1f\u8309\u84e6\u998d\u5aeb\u9546\u79e3\u763c\u8031\u87c6\u8c8a\u8c98',
            mou: '\u8c0b\u725f\u67d0\u53b6\u54de\u5a7a\u7738\u936a',
            mu: '\u62c7\u7261\u4ea9\u59c6\u6bcd\u5893\u66ae\u5e55\u52df\u6155\u6728\u76ee\u7766\u7267\u7a46\u4eeb\u82dc\u5452\u6c90\u6bea\u94bc',
            na: '\u62ff\u54ea\u5450\u94a0\u90a3\u5a1c\u7eb3\u5185\u637a\u80ad\u954e\u8872\u7bac',
            nai: '\u6c16\u4e43\u5976\u8010\u5948\u9f10\u827f\u8418\u67f0',
            nan: '\u5357\u7537\u96be\u56ca\u5583\u56e1\u6960\u8169\u877b\u8d67',
            nao: '\u6320\u8111\u607c\u95f9\u5b6c\u57b4\u7331\u7459\u7847\u94d9\u86f2',
            ne: '\u6dd6\u5462\u8bb7',
            nei: '\u9981',
            nen: '\u5ae9\u80fd\u6798\u6041',
            ni: '\u59ae\u9713\u502a\u6ce5\u5c3c\u62df\u4f60\u533f\u817b\u9006\u6eba\u4f32\u576d\u730a\u6029\u6ee0\u6635\u65ce\u7962\u615d\u7768\u94cc\u9cb5',
            nian: '\u852b\u62c8\u5e74\u78be\u64b5\u637b\u5ff5\u5eff\u8f87\u9ecf\u9c87\u9cb6',
            niang: '\u5a18\u917f',
            niao: '\u9e1f\u5c3f\u8311\u5b32\u8132\u8885',
            nie: '\u634f\u8042\u5b7d\u556e\u954a\u954d\u6d85\u4e5c\u9667\u8616\u55eb\u8080\u989e\u81ec\u8e51',
            nin: '\u60a8\u67e0',
            ning: '\u72de\u51dd\u5b81\u62e7\u6cde\u4f5e\u84e5\u549b\u752f\u804d',
            niu: '\u725b\u626d\u94ae\u7ebd\u72c3\u5ff8\u599e\u86b4',
            nong: '\u8113\u6d53\u519c\u4fac',
            nu: '\u5974\u52aa\u6012\u5476\u5e11\u5f29\u80ec\u5b65\u9a7d',
            nv: '\u5973\u6067\u9495\u8844',
            nuan: '\u6696',
            nuenue: '\u8650',
            nue: '\u759f\u8c11',
            nuo: '\u632a\u61e6\u7cef\u8bfa\u50a9\u6426\u558f\u9518',
            ou: '\u54e6\u6b27\u9e25\u6bb4\u85d5\u5455\u5076\u6ca4\u6004\u74ef\u8026',
            pa: '\u556a\u8db4\u722c\u5e15\u6015\u7436\u8469\u7b62',
            pai: '\u62cd\u6392\u724c\u5f98\u6e43\u6d3e\u4ff3\u848e',
            pan: '\u6500\u6f58\u76d8\u78d0\u76fc\u7554\u5224\u53db\u723f\u6cee\u88a2\u897b\u87e0\u8e52',
            pang: '\u4e53\u5e9e\u65c1\u802a\u80d6\u6ec2\u9004',
            pao: '\u629b\u5486\u5228\u70ae\u888d\u8dd1\u6ce1\u530f\u72cd\u5e96\u812c\u75b1',
            pei: '\u5478\u80da\u57f9\u88f4\u8d54\u966a\u914d\u4f69\u6c9b\u638a\u8f94\u5e14\u6de0\u65c6\u952b\u9185\u9708',
            pen: '\u55b7\u76c6\u6e53',
            peng: '\u7830\u62a8\u70f9\u6f8e\u5f6d\u84ec\u68da\u787c\u7bf7\u81a8\u670b\u9e4f\u6367\u78b0\u576f\u580b\u562d\u6026\u87db',
            pi: '\u7812\u9739\u6279\u62ab\u5288\u7435\u6bd7\u5564\u813e\u75b2\u76ae\u5339\u75de\u50fb\u5c41\u8b6c\u4e15\u9674\u90b3\u90eb\u572e\u9f19\u64d7\u567c\u5e80\u5ab2\u7eb0\u6787\u7513\u7765\u7f74\u94cd\u75e6\u7656\u758b\u868d\u8c94',
            pian: '\u7bc7\u504f\u7247\u9a97\u8c1d\u9a88\u728f\u80fc\u890a\u7fe9\u8e41',
            piao: '\u98d8\u6f02\u74e2\u7968\u527d\u560c\u5ad6\u7f25\u6b8d\u779f\u87b5',
            pie: '\u6487\u77a5\u4e3f\u82e4\u6c15',
            pin: '\u62fc\u9891\u8d2b\u54c1\u8058\u62da\u59d8\u5ad4\u6980\u725d\u98a6',
            ping: '\u4e52\u576a\u82f9\u840d\u5e73\u51ed\u74f6\u8bc4\u5c4f\u4fdc\u5a09\u67b0\u9c86',
            po: '\u5761\u6cfc\u9887\u5a46\u7834\u9b44\u8feb\u7c95\u53f5\u9131\u6ea5\u73c0\u948b\u94b7\u76a4\u7b38',
            pou: '\u5256\u88d2\u8e23',
            pu: '\u6251\u94fa\u4ec6\u8386\u8461\u83e9\u84b2\u57d4\u6734\u5703\u666e\u6d66\u8c31\u66dd\u7011\u530d\u5657\u6fee\u749e\u6c06\u9564\u9568\u8e7c',
            qi: '\u671f\u6b3a\u6816\u621a\u59bb\u4e03\u51c4\u6f06\u67d2\u6c8f\u5176\u68cb\u5947\u6b67\u7566\u5d0e\u8110\u9f50\u65d7\u7948\u7941\u9a91\u8d77\u5c82\u4e5e\u4f01\u542f\u5951\u780c\u5668\u6c14\u8fc4\u5f03\u6c7d\u6ce3\u8bab\u4e9f\u4e93\u573b\u8291\u840b\u847a\u5601\u5c7a\u5c90\u6c54\u6dc7\u9a90\u7eee\u742a\u7426\u675e\u6864\u69ed\u6b39\u797a\u61a9\u789b\u86f4\u871e\u7da6\u7dae\u8dbf\u8e4a\u9ccd\u9e92',
            qia: '\u6390\u6070\u6d3d\u845c',
            qian: '\u7275\u6266\u948e\u94c5\u5343\u8fc1\u7b7e\u4edf\u8c26\u4e7e\u9ed4\u94b1\u94b3\u524d\u6f5c\u9063\u6d45\u8c34\u5811\u5d4c\u6b20\u6b49\u4f65\u9621\u828a\u82a1\u8368\u63ae\u5c8d\u60ad\u614a\u9a9e\u6434\u8930\u7f31\u6920\u80b7\u6106\u94a4\u8654\u7b9d',
            qiang: '\u67aa\u545b\u8154\u7f8c\u5899\u8537\u5f3a\u62a2\u5af1\u6a2f\u6217\u709d\u9516\u9535\u956a\u8941\u8723\u7f9f\u8deb\u8dc4',
            qiao: '\u6a47\u9539\u6572\u6084\u6865\u77a7\u4e54\u4fa8\u5de7\u9798\u64ac\u7fd8\u5ced\u4fcf\u7a8d\u5281\u8bee\u8c2f\u835e\u6100\u6194\u7f32\u6a35\u6bf3\u7857\u8df7\u9792',
            qie: '\u5207\u8304\u4e14\u602f\u7a83\u90c4\u553c\u60ec\u59be\u6308\u9532\u7ba7',
            qin: '\u94a6\u4fb5\u4eb2\u79e6\u7434\u52e4\u82b9\u64d2\u79bd\u5bdd\u6c81\u82a9\u84c1\u8572\u63ff\u5423\u55ea\u5659\u6eb1\u6a8e\u8793\u887e',
            qing: '\u9752\u8f7b\u6c22\u503e\u537f\u6e05\u64ce\u6674\u6c30\u60c5\u9877\u8bf7\u5e86\u5029\u82d8\u570a\u6aa0\u78ec\u873b\u7f44\u7b90\u8b26\u9cad\u9ee5',
            qiong: '\u743c\u7a77\u909b\u8315\u7a79\u7b47\u928e',
            qiu: '\u79cb\u4e18\u90b1\u7403\u6c42\u56da\u914b\u6cc5\u4fc5\u6c3d\u5def\u827d\u72b0\u6e6b\u9011\u9052\u6978\u8d47\u9e20\u866c\u86af\u8764\u88d8\u7cd7\u9cc5\u9f3d',
            qu: '\u8d8b\u533a\u86c6\u66f2\u8eaf\u5c48\u9a71\u6e20\u53d6\u5a36\u9f8b\u8da3\u53bb\u8bce\u52ac\u8556\u8627\u5c96\u8862\u9612\u74a9\u89d1\u6c0d\u795b\u78f2\u766f\u86d0\u883c\u9eb4\u77bf\u9ee2',
            quan: '\u5708\u98a7\u6743\u919b\u6cc9\u5168\u75ca\u62f3\u72ac\u5238\u529d\u8be0\u8343\u737e\u609b\u7efb\u8f81\u754e\u94e8\u8737\u7b4c\u9b08',
            que: '\u7f3a\u7094\u7638\u5374\u9e4a\u69b7\u786e\u96c0\u9619\u60ab',
            qun: '\u88d9\u7fa4\u9021',
            ran: '\u7136\u71c3\u5189\u67d3\u82d2\u9aef',
            rang: '\u74e4\u58e4\u6518\u56b7\u8ba9\u79b3\u7a70',
            rao: '\u9976\u6270\u7ed5\u835b\u5a06\u6861',
            ruo: '\u60f9\u82e5\u5f31',
            re: '\u70ed\u504c',
            ren: '\u58ec\u4ec1\u4eba\u5fcd\u97e7\u4efb\u8ba4\u5203\u598a\u7eab\u4ede\u834f\u845a\u996a\u8f6b\u7a14\u887d',
            reng: '\u6254\u4ecd',
            ri: '\u65e5',
            rong: '\u620e\u8338\u84c9\u8363\u878d\u7194\u6eb6\u5bb9\u7ed2\u5197\u5d58\u72e8\u7f1b\u6995\u877e',
            rou: '\u63c9\u67d4\u8089\u7cc5\u8e42\u97a3',
            ru: '\u8339\u8815\u5112\u5b7a\u5982\u8fb1\u4e73\u6c5d\u5165\u8925\u84d0\u85b7\u5685\u6d33\u6ebd\u6fe1\u94f7\u8966\u98a5',
            ruan: '\u8f6f\u962e\u670a',
            rui: '\u854a\u745e\u9510\u82ae\u8564\u777f\u868b',
            run: '\u95f0\u6da6',
            sa: '\u6492\u6d12\u8428\u5345\u4ee8\u6332\u98d2',
            sai: '\u816e\u9cc3\u585e\u8d5b\u567b',
            san: '\u4e09\u53c1\u4f1e\u6563\u5f61\u9993\u6c35\u6bf5\u7cc1\u9730',
            sang: '\u6851\u55d3\u4e27\u6421\u78c9\u98a1',
            sao: '\u6414\u9a9a\u626b\u5ac2\u57fd\u81ca\u7619\u9ccb',
            se: '\u745f\u8272\u6da9\u556c\u94e9\u94ef\u7a51',
            sen: '\u68ee',
            seng: '\u50e7',
            sha: '\u838e\u7802\u6740\u5239\u6c99\u7eb1\u50bb\u5565\u715e\u810e\u6b43\u75e7\u88df\u970e\u9ca8',
            shai: '\u7b5b\u6652\u917e',
            shan: '\u73ca\u82eb\u6749\u5c71\u5220\u717d\u886b\u95ea\u9655\u64c5\u8d61\u81b3\u5584\u6c55\u6247\u7f2e\u5261\u8baa\u912f\u57cf\u829f\u6f78\u59d7\u9a9f\u81bb\u9490\u759d\u87ee\u8222\u8dda\u9cdd',
            shang: '\u5892\u4f24\u5546\u8d4f\u664c\u4e0a\u5c1a\u88f3\u57a7\u7ef1\u6b87\u71b5\u89de',
            shao: '\u68a2\u634e\u7a0d\u70e7\u828d\u52fa\u97f6\u5c11\u54e8\u90b5\u7ecd\u52ad\u82d5\u6f72\u86f8\u7b24\u7b72\u8244',
            she: '\u5962\u8d4a\u86c7\u820c\u820d\u8d66\u6444\u5c04\u6151\u6d89\u793e\u8bbe\u538d\u4f58\u731e\u7572\u9e9d',
            shen: '\u7837\u7533\u547b\u4f38\u8eab\u6df1\u5a20\u7ec5\u795e\u6c88\u5ba1\u5a76\u751a\u80be\u614e\u6e17\u8bdc\u8c02\u5432\u54c2\u6e16\u6939\u77e7\u8703',
            sheng: '\u58f0\u751f\u7525\u7272\u5347\u7ef3\u7701\u76db\u5269\u80dc\u5723\u4e1e\u6e11\u5ab5\u771a\u7b19',
            shi: '\u5e08\u5931\u72ee\u65bd\u6e7f\u8bd7\u5c38\u8671\u5341\u77f3\u62fe\u65f6\u4ec0\u98df\u8680\u5b9e\u8bc6\u53f2\u77e2\u4f7f\u5c4e\u9a76\u59cb\u5f0f\u793a\u58eb\u4e16\u67ff\u4e8b\u62ed\u8a93\u901d\u52bf\u662f\u55dc\u566c\u9002\u4ed5\u4f8d\u91ca\u9970\u6c0f\u5e02\u6043\u5ba4\u89c6\u8bd5\u8c25\u57d8\u83b3\u84cd\u5f11\u5511\u9963\u8f7c\u8006\u8d33\u70bb\u793b\u94c8\u94ca\u87ab\u8210\u7b6e\u8c55\u9ca5\u9cba',
            shou: '\u6536\u624b\u9996\u5b88\u5bff\u6388\u552e\u53d7\u7626\u517d\u624c\u72e9\u7ef6\u824f',
            shu: '\u852c\u67a2\u68b3\u6b8a\u6292\u8f93\u53d4\u8212\u6dd1\u758f\u4e66\u8d4e\u5b70\u719f\u85af\u6691\u66d9\u7f72\u8700\u9ecd\u9f20\u5c5e\u672f\u8ff0\u6811\u675f\u620d\u7ad6\u5885\u5eb6\u6570\u6f31\u6055\u500f\u587e\u83fd\u5fc4\u6cad\u6d91\u6f8d\u59dd\u7ebe\u6bf9\u8167\u6bb3\u956f\u79eb\u9e6c',
            shua: '\u5237\u800d\u5530\u6dae',
            shuai: '\u6454\u8870\u7529\u5e05\u87c0',
            shuan: '\u6813\u62f4\u95e9',
            shuang: '\u971c\u53cc\u723d\u5b40',
            shui: '\u8c01\u6c34\u7761\u7a0e',
            shun: '\u542e\u77ac\u987a\u821c\u6042',
            shuo: '\u8bf4\u7855\u6714\u70c1\u84b4\u6420\u55cd\u6fef\u5981\u69ca\u94c4',
            si: '\u65af\u6495\u5636\u601d\u79c1\u53f8\u4e1d\u6b7b\u8086\u5bfa\u55e3\u56db\u4f3a\u4f3c\u9972\u5df3\u53ae\u4fdf\u5155\u83e5\u549d\u6c5c\u6cd7\u6f8c\u59d2\u9a77\u7f0c\u7940\u7960\u9536\u9e36\u801c\u86f3\u7b25',
            song: '\u677e\u8038\u6002\u9882\u9001\u5b8b\u8bbc\u8bf5\u51c7\u83d8\u5d27\u5d69\u5fea\u609a\u6dde\u7ae6',
            sou: '\u641c\u8258\u64de\u55fd\u53df\u55d6\u55fe\u998a\u6eb2\u98d5\u778d\u953c\u878b',
            su: '\u82cf\u9165\u4fd7\u7d20\u901f\u7c9f\u50f3\u5851\u6eaf\u5bbf\u8bc9\u8083\u5919\u8c21\u850c\u55c9\u612b\u7c0c\u89eb\u7a23',
            suan: '\u9178\u849c\u7b97',
            sui: '\u867d\u968b\u968f\u7ee5\u9ad3\u788e\u5c81\u7a57\u9042\u96a7\u795f\u84d1\u51ab\u8c07\u6fc9\u9083\u71e7\u772d\u7762',
            sun: '\u5b59\u635f\u7b0b\u836a\u72f2\u98e7\u69ab\u8de3\u96bc',
            suo: '\u68ad\u5506\u7f29\u7410\u7d22\u9501\u6240\u5522\u55e6\u5a11\u686b\u7743\u7fa7',
            ta: '\u584c\u4ed6\u5b83\u5979\u5854\u736d\u631e\u8e4b\u8e0f\u95fc\u6ebb\u9062\u69bb\u6c93',
            tai: '\u80ce\u82d4\u62ac\u53f0\u6cf0\u915e\u592a\u6001\u6c70\u90b0\u85b9\u80bd\u70b1\u949b\u8dc6\u9c90',
            tan: '\u574d\u644a\u8d2a\u762b\u6ee9\u575b\u6a80\u75f0\u6f6d\u8c2d\u8c08\u5766\u6bef\u8892\u78b3\u63a2\u53f9\u70ad\u90ef\u8548\u6619\u94bd\u952c\u8983',
            tang: '\u6c64\u5858\u642a\u5802\u68e0\u819b\u5510\u7cd6\u50a5\u9967\u6e8f\u746d\u94f4\u9557\u8025\u8797\u87b3\u7fb0\u91a3',
            thang: '\u5018\u8eba\u6dcc',
            theng: '\u8d9f\u70eb',
            tao: '\u638f\u6d9b\u6ed4\u7ee6\u8404\u6843\u9003\u6dd8\u9676\u8ba8\u5957\u6311\u9f17\u5555\u97ec\u9955',
            te: '\u7279',
            teng: '\u85e4\u817e\u75bc\u8a8a\u6ed5',
            ti: '\u68af\u5254\u8e22\u9511\u63d0\u9898\u8e44\u557c\u4f53\u66ff\u568f\u60d5\u6d95\u5243\u5c49\u8351\u608c\u9016\u7ee8\u7f07\u9e48\u88fc\u918d',
            tian: '\u5929\u6dfb\u586b\u7530\u751c\u606c\u8214\u8146\u63ad\u5fdd\u9617\u6b84\u754b\u94bf\u86ba',
            tiao: '\u6761\u8fe2\u773a\u8df3\u4f7b\u7967\u94eb\u7a95\u9f86\u9ca6',
            tie: '\u8d34\u94c1\u5e16\u841c\u992e',
            ting: '\u5385\u542c\u70c3\u6c40\u5ef7\u505c\u4ead\u5ead\u633a\u8247\u839b\u8476\u5a77\u6883\u8713\u9706',
            tong: '\u901a\u6850\u916e\u77b3\u540c\u94dc\u5f64\u7ae5\u6876\u6345\u7b52\u7edf\u75db\u4f5f\u50ee\u4edd\u833c\u55f5\u6078\u6f7c\u783c',
            tou: '\u5077\u6295\u5934\u900f\u4ea0',
            tu: '\u51f8\u79c3\u7a81\u56fe\u5f92\u9014\u6d82\u5c60\u571f\u5410\u5154\u580d\u837c\u83df\u948d\u9174',
            tuan: '\u6e4d\u56e2\u7583',
            tui: '\u63a8\u9893\u817f\u8715\u892a\u9000\u5fd2\u717a',
            tun: '\u541e\u5c6f\u81c0\u9968\u66be\u8c5a\u7a80',
            tuo: '\u62d6\u6258\u8131\u9e35\u9640\u9a6e\u9a7c\u692d\u59a5\u62d3\u553e\u4e47\u4f57\u5768\u5eb9\u6cb1\u67dd\u7823\u7ba8\u8204\u8dce\u9f0d',
            wa: '\u6316\u54c7\u86d9\u6d3c\u5a03\u74e6\u889c\u4f64\u5a32\u817d',
            wai: '\u6b6a\u5916',
            wan: '\u8c4c\u5f2f\u6e7e\u73a9\u987d\u4e38\u70f7\u5b8c\u7897\u633d\u665a\u7696\u60cb\u5b9b\u5a49\u4e07\u8155\u525c\u8284\u82cb\u83c0\u7ea8\u7efe\u742c\u8118\u7579\u873f\u7ba2',
            wang: '\u6c6a\u738b\u4ea1\u6789\u7f51\u5f80\u65fa\u671b\u5fd8\u5984\u7f54\u5c22\u60d8\u8f8b\u9b4d',
            wei: '\u5a01\u5dcd\u5fae\u5371\u97e6\u8fdd\u6845\u56f4\u552f\u60df\u4e3a\u6f4d\u7ef4\u82c7\u840e\u59d4\u4f1f\u4f2a\u5c3e\u7eac\u672a\u851a\u5473\u754f\u80c3\u5582\u9b4f\u4f4d\u6e2d\u8c13\u5c09\u6170\u536b\u502d\u504e\u8bff\u9688\u8473\u8587\u5e0f\u5e37\u5d34\u5d6c\u7325\u732c\u95f1\u6ca9\u6d27\u6da0\u9036\u5a13\u73ae\u97ea\u8ece\u709c\u7168\u71a8\u75ff\u8249\u9c94',
            wen: '\u761f\u6e29\u868a\u6587\u95fb\u7eb9\u543b\u7a33\u7d0a\u95ee\u520e\u6120\u960c\u6c76\u74ba\u97eb\u6b81\u96ef',
            weng: '\u55e1\u7fc1\u74ee\u84ca\u8579',
            wo: '\u631d\u8717\u6da1\u7a9d\u6211\u65a1\u5367\u63e1\u6c83\u83b4\u5e44\u6e25\u674c\u809f\u9f8c',
            wu: '\u5deb\u545c\u94a8\u4e4c\u6c61\u8bec\u5c4b\u65e0\u829c\u68a7\u543e\u5434\u6bcb\u6b66\u4e94\u6342\u5348\u821e\u4f0d\u4fae\u575e\u620a\u96fe\u6664\u7269\u52ff\u52a1\u609f\u8bef\u5140\u4ef5\u9622\u90ac\u572c\u82b4\u5e91\u6003\u5fe4\u6d6f\u5be4\u8fd5\u59a9\u9a9b\u727e\u7110\u9e49\u9e5c\u8708\u92c8\u9f2f',
            xi: '\u6614\u7199\u6790\u897f\u7852\u77fd\u6670\u563b\u5438\u9521\u727a\u7a00\u606f\u5e0c\u6089\u819d\u5915\u60dc\u7184\u70ef\u6eaa\u6c50\u7280\u6a84\u88ad\u5e2d\u4e60\u5ab3\u559c\u94e3\u6d17\u7cfb\u9699\u620f\u7ec6\u50d6\u516e\u96b0\u90d7\u831c\u8478\u84f0\u595a\u550f\u5f99\u9969\u960b\u6d60\u6dc5\u5c63\u5b09\u73ba\u6a28\u66e6\u89cb\u6b37\u71b9\u798a\u79a7\u94b8\u7699\u7a78\u8725\u87cb\u823e\u7fb2\u7c9e\u7fd5\u91af\u9f37',
            xia: '\u778e\u867e\u5323\u971e\u8f96\u6687\u5ce1\u4fa0\u72ed\u4e0b\u53a6\u590f\u5413\u6380\u846d\u55c4\u72ce\u9050\u7455\u7856\u7615\u7f45\u9ee0',
            xian: '\u9528\u5148\u4ed9\u9c9c\u7ea4\u54b8\u8d24\u8854\u8237\u95f2\u6d8e\u5f26\u5acc\u663e\u9669\u73b0\u732e\u53bf\u817a\u9985\u7fa1\u5baa\u9677\u9650\u7ebf\u51bc\u85d3\u5c98\u7303\u66b9\u5a34\u6c19\u7946\u9e47\u75eb\u86ac\u7b45\u7c7c\u9170\u8df9',
            xiang: '\u76f8\u53a2\u9576\u9999\u7bb1\u8944\u6e58\u4e61\u7fd4\u7965\u8be6\u60f3\u54cd\u4eab\u9879\u5df7\u6a61\u50cf\u5411\u8c61\u8297\u8459\u9977\u5ea0\u9aa7\u7f03\u87d3\u9c9e\u98e8',
            xiao: '\u8427\u785d\u9704\u524a\u54ee\u56a3\u9500\u6d88\u5bb5\u6dc6\u6653\u5c0f\u5b5d\u6821\u8096\u5578\u7b11\u6548\u54d3\u54bb\u5d24\u6f47\u900d\u9a81\u7ee1\u67ad\u67b5\u7b71\u7bab\u9b48',
            xie: '\u6954\u4e9b\u6b47\u874e\u978b\u534f\u631f\u643a\u90aa\u659c\u80c1\u8c10\u5199\u68b0\u5378\u87f9\u61c8\u6cc4\u6cfb\u8c22\u5c51\u5055\u4eb5\u52f0\u71ee\u85a4\u64b7\u5ee8\u7023\u9082\u7ec1\u7f2c\u69ad\u698d\u6b59\u8e9e',
            xin: '\u85aa\u82af\u950c\u6b23\u8f9b\u65b0\u5ffb\u5fc3\u4fe1\u8845\u56df\u99a8\u8398\u6b46\u94fd\u946b',
            xing: '\u661f\u8165\u7329\u60fa\u5174\u5211\u578b\u5f62\u90a2\u884c\u9192\u5e78\u674f\u6027\u59d3\u9649\u8347\u8365\u64e4\u60bb\u784e',
            xiong: '\u5144\u51f6\u80f8\u5308\u6c79\u96c4\u718a\u828e',
            xiu: '\u4f11\u4fee\u7f9e\u673d\u55c5\u9508\u79c0\u8896\u7ee3\u83a0\u5cab\u9990\u5ea5\u9e3a\u8c85\u9af9',
            xu: '\u589f\u620c\u9700\u865a\u5618\u987b\u5f90\u8bb8\u84c4\u9157\u53d9\u65ed\u5e8f\u755c\u6064\u7d6e\u5a7f\u7eea\u7eed\u8bb4\u8be9\u5729\u84ff\u6035\u6d2b\u6e86\u987c\u6829\u7166\u7809\u76f1\u80e5\u7cc8\u9191',
            xuan: '\u8f69\u55a7\u5ba3\u60ac\u65cb\u7384\u9009\u7663\u7729\u7eda\u5107\u8c16\u8431\u63ce\u9994\u6ceb\u6d35\u6e32\u6f29\u7487\u6966\u6684\u70ab\u714a\u78b9\u94c9\u955f\u75c3',
            xue: '\u9774\u859b\u5b66\u7a74\u96ea\u8840\u5671\u6cf6\u9cd5',
            xun: '\u52cb\u718f\u5faa\u65ec\u8be2\u5bfb\u9a6f\u5de1\u6b89\u6c5b\u8bad\u8baf\u900a\u8fc5\u5dfd\u57d9\u8340\u85b0\u5ccb\u5f87\u6d54\u66db\u7aa8\u91ba\u9c9f',
            ya: '\u538b\u62bc\u9e26\u9e2d\u5440\u4e2b\u82bd\u7259\u869c\u5d16\u8859\u6daf\u96c5\u54d1\u4e9a\u8bb6\u4f22\u63e0\u5416\u5c88\u8fd3\u5a05\u740a\u6860\u6c29\u7811\u775a\u75d6',
            yan: '\u7109\u54bd\u9609\u70df\u6df9\u76d0\u4e25\u7814\u8712\u5ca9\u5ef6\u8a00\u989c\u960e\u708e\u6cbf\u5944\u63a9\u773c\u884d\u6f14\u8273\u5830\u71d5\u538c\u781a\u96c1\u5501\u5f66\u7130\u5bb4\u8c1a\u9a8c\u53a3\u9765\u8d5d\u4fe8\u5043\u5156\u8ba0\u8c33\u90fe\u9122\u82ab\u83f8\u5d26\u6079\u95eb\u960f\u6d07\u6e6e\u6edf\u598d\u5ae3\u7430\u664f\u80ed\u814c\u7131\u7f68\u7b75\u917d\u9b47\u990d\u9f39',
            yang: '\u6b83\u592e\u9e2f\u79e7\u6768\u626c\u4f6f\u75a1\u7f8a\u6d0b\u9633\u6c27\u4ef0\u75d2\u517b\u6837\u6f3e\u5f89\u600f\u6cf1\u7080\u70ca\u6059\u86d8\u9785',
            yao: '\u9080\u8170\u5996\u7476\u6447\u5c27\u9065\u7a91\u8c23\u59da\u54ac\u8200\u836f\u8981\u8000\u592d\u723b\u5406\u5d3e\u5fad\u7039\u5e7a\u73e7\u6773\u66dc\u80b4\u9e5e\u7a88\u7e47\u9cd0',
            ye: '\u6930\u564e\u8036\u7237\u91ce\u51b6\u4e5f\u9875\u6396\u4e1a\u53f6\u66f3\u814b\u591c\u6db2\u8c12\u90ba\u63f6\u9980\u6654\u70e8\u94d8',
            yi: '\u4e00\u58f9\u533b\u63d6\u94f1\u4f9d\u4f0a\u8863\u9890\u5937\u9057\u79fb\u4eea\u80f0\u7591\u6c82\u5b9c\u59e8\u5f5d\u6905\u8681\u501a\u5df2\u4e59\u77e3\u4ee5\u827a\u6291\u6613\u9091\u5c79\u4ebf\u5f79\u81c6\u9038\u8084\u75ab\u4ea6\u88d4\u610f\u6bc5\u5fc6\u4e49\u76ca\u6ea2\u8be3\u8bae\u8c0a\u8bd1\u5f02\u7ffc\u7fcc\u7ece\u5208\u5293\u4f7e\u8bd2\u572a\u572f\u57f8\u61ff\u82e1\u858f\u5f08\u5955\u6339\u5f0b\u5453\u54a6\u54bf\u566b\u5cc4\u5db7\u7317\u9974\u603f\u6021\u6092\u6f2a\u8fe4\u9a7f\u7f22\u6baa\u8d3b\u65d6\u71a0\u9487\u9552\u9571\u75cd\u7617\u7654\u7fca\u8864\u8734\u8223\u7fbf\u7ff3\u914f\u9edf',
            yin: '\u8335\u836b\u56e0\u6bb7\u97f3\u9634\u59fb\u541f\u94f6\u6deb\u5bc5\u996e\u5c39\u5f15\u9690\u5370\u80e4\u911e\u5819\u831a\u5591\u72fa\u5924\u6c24\u94df\u763e\u8693\u972a\u9f88',
            ying: '\u82f1\u6a31\u5a74\u9e70\u5e94\u7f28\u83b9\u8424\u8425\u8367\u8747\u8fce\u8d62\u76c8\u5f71\u9896\u786c\u6620\u5b34\u90e2\u8314\u83ba\u8426\u6484\u5624\u81ba\u6ee2\u6f46\u701b\u745b\u748e\u6979\u9e66\u763f\u988d\u7f42',
            yo: '\u54df\u5537',
            yong: '\u62e5\u4f63\u81c3\u75c8\u5eb8\u96cd\u8e0a\u86f9\u548f\u6cf3\u6d8c\u6c38\u607f\u52c7\u7528\u4fd1\u58c5\u5889\u6175\u9095\u955b\u752c\u9cd9\u9954',
            you: '\u5e7d\u4f18\u60a0\u5fe7\u5c24\u7531\u90ae\u94c0\u72b9\u6cb9\u6e38\u9149\u6709\u53cb\u53f3\u4f51\u91c9\u8bf1\u53c8\u5e7c\u5363\u6538\u4f91\u83b8\u5466\u56ff\u5ba5\u67da\u7337\u7256\u94d5\u75a3\u8763\u9c7f\u9edd\u9f2c',
            yu: '\u8fc2\u6de4\u4e8e\u76c2\u6986\u865e\u611a\u8206\u4f59\u4fde\u903e\u9c7c\u6109\u6e1d\u6e14\u9685\u4e88\u5a31\u96e8\u4e0e\u5c7f\u79b9\u5b87\u8bed\u7fbd\u7389\u57df\u828b\u90c1\u5401\u9047\u55bb\u5cea\u5fa1\u6108\u6b32\u72f1\u80b2\u8a89\u6d74\u5bd3\u88d5\u9884\u8c6b\u9a6d\u79ba\u6bd3\u4f1b\u4fe3\u8c00\u8c15\u8438\u84e3\u63c4\u5581\u5704\u5709\u5d5b\u72f3\u996b\u5ebe\u9608\u59aa\u59a4\u7ea1\u745c\u6631\u89ce\u8174\u6b24\u65bc\u715c\u71e0\u807f\u94b0\u9e46\u7610\u7600\u7ab3\u8753\u7afd\u8201\u96e9\u9f89',
            yuan: '\u9e33\u6e0a\u51a4\u5143\u57a3\u8881\u539f\u63f4\u8f95\u56ed\u5458\u5706\u733f\u6e90\u7f18\u8fdc\u82d1\u613f\u6028\u9662\u586c\u6c85\u5a9b\u7457\u6a7c\u7230\u7722\u9e22\u8788\u9f0b',
            yue: '\u66f0\u7ea6\u8d8a\u8dc3\u94a5\u5cb3\u7ca4\u6708\u60a6\u9605\u9fa0\u6a3e\u5216\u94ba',
            yun: '\u8018\u4e91\u90e7\u5300\u9668\u5141\u8fd0\u8574\u915d\u6655\u97f5\u5b55\u90d3\u82b8\u72c1\u607d\u7ead\u6b92\u6600\u6c32',
            za: '\u531d\u7838\u6742\u62f6\u5482',
            zai: '\u683d\u54c9\u707e\u5bb0\u8f7d\u518d\u5728\u54b1\u5d3d\u753e',
            zan: '\u6512\u6682\u8d5e\u74d2\u661d\u7c2a\u7ccc\u8db1\u933e',
            zang: '\u8d43\u810f\u846c\u5958\u6215\u81e7',
            zao: '\u906d\u7cdf\u51ff\u85fb\u67a3\u65e9\u6fa1\u86a4\u8e81\u566a\u9020\u7682\u7076\u71e5\u5523\u7f2b',
            ze: '\u8d23\u62e9\u5219\u6cfd\u4ec4\u8d5c\u5567\u8fee\u6603\u7b2e\u7ba6\u8234',
            zei: '\u8d3c',
            zen: '\u600e\u8c2e',
            zeng: '\u589e\u618e\u66fe\u8d60\u7f2f\u7511\u7f7e\u9503',
            zha: '\u624e\u55b3\u6e23\u672d\u8f67\u94e1\u95f8\u7728\u6805\u69a8\u548b\u4e4d\u70b8\u8bc8\u63f8\u5412\u54a4\u54f3\u600d\u781f\u75c4\u86b1\u9f44',
            zhai: '\u6458\u658b\u5b85\u7a84\u503a\u5be8\u7826',
            zhan: '\u77bb\u6be1\u8a79\u7c98\u6cbe\u76cf\u65a9\u8f97\u5d2d\u5c55\u8638\u6808\u5360\u6218\u7ad9\u6e5b\u7efd\u8c35\u640c\u65c3',
            zhang: '\u6a1f\u7ae0\u5f70\u6f33\u5f20\u638c\u6da8\u6756\u4e08\u5e10\u8d26\u4ed7\u80c0\u7634\u969c\u4ec9\u9123\u5e5b\u5d82\u7350\u5adc\u748b\u87d1',
            zhao: '\u62db\u662d\u627e\u6cbc\u8d75\u7167\u7f69\u5146\u8087\u53ec\u722a\u8bcf\u68f9\u948a\u7b0a',
            zhe: '\u906e\u6298\u54f2\u86f0\u8f99\u8005\u9517\u8517\u8fd9\u6d59\u8c2a\u966c\u67d8\u8f84\u78d4\u9e67\u891a\u8707\u8d6d',
            zhen: '\u73cd\u659f\u771f\u7504\u7827\u81fb\u8d1e\u9488\u4fa6\u6795\u75b9\u8bca\u9707\u632f\u9547\u9635\u7f1c\u6862\u699b\u8f78\u8d48\u80d7\u6715\u796f\u755b\u9e29',
            zheng: '\u84b8\u6323\u7741\u5f81\u72f0\u4e89\u6014\u6574\u62ef\u6b63\u653f\u5e27\u75c7\u90d1\u8bc1\u8be4\u5ce5\u94b2\u94ee\u7b5d',
            zhi: '\u829d\u679d\u652f\u5431\u8718\u77e5\u80a2\u8102\u6c41\u4e4b\u7ec7\u804c\u76f4\u690d\u6b96\u6267\u503c\u4f84\u5740\u6307\u6b62\u8dbe\u53ea\u65e8\u7eb8\u5fd7\u631a\u63b7\u81f3\u81f4\u7f6e\u5e1c\u5cd9\u5236\u667a\u79e9\u7a1a\u8d28\u7099\u75d4\u6ede\u6cbb\u7a92\u536e\u965f\u90c5\u57f4\u82b7\u646d\u5e19\u5fee\u5f58\u54ab\u9a98\u6809\u67b3\u6800\u684e\u8f75\u8f7e\u6534\u8d3d\u81a3\u7949\u7957\u9ef9\u96c9\u9e37\u75e3\u86ed\u7d77\u916f\u8dd6\u8e2c\u8e2f\u8c78\u89ef',
            zhong: '\u4e2d\u76c5\u5fe0\u949f\u8877\u7ec8\u79cd\u80bf\u91cd\u4ef2\u4f17\u51a2\u953a\u87bd\u8202\u822f\u8e35',
            zhou: '\u821f\u5468\u5dde\u6d32\u8bcc\u7ca5\u8f74\u8098\u5e1a\u5492\u76b1\u5b99\u663c\u9aa4\u5544\u7740\u501c\u8bf9\u836e\u9b3b\u7ea3\u80c4\u78a1\u7c40\u8233\u914e\u9cb7',
            zhu: '\u73e0\u682a\u86db\u6731\u732a\u8bf8\u8bdb\u9010\u7af9\u70db\u716e\u62c4\u77a9\u5631\u4e3b\u8457\u67f1\u52a9\u86c0\u8d2e\u94f8\u7b51\u4f4f\u6ce8\u795d\u9a7b\u4f2b\u4f8f\u90be\u82ce\u8331\u6d19\u6e1a\u6f74\u9a7a\u677c\u69e0\u6a65\u70b7\u94e2\u75b0\u7603\u86b0\u7afa\u7bb8\u7fe5\u8e85\u9e88',
            zhua: '\u6293',
            zhuai: '\u62fd',
            zhuan: '\u4e13\u7816\u8f6c\u64b0\u8d5a\u7bc6\u629f\u556d\u989b',
            zhuang: '\u6869\u5e84\u88c5\u5986\u649e\u58ee\u72b6\u4e2c',
            zhui: '\u690e\u9525\u8ffd\u8d58\u5760\u7f00\u8411\u9a93\u7f12',
            zhun: '\u8c06\u51c6',
            zhuo: '\u6349\u62d9\u5353\u684c\u7422\u8301\u914c\u707c\u6d4a\u502c\u8bfc\u5ef4\u855e\u64e2\u555c\u6d5e\u6dbf\u6753\u712f\u799a\u65ab',
            zi: '\u5179\u54a8\u8d44\u59ff\u6ecb\u6dc4\u5b5c\u7d2b\u4ed4\u7c7d\u6ed3\u5b50\u81ea\u6e0d\u5b57\u8c18\u5d6b\u59ca\u5b73\u7f01\u6893\u8f8e\u8d40\u6063\u7726\u9531\u79ed\u8014\u7b2b\u7ca2\u89dc\u8a3e\u9cbb\u9aed',
            zong: '\u9b03\u68d5\u8e2a\u5b97\u7efc\u603b\u7eb5\u8159\u7cbd',
            zou: '\u90b9\u8d70\u594f\u63cd\u9139\u9cb0',
            zu: '\u79df\u8db3\u5352\u65cf\u7956\u8bc5\u963b\u7ec4\u4fce\u83f9\u5550\u5f82\u9a75\u8e74',
            zuan: '\u94bb\u7e82\u6525\u7f35',
            zui: '\u5634\u9189\u6700\u7f6a',
            zun: '\u5c0a\u9075\u6499\u6a3d\u9cdf',
            zuo: '\u6628\u5de6\u4f50\u67de\u505a\u4f5c\u5750\u5ea7\u961d\u963c\u80d9\u795a\u9162',
            cou: '\u85ae\u6971\u8f8f\u8160',
            nang: '\u652e\u54dd\u56d4\u9995\u66e9',
            o: '\u5594',
            dia: '\u55f2',
            chuai: '\u562c\u81aa\u8e39',
            cen: '\u5c91\u6d94',
            diu: '\u94e5',
            nou: '\u8028',
            fou: '\u7f36',
            bia: '\u9adf',
        };
        this.polyphone = {
            19969: 'DZ',
            19975: 'WM',
            19988: 'QJ',
            20048: 'YL',
            20056: 'SC',
            20060: 'NM',
            20094: 'QG',
            20127: 'QJ',
            20167: 'QC',
            20193: 'YG',
            20250: 'KH',
            20256: 'ZC',
            20282: 'SC',
            20285: 'QJG',
            20291: 'TD',
            20314: 'YD',
            20340: 'NE',
            20375: 'TD',
            20389: 'YJ',
            20391: 'CZ',
            20415: 'PB',
            20446: 'YS',
            20447: 'SQ',
            20504: 'TC',
            20608: 'KG',
            20854: 'QJ',
            20857: 'ZC',
            20911: 'PF',
            20985: 'AW',
            21032: 'PB',
            21048: 'XQ',
            21049: 'SC',
            21089: 'YS',
            21119: 'JC',
            21242: 'SB',
            21273: 'SC',
            21305: 'YP',
            21306: 'QO',
            21330: 'ZC',
            21333: 'SDC',
            21345: 'QK',
            21378: 'CA',
            21397: 'SC',
            21414: 'XS',
            21442: 'SC',
            21477: 'JG',
            21480: 'TD',
            21484: 'ZS',
            21494: 'YX',
            21505: 'YX',
            21512: 'HG',
            21523: 'XH',
            21537: 'PB',
            21542: 'PF',
            21549: 'KH',
            21571: 'E',
            21574: 'DA',
            21588: 'TD',
            21589: 'O',
            21618: 'ZC',
            21621: 'KHA',
            21632: 'ZJ',
            21654: 'KG',
            21679: 'LKG',
            21683: 'KH',
            21710: 'A',
            21719: 'YH',
            21734: 'WOE',
            21769: 'A',
            21780: 'WN',
            21804: 'XH',
            21834: 'A',
            21899: 'ZD',
            21903: 'RN',
            21908: 'WO',
            21939: 'ZC',
            21956: 'SA',
            21964: 'YA',
            21970: 'TD',
            22003: 'A',
            22031: 'JG',
            22040: 'XS',
            22060: 'ZC',
            22066: 'ZC',
            22079: 'MH',
            22129: 'XJ',
            22179: 'XA',
            22237: 'NJ',
            22244: 'TD',
            22280: 'JQ',
            22300: 'YH',
            22313: 'XW',
            22331: 'YQ',
            22343: 'YJ',
            22351: 'PH',
            22395: 'DC',
            22412: 'TD',
            22484: 'PB',
            22500: 'PB',
            22534: 'ZD',
            22549: 'DH',
            22561: 'PB',
            22612: 'TD',
            22771: 'KQ',
            22831: 'HB',
            22841: 'JG',
            22855: 'QJ',
            22865: 'XQ',
            23013: 'ML',
            23081: 'WM',
            23487: 'SX',
            23558: 'QJ',
            23561: 'YW',
            23586: 'YW',
            23614: 'YW',
            23615: 'SN',
            23631: 'PB',
            23646: 'ZS',
            23663: 'ZT',
            23673: 'YG',
            23762: 'TD',
            23769: 'ZS',
            23780: 'QJ',
            23884: 'QK',
            24055: 'XH',
            24113: 'DC',
            24162: 'ZC',
            24191: 'GA',
            24273: 'QJ',
            24324: 'NL',
            24377: 'TD',
            24378: 'QJ',
            24439: 'PF',
            24554: 'ZS',
            24683: 'TD',
            24694: 'WE',
            24733: 'LK',
            24925: 'TN',
            25094: 'ZG',
            25100: 'XQ',
            25103: 'XH',
            25153: 'PB',
            25170: 'PB',
            25179: 'KG',
            25203: 'PB',
            25240: 'ZS',
            25282: 'FB',
            25303: 'NA',
            25324: 'KG',
            25341: 'ZY',
            25373: 'WZ',
            25375: 'XJ',
            25384: 'A',
            25457: 'A',
            25528: 'SD',
            25530: 'SC',
            25552: 'TD',
            25774: 'ZC',
            25874: 'ZC',
            26044: 'YW',
            26080: 'WM',
            26292: 'PB',
            26333: 'PB',
            26355: 'ZY',
            26366: 'CZ',
            26397: 'ZC',
            26399: 'QJ',
            26415: 'ZS',
            26451: 'SB',
            26526: 'ZC',
            26552: 'JG',
            26561: 'TD',
            26588: 'JG',
            26597: 'CZ',
            26629: 'ZS',
            26638: 'YL',
            26646: 'XQ',
            26653: 'KG',
            26657: 'XJ',
            26727: 'HG',
            26894: 'ZC',
            26937: 'ZS',
            26946: 'ZC',
            26999: 'KJ',
            27099: 'KJ',
            27449: 'YQ',
            27481: 'XS',
            27542: 'ZS',
            27663: 'ZS',
            27748: 'TS',
            27784: 'SC',
            27788: 'ZD',
            27795: 'TD',
            27812: 'O',
            27850: 'PB',
            27852: 'MB',
            27895: 'SL',
            27898: 'PL',
            27973: 'QJ',
            27981: 'KH',
            27986: 'HX',
            27994: 'XJ',
            28044: 'YC',
            28065: 'WG',
            28177: 'SM',
            28267: 'QJ',
            28291: 'KH',
            28337: 'ZQ',
            28463: 'TL',
            28548: 'DC',
            28601: 'TD',
            28689: 'PB',
            28805: 'JG',
            28820: 'QG',
            28846: 'PB',
            28952: 'TD',
            28975: 'ZC',
            29100: 'A',
            29325: 'QJ',
            29575: 'SL',
            29602: 'FB',
            30010: 'TD',
            30044: 'CX',
            30058: 'PF',
            30091: 'YSP',
            30111: 'YN',
            30229: 'XJ',
            30427: 'SC',
            30465: 'SX',
            30631: 'YQ',
            30655: 'QJ',
            30684: 'QJG',
            30707: 'SD',
            30729: 'XH',
            30796: 'LG',
            30917: 'PB',
            31074: 'NM',
            31085: 'JZ',
            31109: 'SC',
            31181: 'ZC',
            31192: 'MLB',
            31293: 'JQ',
            31400: 'YX',
            31584: 'YJ',
            31896: 'ZN',
            31909: 'ZY',
            31995: 'XJ',
            32321: 'PF',
            32327: 'ZY',
            32418: 'HG',
            32420: 'XQ',
            32421: 'HG',
            32438: 'LG',
            32473: 'GJ',
            32488: 'TD',
            32521: 'QJ',
            32527: 'PB',
            32562: 'ZSQ',
            32564: 'JZ',
            32735: 'ZD',
            32793: 'PB',
            33071: 'PF',
            33098: 'XL',
            33100: 'YA',
            33152: 'PB',
            33261: 'CX',
            33324: 'BP',
            33333: 'TD',
            33406: 'YA',
            33426: 'WM',
            33432: 'PB',
            33445: 'JG',
            33486: 'ZN',
            33493: 'TS',
            33507: 'QJ',
            33540: 'QJ',
            33544: 'ZC',
            33564: 'XQ',
            33617: 'YT',
            33632: 'QJ',
            33636: 'XH',
            33637: 'YX',
            33694: 'WG',
            33705: 'PF',
            33728: 'YW',
            33882: 'SR',
            34067: 'WM',
            34074: 'YW',
            34121: 'QJ',
            34255: 'ZC',
            34259: 'XL',
            34425: 'JH',
            34430: 'XH',
            34485: 'KH',
            34503: 'YS',
            34532: 'HG',
            34552: 'XS',
            34558: 'YE',
            34593: 'ZL',
            34660: 'YQ',
            34892: 'XH',
            34928: 'SC',
            34999: 'QJ',
            35048: 'PB',
            35059: 'SC',
            35098: 'ZC',
            35203: 'TQ',
            35265: 'JX',
            35299: 'JX',
            35782: 'SZ',
            35828: 'YS',
            35830: 'E',
            35843: 'TD',
            35895: 'YG',
            35977: 'MH',
            36158: 'JG',
            36228: 'QJ',
            36426: 'XQ',
            36466: 'DC',
            36710: 'JC',
            36711: 'ZYG',
            36767: 'PB',
            36866: 'SK',
            36951: 'YW',
            37034: 'YX',
            37063: 'XH',
            37218: 'ZC',
            37325: 'ZC',
            38063: 'PB',
            38079: 'TD',
            38085: 'QY',
            38107: 'DC',
            38116: 'TD',
            38123: 'YD',
            38224: 'HG',
            38241: 'XTC',
            38271: 'ZC',
            38415: 'YE',
            38426: 'KH',
            38461: 'YD',
            38463: 'AE',
            38466: 'PB',
            38477: 'XJ',
            38518: 'YT',
            38551: 'WK',
            38585: 'ZC',
            38704: 'XS',
            38739: 'LJ',
            38761: 'GJ',
            38808: 'SQ',
            39048: 'JG',
            39049: 'XJ',
            39052: 'HG',
            39076: 'CZ',
            39271: 'XT',
            39534: 'TD',
            39552: 'TD',
            39584: 'PB',
            39647: 'SB',
            39730: 'LG',
            39748: 'TPB',
            40109: 'ZQ',
            40479: 'ND',
            40516: 'HG',
            40536: 'HG',
            40583: 'QJ',
            40765: 'YQ',
            40784: 'QJ',
            40840: 'YK',
            40863: 'QJG',
        };
    }
    // 提取拼音
    getFullChar(str) {
        for (const key in this.fullDict) {
            if (this.fullDict[key].indexOf(str) !== -1) {
                return this.capitalize(key);
            }
        }
        return false;
    }
    // 提取拼音, 返回首字母大写形式
    getFullChars(str) {
        let result = '';
        let name;
        for (let i = 0, len = str.length; i < len; i++) {
            const ch = str.substr(i, 1);
            const unicode = ch.charCodeAt(0);
            if (unicode > 40869 || unicode < 19968) {
                result += ch;
            }
            else {
                name = this.getFullChar(ch);
                if (name !== false) {
                    result += name;
                }
            }
        }
        return result;
    }
    // 提取首字母，返回大写形式
    getCamelChars(str) {
        if (typeof str !== 'string')
            throw new Error('函数getFisrt需要字符串类型参数!');
        const chars = []; // 保存中间结果的数组
        for (let i = 0, len = str.length; i < len; i++) {
            // 获得unicode码
            const ch = str.charAt(i);
            // 检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理
            chars.push(this.getChar(ch));
        }
        // 处理arrResult,返回所有可能的拼音首字母串数组
        return this.getResult(chars);
    }
    // 首字母大写
    capitalize(str) {
        if (str.length > 0) {
            const first = str.substr(0, 1).toUpperCase();
            const spare = str.substr(1, str.length);
            return first + spare;
        }
        return str;
    }
    getChar(ch) {
        const unicode = ch.charCodeAt(0);
        // 如果不在汉字处理范围之内,返回原字符,也可以调用自己的处理函数
        if (unicode > 40869 || unicode < 19968)
            return ch; // dealWithOthers(ch);
        // 检查是否是多音字,是按多音字处理,不是就直接在strChineseFirstPY字符串中找对应的首字母
        if (!this.options.checkPolyphone)
            return this.charDict.charAt(unicode - 19968);
        return this.polyphone[unicode] ? this.polyphone[unicode] : this.charDict.charAt(unicode - 19968);
    }
    getResult(chars) {
        if (!this.options.checkPolyphone)
            return chars.join('');
        let result = [''];
        for (let i = 0, len = chars.length; i < len; i++) {
            const str = chars[i];
            const strlen = str.length;
            if (strlen === 1) {
                for (let j = 0; j < result.length; j++) {
                    result[j] += str;
                }
            }
            else {
                const swap1 = result.slice(0);
                result = [];
                for (let j = 0; j < strlen; j++) {
                    // 复制一个相同的arrRslt
                    const swap2 = swap1.slice(0);
                    // 把当前字符str[k]添加到每个元素末尾
                    for (let k = 0; k < swap2.length; k++) {
                        swap2[k] += str.charAt(j);
                    }
                    // 把复制并修改后的数组连接到arrRslt上
                    result = result.concat(swap2);
                }
            }
        }
        return result;
    }
}

class ReportDate extends Date {
    // prototype: any;
    // constructor() {
    //   super();
    //   set(this.prototype, 'Format', this.Format);
    //   Object.assign(Date, this);
    // }
    Format = (fmt) => {
        const o = {
            '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;
    };
}

const pinyin = new Pinyin();
const isEmptyString = (str) => {
    let rst = false;
    if (str === null || str === undefined) {
        rst = true;
    }
    else if (typeof str === 'string') {
        let reg = /^\s*$/;
        rst = reg.test(str);
    }
    return rst;
};
const trim = (str) => {
    return str.replace(/(^\s*)|(\s*$)/g, "");
};
const leftTrim = (str) => {
    return str.replace(/(^\s*)/g, "");
};
const rightTrim = (str) => {
    return str.replace(/(\s*$)/g, "");
};
const replaceAll$1 = (targetStr, FindText, RepText) => {
    let regExp = new RegExp(FindText, "gm");
    return targetStr.replace(regExp, RepText);
};
const comdify$1 = (numStr) => {
    let re = /\d{1,3}(?=(\d{3})+$)/g;
    return numStr.replace(/^(\d+)((\.\d+)?)$/, function (s, s1, s2) { return s1.replace(re, "$&,") + s2; });
};
const convertToCaptionNum = (num, isCurrency, isTraditionalCap) => {
    let rst = "";
    if (/^\d*(\.\d*)?$/.test(num)) {
        let capChars, unitChars;
        if (isTraditionalCap) {
            capChars = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"];
            unitChars = ["", "拾", "佰", "仟", "萬", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万"];
        }
        else {
            capChars = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
            unitChars = ["", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千", "万"];
        }
        let numSplitArr = ("" + num).replace(/(^0*)/g, "").split(".");
        if (numSplitArr[0] === "")
            numSplitArr[0] = "0";
        let len = numSplitArr[0].length;
        let intPartArr = [];
        if (len <= 13) {
            for (let idx = 0; idx < len; idx++) {
                intPartArr.push(capChars[parseInt(numSplitArr[0].charAt(idx))] + unitChars[len - idx - 1]);
            }
            rst = intPartArr.join('');
            rst = replaceAll$1(rst, capChars[0] + unitChars[3], capChars[0]); //零千 -> 零
            rst = replaceAll$1(rst, capChars[0] + unitChars[2], capChars[0]); //零百 -> 零
            rst = replaceAll$1(rst, capChars[0] + unitChars[1], capChars[0]); //零十 -> 零
            //
            rst = replaceAll$1(replaceAll$1(rst, "零零", "零"), "零零", "零");
            rst = replaceAll$1(rst, capChars[0] + unitChars[8], unitChars[8]); //零亿 -> 亿
            rst = replaceAll$1(rst, capChars[0] + unitChars[4], unitChars[4]); //零万 -> 万
            //
            rst = replaceAll$1(rst, unitChars[8] + unitChars[4], unitChars[8] + capChars[0]); //亿万 -> 亿零
            if (num === 0) {
                rst = "零";
            }
            else if (rst.length > 1 && rst.charAt(rst.length - 1) === '零') {
                rst = rst.slice(0, rst.length - 1);
            }
            //小数部分处理
            if (numSplitArr.length > 1) {
                len = numSplitArr[1].length;
                if (parseInt(numSplitArr[1]) === 0) {
                    rst = rst + (isCurrency ? "元整" : "");
                }
                else {
                    if (isCurrency && len > 2)
                        len = 2;
                    let fractionStr = [];
                    for (let idx = 0; idx < len; idx++) {
                        fractionStr.push(capChars[parseInt(numSplitArr[1].charAt(idx))] + (isCurrency ? ((idx === 0) ? "角" : "分") : ""));
                    }
                    rst = rst + (isCurrency ? "元" : "点") + fractionStr.join("");
                }
            }
            else {
                rst = rst + (isCurrency ? "元整" : "");
            }
        }
        else {
            rst = "Number is too big!";
        }
    }
    else {
        rst = "Number is wrong!";
    }
    return rst;
};
const convertStrToBoolean = (str) => {
    let rst = false;
    if (!isEmptyString(str)) {
        let upperStr = str.toUpperCase();
        if (upperStr === 'T' || upperStr === 'Y' || upperStr === 'YES' || upperStr === 'TRUE') {
            rst = true;
        }
    }
    return rst;
};
const getPinYinFullChars = (value) => {
    return pinyin.getFullChars(value);
};
const getPinYinCamelChars = (value) => {
    return pinyin.getCamelChars(value);
};
const formatNumber = (formatStr, val) => {
    let rst = val;
    if (formatStr) {
        if (!(isNaN(parseFloat(val)))) {
            let dotIdx = formatStr.indexOf(".");
            if (dotIdx >= 0) {
                let tmpStr = parseFloat(val).toFixed(formatStr.length - dotIdx - 1);
                let digStr = formatStr.substr(dotIdx + 1, formatStr.length - dotIdx);
                for (let sIdx = digStr.length - 1; sIdx >= 0; sIdx--) {
                    if (digStr[sIdx] === '#') {
                        if (tmpStr.length > 0 && tmpStr[tmpStr.length - 1] === '0') {
                            tmpStr = tmpStr.substr(0, tmpStr.length - 1);
                        }
                        else {
                            break;
                        }
                    }
                    else {
                        break;
                    }
                }
                if (tmpStr[tmpStr.length - 1] === '.')
                    tmpStr = tmpStr.substr(0, tmpStr.length - 1);
                rst = tmpStr;
            }
            else {
                rst = parseFloat(val).toFixed(0);
            }
            let commaIdx = formatStr.indexOf(",");
            if (commaIdx >= 0) {
                rst = comdify$1(val.toString());
            }
        }
    }
    return rst;
};
const setupDateFormat = () => {
    // 原本是直接向Date赋值的，但是现在ts不允许这么做，因此定义一个继承了Date的类使用
    const newReportDate = new ReportDate();
    Object.assign(Date, newReportDate);
};

var stringUtil = /*#__PURE__*/Object.freeze({
    __proto__: null,
    isEmptyString: isEmptyString,
    trim: trim,
    leftTrim: leftTrim,
    rightTrim: rightTrim,
    replaceAll: replaceAll$1,
    comdify: comdify$1,
    convertToCaptionNum: convertToCaptionNum,
    convertStrToBoolean: convertStrToBoolean,
    formatNumber: formatNumber,
    getPinYinFullChars: getPinYinFullChars,
    getPinYinCamelChars: getPinYinCamelChars,
    setupDateFormat: setupDateFormat
});

//数据类型
exports.IDataObjProps = void 0;
(function (IDataObjProps) {
    IDataObjProps["detail_data"] = "detail_data";
    IDataObjProps["detail_data_ex"] = "detail_data_ex";
    IDataObjProps["discrete_data"] = "discrete_data";
    IDataObjProps["master_data"] = "master_data";
    IDataObjProps["master_data_ex"] = "master_data_ex";
    IDataObjProps["NA"] = "NA";
})(exports.IDataObjProps || (exports.IDataObjProps = {}));
exports.IEventType = void 0;
(function (IEventType) {
    IEventType["GRP_ON_CREATE"] = "GRP_ON_CREATE";
    IEventType["FLOW_CONTENT_ON_CREATE"] = "FLOW_CONTENT_ON_CREATE";
})(exports.IEventType || (exports.IEventType = {}));
//操作的步骤
exports.IRunType = void 0;
(function (IRunType) {
    IRunType["beforeAnalyzing"] = "before_analyzing";
    IRunType["beforePaging"] = "before_paging";
    IRunType["beforeOutput"] = "before_output";
    IRunType["beforeCombine"] = "before_combine";
    IRunType["afterCombine"] = "after_combine";
})(exports.IRunType || (exports.IRunType = {}));
exports.IPagingOption = void 0;
(function (IPagingOption) {
    IPagingOption["normal"] = "normal";
    IPagingOption["infinity"] = "infinity";
})(exports.IPagingOption || (exports.IPagingOption = {}));
exports.IControlProps = void 0;
(function (IControlProps) {
    IControlProps[IControlProps["Shrink"] = 0] = "Shrink";
    IControlProps[IControlProps["ShowZero"] = 1] = "ShowZero";
    IControlProps[IControlProps["Horizon"] = 2] = "Horizon";
    IControlProps[IControlProps["Vertical"] = 3] = "Vertical";
    IControlProps[IControlProps["Wrap"] = 4] = "Wrap";
    IControlProps[IControlProps["VerticalForExcel"] = 5] = "VerticalForExcel";
    IControlProps[IControlProps["ShrinkFirst"] = 6] = "ShrinkFirst";
    IControlProps[IControlProps["CloseOutput"] = 7] = "CloseOutput";
})(exports.IControlProps || (exports.IControlProps = {}));
exports.IFontProps = void 0;
(function (IFontProps) {
    IFontProps[IFontProps["Name"] = 0] = "Name";
    IFontProps[IFontProps["FontHeight"] = 1] = "FontHeight";
    IFontProps[IFontProps["FontColor"] = 2] = "FontColor";
    IFontProps[IFontProps["FontBold"] = 3] = "FontBold";
    IFontProps[IFontProps["FontItalic"] = 4] = "FontItalic";
    IFontProps[IFontProps["FontUnderline"] = 5] = "FontUnderline";
    IFontProps[IFontProps["FontStrikeOut"] = 6] = "FontStrikeOut";
    IFontProps[IFontProps["FontAngle"] = 7] = "FontAngle";
})(exports.IFontProps || (exports.IFontProps = {}));
exports.IPositionProps = void 0;
(function (IPositionProps) {
    IPositionProps["Top"] = "Top";
    IPositionProps["Bottom"] = "Bottom";
    IPositionProps["Left"] = "Left";
    IPositionProps["Right"] = "Right";
})(exports.IPositionProps || (exports.IPositionProps = {}));
exports.IPositionIdx = void 0;
(function (IPositionIdx) {
    IPositionIdx[IPositionIdx["Left"] = 0] = "Left";
    IPositionIdx[IPositionIdx["Top"] = 1] = "Top";
    IPositionIdx[IPositionIdx["Right"] = 2] = "Right";
    IPositionIdx[IPositionIdx["Bottom"] = 3] = "Bottom";
})(exports.IPositionIdx || (exports.IPositionIdx = {}));
//常量，上下左右的顺序，对应于逻辑代码中某些数组的顺序
const IDX_LEFT = 0;
const IDX_TOP = 1;
const IDX_RIGHT = 2;
const IDX_BOTTOM = 3;
//输出的偏移量
exports.IOutputOffset = void 0;
(function (IOutputOffset) {
    IOutputOffset[IOutputOffset["LEFT"] = 2] = "LEFT";
    IOutputOffset[IOutputOffset["TOP"] = 2] = "TOP";
    IOutputOffset[IOutputOffset["RIGHT"] = 1] = "RIGHT";
    IOutputOffset[IOutputOffset["BOTTOM"] = 3] = "BOTTOM";
})(exports.IOutputOffset || (exports.IOutputOffset = {}));
//垂直角度
const VERTICAL_ANGLE = '90';
const ANTI_VERTICAL_ANGLE = '-90';
const VERTICAL_ANGLE_INT = 90;
const ANTI_VERTICAL_ANGLE_INT = -90;
exports.FONT_PROPS = void 0;
(function (FONT_PROPS) {
    FONT_PROPS["NAME"] = "Name";
    FONT_PROPS["FONT_HEIGHT"] = "FontHeight";
    FONT_PROPS["FONT_COLOR"] = "FontColor";
    FONT_PROPS["FONT_BOLD"] = "FontBold";
    FONT_PROPS["FONT_ITALIC"] = "FontItalic";
    FONT_PROPS["FONT_UNDERLINE"] = "FontUnderline";
    FONT_PROPS["FONT_STRIKEOUT"] = "FontStrikeOut";
    FONT_PROPS["FONT_ANGLE"] = "FontAngle";
})(exports.FONT_PROPS || (exports.FONT_PROPS = {}));
exports.CONTROL_PROPS = void 0;
(function (CONTROL_PROPS) {
    CONTROL_PROPS["SHRINK"] = "Shrink";
    CONTROL_PROPS["SHOWZERO"] = "ShowZero";
    CONTROL_PROPS["HORIZON"] = "Horizon";
    CONTROL_PROPS["VERTICAL"] = "Vertical";
    CONTROL_PROPS["WRAP"] = "Wrap";
    CONTROL_PROPS["VERTIVAL_FOR_EXCEL"] = "VerticalForExcel";
    CONTROL_PROPS["SHRIK_FIRST"] = "ShrinkFirst";
    CONTROL_PROPS["CLOSE_OUTPUT"] = "CloseOutput";
})(exports.CONTROL_PROPS || (exports.CONTROL_PROPS = {}));
const PROP_FONT = 'font';
exports.PAGES_SIZE_STR = void 0;
(function (PAGES_SIZE_STR) {
    PAGES_SIZE_STR["A3"] = "A3";
    PAGES_SIZE_STR["A4"] = "A4";
    PAGES_SIZE_STR["A5"] = "A5";
    PAGES_SIZE_STR["B5"] = "B5";
    PAGES_SIZE_STR["LETTER"] = "LETTER";
    PAGES_SIZE_STR["LEGAL"] = "LEGAL";
    PAGES_SIZE_STR["EXECUTIVE"] = "EXECUTIVE";
    PAGES_SIZE_STR["16K"] = "16K";
})(exports.PAGES_SIZE_STR || (exports.PAGES_SIZE_STR = {}));
exports.PAGES_SIZE = void 0;
(function (PAGES_SIZE) {
    PAGES_SIZE[PAGES_SIZE["A3"] = 8] = "A3";
    PAGES_SIZE[PAGES_SIZE["A4"] = 9] = "A4";
    PAGES_SIZE[PAGES_SIZE["A5"] = 11] = "A5";
    PAGES_SIZE[PAGES_SIZE["B5"] = 13] = "B5";
    PAGES_SIZE[PAGES_SIZE["LETTER"] = 1] = "LETTER";
    PAGES_SIZE[PAGES_SIZE["LEGAL"] = 5] = "LEGAL";
    PAGES_SIZE[PAGES_SIZE["EXECUTIVE"] = 7] = "EXECUTIVE";
    PAGES_SIZE[PAGES_SIZE["16K"] = 93] = "16K";
})(exports.PAGES_SIZE || (exports.PAGES_SIZE = {}));

/**
 * Created by Tony on 2016/12/28.
 */
const JE = {
    $STR_UTIL: stringUtil,
    $SC_MATH_UTIL: scMathUtil__namespace,
    //获取把数据中fields的相关对象，并准备赋值到该对象中的某个属性
    F: (fID, $CURRENT_RPT) => {
        let rst = null;
        if ($CURRENT_RPT && ($CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.从数据指标_集合[JV.PROP_ID + "_" + fID];
        }
        else if ($CURRENT_RPT && ($CURRENT_RPT.fields.主数据指标_集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.主数据指标_集合[JV.PROP_ID + "_" + fID];
        }
        else if ($CURRENT_RPT && ($CURRENT_RPT.fields.主数据指标_拓展集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.主数据指标_拓展集合[JV.PROP_ID + "_" + fID];
        }
        else if ($CURRENT_RPT && ($CURRENT_RPT.fields.从数据指标_拓展集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.从数据指标_拓展集合[JV.PROP_ID + "_" + fID];
        }
        else if ($CURRENT_RPT && ($CURRENT_RPT.fields.离散指标_集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.离散指标_集合[JV.PROP_ID + "_" + fID];
        }
        else if ($CURRENT_RPT && ($CURRENT_RPT.fields.无映射离散指标_集合[JV.PROP_ID + "_" + fID])) {
            rst = $CURRENT_RPT.fields.无映射离散指标_集合[JV.PROP_ID + "_" + fID];
        }
        else {
            //该方法返回对象可能会导致jpc_flow_tab.ts 的130行 报错, ,by lish
            rst = null;
            // rst = {msg: "the Field-ID is not valid, no result could be found!"};
        }
        return rst;
    },
    //获取把数据中params的相关对象，并准备赋值到该对象中的某个属性
    P: (pID, $CURRENT_RPT) => {
        let rst = null;
        if ($CURRENT_RPT && ($CURRENT_RPT.params[JV.PROP_ID + "_" + pID])) {
            rst = $CURRENT_RPT.params["ID_" + pID];
        }
        // rst = {msg: "the Param-ID is not valid, no result was found!"}; by lish
        return rst;
    },
    getCurrentPage: function ($CURRENT_RPT) {
        let rst = 0;
        if ($CURRENT_RPT && $CURRENT_RPT.runTimePageData.currentPage) {
            rst = $CURRENT_RPT.runTimePageData.currentPage;
        }
        return rst;
    },
    getTotalPage: function ($CURRENT_RPT) {
        let rst = 0;
        if ($CURRENT_RPT) {
            rst = $CURRENT_RPT.totalPages;
        }
        return rst;
    },
    getFieldDataLen: function (field, dataObj) {
        let rst = 0;
        if (field.DataNodeName === 'NA') {
            if (!field.data_field) {
                field.data_field = [];
            }
            rst = field.data_field.length;
        }
        else {
            if (!field.DataNodeName) {
                // 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([]);
            }
            rst = dataObj[field.DataNodeName][field.DataSeq].length;
        }
        return rst;
    },
    //向目标对象赋值
    setFieldValue: function (field, dataObj, valIdx, newValue) {
        if (field.DataNodeName === "NA") {
            if (!field.data_field) {
                field.data_field = [];
            }
            field.data_field[valIdx] = newValue;
        }
        else if (!field.DataNodeName) {
            //that means this is a self-defined discrete field!
            field.DataNodeName = exports.IDataObjProps.discrete_data;
            field.DataSeq = dataObj[exports.IDataObjProps.discrete_data].length;
            dataObj[exports.IDataObjProps.discrete_data].push([]);
            dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
        }
        else {
            dataObj[field.DataNodeName][field.DataSeq][valIdx] = newValue;
        }
    },
    getFieldValue: function (field, dataObj, valIdx, newVal) {
        let rst = null;
        if (field.DataNodeName === "NA") {
            if (!field.data_field) {
                field.data_field = [];
            }
            if (field.data_field.length > valIdx) {
                rst = field.data_field[valIdx];
            }
            else {
                if (newVal === null && field.data_field.length > 0) {
                    rst = field.data_field[field.data_field.length - 1];
                }
            }
        }
        else {
            if (!field.DataNodeName) {
                //that means this is a self-defined discrete field!
                field.DataNodeName = exports.IDataObjProps.discrete_data;
                field.DataSeq = dataObj[exports.IDataObjProps.discrete_data];
                dataObj[exports.IDataObjProps.discrete_data].push([]);
            }
            if (dataObj[field.DataNodeName][field.DataSeq].length > valIdx) {
                rst = dataObj[field.DataNodeName][field.DataSeq][valIdx];
            }
            else {
                if (newVal === null && dataObj[field.DataNodeName][field.DataSeq].length > 0) {
                    rst = dataObj[field.DataNodeName][field.DataSeq][dataObj[field.DataNodeName][field.DataSeq].length - 1];
                }
            }
        }
        if (rst === null || rst === undefined)
            rst = newVal;
        return rst;
    },
    getFieldValueArray: function (field, dataObj) {
        let rst = null;
        if (field.DataNodeName === 'NA') {
            if (!field.data_field) {
                field.data_field = [];
            }
            rst = field.data_field;
        }
        else {
            if (!field.DataNodeName) {
                // 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([]);
            }
            rst = dataObj[field.DataNodeName][field.DataSeq];
        }
        if (rst === null || rst === undefined)
            rst = [];
        return rst;
    },
    setFieldValueArray: function (field, dataObj, newArr) {
        if (newArr instanceof Array) {
            if (field.DataNodeName === 'NA') {
                field.data_field = newArr;
            }
            else {
                if (!field.DataNodeName) {
                    // that means this is a self-defined discrete field!
                    field.DataNodeName = JV.DATA_DISCRETE_DATA;
                    field.DataSeq = dataObj[JV.DATA_DISCRETE_DATA].length;
                    dataObj[JV.DATA_DISCRETE_DATA].push([]);
                }
                dataObj[field.DataNodeName][field.DataSeq] = newArr;
            }
        }
    },
    removeFieldValue: function (field, dataObj, valIdx) {
        if (field.DataNodeName === "NA") {
            if (field.data_field.length > valIdx && valIdx >= 0) {
                field.data_field.splice(valIdx, 1);
            }
        }
        else {
            if (dataObj[field.DataNodeName][field.DataSeq].length > valIdx && valIdx >= 0) {
                dataObj[field.DataNodeName][field.DataSeq].splice(valIdx, 1);
            }
        }
    },
    insertFieldValue: function (field, dataObj, valIdx, newValue) {
        if (field.DataNodeName === "NA") {
            if (!field.data_field)
                field.data_field = [];
            if (field.data_field.length > valIdx && valIdx >= 0) {
                field.data_field.splice(valIdx, 0, newValue);
            }
            else if (field.data_field.length <= valIdx) {
                field.data_field[field.data_field.length] = newValue;
            }
        }
        else {
            if (dataObj[field.DataNodeName][field.DataSeq].length > valIdx && valIdx >= 0) {
                dataObj[field.DataNodeName][field.DataSeq].splice(valIdx, 0, newValue);
            }
            else if (dataObj[field.DataNodeName][field.DataSeq].length <= valIdx) {
                dataObj[field.DataNodeName][field.DataSeq][dataObj[field.DataNodeName][field.DataSeq].length] = newValue;
            }
        }
    },
    alignFieldDecimal: function (sourceID, destID, $CURRENT_RPT) {
        // 把source指标的精度align到dest
        const me = JE;
        let sourceField = null;
        if (isNaN(sourceID)) {
            sourceField = sourceID;
        }
        else {
            sourceField = me.F(sourceID, $CURRENT_RPT);
        }
        let destField;
        if (isNaN(destID)) {
            destField = destID;
        }
        else {
            destField = me.F(destID, $CURRENT_RPT);
        }
        if (sourceField instanceof Object && sourceField && sourceField.Precision) {
            destField.Precision = sourceField.Precision;
            destField.fixedPrecisionNum = sourceField.fixedPrecisionNum;
        }
    },
    batchIniFields: function (IDArr, $CURRENT_RPT) {
        // 批处理查找指标
        const me = JE;
        for (let idxF = 0; idxF < IDArr.length; idxF++) {
            IDArr[idxF] = me.F(IDArr[idxF], $CURRENT_RPT);
        }
    }
};

let JpcFieldHelper = {
    getValue: function (dataField, valueIdx) {
        let rst = '';
        if (dataField && (dataField.length > valueIdx) && (valueIdx >= 0)) {
            rst = dataField[valueIdx];
        }
        return `${rst}`;
    },
    setValue: function (dataField, valueIdx, newValue) {
        if (dataField && (dataField.length > valueIdx) && (valueIdx >= 0)) {
            dataField[valueIdx] = newValue;
        }
    },
    resetSumFormat: function (ref_tab_fields, sum_tab_field) {
        let rst = false;
        if (ref_tab_fields && ref_tab_fields.length > 0) {
            for (let tab_field of ref_tab_fields) {
                if (tab_field[JV.PROP_FIELD_ID] === sum_tab_field[JV.PROP_FIELD_ID]) {
                    rst = true;
                    if (tab_field.Format) {
                        sum_tab_field.Format = tab_field.Format;
                    }
                    break;
                }
            }
        }
        return rst;
    },
    resetFormat: function (tab_field, map_field, customizeCfg) {
        let rst = false;
        if (map_field && map_field.Precision && map_field.Precision.type === "fixed") {
            let formatStrs = ["#"], ffStr = (customizeCfg && customizeCfg.fillZero) ? "0" : "#";
            for (let idx = 0; idx < parseInt(map_field[JV.PROP_FIXED_PRECISION_AMT]); idx++) {
                if (idx === 0) {
                    formatStrs.push(".");
                }
                formatStrs.push(ffStr);
            }
            if (tab_field.Format && tab_field.Format.indexOf(",") >= 0) {
                tab_field.Format = "," + formatStrs.join("");
            }
            else {
                tab_field.Format = formatStrs.join("");
            }
            map_field.Format = tab_field.Format; //这里顺手把format也赋给map_field,后期统计用得着
            rst = true;
        }
        else if (map_field && tab_field.Format && tab_field.Format.indexOf("#") >= 0 && (customizeCfg && customizeCfg.fillZero)) {
            tab_field.Format = replaceAll$1(tab_field.Format, '#', '0');
            map_field.Format = tab_field.Format;
            rst = true;
        }
        return rst;
    },
    resetFlexibleFormat: function (tab_field, ref_field_data, flexiblePrecisionRefObj, valueIdx, customizeCfg) {
        let precisionAmt = 2;
        if (ref_field_data && flexiblePrecisionRefObj && valueIdx >= 0) {
            precisionAmt = flexiblePrecisionRefObj["refUnit_" + ref_field_data[valueIdx]];
            if (precisionAmt === null || precisionAmt === undefined)
                precisionAmt = flexiblePrecisionRefObj["refUnit_其他未列单位"];
        }
        let formatStrs = ["#."], ffStr = (customizeCfg && customizeCfg.fillZero) ? "0" : "#";
        for (let idx = 0; idx < precisionAmt; idx++) {
            formatStrs.push(ffStr);
        }
        if (tab_field.Format && tab_field.Format.indexOf(",") >= 0) {
            tab_field.Format = "," + formatStrs.join("");
        }
        else {
            tab_field.Format = formatStrs.join("");
        }
    },
    decorateValue: function (cell, controls) {
        if (controls) {
            const showZero = controls[cell.control].ShowZero;
            if (showZero && showZero === 'F') {
                const val = parseFloat(cell.Value);
                if (val === 0) {
                    let chkRst = true;
                    if (typeof cell.Value === 'string' && cell.Value.length > 1) {
                        for (let idx = 0; idx < cell.Value.length; idx++) {
                            if (cell.Value[idx] !== '0' && cell.Value[idx] !== '.') {
                                chkRst = false;
                                break;
                            }
                        }
                    }
                    if (chkRst)
                        cell.Value = '';
                }
            }
        }
    },
    findAndPutDataFieldIdx: (rptTpl, tab_fields, rstFields, rstFieldsIdx, isEx) => {
        //通过FieldID找到相关映射指标的位置IDX并记录下来，方便后续引用
        if (tab_fields) {
            let DTL_STR = isEx ? '从数据指标_拓展集合' : '从数据指标_集合';
            let detail_fields = rptTpl.指标_数据_映射[DTL_STR];
            for (let i = 0; i < tab_fields.length; i++) {
                let isFounded = false;
                for (let j = 0; j < detail_fields.length; j++) {
                    if (tab_fields[i].FieldID === detail_fields[j].ID) {
                        isFounded = true;
                        if (rstFields)
                            rstFields.push(tab_fields[i]);
                        if (rstFieldsIdx)
                            rstFieldsIdx.push(j);
                        break;
                    }
                }
                if (!isFounded) {
                    if (rstFields)
                        rstFields.push(tab_fields[i]);
                    if (rstFieldsIdx) {
                        if (rptTpl.无映射离散指标_集合 && rptTpl.无映射离散指标_集合.length > 0) {
                            for (let discretField of rptTpl.无映射离散指标_集合) {
                                if (discretField.ID === tab_fields[i].FieldID) {
                                    rstFieldsIdx.push(discretField);
                                    isFounded = true;
                                    break;
                                }
                            }
                        }
                        else {
                            rstFieldsIdx.push(JV.BLANK_FIELD_INDEX);
                        }
                    }
                }
            }
        }
    },
    findAutoHeightFieldIdx: function (rptTpl, tab_fields, rstFieldsIdx, isEx) {
        if (tab_fields) {
            let DTL_STR = isEx ? JV.NODE_DETAIL_FIELDS_EX : JV.NODE_DETAIL_FIELDS;
            let detail_fields = rptTpl.指标_数据_映射[DTL_STR];
            for (let i = 0; i < tab_fields.length; i++) {
                if (tab_fields[i].isAutoHeight) {
                    for (let j = 0; j < detail_fields.length; j++) {
                        if (tab_fields[i]["FieldID"] === detail_fields[j]["ID"]) {
                            let item = [];
                            item[0] = j;
                            item[1] = tab_fields[i];
                            rstFieldsIdx.push(item);
                            break;
                        }
                    }
                }
            }
            if (!isEx) {
                let dis_detail_fields = rptTpl.无映射离散指标_集合;
                for (let i = 0; i < tab_fields.length; i++) {
                    if (tab_fields[i].isAutoHeight) {
                        for (let j = 0; j < dis_detail_fields.length; j++) {
                            if (tab_fields[i]["FieldID"] === dis_detail_fields[j]["ID"]) {
                                let item = [];
                                item[0] = JV.BLANK_FIELD_INDEX;
                                item[1] = tab_fields[i];
                                rstFieldsIdx.push(item);
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
};

let JpcFlowTabHelper = {
    getRowHeight: function (bands, rptTpl, isEx) {
        let rst = 0;
        (!isEx) ? JV.NODE_FLOW_INFO : JV.NODE_FLOW_INFO_EX;
        let tab = rptTpl.流水式表_信息.流水式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            let maxFieldMeasure = 1.0;
            if (JV.CAL_TYPE_ABSTRACT === JpcCommonHelper.getPosCalculationType(tab.CalculationType)) {
                let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
                maxFieldMeasure = 1.0 * rptTpl.流水式表_信息.流水式表_数据.CommonHeight * unitFactor;
            }
            else {
                maxFieldMeasure = (band.Bottom - band.Top) * rptTpl.流水式表_信息.流水式表_数据.CommonHeight / JV.HUNDRED_PERCENT;
            }
            rst = maxFieldMeasure;
        }
        return rst;
    },
    getMaxRowsPerPage: function (bands, rptTpl, isEx) {
        let rst = 1;
        let tab;
        (!isEx) ? tab = rptTpl.流水式表_信息.流水式表_数据 : tab = rptTpl.流水式表_拓展信息.流水式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            let maxFieldMeasure = 1.0;
            if (JV.CAL_TYPE_ABSTRACT === JpcCommonHelper.getPosCalculationType(tab.CalculationType)) {
                let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
                maxFieldMeasure = 1.0 * tab.CommonHeight * unitFactor;
            }
            else {
                maxFieldMeasure = (band.Bottom - band.Top) * tab.CommonHeight / JV.HUNDRED_PERCENT;
            }
            rst = Math.floor((band.Bottom - band.Top) / maxFieldMeasure);
        }
        return rst;
    },
    getActualContentAreaHeight: function (bands, rptTpl, segments, rowAmt, page, isEx) {
        let rst = 1;
        let tab;
        (!isEx) ? tab = rptTpl.流水式表_信息.流水式表_数据 : tab = rptTpl.流水式表_拓展信息.流水式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            let maxFieldMeasure = 1.0;
            if (JV.CAL_TYPE_ABSTRACT === JpcCommonHelper.getPosCalculationType(tab.CalculationType)) {
                let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
                maxFieldMeasure = 1.0 * tab.CommonHeight * unitFactor;
            }
            else {
                maxFieldMeasure = (band.Bottom - band.Top) * tab.CommonHeight / JV.HUNDRED_PERCENT;
            }
            if (segments.length >= page) {
                rst = rowAmt * maxFieldMeasure;
            }
        }
        return rst;
    },
    chkSegEnd: function (bands, rptTpl, segmentLength, preRec, pageRecAmt, isEx) {
        let me = this, rst = false;
        let remainAmt = preRec + pageRecAmt - segmentLength;
        rst = me.hasEnoughSpace(rptTpl, bands, remainAmt, isEx);
        return rst;
    },
    hasEnoughSpace: function (rptTpl, bands, remainAmt, isEx) {
        if (remainAmt < 0)
            return false;
        let rst = true, measurement = 1.0, douDiffForCompare = 0.00001;
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        let tab;
        (!isEx) ? tab = rptTpl.流水式表_信息.流水式表_数据 : tab = rptTpl.流水式表_拓展信息.流水式表_数据;
        let band = bands[tab.BandName];
        if (band !== null && band !== undefined) {
            measurement = 1.0 * tab.CommonHeight * unitFactor;
            let spareHeight = measurement * remainAmt;
            let douH = band.Bottom - band.Top;
            rst = ((spareHeight >= douH) || ((spareHeight - douH) <= douDiffForCompare));
        }
        return rst;
    }
};

const OFFSET_FLOAT = 0.0000000001;
let JpcCommonOutputHelper = {
    createCommonOutputWithoutDecorate: function (node, value, forceCombine) {
        let me = this, 
        //1. font/style/control
        rst = {
            font: node.font,
            control: node.control,
            style: node.style,
            Value: value
        };
        //2. value
        me.formatCell(node.Format, rst);
        // innerFormat(node.Format, rst);
        if (node.Prefix && rst.Value !== null) {
            rst.Value = node.Prefix + rst.Value;
        }
        else if (node.Prefix && forceCombine) {
            rst.Value = node.Prefix;
        }
        if (node.Suffix && rst.Value !== null) {
            rst.Value = rst.Value + node.Suffix;
        }
        else if (node.Suffix && forceCombine) {
            rst.Value = node.Suffix;
        }
        return rst;
    },
    createCommonOutput: function (node, value, controls) {
        let me = this, 
        //1. font/style/control
        rst = {
            font: node.font,
            control: node.control,
            style: node.style,
            Value: value
        };
        //2. value
        JpcFieldHelper.decorateValue(rst, controls);
        me.formatCell(node.Format, rst);
        // innerFormat(node.Format, rst);
        if (node.Prefix && rst.Value !== null && rst.Value !== '') {
            rst.Value = node.Prefix + rst.Value;
        }
        if (node.Suffix && rst.Value !== null && rst.Value !== '') {
            rst.Value = rst.Value + node.Suffix;
        }
        return rst;
    },
    formatCell: function (formatStr, rstCell) {
        if (formatStr) {
            const rstCellFloatVal = parseFloat(rstCell.Value);
            if (!(isNaN(rstCellFloatVal))) {
                const dotIdx = formatStr.indexOf('.');
                if (dotIdx >= 0) {
                    let tmpStr = (rstCellFloatVal + OFFSET_FLOAT).toFixed(formatStr.length - dotIdx - 1);
                    const digStr = formatStr.substr(dotIdx + 1, formatStr.length - dotIdx);
                    for (let sIdx = digStr.length - 1; sIdx >= 0; sIdx--) {
                        if (digStr[sIdx] === '#') {
                            if (tmpStr.length > 0 && tmpStr[tmpStr.length - 1] === '0') {
                                tmpStr = tmpStr.substr(0, tmpStr.length - 1);
                            }
                            else {
                                break;
                            }
                        }
                        else {
                            break;
                        }
                    }
                    if (tmpStr[tmpStr.length - 1] === '.')
                        tmpStr = tmpStr.substr(0, tmpStr.length - 1);
                    rstCell.Value = tmpStr;
                }
                else {
                    rstCell.Value = (rstCellFloatVal + OFFSET_FLOAT).toFixed(0);
                }
                const commaIdx = formatStr.indexOf(',');
                if (commaIdx >= 0) {
                    rstCell.Value = comdify(rstCell.Value.toString());
                }
            }
        }
    }
};
function comdify(numStr) {
    let re = /\d{1,3}(?=(\d{3})+$)/g;
    return numStr.replace(/^(\d+)((\.\d+)?)$/, function (s, s1, s2) { return s1.replace(re, '$&,') + s2; });
}

const JpcAreaHelper = {
    outputArea: function (areaNode, band, unitFactor, rowAmount, rowIdx, colAmount, colIdx, multipleDispCol, multipleColIdx, syncHeight, syncWidth) {
        let rst = {
            Left: 0,
            Right: 0,
            Top: 0,
            Bottom: 0,
        }, maxMultiColumns = 3;
        if (multipleDispCol > 0 && multipleDispCol <= maxMultiColumns) {
            //1. calculate left/right
            let areaWidth = 1.0 * (band.Right - band.Left) / multipleDispCol;
            areaWidth = areaWidth / colAmount;
            let innerLeft = 0.0, innerRight = areaWidth;
            //
            if (typeof areaNode.H_CalculationType === "string") {
                switch (areaNode.H_CalculationType) {
                    case JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]:
                        innerLeft = (1.0 * areaNode.Left * areaWidth / JV.HUNDRED_PERCENT);
                        innerRight = (1.0 * areaNode.Right * areaWidth / JV.HUNDRED_PERCENT);
                        break;
                    case JV.CAL_TYPE[JV.CAL_TYPE_ABSTRACT]:
                        innerLeft = 1.0 * areaNode.Left * unitFactor;
                        innerRight = 1.0 * areaNode.Right * unitFactor;
                        break;
                }
            }
            else {
                //颗粒度更加细化的控制，可能左右两边的计算坐标方式都不同
                if (areaNode.H_CalculationType && areaNode.H_CalculationType.Left === JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]) {
                    innerLeft = (1.0 * areaNode.Left * areaWidth / JV.HUNDRED_PERCENT);
                }
                else {
                    innerLeft = 1.0 * areaNode.Left * unitFactor;
                }
                if (areaNode.H_CalculationType && areaNode.H_CalculationType.Right === JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]) {
                    innerRight = (1.0 * areaNode.Right * areaWidth / JV.HUNDRED_PERCENT);
                }
                else {
                    innerRight = 1.0 * areaNode.Right * unitFactor;
                }
            }
            //2. calculate top/bottom
            let areaHeight = 1.0 * (band.Bottom - band.Top);
            areaHeight = areaHeight / rowAmount;
            let innerTop = 0.0, innerBottom = areaHeight;
            if (typeof areaNode.V_CalculationType === "string") {
                switch (areaNode.V_CalculationType) {
                    case JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]:
                        innerTop = (1.0 * areaNode.Top * areaHeight / JV.HUNDRED_PERCENT);
                        innerBottom = (1.0 * areaNode.Bottom * areaHeight / JV.HUNDRED_PERCENT);
                        break;
                    case JV.CAL_TYPE[JV.CAL_TYPE_ABSTRACT]:
                        innerTop = 1.0 * areaNode.Top * unitFactor;
                        innerBottom = 1.0 * areaNode.Bottom * unitFactor;
                        break;
                }
            }
            else {
                //颗粒度更加细化的控制，可能上下两边的计算坐标方式都不同
                if (areaNode.V_CalculationType && areaNode.V_CalculationType.Top === JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]) {
                    innerTop = (1.0 * areaNode.Top * areaHeight / JV.HUNDRED_PERCENT);
                }
                else {
                    innerTop = 1.0 * areaNode.Top * unitFactor;
                }
                if (areaNode.V_CalculationType && areaNode.V_CalculationType.Bottom === JV.CAL_TYPE[JV.CAL_TYPE_PERCENTAGE]) {
                    innerBottom = (1.0 * areaNode.Bottom * areaHeight / JV.HUNDRED_PERCENT);
                }
                else {
                    innerBottom = 1.0 * areaNode.Bottom * unitFactor;
                }
            }
            //
            let rstLeft = 0.0, rstRight = 0.0, rstTop = 0.0, rstBottom = 0.0;
            if (syncHeight) {
                rstBottom = Math.round(1.0 * band.Top + areaHeight * (rowIdx + 1) + innerTop);
            }
            else {
                rstBottom = Math.round(1.0 * band.Top + areaHeight * rowIdx + innerBottom);
            }
            if (syncWidth) {
                rstRight = Math.round(1.0 * band.Left + areaWidth * (colIdx + 1) + innerLeft + multipleColIdx * areaWidth);
            }
            else {
                rstRight = Math.round(1.0 * band.Left + areaWidth * colIdx + innerRight + multipleColIdx * areaWidth);
            }
            rstLeft = Math.round(1.0 * band.Left + areaWidth * colIdx + innerLeft + multipleColIdx * areaWidth);
            rstTop = Math.round(1.0 * band.Top + areaHeight * rowIdx + innerTop);
            rst.Left = rstLeft;
            rst.Right = rstRight;
            rst.Top = rstTop;
            rst.Bottom = rstBottom;
        }
        return rst;
    }
};

let JpcTextHelper = {
    //暂定
    outputText: function (textNode, band, unitFactor, rows, rowIdx, cols, colIdx, multiCols, multiColIdx) {
        let rst = JpcCommonOutputHelper.createCommonOutput(textNode, textNode.Label, null);
        //position
        rst.area = JpcAreaHelper.outputArea(textNode.area, band, unitFactor, rows, rowIdx, cols, colIdx, multiCols, multiColIdx, false, false);
        return rst;
    },
    outputDirectValue: function (textNode, value, band, unitFactor, rows, rowIdx, cols, colIdx, multiCols, multiColIdx) {
        let rst = JpcCommonOutputHelper.createCommonOutput(textNode, value, null);
        //position
        rst.area = JpcAreaHelper.outputArea(textNode.area, band, unitFactor, rows, rowIdx, cols, colIdx, multiCols, multiColIdx, false, false);
        return rst;
    }
};

const JpcDiscreteHelper = {
    outputDiscreteInfo: function (discreteArray, bands, dataObj, unitFactor, pageStatus, segIdx, multiCols, multiColIdx, $CURRENT_RPT, customizeCfg) {
        let rst = [];
        if (discreteArray && dataObj) {
            for (let i = 0; i < discreteArray.length; i++) {
                let band = bands[discreteArray[i].BandName];
                if (band && pageStatus[(band.DisplayType)] === true) {
                    if (discreteArray[i].text) {
                        rst.push(JpcTextHelper.outputText(discreteArray[i].text, band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx));
                    }
                    if (discreteArray[i].text_s) {
                        for (let j = 0; j < discreteArray[i].text_s.length; j++) {
                            rst.push(JpcTextHelper.outputText(discreteArray[i].text_s[j], band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx));
                        }
                    }
                    if (discreteArray[i].discrete_field_s) {
                        let flexiblePrecisionRefObj = null, flexibleRefField = null;
                        for (let j = 0; j < discreteArray[i].discrete_field_s.length; j++) {
                            let df = discreteArray[i].discrete_field_s[j];
                            let value = "";
                            if (df.FieldID) {
                                // let map_data_field = JE.F(df[JV.PROP_FIELD_ID], $CURRENT_RPT);
                                let map_data_field = JE.F(df.FieldID, $CURRENT_RPT);
                                if (map_data_field && map_data_field.DataSeq !== JV.BLANK_FIELD_INDEX) {
                                    let data = dataObj[map_data_field.DataNodeName][map_data_field.DataSeq];
                                    if (data && data.length > 0) {
                                        if (data.length > segIdx) {
                                            value = data[segIdx];
                                        }
                                        else {
                                            value = data[0];
                                        }
                                    }
                                }
                                else {
                                    if (map_data_field && map_data_field[JV.PROP_AD_HOC_DATA] && map_data_field[JV.PROP_AD_HOC_DATA].length > 0) {
                                        value = map_data_field[JV.PROP_AD_HOC_DATA][0];
                                    }
                                    else
                                        value = "";
                                }
                                if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
                                    let pre_ref_data = null;
                                    if (flexiblePrecisionRefObj === null) {
                                        flexiblePrecisionRefObj = {};
                                        flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
                                        if (flexibleRefField)
                                            pre_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq]; //这里的引用指标必须得存在，哪怕不显示，也要存放在指标集合中！
                                        for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                            flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                        }
                                    }
                                    JpcFieldHelper.resetFlexibleFormat(df, pre_ref_data, flexiblePrecisionRefObj, segIdx, customizeCfg);
                                }
                                else {
                                    JpcFieldHelper.resetFormat(df, map_data_field, customizeCfg);
                                }
                            }
                            else if (df.ParamID) {
                                let param = JE.P(df.ParamID, $CURRENT_RPT);
                                if (param && param.Default_Value)
                                    value = param.Default_Value;
                            }
                            let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, true);
                            //position
                            item.area = JpcAreaHelper.outputArea(df.area, band, unitFactor, 1, 0, 1, 0, multiCols, multiColIdx, false, false);
                            rst.push(item);
                        }
                    }
                }
            }
        }
        return rst;
    },
    outputPreviewDiscreteInfo: function (discreteArray, bands, unitFactor, pageStatus) {
        let rst = [];
        for (let i = 0; i < discreteArray.length; i++) {
            let band = bands[discreteArray[i].BandName];
            if (band && pageStatus[(band.DisplayType)]) {
                if (discreteArray[i].text) {
                    rst.push(JpcTextHelper.outputText(discreteArray[i].text, band, unitFactor, 1, 0, 1, 0, 1, 0));
                }
                if (discreteArray[i].text_s) {
                    for (let j = 0; j < discreteArray[i].text_s.length; j++) {
                        rst.push(JpcTextHelper.outputText(discreteArray[i].text_s[j], band, unitFactor, 1, 0, 1, 0, 1, 0));
                    }
                }
                if (discreteArray[i].discrete_field_s) {
                    for (let j = 0; j < discreteArray[i].discrete_field_s.length; j++) {
                        let df = discreteArray[i].discrete_field_s[j];
                        let value = "";
                        if (df.Default_Value) {
                            value = df.Default_Value;
                        }
                        let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, false);
                        //position
                        item.area = JpcAreaHelper.outputArea(df.area, band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                        rst.push(item);
                    }
                }
            }
        }
        return rst;
    },
    outputPreviewSumInfoOutput: function (band, unitFactor, tab) {
        let rst = [];
        if (tab.text) {
            rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, 1, 0, 1, 0));
        }
        if (tab.text_s) {
            for (let j = 0; j < tab.text_s.length; j++) {
                rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, 1, 0, 1, 0));
            }
        }
        if (tab.sum_field_s) {
            for (let i = 0; i < tab.sum_field_s.length; i++) {
                let tab_field = tab.sum_field_s[i];
                if (!(tab_field.Hidden)) {
                    // rst.push(me.outputTabField(band, tab_field, null, -1, -1, 1, 0, 1, 0, unitFactor, true, controls, 0));
                    let value = "";
                    let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(tab_field, value, false);
                    //position
                    item.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                    rst.push(item);
                }
            }
        }
        return rst;
    }
};

/**
 * Created by Tony on 2019/12/12.
 */
const fontWidthMap = {
    '宋体': {
        '宽': {
            '_6': 6,
            '_7': 7,
            '_8': 8,
            '_9': 9,
            '_10': 10,
            '_11': 11,
            '_12': 12,
            '_13': 13,
            '_14': 14,
            '_15': 15,
            '_16': 16,
            '_17': 17,
            '_18': 18,
            '_19': 19,
            '_20': 20,
            '_21': 21,
            '_22': 22,
            '_23': 23,
            '_24': 24,
            '_25': 25,
            '_26': 26,
            '_27': 27,
            '_28': 28,
            '_29': 29,
            '_30': 30,
            '_31': 31,
            '_32': 32,
            '_33': 33,
            '_34': 34,
            '_35': 35,
            '_36': 36,
            '_37': 37,
            '_38': 38,
            '_39': 39,
            '_40': 40,
            '_41': 41,
            '_42': 42,
            '_43': 43,
            '_44': 44,
            '_45': 45,
            '_46': 46,
            '_47': 47,
            '_48': 48,
            '_49': 49,
            '_50': 50,
            '_51': 51,
            '_52': 52,
            '_53': 53,
            '_54': 54,
            '_55': 55,
            '_56': 56,
            '_57': 57,
            '_58': 58,
            '_59': 59,
            '_60': 60,
            '_61': 61,
            '_62': 62,
            '_63': 63,
            '_64': 64
        },
        '窄': {
            '_6': 3,
            '_7': 3.5,
            '_8': 4,
            '_9': 4.5,
            '_10': 5,
            '_11': 5.5,
            '_12': 6,
            '_13': 6.5,
            '_14': 7,
            '_15': 7.5,
            '_16': 8,
            '_17': 8.5,
            '_18': 9,
            '_19': 9.5,
            '_20': 10,
            '_21': 10.5,
            '_22': 11,
            '_23': 11.5,
            '_24': 12,
            '_25': 12.5,
            '_26': 13,
            '_27': 13.5,
            '_28': 14,
            '_29': 14.5,
            '_30': 15,
            '_31': 15.5,
            '_32': 16,
            '_33': 16.5,
            '_34': 17,
            '_35': 17.5,
            '_36': 18,
            '_37': 18.5,
            '_38': 19,
            '_39': 19.5,
            '_40': 20,
            '_41': 20.5,
            '_42': 21,
            '_43': 21.5,
            '_44': 22,
            '_45': 22.5,
            '_46': 23,
            '_47': 23.5,
            '_48': 24,
            '_49': 24.5,
            '_50': 25,
            '_51': 25.5,
            '_52': 26,
            '_53': 26.5,
            '_54': 27,
            '_55': 27.5,
            '_56': 28,
            '_57': 28.5,
            '_58': 29,
            '_59': 29.5,
            '_60': 30,
            '_61': 30.5,
            '_62': 31,
            '_63': 31.5,
            '_64': 32
        }
    },
    '黑体': {
        '宽': {
            '_6': 6,
            '_7': 7,
            '_8': 8,
            '_9': 9,
            '_10': 10,
            '_11': 11,
            '_12': 12,
            '_13': 13,
            '_14': 14,
            '_15': 15,
            '_16': 16,
            '_17': 17,
            '_18': 18,
            '_19': 19,
            '_20': 20,
            '_21': 21,
            '_22': 22,
            '_23': 23,
            '_24': 24,
            '_25': 25,
            '_26': 26,
            '_27': 27,
            '_28': 28,
            '_29': 29,
            '_30': 30,
            '_31': 31,
            '_32': 32,
            '_33': 33,
            '_34': 34,
            '_35': 35,
            '_36': 36,
            '_37': 37,
            '_38': 38,
            '_39': 39,
            '_40': 40,
            '_41': 41,
            '_42': 42,
            '_43': 43,
            '_44': 44,
            '_45': 45,
            '_46': 46,
            '_47': 47,
            '_48': 48,
            '_49': 49,
            '_50': 50,
            '_51': 51,
            '_52': 52,
            '_53': 53,
            '_54': 54,
            '_55': 55,
            '_56': 56,
            '_57': 57,
            '_58': 58,
            '_59': 59,
            '_60': 60,
            '_61': 61,
            '_62': 62,
            '_63': 63,
            '_64': 64
        },
        '窄': {
            '_6': 3,
            '_7': 3.5,
            '_8': 4,
            '_9': 4.5,
            '_10': 5,
            '_11': 5.5,
            '_12': 6,
            '_13': 6.5,
            '_14': 7,
            '_15': 7.5,
            '_16': 8,
            '_17': 8.5,
            '_18': 9,
            '_19': 9.5,
            '_20': 10,
            '_21': 10.5,
            '_22': 11,
            '_23': 11.5,
            '_24': 12,
            '_25': 12.5,
            '_26': 13,
            '_27': 13.5,
            '_28': 14,
            '_29': 14.5,
            '_30': 15,
            '_31': 15.5,
            '_32': 16,
            '_33': 16.5,
            '_34': 17,
            '_35': 17.5,
            '_36': 18,
            '_37': 18.5,
            '_38': 19,
            '_39': 19.5,
            '_40': 20,
            '_41': 20.5,
            '_42': 21,
            '_43': 21.5,
            '_44': 22,
            '_45': 22.5,
            '_46': 23,
            '_47': 23.5,
            '_48': 24,
            '_49': 24.5,
            '_50': 25,
            '_51': 25.5,
            '_52': 26,
            '_53': 26.5,
            '_54': 27,
            '_55': 27.5,
            '_56': 28,
            '_57': 28.5,
            '_58': 29,
            '_59': 29.5,
            '_60': 30,
            '_61': 30.5,
            '_62': 31,
            '_63': 31.5,
            '_64': 32
        }
    },
    '楷体': {
        '宽': {
            '_6': 6,
            '_7': 7,
            '_8': 8,
            '_9': 9,
            '_10': 10,
            '_11': 11,
            '_12': 12,
            '_13': 13,
            '_14': 14,
            '_15': 15,
            '_16': 16,
            '_17': 17,
            '_18': 18,
            '_19': 19,
            '_20': 20,
            '_21': 21,
            '_22': 22,
            '_23': 23,
            '_24': 24,
            '_25': 25,
            '_26': 26,
            '_27': 27,
            '_28': 28,
            '_29': 29,
            '_30': 30,
            '_31': 31,
            '_32': 32,
            '_33': 33,
            '_34': 34,
            '_35': 35,
            '_36': 36,
            '_37': 37,
            '_38': 38,
            '_39': 39,
            '_40': 40,
            '_41': 41,
            '_42': 42,
            '_43': 43,
            '_44': 44,
            '_45': 45,
            '_46': 46,
            '_47': 47,
            '_48': 48,
            '_49': 49,
            '_50': 50,
            '_51': 51,
            '_52': 52,
            '_53': 53,
            '_54': 54,
            '_55': 55,
            '_56': 56,
            '_57': 57,
            '_58': 58,
            '_59': 59,
            '_60': 60,
            '_61': 61,
            '_62': 62,
            '_63': 63,
            '_64': 64
        },
        '窄': {
            '_6': 3,
            '_7': 3.5,
            '_8': 4,
            '_9': 4.5,
            '_10': 5,
            '_11': 5.5,
            '_12': 6,
            '_13': 6.5,
            '_14': 7,
            '_15': 7.5,
            '_16': 8,
            '_17': 8.5,
            '_18': 9,
            '_19': 9.5,
            '_20': 10,
            '_21': 10.5,
            '_22': 11,
            '_23': 11.5,
            '_24': 12,
            '_25': 12.5,
            '_26': 13,
            '_27': 13.5,
            '_28': 14,
            '_29': 14.5,
            '_30': 15,
            '_31': 15.5,
            '_32': 16,
            '_33': 16.5,
            '_34': 17,
            '_35': 17.5,
            '_36': 18,
            '_37': 18.5,
            '_38': 19,
            '_39': 19.5,
            '_40': 20,
            '_41': 20.5,
            '_42': 21,
            '_43': 21.5,
            '_44': 22,
            '_45': 22.5,
            '_46': 23,
            '_47': 23.5,
            '_48': 24,
            '_49': 24.5,
            '_50': 25,
            '_51': 25.5,
            '_52': 26,
            '_53': 26.5,
            '_54': 27,
            '_55': 27.5,
            '_56': 28,
            '_57': 28.5,
            '_58': 29,
            '_59': 29.5,
            '_60': 30,
            '_61': 30.5,
            '_62': 31,
            '_63': 31.5,
            '_64': 32
        }
    },
    'Arial': {
        '宽': {
            '_6': 6,
            '_7': 7,
            '_8': 8,
            '_9': 9,
            '_10': 10,
            '_11': 11,
            '_12': 12,
            '_13': 13,
            '_14': 14,
            '_15': 15,
            '_16': 16,
            '_17': 17,
            '_18': 18,
            '_19': 19,
            '_20': 20,
            '_21': 21,
            '_22': 22,
            '_23': 23,
            '_24': 24,
            '_25': 25,
            '_26': 26,
            '_27': 27,
            '_28': 28,
            '_29': 29,
            '_30': 30,
            '_31': 31,
            '_32': 32,
            '_33': 33,
            '_34': 34,
            '_35': 35,
            '_36': 36,
            '_37': 37,
            '_38': 38,
            '_39': 39,
            '_40': 40,
            '_41': 41,
            '_42': 42,
            '_43': 43,
            '_44': 44,
            '_45': 45,
            '_46': 46,
            '_47': 47,
            '_48': 48,
            '_49': 49,
            '_50': 50,
            '_51': 51,
            '_52': 52,
            '_53': 53,
            '_54': 54,
            '_55': 55,
            '_56': 56,
            '_57': 57,
            '_58': 58,
            '_59': 59,
            '_60': 60,
            '_61': 61,
            '_62': 62,
            '_63': 63,
            '_64': 64
        },
        '窄': {
            '_6': 3.3399999141693115,
            '_7': 3.8899998664855957,
            '_8': 4.449999809265137,
            '_9': 5.009999752044678,
            '_10': 5.559999942779541,
            '_11': 6.119999885559082,
            '_12': 6.670000076293945,
            '_13': 7.230000019073486,
            '_14': 7.789999961853027,
            '_15': 8.34000015258789,
            '_16': 8.899999618530273,
            '_17': 9.449999809265136,
            '_18': 10.010000228881836,
            '_19': 10.569999694824218,
            '_20': 11.119999885559082,
            '_21': 11.679999351501464,
            '_22': 12.239999771118164,
            '_23': 12.789999961853027,
            '_24': 13.34999942779541,
            '_25': 13.899999618530273,
            '_26': 14.460000038146972,
            '_27': 15.019999504089355,
            '_28': 15.569999694824218,
            '_29': 16.1299991607666,
            '_30': 16.68000030517578,
            '_31': 17.239999771118164,
            '_32': 17.799999237060547,
            '_33': 18.350000381469726,
            '_34': 18.90999984741211,
            '_35': 19.469999313354492,
            '_36': 20.020000457763672,
            '_37': 20.579999923706054,
            '_38': 21.1299991607666,
            '_39': 21.689998626708984,
            '_40': 22.25,
            '_41': 22.799999237060547,
            '_42': 23.35999870300293,
            '_43': 23.90999984741211,
            '_44': 24.469999313354492,
            '_45': 25.029998779296875,
            '_46': 25.579999923706054,
            '_47': 26.139999389648437,
            '_48': 26.69999885559082,
            '_49': 27.25,
            '_50': 27.809999465942383,
            '_51': 28.35999870300293,
            '_52': 28.920000076293945,
            '_53': 29.479999542236328,
            '_54': 30.029998779296875,
            '_55': 30.59000015258789,
            '_56': 31.139999389648437,
            '_57': 31.69999885559082,
            '_58': 32.2599983215332,
            '_59': 32.80999755859375,
            '_60': 33.369998931884766,
            '_61': 33.93000030517578,
            '_62': 34.47999954223633,
            '_63': 35.040000915527344,
            '_64': 35.59000015258789
        }
    },
    getFontWidth: function (fontName, fontHeight, typeStr) {
        let rst = 12;
        if (fontWidthMap[fontName]) {
            rst = fontWidthMap[fontName][typeStr]['_' + fontHeight];
        }
        else {
            rst = fontWidthMap['宋体'][typeStr]['_' + fontHeight];
        }
        return rst;
    }
};

let FData = {};
let PData = {};
let DData = {};
let rpt = {};
let orgData = {};
const setupData = ($CURRENT_RPT, $CURRENT_DATA) => {
    rpt = $CURRENT_RPT;
    orgData = $CURRENT_DATA;
};
const resetData = () => {
    DData = {};
    FData = {};
    PData = {};
};
const getFieldValueArray = (field) => {
    let rst;
    if (field.DataNodeName === exports.IDataObjProps.NA) {
        if (!field.data_field) {
            field.data_field = [];
        }
        rst = field.data_field;
    }
    else {
        if (!field.DataNodeName) {
            console.log('进来了特殊情况');
            // that means this is a self-defined discrete field!
            field.DataNodeName = exports.IDataObjProps.discrete_data;
            // field.DataSeq = dataObj[IDataObjProps.discrete_data];
            orgData[exports.IDataObjProps.discrete_data].push([]);
        }
        rst = orgData[field.DataNodeName][field.DataSeq];
    }
    if (rst === null || rst === undefined)
        rst = [];
    return rst;
};
//获取一般指标的指标对象($CURRENT_RPT.fields中的对象)
const F = (fieldID) => {
    if (FData[fieldID]) {
        return FData[fieldID];
    }
    else {
        for (const dataSet in rpt.fields) {
            for (const field in rpt.fields[dataSet]) {
                const newFieldID = field.replace('ID_', '');
                if (newFieldID === `${fieldID}`) {
                    FData[fieldID] = rpt.fields[dataSet][field];
                    DData[fieldID] = getFieldValueArray(rpt.fields[dataSet][field]);
                    return FData[fieldID];
                }
            }
        }
    }
    return false;
};
// 获取离散指标的指标对象($CURRENT_RPT.params中的对象,一般是打印页，总页数，当前页数)
const P = (fieldID) => {
    if (PData[fieldID]) {
        return PData[fieldID];
    }
    else {
        for (const field in rpt.params) {
            const fieldID = field.replace('ID_', '');
            if (fieldID === fieldID) {
                PData[fieldID] = rpt.params[field];
                DData[fieldID] = rpt.params[field].Default_Value;
                return rpt.params[field];
            }
        }
    }
    return false;
};
// 获取数据，只有一个参数时获取该指标所有数据（数组），两个参数时获取该指标中的第N个数据（值）
const D = (fieldID, valIndex, newValue) => {
    if (valIndex || valIndex === 0) {
        if (DData[fieldID]) {
            return DData[fieldID][valIndex];
        }
        else {
            if (!F(fieldID))
                P(fieldID);
            if (DData[fieldID]) {
                if (DData[fieldID].length >= valIndex) {
                    if (!DData[fieldID][valIndex] && DData[fieldID][valIndex] !== 0)
                        return '';
                    return DData[fieldID][valIndex];
                }
                else {
                    console.log(`指标id:${fieldID},${valIndex}>${DData[fieldID].length}，请检查`);
                    return '';
                }
            }
            else {
                console.log(`无ID为${fieldID}的指标，请检查`);
                return '';
            }
        }
    }
    else {
        if (DData[fieldID]) {
            return DData[fieldID];
        }
        else {
            if (!F(fieldID))
                P(fieldID);
            if (DData[fieldID]) {
                return DData[fieldID];
            }
            else {
                console.log(`无ID为${fieldID}的指标，请检查`);
                return [];
            }
        }
    }
};
//获取相应指标的数据长度
const L = (arg) => {
    if (arg in exports.IDataObjProps) {
        return orgData[arg][0].length;
    }
    else {
        if (DData[arg]) {
            return DData[arg].length;
        }
        else {
            F(arg);
            if (DData[arg]) {
                return DData[arg];
            }
            else {
                console.log(`无ID为${arg}的指标，请检查`);
                return 0;
            }
        }
    }
};
//获取当前页
const getCurrentPage = () => {
    let rst = 0;
    if (rpt && rpt.runTimePageData.currentPage) {
        rst = rpt.runTimePageData.currentPage;
    }
    return rst;
};
// 获取总页数
const getTotalPage = () => {
    let rst = 0;
    if (rpt) {
        rst = rpt.totalPages;
    }
    return rst;
};
//向目标对象赋值
const setFieldValue = (field, valIdx, newValue) => {
    if (field.DataNodeName === "NA") {
        if (!field.data_field) {
            field.data_field = [];
        }
        field.data_field[valIdx] = newValue;
    }
    else if (!field.DataNodeName) {
        //that means this is a self-defined discrete field!
        field.DataNodeName = exports.IDataObjProps.discrete_data;
        field.DataSeq = orgData[exports.IDataObjProps.discrete_data].length;
        orgData[exports.IDataObjProps.discrete_data].push([]);
        orgData[field.DataNodeName][field.DataSeq][valIdx] = newValue;
    }
    else {
        orgData[field.DataNodeName][field.DataSeq][valIdx] = newValue;
    }
};
//反向设置原始数据
const setFieldValueArray = (field, newArr) => {
    if (newArr instanceof Array) {
        if (field.DataNodeName === 'NA') {
            field.data_field = newArr;
        }
        else {
            if (!field.DataNodeName) {
                // that means this is a self-defined discrete field!
                field.DataNodeName = exports.IDataObjProps.discrete_data;
                field.DataSeq = orgData[exports.IDataObjProps.discrete_data].length;
                orgData[exports.IDataObjProps.discrete_data].push([]);
            }
            orgData[field.DataNodeName][field.DataSeq] = newArr;
        }
    }
};
//反向设置原始数据
const setFieldDefaultValue = (fieldID, newValue) => {
    rpt.params[`ID_${fieldID}`].Default_Value = newValue;
};
//该函数为共用方法，参数有两套组合：
// (指标id,更改后的数组)
// (指标id,需要更改的index,.需要更改的值)
const setData = (fieldID, arg1, arg2) => {
    const field = F(fieldID);
    if (field) {
        if (arg1 instanceof Array) {
            if (DData[fieldID]) {
                DData[fieldID] = arg1;
                setFieldValueArray(field, arg1);
            }
            else {
                console.log(`无ID为${fieldID}的指标，请检查`);
            }
        }
        else {
            if (typeof (arg1) === 'number') {
                if (DData[fieldID]) {
                    if (arg1 <= DData[fieldID].length) {
                        DData[fieldID][arg1] = arg2;
                        setFieldValue(field, arg1, arg2);
                    }
                    else {
                        console.log(`指标id:${fieldID},数据长度为${DData[fieldID].length},第二参数为${arg1}，请检查`);
                    }
                }
                else {
                    console.log(`无ID为${fieldID}的指标，请检查`);
                }
            }
        }
    }
    else if (P(fieldID)) {
        setFieldDefaultValue(fieldID, arg1);
        DData[fieldID] = arg1;
    }
};
//把数组每个元素都转换成数字
const getNumberArray = (data) => {
    const rst = [];
    for (const item of data) {
        if (isNaN(Number(item))) {
            rst.push(0);
        }
        else {
            rst.push(Number(item));
        }
    }
    return rst;
};
const removeFieldValue = (fieldID, valIdx) => {
    const fField = F(fieldID);
    if (fField) {
        DData[fieldID].splice(valIdx, 1);
    }
    else {
        console.log(`指标${fieldID}的数据不支持removeFieldValue操作`);
    }
};
const insertFieldValue = (fieldID, valIdx, newValue) => {
    let field = F(fieldID);
    if (field) {
        DData[fieldID].splice(valIdx, 0, newValue);
    }
    else {
        console.log(`指标${fieldID}的数据不支持insertFieldValue操作`);
    }
};
//复制精度
const copyPrecision = (targetFieldID, orgFieldID) => {
    copyProperty(targetFieldID, orgFieldID, 'Precision');
};
const copyFixedPrecisionNum = (targetFieldID, orgFieldID) => {
    copyProperty(targetFieldID, orgFieldID, 'fixedPrecisionNum');
};
//复制属性
const copyProperty = (targetFieldID, orgFieldID, property) => {
    const targetField = F(targetFieldID);
    const orgField = F(orgFieldID);
    if (targetField && orgField) {
        if (orgField[property]) {
            if (!targetField[property]) {
                targetField[property] = {};
            }
            Object.assign(targetField[property], orgField[property]);
        }
        else {
            console.log(`指标${orgFieldID}不存在${property}属性`);
        }
    }
    else {
        console.log(`指标${targetFieldID}和${orgFieldID}的数据不支持copyProperty操作`);
    }
};
const setDate = (fieldID, format) => {
    const date = new ReportDate();
    setData(fieldID, date.Format(format));
};
const DLength = () => {
    if (orgData && orgData.detail_data)
        return orgData.detail_data[0].length;
    return 0;
};
var formulasDataSetter = {
    setupData,
    P,
    F,
    D,
    getCurrentPage,
    getTotalPage,
    L,
    setFieldValue,
    setFieldValueArray,
    removeFieldValue,
    insertFieldValue,
    setData,
    resetData,
    getNumberArray,
    copyPrecision,
    copyFixedPrecisionNum,
    copyProperty,
    setDate,
    DLength
};

// 计算式执行（不同情况的方法会不同）
/* eslint-disable import/prefer-default-export */
const replaceAll = (FindText, RepText, str) => {
    const regExp = new RegExp(FindText, 'g');
    return str.replace(regExp, RepText);
};
const formulaExec = (runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT) => {
    formulasDataSetter.setupData($CURRENT_RPT, $CURRENT_DATA);
    const { P, F, D, L, getCurrentPage, getTotalPage, setFieldValue, setFieldValueArray, removeFieldValue, insertFieldValue, setData, getNumberArray, copyPrecision, copyFixedPrecisionNum, copyProperty, setDate, DLength } = formulasDataSetter;
    const { isEmptyString, trim, leftTrim, rightTrim, comdify, convertToCaptionNum, convertStrToBoolean, formatNumber, } = stringUtil;
    const $JV = JV;
    const $JE = JE;
    const reportDate = ReportDate;
    for (let execFmlIdx = 0; execFmlIdx < $CURRENT_RPT.formulas.length; execFmlIdx++) {
        if ($CURRENT_RPT.formulas[execFmlIdx].run_type === runType) {
            let expression = $CURRENT_RPT.formulas[execFmlIdx].expression;
            if (expression) {
                // 计算式集合，目前是放置打印信息的，用于配置属性的计算
                let $ME = $CURRENT_RPT.formulas[execFmlIdx];
                try {
                    let newExpression = expression;
                    const { format } = $ME;
                    // console.log(expression);
                    //临时处理
                    if (expression.indexOf(`new Date(`)) {
                        newExpression = replaceAll(/new Date\(/g, `new reportDate(`, expression);
                    }
                    eval(newExpression);
                }
                catch (ex) {
                    console.log(ex);
                }
            }
        }
    }
    formulasDataSetter.resetData();
    return {
        $JE,
        $JV,
        P,
        F,
        D,
        L,
        getCurrentPage,
        getTotalPage,
        setFieldValue,
        setFieldValueArray,
        removeFieldValue,
        insertFieldValue,
        setData,
        getNumberArray,
        copyPrecision,
        copyFixedPrecisionNum,
        copyProperty,
        setDate,
        DLength,
        isEmptyString,
        trim,
        leftTrim,
        rightTrim,
        comdify,
        convertToCaptionNum,
        convertStrToBoolean,
        formatNumber,
        reportDate
    };
};
const combinedGridFormula = ($RUN_TYPE, $TEXT, $TIMES, $CURRENT_RPT) => {
    const { $JE, $JV, P, F, D, L, getCurrentPage, getTotalPage, setFieldValue, setFieldValueArray, removeFieldValue, insertFieldValue, setData, getNumberArray, copyPrecision, copyFixedPrecisionNum, copyProperty, setDate, DLength, isEmptyString, trim, leftTrim, rightTrim, comdify, convertToCaptionNum, convertStrToBoolean, formatNumber, reportDate } = $CURRENT_RPT.formulasObject;
    if ($CURRENT_RPT.formulas) {
        for (let execFmlIdx = 0; execFmlIdx < $CURRENT_RPT.formulas.length; execFmlIdx++) {
            if ($CURRENT_RPT.formulas[execFmlIdx].run_type === $RUN_TYPE) {
                let expression = $CURRENT_RPT.formulas[execFmlIdx].expression;
                if (expression) {
                    $CURRENT_RPT.formulas[execFmlIdx];
                    try {
                        eval(expression);
                    }
                    catch (ex) {
                        console.log(ex);
                    }
                }
            }
        }
    }
    formulasDataSetter.resetData();
    return {
        $JE,
        $JV,
        P,
        F,
        D,
        L,
        getCurrentPage,
        getTotalPage,
        setFieldValue,
        setFieldValueArray,
        removeFieldValue,
        insertFieldValue,
        setData,
        getNumberArray,
        copyPrecision,
        copyFixedPrecisionNum,
        copyProperty,
        setDate,
        DLength,
        isEmptyString,
        trim,
        leftTrim,
        rightTrim,
        comdify,
        convertToCaptionNum,
        convertStrToBoolean,
        formatNumber,
        reportDate
    };
};

class JpcFlowTabClass {
    isEx;
    paging_option;
    segments;
    dispValueIdxLst;
    page_seg_map;
    disp_fields_idx;
    disp_fields_ex_idx;
    seg_sum_fields_idx;
    seg_sum_tab_fields;
    page_sum_fields_idx;
    page_sum_tab_fields;
    auto_height_fields_idx; //那些被标记为判断自动行高的指标集合
    auto_height_info;
    group_check_fields;
    group_sum_fields;
    group_sum_values;
    group_node_info; //记录在哪个seg及到哪条记录后有group sum信息
    group_lines_amt; //每group一次占用多少行，计算page信息会用到
    pageStatusLst;
    groupSumValLst;
    segSumValLst;
    pageSumValLst;
    multiCols;
    pagesAmt;
    constructor(isEx) {
        //初始化
        this.isEx = isEx;
        this.paging_option = JV.PAGING_OPTION_NORMAL;
        this.segments = [];
        this.dispValueIdxLst = [];
        this.page_seg_map = [];
        this.disp_fields_idx = [];
        this.disp_fields_ex_idx = [];
        this.seg_sum_fields_idx = [];
        this.seg_sum_tab_fields = [];
        this.page_sum_fields_idx = [];
        this.page_sum_tab_fields = [];
        this.auto_height_fields_idx = []; //那些被标记为判断自动行高的指标集合
        this.auto_height_info = [];
        this.group_check_fields = [];
        this.group_sum_fields = [];
        this.group_sum_values = [];
        // this.group_sum_values = null; 因为在后面初始化时会先把该变量设置为[],所以这里直接修改为[] ,by lish
        this.group_node_info = []; //记录在哪个seg及到哪条记录后有group sum信息
        // this.group_node_info = null; 因为在后面初始化时会先把该变量设置为[],所以这里直接修改为[]  ,by lish
        this.group_lines_amt = 0; //每group一次占用多少行，计算page信息会用到
        this.pageStatusLst = [];
        this.groupSumValLst = [];
        this.segSumValLst = [];
        this.pageSumValLst = [];
        this.multiCols = 1;
        this.pagesAmt = 0;
    }
    ;
    sorting(rptTpl, dataObj, dataSeq, $CURRENT_RPT) {
        let me = this;
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        //因为rptTpl[FLOW_NODE_STR的写法不兼容ts，所以把变量改为flow_node_str代替
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        if (flow_node_str.流水式表_段统计信息)
            JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, flow_node_str.流水式表_段统计信息.sum_field_s, me.seg_sum_tab_fields, me.seg_sum_fields_idx, me.isEx);
        if (flow_node_str.流水式表_页统计信息)
            JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, flow_node_str.流水式表_页统计信息.sum_field_s, me.page_sum_tab_fields, me.page_sum_fields_idx, me.isEx);
        if (flow_node_str.流水式表_分组信息) {
            JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, flow_node_str.流水式表_分组信息.group_field_s, me.group_check_fields, null, me.isEx);
            if (flow_node_str.流水式表_分组信息.group_lines) {
                for (let grpLine of flow_node_str.流水式表_分组信息.group_lines) {
                    if (grpLine.SumKey_S && grpLine.SumKey_S.length > 0) {
                        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, grpLine.SumKey_S, me.group_sum_fields, null, me.isEx);
                    }
                }
            }
            for (let grp_sum_f of me.group_sum_fields) {
                grp_sum_f.SumKey = `grp_sum_key_` + grp_sum_f.FieldID;
            }
        }
        JpcFieldHelper.findAutoHeightFieldIdx(rptTpl, flow_node_str.流水式表_数据.flow_field_s, me.auto_height_fields_idx, me.isEx);
        for (let si = 0; si < dataSeq.length; si++) {
            me.segments.push(dataSeq[si].slice(0));
        }
        //pre-sum the data(for seg sum display)
        //考虑到实际会有离散指标的汇总，这些离散指标数据是通过计算式后得来的，这种情况下，不适宜在sorting阶段进行汇总统计，现挪到preSetupPages阶段处理
    }
    ;
    sumSeg(dataObj, $CURRENT_RPT) {
        let me = this;
        let data_details = me.isEx ? dataObj.detail_data_ex : dataObj.detail_data, data_fields = [];
        for (let i = 0; i < me.seg_sum_fields_idx.length; i++) {
            if (typeof (me.seg_sum_fields_idx[i]) === "object") {
                let exField = JE.F(me.seg_sum_fields_idx[i][JV.PROP_ID], $CURRENT_RPT);
                if (exField) {
                    data_fields.push(exField.data_field);
                }
                else {
                    data_fields.push(null);
                }
            }
            else {
                let data_field = data_details[me.seg_sum_fields_idx[i]];
                data_fields.push(data_field);
            }
        }
        for (let i = 0; i < me.segments.length; i++) { //seg level
            if (me.segments[i].length > 0) {
                let rowGrandTotal = [];
                for (let di = 0; di < data_fields.length; di++) {
                    rowGrandTotal.push(0.0);
                    let precisionAmt = 4;
                    let sum_field = JE.F(me.seg_sum_tab_fields[di][JV.PROP_FIELD_ID], $CURRENT_RPT);
                    if (sum_field && sum_field.Precision && sum_field.Precision.type === `fixed`) {
                        precisionAmt = sum_field.fixedPrecisionNum;
                    }
                    else {
                        let flowF = me.seg_sum_tab_fields[di];
                        if (flowF && !isEmptyString(flowF[JV.PROP_FORMAT])) {
                            let idx = flowF[JV.PROP_FORMAT].indexOf('.');
                            if (idx >= 0) {
                                precisionAmt = flowF[JV.PROP_FORMAT].length - idx - 1;
                            }
                        }
                    }
                    for (let j = 0; j < me.segments[i].length; j++) {
                        //3. start to sum
                        // rowGrandTotal[di] = rowGrandTotal[di] + 1.0 * JpcFieldHelper.getValue(data_fields[di], me.segments[i][j]);
                        let sv = JpcFieldHelper.getValue(data_fields[di], me.segments[i][j]);
                        if (sv) {
                            rowGrandTotal[di] = rowGrandTotal[di] + parseFloat(parseFloat(sv).toFixed(precisionAmt));
                        }
                    }
                }
                me.segSumValLst.push(rowGrandTotal);
            }
        }
    }
    ;
    sumUpGrp(rptTpl, $CURRENT_RPT, dataObj, segIdx, preGrpIdx, nexGrpIdx) {
        let me = this, segDataIdx = me.segments[segIdx];
        for (let j = 0; j < me.group_sum_fields.length; j++) {
            let sum_field = JE.F(me.group_sum_fields[j].FieldID, $CURRENT_RPT);
            if (sum_field) {
                let data_field = null;
                if (sum_field.data_field) {
                    data_field = sum_field.data_field;
                }
                else {
                    data_field = dataObj[sum_field.DataNodeName][sum_field.DataSeq];
                }
                let sumV = 0, precisionAmt = 4;
                for (let si = preGrpIdx; si <= nexGrpIdx; si++) {
                    if (sum_field.Precision && sum_field.Precision.type === `fixed`) {
                        precisionAmt = sum_field.fixedPrecisionNum;
                    }
                    else {
                        let flowF = me.group_sum_fields[j]; //调整后，me.group_sum_fields[j]就是group lines下数组SumKey_S的元素值，无需再找
                        if (flowF && !isEmptyString(flowF.Format)) {
                            let idx = flowF.Format.indexOf('.');
                            if (idx >= 0) {
                                precisionAmt = flowF.Format.length - idx - 1;
                            }
                        }
                    }
                    //sumV += parseFloat(JpcFieldHelper.getValue(data_field, segDataIdx[si]));
                    sumV += parseFloat(parseFloat(JpcFieldHelper.getValue(data_field, segDataIdx[si])).toFixed(precisionAmt));
                }
                // me.group_sum_values[segIdx][j].push(sumV);
                me.group_sum_values[segIdx][me.group_sum_fields[j].SumKey].push(sumV);
            }
        }
        me.group_node_info[segIdx].push(nexGrpIdx);
    }
    ;
    setupGroupingData(rptTpl, dataObj, $CURRENT_RPT) {
        let me = this;
        if (me.group_check_fields.length > 0 && me.group_sum_fields.length > 0) {
            me.group_sum_values = [];
            me.group_node_info = [];
            // let CURRENT_FLOW_INFO = (me.isEx)?'流水式表_拓展信息':'流水式表_信息';
            let current_flow_info = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
            me.group_lines_amt = current_flow_info.流水式表_分组信息.group_lines.length;
            //
            let preGrpIdx = 0, nexGrpIdx = 0;
            for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
                let segDataIdx = me.segments[segIdx];
                // me.group_sum_values.push([]);
                me.group_sum_values.push({});
                me.group_node_info.push([]);
                for (let j = 0; j < me.group_sum_fields.length; j++) {
                    // me.group_sum_values[segIdx].push([]);
                    me.group_sum_values[segIdx][me.group_sum_fields[j].SumKey] = [];
                    // me.group_node_info[segIdx].push([]);
                }
                for (let di = 0; di < segDataIdx.length; di++) {
                    let hasDiff = false;
                    if (di >= 1) {
                        for (let i = 0; i < me.group_check_fields.length; i++) {
                            let grp_field = JE.F(me.group_check_fields[i].FieldID, $CURRENT_RPT);
                            if (grp_field) {
                                let data_field = null;
                                if (grp_field.data_field) {
                                    data_field = grp_field.data_field;
                                }
                                else {
                                    data_field = dataObj[grp_field.DataNodeName][grp_field.DataSeq];
                                }
                                let v1 = JpcFieldHelper.getValue(data_field, segDataIdx[di]), v2 = JpcFieldHelper.getValue(data_field, segDataIdx[di - 1]);
                                if (v1 !== v2) {
                                    hasDiff = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (hasDiff) {
                        //then sum up the fields
                        me.sumUpGrp(rptTpl, $CURRENT_RPT, dataObj, segIdx, preGrpIdx, nexGrpIdx);
                        nexGrpIdx = di;
                        preGrpIdx = di;
                        if (di === segDataIdx.length - 1) {
                            me.sumUpGrp(rptTpl, $CURRENT_RPT, dataObj, segIdx, preGrpIdx, nexGrpIdx);
                        }
                    }
                    else if (di === segDataIdx.length - 1) {
                        me.sumUpGrp(rptTpl, $CURRENT_RPT, dataObj, segIdx, preGrpIdx, di);
                    }
                    else {
                        nexGrpIdx = di;
                    }
                }
            }
        }
    }
    ;
    setupAutoHeightData(bands, segIdx, rptTpl, dataObj, $CURRENT_RPT, defProperties) {
        let me = this;
        if (me.auto_height_fields_idx.length > 0) {
            // let CURRENT_FLOW_INFO = (me.isEx)?'流水式表_拓展信息':'流水式表_信息';
            let current_flow_info = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
            let band = bands[current_flow_info.流水式表_数据.BandName];
            let data_details = me.isEx ? dataObj.detail_data_ex : dataObj.detail_data;
            let tab_fields = current_flow_info.流水式表_数据.flow_field_s;
            let adHocAutoHeightStyleStr = [];
            let reg1 = new RegExp('\n\r', 'g'), reg2 = new RegExp('\r\n', 'g'), reg3 = new RegExp('\n', 'g'), reg4 = new RegExp('\r', 'g');
            // let doc = new PDFKit({autoFirstPage: false});
            let fonts = defProperties.fonts;
            let fontCache = {};
            let private_get_font = function (fontKey) {
                let rst = null;
                if (fontCache[fontKey]) {
                    rst = fontCache[fontKey];
                }
                else {
                    for (let i = 0; i < fonts.length; i++) {
                        if (fonts[i].ID === fontKey) {
                            fontCache[fontKey] = fonts[i];
                            rst = fonts[i];
                            break;
                        }
                    }
                }
                return rst;
            };
            let private_get_max_lines_of_the_record = function (theRecIdx) {
                let rst = 1;
                let maxAmt = 1;
                for (let loop = 0; loop < me.auto_height_fields_idx.length; loop++) {
                    let tab_field = me.auto_height_fields_idx[loop][1];
                    let data_field = null, map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                    if (me.auto_height_fields_idx[loop][0] !== JV.BLANK_FIELD_INDEX && (typeof me.auto_height_fields_idx[loop][0] !== 'object')) {
                        data_field = data_details[me.auto_height_fields_idx[loop][0]];
                    }
                    else {
                        if (map_data_field) {
                            data_field = map_data_field.data_field;
                        }
                    }
                    if (data_field) {
                        let value = JpcFieldHelper.getValue(data_field, theRecIdx);
                        let area = JpcAreaHelper.outputArea(tab_field.area, band, 1, 1, 0, 1, 0, 1, 0, false, false);
                        if (value !== null && value !== undefined) {
                            value = value.replace('\t', '');
                            value = value.replace(reg1, '|').replace(reg2, '|').replace(reg3, '|').replace(reg4, '|');
                        }
                        else {
                            value = '';
                        }
                        JpcFieldHelper.setValue(data_field, theRecIdx, value);
                        let values = value.split('|');
                        // if (values.length > rst) rst = values.length; // 考虑到紧凑输出，不能那么快设置rst
                        let font = private_get_font(tab_field.font);
                        let chkFontName = '宋体';
                        let chkFontHeight = 12;
                        if (font) {
                            chkFontName = font[JV.FONT_PROPS[0]];
                            chkFontHeight = parseFloat(font[JV.FONT_PROPS[JV.FONT_PROP_IDX_HEIGHT]]);
                        }
                        let hasSplitStr = false, splitStrArr = [];
                        let accAmt = 0;
                        // let chnW = doc.widthOfString('一'), otherW = doc.widthOfString('_');
                        let chnW = fontWidthMap.getFontWidth(chkFontName, chkFontHeight, '宽'), otherW = fontWidthMap.getFontWidth(chkFontName, chkFontHeight, '窄');
                        for (let i = 0; i < values.length; i++) {
                            let amt = JpcCommonHelper.getStringLinesInArea(area, values[i], chnW, otherW);
                            accAmt += amt;
                            if (amt > 1) {
                                hasSplitStr = true;
                                splitStrArr.push(i);
                            }
                        }
                        if (accAmt > 3) {
                            // 新优化，计算实际能显示完的真正行数
                            const rowHeight = JpcFlowTabHelper.getRowHeight(bands, rptTpl, me.isEx);
                            let tmpFV = ((chkFontHeight + JV.CLOSE_OUTPUT_ROW_BUFFER) * accAmt) / rowHeight;
                            let tmpAmt = Math.floor(tmpFV);
                            if (Math.ceil(tmpFV) > tmpAmt) {
                                tmpAmt++;
                            }
                            if (maxAmt < tmpAmt)
                                maxAmt = tmpAmt;
                        }
                        else {
                            if (maxAmt < accAmt)
                                maxAmt = accAmt;
                        }
                        if (hasSplitStr) {
                            let newValArr = [];
                            for (let i = 0; i < values.length; i++) {
                                if (splitStrArr.indexOf(i) < 0) {
                                    newValArr.push(values[i]);
                                }
                                else {
                                    newValArr = newValArr.concat(JpcCommonHelper.splitString(area, values[i], chnW, otherW));
                                }
                            }
                            JpcFieldHelper.setValue(data_field, theRecIdx, newValArr.join('|'));
                            splitStrArr = [];
                            newValArr = [];
                        }
                        //备注： 如果outputType是excel类型，那么就只保留原始的分行符，无需介入分行，由excel本身去处理分行，只需要保留足够的空间即可。
                        //      根据最新需求，暂时不考虑excel类型输出,换回原来逻辑
                    }
                }
                if (rst < maxAmt)
                    rst = maxAmt; // 最后才设置最大结果
                return rst;
            };
            for (let tabField of tab_fields) {
                if (adHocAutoHeightStyleStr.indexOf(tabField.style) < 0) {
                    adHocAutoHeightStyleStr.push(tabField.style);
                }
            }
            if (adHocAutoHeightStyleStr.length > 0) {
                if (!(rptTpl.style_collection)) {
                    rptTpl.style_collection = [];
                }
                for (let styleStr of adHocAutoHeightStyleStr) {
                    let adHocStyle1 = { "ID": styleStr + "_AutoHeightMerge_Top" };
                    let adHocStyle2 = { "ID": styleStr + "_AutoHeightMerge_Middle" };
                    let adHocStyle3 = { "ID": styleStr + "_AutoHeightMerge_Bottom" };
                    rptTpl.style_collection.push(adHocStyle1);
                    rptTpl.style_collection.push(adHocStyle2);
                    rptTpl.style_collection.push(adHocStyle3);
                }
            }
            //这里先记录下来每一Segment里的每一条record占用行的数量（普通是1行高度，超过1就表示需要调整行数了）
            let infoArr = [];
            me.auto_height_info.push(infoArr);
            let segArr = me.segments[segIdx];
            for (let i = 0; i < segArr.length; i++) {
                infoArr.push(private_get_max_lines_of_the_record(segArr[i]));
            }
        }
    }
    ;
    preSetupPages(rptTpl, dataObj, defProperties, option, $CURRENT_RPT, followTabEx) {
        //换一种思路来整理流水式数据
        let me = this, rst = 1, counterRowRec = 0, counterRowRecEx = 0, maxRowRec = 1, pageIdx = 0, currentRecAmt = 0;
        me.paging_option = option || JV.PAGING_OPTION_NORMAL;
        let current_flow_info = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, current_flow_info.流水式表_数据.flow_field_s, null, me.disp_fields_idx, me.isEx);
        if (followTabEx) {
            JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.流水式表_拓展信息.流水式表_数据.flow_field_s, null, me.disp_fields_ex_idx, true);
        }
        //根据实际情况，统计前要先根据format整理好小数位数，否则会出现显示的数据的累计与最后统计的结果不一致
        me.setupGroupingData(rptTpl, dataObj, $CURRENT_RPT);
        if (followTabEx) {
            followTabEx.setupGroupingData(rptTpl, dataObj, $CURRENT_RPT);
        }
        me.sumSeg(dataObj, $CURRENT_RPT); //考虑到实际会有离散指标的汇总，这些离散指标数据是通过计算式后得来的，这种情况下，不适宜在sorting阶段进行汇总统计，现统一挪到这里处理
        const bands = JpcBand.createNew(rptTpl, defProperties);
        if (me.paging_option === JV.PAGING_OPTION_INFINITY) {
            rst = me.segments.length;
            const pageStatus = [true, true, false, true, true, true, true, true];
            const grpPageInfo = {};
            let pageIdx = 0;
            for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
                // 备注：有break flow的情况下 连续输出 要考虑段(seg)的多页输出问题
                if (segIdx === me.segments.length - 1) {
                    pageStatus[JV.STATUS_REPORT_END] = true;
                }
                if (segIdx > 0) {
                    pageStatus[JV.STATUS_REPORT_START] = false;
                }
                const grpSeqInfo = (me.group_node_info) ? me.group_node_info[segIdx] : null;
                (grpSeqInfo) ? (grpSeqInfo.length * me.group_lines_amt) : 0;
                grpPageInfo.segGrpRecStartIdx = 0;
                grpPageInfo.insertedGrpRecAmt = 0;
                grpPageInfo.preAddPageGrpInfo = [];
                grpPageInfo.group_lines_amt = me.group_lines_amt;
                JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, !me.isEx, me.isEx);
                maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl, me.isEx);
                me.setupAutoHeightData(bands, segIdx, rptTpl, dataObj, $CURRENT_RPT, defProperties);
                let adHocAutoHeightAmt = 0;
                if (me.auto_height_info.length > 0) {
                    for (let loop = 0; loop < me.auto_height_info[segIdx].length; loop++) {
                        adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
                    }
                }
                me.pageStatusLst.push(pageStatus.slice(0));
                pageIdx++;
                const rowAmt = Math.max(maxRowRec, me.segments[segIdx].length + adHocAutoHeightAmt);
                _addPageValue(me.dispValueIdxLst, me.segments[segIdx], grpSeqInfo, 0, rowAmt, me.page_seg_map, segIdx, pageIdx, grpPageInfo, false, me.auto_height_info, 0);
            }
            //目前不支持flowTabEx
        }
        else {
            let bands = JpcBand.createNew(rptTpl, defProperties);
            let pageStatus = [true, true, false, true, false, false, false, false];
            if (me.isEx) {
                pageStatus[JV.STATUS_REPORT_START] = false;
            }
            if (current_flow_info.多列显示数量) {
                me.multiCols = 1 * current_flow_info.多列显示数量;
            }
            let grpPageInfo = {};
            let prePageLeftAutoHeightRecAmt = 0; //考虑自动行高的跨页情况
            function private_resetBandArea() {
                JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, !me.isEx, me.isEx);
                maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl, me.isEx);
            }
            let handledRowAmt = 0; //handledRowAmt纪录的是真正处理过的显示行数，包含了空白行，主要是为分页用（自动行高）
            let segRestRecAmt = 0; //一般情况下为0，只有在特殊情况下才需要，如09-x表中，正常流水一页显示不了的时候，就有大问题了
            function private_addPage(segIdx, grpSeqInfo, isFollow, isMix, mixSplitPoint) {
                private_resetBandArea();
                me.pageStatusLst.push(pageStatus.slice(0));
                currentRecAmt += maxRowRec; //在自动行高的场景下，currentRecAmt在后面还需要调整
                handledRowAmt += maxRowRec;
                let redundantRecAmt = 0;
                pageIdx++;
                function private_chk_handle_rec_amt(dv, isEx) {
                    if ((dv[1] === JV.DISPLAY_VAL_TYPE_NORMAL) || (dv[1] === JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT && dv[3] === dv[4] - 1)) {
                        if (isEx) {
                            counterRowRecEx++;
                        }
                        else
                            counterRowRec++;
                    }
                    else if (dv[1] === JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT) {
                        redundantRecAmt++;
                    }
                }
                let restRecAmt = 0;
                if (isMix) {
                    //先处理上半部分
                    prePageLeftAutoHeightRecAmt = _addPageValue(me.dispValueIdxLst, me.segments[segIdx], grpSeqInfo, counterRowRec, mixSplitPoint, me.page_seg_map, segIdx, pageIdx, grpPageInfo, false, me.auto_height_info, prePageLeftAutoHeightRecAmt);
                    for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                        private_chk_handle_rec_amt(dv, false);
                    }
                    //再处理下半部分
                    restRecAmt = maxRowRec - me.dispValueIdxLst[me.dispValueIdxLst.length - 1].length; //备注：在一些极端条件下，mixSplitPoint这个分割点不合适处理下半部分数据，以实际生成的value-index数量为准
                    _addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, restRecAmt, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
                    for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                        private_chk_handle_rec_amt(dv, true);
                    }
                    //合并到一页中
                    me.page_seg_map.splice(me.page_seg_map.length - 1, 1);
                    let vl = me.dispValueIdxLst[me.dispValueIdxLst.length - 2];
                    for (let item of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                        vl.push(item);
                    }
                    me.dispValueIdxLst.splice(me.dispValueIdxLst.length - 1, 1);
                }
                else if (isFollow) {
                    prePageLeftAutoHeightRecAmt = _addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
                    for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                        private_chk_handle_rec_amt(dv, true);
                    }
                }
                else {
                    prePageLeftAutoHeightRecAmt = _addPageValue(me.dispValueIdxLst, me.segments[segIdx], grpSeqInfo, counterRowRec, maxRowRec, me.page_seg_map, segIdx, pageIdx, grpPageInfo, false, me.auto_height_info, prePageLeftAutoHeightRecAmt);
                    for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                        private_chk_handle_rec_amt(dv, false);
                    }
                }
                currentRecAmt -= redundantRecAmt; //在自动行高调整场景下，需要减去冗余的数量
                if (restRecAmt < 0) {
                    currentRecAmt -= restRecAmt;
                    segRestRecAmt = restRecAmt;
                }
            }
            for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
                let grpSeqInfo = (me.group_node_info) ? me.group_node_info[segIdx] : null;
                let grpRecAmt = (grpSeqInfo) ? (grpSeqInfo.length * me.group_lines_amt) : 0;
                let grpRecAmtEx = 0;
                let accAutoHeightAmt = 0; //累计的自动行高数量
                handledRowAmt = 0; //初始化每一段的已处理纪录行数
                segRestRecAmt = 0;
                if (followTabEx && followTabEx.group_node_info) {
                    grpRecAmtEx = followTabEx.group_node_info.length * followTabEx.group_lines_amt;
                }
                grpPageInfo.segGrpRecStartIdx = 0;
                grpPageInfo.insertedGrpRecAmt = 0;
                grpPageInfo.preAddPageGrpInfo = [];
                grpPageInfo.group_lines_amt = me.group_lines_amt;
                pageStatus[JV.STATUS_SEGMENT_START] = true;
                private_resetBandArea();
                me.setupAutoHeightData(bands, segIdx, rptTpl, dataObj, $CURRENT_RPT, defProperties);
                let threshold = 0;
                currentRecAmt = 0;
                counterRowRec = 0;
                counterRowRecEx = 0;
                let ttlSegRecAmtNormal = me.segments[segIdx].length + grpRecAmt; //正常的segment下的数据长度累计(含grouping data)
                let ttlSegRecAmt = (followTabEx) ? (me.segments[segIdx].length + grpRecAmt + followTabEx.segments[segIdx].length + grpRecAmtEx) : (me.segments[segIdx].length + grpRecAmt); //所有的segment下的数据长度累计(包括ex部分)
                let adHocAutoHeightAmt = 0;
                let exBuffer = 0;
                let adHocAutoHeightGrpStartIdx = 0;
                if (me.auto_height_fields_idx.length > 0) {
                    for (let loop = 0; loop < me.auto_height_info[segIdx].length; loop++) {
                        adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
                        if (me.group_node_info && me.group_node_info[segIdx]) {
                            if (me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] === loop) {
                                adHocAutoHeightGrpStartIdx++;
                            }
                        }
                    }
                    ttlSegRecAmtNormal += adHocAutoHeightAmt;
                    ttlSegRecAmt += adHocAutoHeightAmt;
                    if (adHocAutoHeightAmt > 0)
                        exBuffer = grpRecAmt;
                }
                //自动行高调整在多流水合并方式时，只支持前部分(后期需要再加)
                while (true) {
                    if (currentRecAmt > 0)
                        pageStatus[JV.STATUS_SEGMENT_START] = false;
                    if (pageIdx > 0)
                        pageStatus[JV.STATUS_REPORT_START] = false;
                    private_resetBandArea(); // 这里得预先算maxRowRec（实际数据情况，会有章首页框，在章数据多的情况下，章第二页开始就得补上章首页框不显示遗留下来的row）
                    //开始判断各种scenarios
                    adHocAutoHeightAmt = 0;
                    if (me.auto_height_fields_idx.length > 0) {
                        adHocAutoHeightAmt -= prePageLeftAutoHeightRecAmt;
                        //for (let loop = currentRecAmt; loop < me.auto_height_info[segIdx].length; loop++) {
                        for (let loop = currentRecAmt; loop < currentRecAmt + maxRowRec; loop++) {
                            if (me.auto_height_info[segIdx].length > loop) {
                                adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
                            }
                            else {
                                break;
                            }
                        }
                    }
                    if ((ttlSegRecAmtNormal < ttlSegRecAmt) || (followTabEx !== null)) {
                        //有流水拓展，并且是follow mode
                        if (currentRecAmt + accAutoHeightAmt + exBuffer + maxRowRec > ttlSegRecAmtNormal) {
                            // if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt + maxRowRec > ttlSegRecAmtNormal) {
                            // if (currentRecAmt + adHocAutoHeightAmt >= ttlSegRecAmtNormal) {
                            if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt >= ttlSegRecAmtNormal) {
                                //纯 followTabEx 数据
                                // if (currentRecAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                    pageStatus[JV.STATUS_SEGMENT_END] = true;
                                    private_resetBandArea();
                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
                                    if (hasAdHocRow) {
                                        //add page info(pre segment end)
                                        pageStatus[JV.STATUS_SEGMENT_END] = false;
                                        private_addPage(segIdx, null, true, false, -1);
                                    }
                                    //add page info
                                    pageStatus[JV.STATUS_SEGMENT_END] = true;
                                    private_addPage(segIdx, null, true, false, -1);
                                }
                                else {
                                    private_addPage(segIdx, null, true, false, -1);
                                }
                            }
                            else {
                                //混合数据
                                // if (currentRecAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt + maxRowRec >= ttlSegRecAmt) {
                                    pageStatus[JV.STATUS_SEGMENT_END] = true;
                                    private_resetBandArea();
                                    let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt, maxRowRec, me.isEx);
                                    if (hasAdHocRow) {
                                        //add page info(pre segment end)
                                        pageStatus[JV.STATUS_SEGMENT_END] = false;
                                        private_addPage(segIdx, grpSeqInfo, false, true, ttlSegRecAmtNormal);
                                    }
                                    //add page info
                                    pageStatus[JV.STATUS_SEGMENT_END] = true;
                                    // if (currentRecAmt + adHocAutoHeightAmt >= ttlSegRecAmtNormal) {
                                    if (currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt >= ttlSegRecAmtNormal) {
                                        //纯 followTabEx 数据啦
                                        private_addPage(segIdx, null, true, false, -1);
                                    }
                                    else {
                                        // private_addPage(segIdx, grpSeqInfo, false, true, ttlSegRecAmtNormal);
                                        //在这里要考虑如果有多页正常的流水数据情况，那么就得考虑这页有多少条普通流水记录，不应该一刀切地用ttlSegRecAmtNormal
                                        let splitPoint = ttlSegRecAmtNormal - handledRowAmt;
                                        private_addPage(segIdx, grpSeqInfo, false, true, splitPoint);
                                    }
                                }
                                else {
                                    //在这里要考虑如果有多页正常的流水数据情况，那么就得考虑这页有多少条普通流水记录，不应该一刀切地用ttlSegRecAmtNormal
                                    let splitPoint = ttlSegRecAmtNormal - handledRowAmt;
                                    // if (splitPoint > (exBuffer + maxRowRec)) {
                                    //     splitPoint = splitPoint % (exBuffer + maxRowRec);
                                    // }
                                    private_addPage(segIdx, grpSeqInfo, false, true, splitPoint);
                                }
                            }
                        }
                        else {
                            //纯followTab数据
                            private_addPage(segIdx, grpSeqInfo, false, false, -1);
                        }
                    }
                    else {
                        //普通流水数据情况
                        if (handledRowAmt + maxRowRec >= ttlSegRecAmt) {
                            //备注： 理论上自动行高是没有上限的，有可能正常一页的数据可以拓展到3页及以上，在此极端情况下，必须做一些限制判断，否则会出现缺页情况。
                            // 2018-08-04 其实之前的判断逻辑完全是自找麻烦，而且还不够正确。其实只需要判断已经处理了多少行纪录(所有的都算，包括空白行)，
                            // 与总的seg纪录数想比较，就很容易得到结果，而且能处理极端边界的情况。
                            pageStatus[JV.STATUS_SEGMENT_END] = true;
                            // pageStatus[JV.STATUS_REPORT_END] = true;
                            pageStatus[JV.STATUS_REPORT_END] = (segIdx === me.segments.length - 1);
                            private_resetBandArea();
                            let hasAdHocRow = ((adHocAutoHeightAmt > maxRowRec) || !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, handledRowAmt, maxRowRec, me.isEx));
                            // !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt, maxRowRec, me.isEx));
                            if (hasAdHocRow) {
                                //add page info(pre segment end)
                                pageStatus[JV.STATUS_SEGMENT_END] = false;
                                pageStatus[JV.STATUS_REPORT_END] = false;
                                private_addPage(segIdx, grpSeqInfo, false, false, -1);
                                pageStatus[JV.STATUS_REPORT_START] = false;
                                pageStatus[JV.STATUS_SEGMENT_START] = false;
                            }
                            //add page info
                            pageStatus[JV.STATUS_SEGMENT_END] = true;
                            pageStatus[JV.STATUS_REPORT_END] = (segIdx === me.segments.length - 1);
                            private_addPage(segIdx, grpSeqInfo, false, false, -1);
                            pageStatus[JV.STATUS_SEGMENT_END] = false; // 加完章统计页后，记得把章尾页设置为false
                        }
                        else {
                            private_addPage(segIdx, grpSeqInfo, false, false, -1);
                        }
                    }
                    //检测是否可退出
                    // if ((currentRecAmt + accAutoHeightAmt + adHocAutoHeightAmt >= ttlSegRecAmt) && (pageIdx % me.multiCols === 0)) {
                    if (handledRowAmt >= (ttlSegRecAmt + segRestRecAmt) && (pageIdx % me.multiCols === 0)) {
                        //备注：这里必须得考虑多栏的情况，否则会造成pageStatus出界的问题
                        break;
                    }
                    accAutoHeightAmt += adHocAutoHeightAmt;
                    //控制阈值，超过阈值则强制退出，防止死循环
                    threshold++;
                    if (threshold > 1000) {
                        console.log("Hey! There may be a dead loop here!!!");
                        break;
                    }
                }
            }
            // console.log(me.auto_height_info);
            // console.log(me.dispValueIdxLst);
            rst = Math.ceil(pageIdx / me.multiCols);
        }
        me.pagesAmt = rst;
        return rst;
    }
    ;
    outputAsPreviewPage(rptTpl, bands, controls, $CURRENT_RPT) {
        let me = this, rst = [], vIdx = [];
        //只预览第一页的数据
        let pageStatus = [true, true, true, true, true, true, true, true];
        me.pageStatusLst.push(pageStatus);
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.流水式表_信息.流水式表_数据.flow_field_s, null, me.disp_fields_idx, false);
        JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
        let maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl, false);
        for (let i = 0; i < maxRowRec; i++) {
            vIdx.push([-1, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
        }
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        // 2.2 Column tab
        rst = rst.concat(me.outputColumn(rptTpl, null, 1, 0, bands, unitFactor, 0, $CURRENT_RPT, null));
        // 2.1 Content-Tab
        rst = rst.concat(me.outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus, maxRowRec));
        // 2.3 Sum Seg
        rst = rst.concat(me.outputPreviewSegSum(rptTpl, bands, unitFactor, controls, pageStatus));
        // 2.4 Sum Page
        rst = rst.concat(me.outputPreviewPageSum(rptTpl, bands, unitFactor, controls, pageStatus));
        // 2.5 Group
        // 2.6 Discrete
        rst = rst.concat(JpcDiscreteHelper.outputPreviewDiscreteInfo(rptTpl.流水式表_信息.离散信息, bands, unitFactor, pageStatus));
        return rst;
    }
    ;
    outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus, maxRec) {
        let me = this, rst = [];
        let tab = rptTpl.流水式表_信息.流水式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            if (pageStatus[(band.DisplayType)]) {
                let tab_fields = tab.flow_field_s;
                for (let rowIdx = 0; rowIdx < maxRec; rowIdx++) {
                    for (let i = 0; i < tab_fields.length; i++) {
                        let tab_field = tab_fields[i];
                        if (!(tab_field.Hidden)) {
                            rst.push(me.outputTabField(band, tab_field, null, -1, -1, maxRec, rowIdx, 1, 0, unitFactor, false, controls, 0));
                        }
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputPreviewSegSum(rptTpl, bands, unitFactor, controls, pageStatus) {
        let rst = [];
        let tab = rptTpl.流水式表_信息.流水式表_段统计信息;
        let band = bands[tab.BandName];
        if (band) {
            if (pageStatus[(band.DisplayType)]) {
                rst = rst.concat(JpcDiscreteHelper.outputPreviewSumInfoOutput(band, unitFactor, tab));
            }
        }
        return rst;
    }
    ;
    outputPreviewPageSum(rptTpl, bands, unitFactor, controls, pageStatus) {
        let rst = [];
        let tab = rptTpl.流水式表_信息.流水式表_页统计信息;
        let band = bands[tab.BandName];
        if (band) {
            if (pageStatus[(band.DisplayType)]) {
                rst = rst.concat(JpcDiscreteHelper.outputPreviewSumInfoOutput(band, unitFactor, tab));
            }
        }
        return rst;
    }
    ;
    outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, adHocMergePos, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], tabRstLst = [];
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        if (me.paging_option === "infinity") {
            const segIdx = page - 1;
            // 1 calculate the band position
            JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], !me.isEx, me.isEx);
            const maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl, me.isEx);
            // 2. then reset the band height
            const tab = rptTpl.流水式表_信息.流水式表_数据;
            const flowContentBand = bands[tab.BandName];
            let adHocAutoHeightAmt = 0;
            if (me.auto_height_info.length > 0) {
                for (let loop = 0; loop < me.auto_height_info[segIdx].length; loop++) {
                    adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
                }
            }
            const rowAmt = Math.max(maxRowRec, me.segments[segIdx].length + adHocAutoHeightAmt); // 如不满一页，则需要填充满一页
            const actH = JpcFlowTabHelper.getActualContentAreaHeight(bands, rptTpl, me.segments, rowAmt, page, me.isEx);
            const offsetY = actH - (flowContentBand.Bottom - flowContentBand.Top);
            JpcBandHelper.resetBandPos(rptTpl.布局框_集合, bands, flowContentBand, 0, offsetY);
            // 2.1 Content-Tab
            tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, 0, $CURRENT_RPT, customizeCfg));
            // 2.2 Column tab
            tabRstLst.push(me.outputColumn(rptTpl, dataObj, page, segIdx, bands, unitFactor, 0, $CURRENT_RPT, customizeCfg));
            // 2.3 Sum Seg
            tabRstLst.push(me.outputSegSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            // 2.4 Sum Page
            tabRstLst.push(me.outputPageSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            // 2.5 Group
            // 2.6 Discrete
            tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(flow_node_str.离散信息, bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, 1, 0, $CURRENT_RPT, customizeCfg));
            // 3. reset merge band position
            if (bands.MergeBand && adHocMergePos) {
                const mergedBand = bands.MergeBand;
                let arr = [];
                arr.push(parseInt(mergedBand.Left.toFixed(0)));
                adHocMergePos.Left = arr;
                arr = [];
                arr.push(parseInt(mergedBand.Right.toFixed(0)));
                adHocMergePos.Right = arr;
                arr = [];
                arr.push(parseInt(mergedBand.Top.toFixed(0)));
                adHocMergePos.Top = arr;
                arr = [];
                arr.push(parseInt((mergedBand.Bottom).toFixed(0)));
                adHocMergePos.Bottom = arr;
            }
        }
        else {
            let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
            //1 calculate the band position
            JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], !me.isEx, me.isEx);
            //2. start to output detail-part
            for (let pi = 0; pi < me.multiCols; pi++) {
                let actualPage = (page - 1) * me.multiCols + pi + 1;
                // 2.1 Content-Tab
                tabRstLst.push(me.outputContent(rptTpl, dataObj, actualPage, bands, unitFactor, controls, pi, $CURRENT_RPT, customizeCfg));
                // 2.2 Column tab
                tabRstLst.push(me.outputColumn(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, pi, $CURRENT_RPT, customizeCfg));
                // 2.3 Sum Seg
                tabRstLst.push(me.outputSegSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
                // 2.4 Sum Page
                tabRstLst.push(me.outputPageSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
                // 2.5 Group
                // 2.6 Discrete
                if (pi === 0) {
                    tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(flow_node_str.离散信息, bands, dataObj, unitFactor, me.pageStatusLst[actualPage - 1], segIdx, 1, pi, $CURRENT_RPT, customizeCfg));
                }
            }
        }
        for (let i = 0; i < tabRstLst.length; i++) {
            rst = rst.concat(tabRstLst[i]);
            tabRstLst[i] = null;
        }
        return rst;
    }
    ;
    outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, multiColIdx, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], prepareObj = {};
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        let tab = flow_node_str.流水式表_数据;
        let tabEx = (rptTpl.流水式表_拓展信息) ? rptTpl.流水式表_拓展信息.流水式表_数据 : null;
        let verticalCombinePos = [], horizonCombinePos = []; //合并特性用
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)]) {
                let tab_fields = tab.flow_field_s;
                let tab_fields_ex = tabEx ? tabEx.flow_field_s : null;
                let data_details = me.isEx ? dataObj.detail_data_ex : dataObj.detail_data;
                let data_details_ex = $CURRENT_RPT.isFollowMode ? dataObj.detail_data_ex : null;
                let contentValuesIdx = me.dispValueIdxLst[page - 1];
                let page_sum_data_fields = [];
                for (let i = 0; i < me.page_sum_fields_idx.length; i++) {
                    if (typeof (me.page_sum_fields_idx[i]) === "object") {
                        let exField = JE.F(me.page_sum_fields_idx[i][JV.PROP_ID], $CURRENT_RPT);
                        if (exField) {
                            page_sum_data_fields.push(exField.data_field);
                        }
                        else {
                            page_sum_data_fields.push(null);
                        }
                    }
                    else {
                        let data_field = data_details[me.page_sum_fields_idx[i]];
                        page_sum_data_fields.push(data_field);
                    }
                }
                let rowGrandTotal = [];
                for (let di = 0; di < page_sum_data_fields.length; di++) {
                    rowGrandTotal.push(0.0);
                }
                //normal content
                let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
                for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                    for (let fieldIdx = 0; fieldIdx < tab_fields.length; fieldIdx++) {
                        let tab_field = tab_fields[fieldIdx];
                        let data_field = null, map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                        if (me.disp_fields_idx[fieldIdx] !== JV.BLANK_FIELD_INDEX && (typeof me.disp_fields_idx[fieldIdx] !== 'object')) {
                            data_field = data_details[me.disp_fields_idx[fieldIdx]];
                        }
                        else {
                            if (map_data_field) {
                                data_field = map_data_field.data_field;
                            }
                        }
                        if (map_data_field && map_data_field.Precision && map_data_field.flexiblePrecisionRefObj) {
                            if (flexiblePrecisionRefObj === null) {
                                flexiblePrecisionRefObj = {};
                                if (map_data_field.Precision.flexibleRefFieldID)
                                    flexibleRefField = JE.F(map_data_field.Precision.flexibleRefFieldID, $CURRENT_RPT);
                                if (flexibleRefField)
                                    precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
                                for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                    flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                }
                            }
                            JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, contentValuesIdx[rowIdx][2], customizeCfg);
                        }
                        else {
                            if (rowIdx === 0)
                                JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                        }
                        if (!(tab_field.Hidden)) {
                            if (contentValuesIdx[rowIdx][0] !== JV.TYPE_FOLLOW_MODE && contentValuesIdx[rowIdx][1] === JV.DISPLAY_VAL_TYPE_NORMAL) {
                                rst.push(me.outputTabField(band, tab_field, data_field, contentValuesIdx[rowIdx][2], -1, contentValuesIdx.length, rowIdx, 1, 0, unitFactor, false, controls, multiColIdx));
                            }
                            else if (contentValuesIdx[rowIdx][1] === JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT) {
                                if (contentValuesIdx[rowIdx][4] === 1) {
                                    //等效于普通输出
                                    rst.push(me.outputTabField(band, tab_field, data_field, contentValuesIdx[rowIdx][2], -1, contentValuesIdx.length, rowIdx, 1, 0, unitFactor, false, controls, multiColIdx));
                                }
                                else {
                                    //这里需要做些style调整(中间的那些横杠线去掉)
                                    let cellItem = me.outputAutoHeightTabField(band, tab_field, data_field, contentValuesIdx[rowIdx], contentValuesIdx.length, rowIdx, 1, 0, unitFactor, true, controls, multiColIdx);
                                    rst.push(cellItem);
                                    if (contentValuesIdx[rowIdx][3] === 0 || rowIdx === 0) {
                                        cellItem.style = cellItem.style + '_AutoHeightMerge_Top';
                                    }
                                    else if (contentValuesIdx[rowIdx][3] === contentValuesIdx[rowIdx][4] - 1) {
                                        cellItem.style = cellItem.style + '_AutoHeightMerge_Bottom';
                                    }
                                    else {
                                        cellItem.style = cellItem.style + '_AutoHeightMerge_Middle';
                                    }
                                    prepareAutoHeightCells(prepareObj, cellItem, rst.length - 1, rst);
                                }
                            }
                        }
                        if (rowIdx === 0 && tab_field.combineType !== undefined && tab_field.combineType !== null) {
                            let rstCellItem = rst[rst.length - 1];
                            let cbfPos = [];
                            cbfPos.push(rstCellItem.area.Left);
                            cbfPos.push(rstCellItem.area.Right);
                            if (tab_field.combineType === 'vertical') {
                                verticalCombinePos.push(cbfPos);
                            }
                            else if (tab_field.combineType === 'horizon') {
                                horizonCombinePos.push(cbfPos);
                            }
                        }
                    }
                    if (tab_fields_ex && contentValuesIdx[rowIdx][0] === 1) {
                        for (let idx_ex = 0; idx_ex < tab_fields_ex.length; idx_ex++) {
                            let tab_fieldex = tab_fields_ex[idx_ex];
                            let data_fieldex = null, map_data_fieldex = JE.F(tab_fieldex.FieldID, $CURRENT_RPT);
                            if (data_details_ex && me.disp_fields_ex_idx[idx_ex] !== JV.BLANK_FIELD_INDEX && (typeof me.disp_fields_ex_idx[idx_ex] !== 'object')) {
                                data_fieldex = data_details_ex[me.disp_fields_ex_idx[idx_ex]];
                            }
                            else {
                                if (map_data_fieldex) {
                                    data_fieldex = map_data_fieldex.data_field;
                                }
                            }
                            if (map_data_fieldex && map_data_fieldex.Precision && map_data_fieldex.flexiblePrecisionRefObj) {
                                if (flexiblePrecisionRefObj === null) {
                                    flexiblePrecisionRefObj = {};
                                    if (map_data_fieldex.Precision.flexibleRefFieldID)
                                        flexibleRefField = JE.F(map_data_fieldex.Precision.flexibleRefFieldID, $CURRENT_RPT);
                                    for (let decimalObj of map_data_fieldex.flexiblePrecisionRefObj) {
                                        flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                    }
                                }
                                JpcFieldHelper.resetFlexibleFormat(tab_fieldex, flexibleRefField, flexiblePrecisionRefObj, contentValuesIdx[rowIdx][2], customizeCfg);
                            }
                            else {
                                if (rowIdx === 0)
                                    JpcFieldHelper.resetFormat(tab_fieldex, map_data_fieldex, customizeCfg);
                            }
                            if (!(tab_fieldex.Hidden)) {
                                if (contentValuesIdx[rowIdx][0] === 1 && contentValuesIdx[rowIdx][1] === 0) {
                                    rst.push(me.outputTabField(band, tab_fieldex, data_fieldex, contentValuesIdx[rowIdx][2], -1, contentValuesIdx.length, rowIdx, 1, 0, unitFactor, false, controls, multiColIdx));
                                }
                            }
                        }
                    }
                    //page sum content
                    for (let di = 0; di < page_sum_data_fields.length; di++) {
                        if (contentValuesIdx[rowIdx][1] === 0 ||
                            contentValuesIdx[rowIdx][1] === 2 && contentValuesIdx[rowIdx][3] === 0) {
                            let precisionAmt = 4;
                            let sum_field = JE.F(me.page_sum_tab_fields[di].FieldID, $CURRENT_RPT);
                            if (sum_field && sum_field.Precision && sum_field.Precision.type === `fixed`) {
                                precisionAmt = sum_field.fixedPrecisionNum;
                            }
                            else {
                                let flowF = me.page_sum_tab_fields[di];
                                if (flowF && !isEmptyString(flowF.Format)) {
                                    let idx = flowF.Format.indexOf('.');
                                    if (idx >= 0) {
                                        precisionAmt = flowF.Format.length - idx - 1;
                                    }
                                }
                            }
                            // rowGrandTotal[di] = rowGrandTotal[di] + 1.0 * JpcFieldHelper.getValue(page_sum_data_fields[di], contentValuesIdx[rowIdx][2]);
                            if (contentValuesIdx[rowIdx][2] >= 0) {
                                let psv = JpcFieldHelper.getValue(page_sum_data_fields[di], contentValuesIdx[rowIdx][2]);
                                if (psv) {
                                    rowGrandTotal[di] = rowGrandTotal[di] + parseFloat(parseFloat(psv).toFixed(precisionAmt));
                                }
                            }
                        }
                    }
                }
                me.pageSumValLst.push(rowGrandTotal);
                //grouping content
                let grpCntIdx = 0;
                for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                    if (contentValuesIdx[rowIdx][1] === 1) {
                        for (let grpIdx = 0; grpIdx < flow_node_str.流水式表_分组信息.group_lines.length; grpIdx++) {
                            if (contentValuesIdx[rowIdx][3] === grpIdx) {
                                let grp_line = flow_node_str.流水式表_分组信息.group_lines[grpIdx];
                                if (page === 1) {
                                    if (grp_line.SumKey_S && grp_line.SumKey_S.length > 0) {
                                        for (let grp_sum_field of grp_line.SumKey_S) {
                                            if (grp_sum_field.FieldID) {
                                                let map_field = JE.F(grp_sum_field.FieldID, $CURRENT_RPT);
                                                JpcFieldHelper.resetFormat(grp_sum_field, map_field, customizeCfg);
                                            }
                                        }
                                    }
                                }
                                let lineRst = me.outputTabGrpLine(band, grp_line, page, contentValuesIdx[rowIdx], contentValuesIdx.length, rowIdx, 1, 0, unitFactor, true, controls, multiColIdx, grpCntIdx, $CURRENT_RPT);
                                rst = rst.concat(lineRst);
                            }
                        }
                        grpCntIdx++;
                    }
                }
            }
        }
        //合并自动换行的格子，直接把第一个格子的值一个一个递增为目标值，并且把被合并的格子的id纪录下来，准备在下面进行删除
        //（本来是一行一个格子的，此处通过表示对值进行递增）
        let eliminateCells = combineAutoHeightCells(prepareObj, page, controls);
        for (let idIdx = eliminateCells.length - 1; idIdx >= 0; idIdx--) {
            rst.splice(eliminateCells[idIdx], 1);
        }
        me.checkCombineEvent(JV.RUN_TYPE_BEFORE_COMBINE, verticalCombinePos, horizonCombinePos, rst, $CURRENT_RPT);
        me.combinePageCells(rst, verticalCombinePos, horizonCombinePos);
        me.checkCombineEvent(JV.RUN_TYPE_AFTER_COMBINE, verticalCombinePos, horizonCombinePos, rst, $CURRENT_RPT);
        return rst;
    }
    ;
    combinePageCells(rstPageCells, verticalCombinePos, horizonCombinePos) {
        // let me = this;
        //备注：纵向合并要考虑以下因素：
        //     如果有多个column纵向合并，需要总体考虑分割，
        //     假如：第一列的前3个数据(1、2、3)是相同的，第二列中第2、3、4行数据相同，那么第二列只能合并2、3行的数据，不能合并到第四行
        //     同理如此类推第三列...n列
        if (verticalCombinePos.length > 0 || horizonCombinePos.length > 1) {
            let cacheObj = { vCache: {}, hCache: {}, hCacheStr: [] };
            let removeCellIds = [];
            for (let vPosArr of verticalCombinePos) {
                let pStr = "_" + vPosArr[0] + "_" + vPosArr[1];
                cacheObj.vCache[pStr] = [];
            }
            //horizonCombinePos不需要预记
            for (let idx = 0; idx < rstPageCells.length; idx++) {
                let cell = rstPageCells[idx];
                for (let vPosArr of verticalCombinePos) {
                    if (cell.area.Left === vPosArr[0] && cell.area.Right === vPosArr[1]) {
                        cacheObj.vCache["_" + vPosArr[0] + "_" + vPosArr[1]].push(idx);
                    }
                }
                for (let hPosArr of horizonCombinePos) {
                    if (cell.area.Left === hPosArr[0] && cell.area.Right === hPosArr[1]) {
                        let hpStr = "_" + cell.area.Top + "_" + cell.area.Bottom;
                        if (cacheObj.hCacheStr.indexOf(hpStr) < 0) {
                            cacheObj.hCache[hpStr] = [];
                            cacheObj.hCacheStr.push(hpStr);
                        }
                        cacheObj.hCache[hpStr].push(idx);
                    }
                }
            }
            if (verticalCombinePos.length > 0) {
                let preColMergePosArr = []; //见上面备注描述，纪录当前列的分割坐标集合情况
                let private_chk_in_pre_merge = function (preIdx, newCell) {
                    let rst = true;
                    if (preIdx >= 0 && preIdx < preColMergePosArr.length) {
                        for (let mergeArea of preColMergePosArr[preIdx]) {
                            if (newCell.area[JV.PROP_TOP] >= mergeArea[0] && newCell.area[JV.PROP_TOP] < mergeArea[1]) {
                                rst = (newCell.area.Bottom <= mergeArea[1]);
                                break;
                            }
                        }
                    }
                    return rst;
                };
                for (let vidx = 0; vidx < verticalCombinePos.length; vidx++) {
                    let vPosArr = verticalCombinePos[vidx];
                    let pStr = "_" + vPosArr[0] + "_" + vPosArr[1];
                    //rstPageCells的结果已经是按顺序排列了，这里不用再排序
                    if (cacheObj.vCache[pStr] && cacheObj.vCache[pStr].length > 0) {
                        let preCell = rstPageCells[cacheObj.vCache[pStr][0]];
                        if (vidx === 0) {
                            //这里要处理下
                            let minY = 10000, maxY = 0;
                            for (let preCIdx = 0; preCIdx < cacheObj.vCache[pStr].length; preCIdx++) {
                                if (minY > rstPageCells[cacheObj.vCache[pStr][preCIdx]].area.Top)
                                    minY = rstPageCells[cacheObj.vCache[pStr][preCIdx]].area.Top;
                                if (maxY < rstPageCells[cacheObj.vCache[pStr][preCIdx]].area.Bottom)
                                    maxY = rstPageCells[cacheObj.vCache[pStr][preCIdx]].area.Bottom;
                            }
                            preColMergePosArr.push([[minY, maxY]]);
                        }
                        let dtlColMergePosArr = [];
                        preColMergePosArr.push(dtlColMergePosArr);
                        for (let cIdx = 1; cIdx < cacheObj.vCache[pStr].length; cIdx++) {
                            if (preCell.Value === "") {
                                dtlColMergePosArr.push([preCell.area.Top, preCell.area.Bottom]);
                                preCell = rstPageCells[cacheObj.vCache[pStr][cIdx]];
                            }
                            else {
                                if (preCell.Value === rstPageCells[cacheObj.vCache[pStr][cIdx]].Value) {
                                    let bkBottom = preCell.area.Bottom;
                                    preCell.area.Bottom = rstPageCells[cacheObj.vCache[pStr][cIdx]].area.Bottom;
                                    if (private_chk_in_pre_merge(vidx, preCell)) {
                                        removeCellIds.push(cacheObj.vCache[pStr][cIdx]);
                                        if (cIdx === cacheObj.vCache[pStr].length - 1) {
                                            dtlColMergePosArr.push([preCell.area.Top, preCell.area.Bottom]);
                                        }
                                    }
                                    else {
                                        preCell.area.Bottom = bkBottom;
                                        dtlColMergePosArr.push([preCell.area.Top, preCell.area.Bottom]);
                                        preCell = rstPageCells[cacheObj.vCache[pStr][cIdx]];
                                    }
                                }
                                else {
                                    dtlColMergePosArr.push([preCell.area.Top, preCell.area.Bottom]);
                                    preCell = rstPageCells[cacheObj.vCache[pStr][cIdx]];
                                }
                            }
                        }
                    }
                }
            }
            if (horizonCombinePos.length > 1) {
                if (cacheObj.hCacheStr.length > 0) {
                    for (let hStr of cacheObj.hCacheStr) {
                        let preCell = rstPageCells[cacheObj.hCache[hStr][0]];
                        for (let cIdx = 1; cIdx < cacheObj.hCache[hStr].length; cIdx++) {
                            if (preCell.Value === "") {
                                preCell = rstPageCells[cacheObj.hCache[hStr][cIdx]];
                            }
                            else {
                                if (preCell.Value === rstPageCells[cacheObj.hCache[hStr][cIdx]].Value) {
                                    if (preCell.area.Right < rstPageCells[cacheObj.hCache[hStr][cIdx]].area.Right) {
                                        preCell.area.Right = rstPageCells[cacheObj.hCache[hStr][cIdx]].area.Right;
                                    }
                                    else {
                                        preCell.area.Left = rstPageCells[cacheObj.hCache[hStr][cIdx]].area.Left;
                                    }
                                    removeCellIds.push(cacheObj.hCache[hStr][cIdx]);
                                }
                                else {
                                    preCell = rstPageCells[cacheObj.hCache[hStr][cIdx]];
                                }
                            }
                        }
                    }
                }
            }
            if (removeCellIds.length > 0) {
                //排序，保证一定的顺序，不能用默认的方式(默认方式是针对字符串的简单排序)
                removeCellIds.sort(function (idx1, idx2) {
                    return parseInt(idx1) - parseInt(idx2);
                });
                for (let idx = removeCellIds.length - 1; idx >= 0; idx--) {
                    rstPageCells.splice(removeCellIds[idx], 1);
                }
            }
        }
    }
    ;
    checkCombineEvent($RUN_TYPE, $VER_COMB_ARRAY, $HOR_COMB_ARRAY, $CURRENT_CELL_ITEMS, $CURRENT_RPT) {
        const { $JE, $JV, P, F, D, L, getCurrentPage, getTotalPage, setFieldValue, setFieldValueArray, removeFieldValue, insertFieldValue, setData, getNumberArray, copyPrecision, copyFixedPrecisionNum, copyProperty, setDate, DLength, isEmptyString, trim, leftTrim, rightTrim, comdify, convertToCaptionNum, convertStrToBoolean, formatNumber, reportDate } = $CURRENT_RPT.formulasObject;
        if ($CURRENT_RPT.formulas) {
            for (let execFmlIdx = 0; execFmlIdx < $CURRENT_RPT.formulas.length; execFmlIdx++) {
                if ($CURRENT_RPT.formulas[execFmlIdx].run_type === $RUN_TYPE) {
                    let expression = $CURRENT_RPT.formulas[execFmlIdx].expression;
                    if (expression) {
                        $CURRENT_RPT.formulas[execFmlIdx];
                        try {
                            eval(expression);
                        }
                        catch (ex) {
                            console.log(ex);
                        }
                    }
                }
            }
        }
        return {
            $JE,
            $JV,
            P,
            F,
            D,
            L,
            getCurrentPage,
            getTotalPage,
            setFieldValue,
            setFieldValueArray,
            removeFieldValue,
            insertFieldValue,
            setData,
            getNumberArray,
            copyPrecision,
            copyFixedPrecisionNum,
            copyProperty,
            setDate,
            DLength,
            isEmptyString,
            trim,
            leftTrim,
            rightTrim,
            comdify,
            convertToCaptionNum,
            convertStrToBoolean,
            formatNumber,
            reportDate
        };
    }
    ;
    outputColumn(rptTpl, dataObj, page, segIdx, bands, unitFactor, multiColIdx, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        let tab = flow_node_str.流水式表_列;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)]) {
                rst = rst.concat(me.commonTabRestOutput(dataObj, page, segIdx, bands, band, unitFactor, tab, multiColIdx, $CURRENT_RPT, customizeCfg));
            }
        }
        return rst;
    }
    ;
    outputSegSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        let tab = flow_node_str.流水式表_段统计信息;
        let refTab = flow_node_str.流水式表_数据;
        let refTabEx = (rptTpl.流水式表_拓展信息) ? rptTpl.流水式表_拓展信息.流水式表_数据 : null;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)]) {
                let ref_tab_fields = refTab.flow_field_s;
                let ref_tab_fields_ex = refTabEx ? refTabEx.flow_field_s : null;
                let tab_fields = me.seg_sum_tab_fields;
                for (let i = 0; i < tab_fields.length; i++) {
                    if (ref_tab_fields_ex && !JpcFieldHelper.resetSumFormat(ref_tab_fields, tab_fields[i])) {
                        if (!JpcFieldHelper.resetSumFormat(ref_tab_fields_ex, tab_fields[i])) {
                            let map_data_field = JE.F(tab_fields[i][JV.PROP_FIELD_ID], $CURRENT_RPT);
                            JpcFieldHelper.resetFormat(tab_fields[i], map_data_field, customizeCfg);
                            //如果都找不到，就得靠自己的Format属性了
                        }
                    }
                    let sumVal = 0;
                    if (me.segSumValLst[segIdx] && me.segSumValLst[segIdx].length > i) {
                        sumVal = me.segSumValLst[segIdx][i];
                    }
                    //备注：考虑到有时候会出现没有数据可合计的scenario,得有容错处理
                    let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_fields[i], sumVal, controls);
                    cellItem.area = JpcAreaHelper.outputArea(tab_fields[i].area, band, unitFactor, 1, 0, 1, 0, me.multiCols, 0, false, false);
                    rst.push(cellItem);
                }
                rst = rst.concat(me.commonTabRestOutput(dataObj, page, segIdx, bands, band, unitFactor, tab, 0, $CURRENT_RPT, customizeCfg));
            }
        }
        return rst;
    }
    ;
    //每页的合计
    outputPageSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
        let flow_node_str = me.isEx ? rptTpl.流水式表_拓展信息 : rptTpl.流水式表_信息;
        let tab = flow_node_str.流水式表_页统计信息;
        let refTab = flow_node_str.流水式表_数据;
        let refTabEx = (rptTpl.流水式表_拓展信息) ? rptTpl.流水式表_拓展信息.流水式表_数据 : null;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)]) {
                let ref_tab_fields = refTab.flow_field_s;
                let ref_tab_fields_ex = refTabEx ? refTabEx.flow_field_s : null;
                let tab_fields = me.page_sum_tab_fields;
                for (let i = 0; i < tab_fields.length; i++) {
                    if (!JpcFieldHelper.resetSumFormat(ref_tab_fields, tab_fields[i])) {
                        if (ref_tab_fields_ex && !JpcFieldHelper.resetSumFormat(ref_tab_fields_ex, tab_fields[i])) {
                            let map_data_field = JE.F(tab_fields[i][JV.PROP_FIELD_ID], $CURRENT_RPT);
                            JpcFieldHelper.resetFormat(tab_fields[i], map_data_field, customizeCfg);
                            //如果都找不到，就得靠自己的Format属性了
                        }
                    }
                    let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_fields[i], me.pageSumValLst[page - 1][i], controls);
                    cellItem.area = JpcAreaHelper.outputArea(tab_fields[i].area, band, unitFactor, 1, 0, 1, 0, me.multiCols, 0, false, false);
                    rst.push(cellItem);
                }
                rst = rst.concat(me.commonTabRestOutput(dataObj, page, segIdx, bands, band, unitFactor, tab, 0, $CURRENT_RPT, customizeCfg));
            }
        }
        return rst;
    }
    ;
    outputTabField(band, tab_field, data_field, valueIdx, serialIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx) {
        let me = this, rst = JpcCommonOutputHelper.createCommonOutput(tab_field, JpcFieldHelper.getValue(data_field, valueIdx), controls);
        rst.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, isRow, false);
        return rst;
    }
    ;
    outputAutoHeightTabField(band, tab_field, data_field, contentValInfo, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx) {
        let me = this;
        let showText = JpcFieldHelper.getValue(data_field, contentValInfo[2]);
        if (tab_field.isAutoHeight) {
            let textArr = [];
            if (showText) {
                textArr = textArr.concat(showText.split('|'));
            }
            /*
if (contentValInfo[3] < textArr.length && contentValInfo[3] >= 0) {
    showText = textArr[contentValInfo[3]];
}
else {
    showText = '';
}
/*/
            // 因新逻辑要优化自动行高，不再是一个折行占用1row，而是: 
            // a. 根据实际情况，设置了一个实际的行数值(比如共有10行，根据行高情况，可能只设置了6行的高度，在setupAutoHeightData方法里处理)
            // b. 这里最大的难题在于跨页分配(预估会有来回调整，目前采用按比例分配原则)
            // c. 还有个问题就是多个自动行高指标的问题
            const ACT_ROWS = contentValInfo[4]; //经实际计算，能容纳所有数据的实际行数
            const CURRENT_ROW = contentValInfo[3]; //从0开始
            const QUOTA_Rate = textArr.length / ACT_ROWS; //每行显示的加权系数(超过2的话，表示给的行高太多了，需要另外一些特殊处理，后期有需要再加)
            if (textArr.length <= 3 || ACT_ROWS > textArr.length) {
                //表示这个一定是附属的autoheight指标，或者数据就只有3行(假如数据3行精简成2行，但刚好处于分页状态，那么无论是前一页或后一页，显示上都很纠结(多出来的一行放哪好？)，所以新逻辑的起点要3行以上，少了就不折腾了，老老实实地一个萝卜一个坑)
                if (CURRENT_ROW < textArr.length && CURRENT_ROW >= 0) {
                    showText = textArr[CURRENT_ROW];
                }
                else {
                    showText = '';
                }
            }
            else {
                //这里不管是不是附属autoheight指标,有足够的条件单独处理
                if (QUOTA_Rate >= 3) {
                    console.log('压缩率太高了，模板的行高设置小一点');
                    //压缩超过一半空间的话，说明给的行高度太高了，需要另外一些特殊处理，后期有需要再加
                }
                else {
                    //正常的压缩比例
                    let startIdx = 0, endIdx = 0;
                    if (CURRENT_ROW > 0) {
                        endIdx = Math.round((CURRENT_ROW + 1) * QUOTA_Rate) - 1;
                        let preEndIdx = 0;
                        if (CURRENT_ROW > 1) {
                            //重定位 preEndIdx
                            preEndIdx = Math.round(CURRENT_ROW * QUOTA_Rate) - 1;
                        }
                        startIdx = preEndIdx + 1;
                    }
                    //按比例分配
                    showText = textArr[startIdx];
                    for (let idx = startIdx + 1; idx <= endIdx; idx++) {
                        showText += `|${textArr[idx]}`;
                    }
                }
            }
            //*/
            let rst = JpcCommonOutputHelper.createCommonOutput(tab_field, showText, controls);
            rst.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, true, false);
            rst.isAutoHeight = true;
            return rst;
        }
        else {
            if (contentValInfo[3] > 0)
                showText = '';
            let rst = JpcCommonOutputHelper.createCommonOutput(tab_field, showText, controls);
            rst.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, true, false);
            rst.isAutoHeight = false;
            return rst;
        }
    }
    ;
    outputTabGrpLine(band, grp_line, page, grpValueIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx, grpCntIdx, $CURRENT_RPT) {
        let me = this, rst = [];
        if (grp_line.SumKey_S) {
            let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
            let curSegGrpSum = me.group_sum_values[segIdx];
            for (let sumFieldNode of grp_line.SumKey_S) {
                // let value = curSegGrpSum[sumFieldNode[JV.PROP_SUM_KEY]][grpValueIdx[2]];
                let value = curSegGrpSum[`grp_sum_key_` + sumFieldNode.FieldID][grpValueIdx[2]];
                let sumFldRst = JpcTextHelper.outputDirectValue(sumFieldNode, value, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx);
                rst.push(sumFldRst);
            }
        }
        if (grp_line.text_s) {
            for (let txt of grp_line.text_s) {
                me.checkGrpTxtOutEvent(JV.RUN_TYPE_BEFORE_GROUP_TEXT_OUT, txt, grpCntIdx, $CURRENT_RPT);
                rst.push(JpcTextHelper.outputText(txt, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx));
                // me.combinePageCells(rst, verticalCombinePos, horizonCombinePos);
                // 可能会有一个After，但意义不大，用不着
            }
        }
        if (grp_line.discrete_field_s) ;
        if (grp_line.param_s) ;
        // console.log(rst);
        return rst;
    }
    ;
    checkGrpTxtOutEvent($RUN_TYPE, $TEXT, $TIMES, $CURRENT_RPT) {
        combinedGridFormula($RUN_TYPE, $TEXT, $TIMES, $CURRENT_RPT);
    }
    ;
    commonTabRestOutput(dataObj, page, segIdx, bands, band, unitFactor, tab, multiColIdx, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        if (tab.text) {
            rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, 1, 0, me.multiCols, multiColIdx));
        }
        if (tab.text_s) {
            for (let j = 0; j < tab.text_s.length; j++) {
                rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, 1, 0, me.multiCols, multiColIdx));
            }
        }
        if (tab.离散信息) {
            rst = rst.concat(JpcDiscreteHelper.outputDiscreteInfo(tab.离散信息, bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, 1, 0, $CURRENT_RPT, customizeCfg));
        }
        return rst;
    }
    ;
}
function _addPageValue(ValuedIdxLst, sortedSequence, grpSequenceInfo, startRecIdx, maxRecPerPage, page_seg_map, segIdx, pageIdx, grpPageInfo, isFollow, segAutoHeightInfo, prePageLeftAutoHeightRecAmt) {
    let vIdx = [], vFirstIdx = [], preAmt = 0, insertedGrpAmt = 0, grp_lines = 0, followMode = (isFollow) ? JV.TYPE_FOLLOW_MODE : -1, nextPageAutoHeightRecAmt = 0;
    if (grpSequenceInfo && grpPageInfo) {
        if (grpPageInfo.preAddPageGrpInfo.length > 0) {
            for (let grpLineIdx of grpPageInfo.preAddPageGrpInfo) {
                //vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo.segGrpRecStartIdx, grpLineIdx]);
                vFirstIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo.segGrpRecStartIdx, grpLineIdx]);
            }
            grpPageInfo.segGrpRecStartIdx++;
        }
        preAmt = grpPageInfo.preAddPageGrpInfo.length;
        grpPageInfo.preAddPageGrpInfo = [];
        grp_lines = grpPageInfo.group_lines_amt;
    }
    let autoHeightAmt = 0;
    let private_addAutoHeightPageValue = function (vi) {
        let couldBreak = false, startIdx = 0;
        let ttlValAmt = 0;
        if (segAutoHeightInfo && segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
            ttlValAmt = segAutoHeightInfo[segIdx][startRecIdx + vi];
        }
        if (prePageLeftAutoHeightRecAmt > 0 && vi === 0) {
            startIdx = prePageLeftAutoHeightRecAmt;
        }
        for (let subValIdx = startIdx; subValIdx < ttlValAmt; subValIdx++) {
            vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT, sortedSequence[startRecIdx + vi], subValIdx, ttlValAmt]);
            autoHeightAmt++;
            if (autoHeightAmt >= maxRecPerPage) {
                nextPageAutoHeightRecAmt = (subValIdx + 1) % ttlValAmt;
                couldBreak = true;
                break;
            }
        }
        return couldBreak;
    };
    let private_inner_add_grp_rec = function (vi) {
        let hasFullGrp = true, couldBreak = false;
        if (grpPageInfo) {
            for (let i = 0; i < grp_lines; i++) {
                if (vIdx.length >= maxRecPerPage) {
                    for (let j = i; j < grp_lines; j++) {
                        grpPageInfo.preAddPageGrpInfo.push(j);
                    }
                    //准备要跳出去了
                    hasFullGrp = false;
                    break;
                }
                else {
                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo.segGrpRecStartIdx, i]);
                }
            }
            //3. 进位下一个group信息所在位置
            if (hasFullGrp) {
                grpPageInfo.insertedGrpRecAmt++;
                insertedGrpAmt++;
                grpPageInfo.segGrpRecStartIdx++;
            }
            else {
                couldBreak = true;
            }
        }
        return couldBreak;
    };
    let private_normal_add_rec = function (vi) {
        let couldBreak = false;
        if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
            if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
                couldBreak = private_addAutoHeightPageValue(vi);
                // if (couldBreak) break;
            }
            else if (vIdx.length < maxRecPerPage) {
                vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
            }
        }
        else {
            if (sortedSequence.length > startRecIdx + vi) {
                vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
            }
            else {
                vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
            }
        }
        return couldBreak;
    };
    for (let vi = 0; (vi + insertedGrpAmt * grp_lines) < maxRecPerPage - preAmt; vi++) {
        if (grpSequenceInfo && grpPageInfo) {
            if ((startRecIdx + vi) === grpSequenceInfo[grpPageInfo.segGrpRecStartIdx]) {
                //表示这里要插入grouping信息啦！
                let couldBreak = false;
                //1. 首先push正常的记录(要考虑自动行高调整的分支)
                if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
                    couldBreak = private_addAutoHeightPageValue(vi);
                }
                else {
                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
                }
                //2. 然后就要push grouping记录了
                if (private_inner_add_grp_rec())
                    break;
                if (couldBreak)
                    break;
            }
            else {
                //备注： 在有group的情况下，如果grpPageInfo[JV.PROP_SEG_GRP_IDX] 范围大于 grpSequenceInfo.length，则表示已经到最后了，不要再加空白数据了
                //      ！！！但这是在有ex数据的情况下！！！
                if (grpPageInfo.segGrpRecStartIdx < grpSequenceInfo.length) {
                    if (private_normal_add_rec(vi))
                        break;
                }
                else {
                    //还得判断是否是普通的流水数据情况，这里可以用isFollow来进行判断，暂时不需要特意加新参数(以后如isFollow的意义有变化则需要调整)
                    if (!isFollow) {
                        if (private_normal_add_rec(vi))
                            break;
                    }
                    else {
                        break;
                    }
                }
            }
        }
        else {
            if (private_normal_add_rec(vi))
                break;
        }
    }
    if (vFirstIdx.length > 0) {
        vIdx = vIdx.concat(vFirstIdx);
        //备注： 在一开始就加grp的情况下，这些数据应该放在后面才对
    }
    page_seg_map.push([pageIdx, segIdx]);
    ValuedIdxLst.push(vIdx);
    return nextPageAutoHeightRecAmt;
}
function push_cell(pageCellObj, cell, cellIdx) {
    let key = cell.area.Left + '_' + cell.area.Right;
    if (!pageCellObj[key]) {
        pageCellObj[key] = [];
    }
    let cellArr = pageCellObj[key];
    cellArr.push({ "cellIdx": cellIdx, "cell": cell });
}
function prepareAutoHeightCells(prepareObj, cellItem, cellIdx, cellsArr) {
    if (prepareObj) {
        if (prepareObj.cellsArr === undefined) {
            prepareObj.cellsArr = cellsArr;
            prepareObj.pageCellObj = {};
        }
        push_cell(prepareObj.pageCellObj, cellItem, cellIdx);
    }
}
function setupControl(mergeCell, controls) {
    let orgCtrl = null;
    if (typeof mergeCell.control === "string") {
        orgCtrl = controls[mergeCell.control];
        mergeCell.control = {
            "Shrink": "T",
            "ShrinkFirst": orgCtrl.ShrinkFirst,
            "CloseOutput": orgCtrl.CloseOutput,
            "ShowZero": orgCtrl.ShowZero,
            "Horizon": orgCtrl.Horizon,
            "Vertical": orgCtrl.Vertical,
            "Wrap": (mergeCell.isAutoHeight) ? 'T' : 'F',
            "VerticalForExcel": "center"
        };
    }
    else {
        mergeCell.control.Shrink = "T";
        mergeCell.control.Vertical = "top";
        mergeCell.control.Wrap = (mergeCell.isAutoHeight) ? 'T' : 'F',
            mergeCell.control.VerticalForExcel = "center";
        orgCtrl = mergeCell.control;
    }
    if (mergeCell.isAutoHeight) {
        mergeCell.control.VerticalForExcel = 'justify';
        // mergeCell.control["Vertical"] = 'center';
    }
    else {
        mergeCell.control.VerticalForExcel = 'center';
        // mergeCell.control["Vertical"] = 'top';
    }
    return orgCtrl;
}
function combineAutoHeightCells(prepareObj, page, controls) {
    // 该方法主要是用来生成自动合并的格子的，本来是已经生成了一行一个格子的，但现在需要把可以自动合并的格子进行中整合，在这里进行这个动作
    // 最后输出的是被合并的格子的index，在外面再剔除
    let rst = [];
    if (prepareObj.cellsArr) {
        //merge cells' value and area
        //备注： 系统逻辑已经把Cell的顺序放好，无需再做排序。
        for (let mergeKey in prepareObj.pageCellObj) {
            let sameColCells = prepareObj.pageCellObj[mergeKey]; //左右位置相同的Cell先放在一起，统一处理
            if (sameColCells.length > 1) {
                //    这里获取第一个被合并的cell的数据
                let firstMergeCell = sameColCells[0].cell;
                firstMergeCell.style = firstMergeCell.style.slice(0, firstMergeCell.style.indexOf("_AutoHeightMerge")); //首先还原original style
                //生成原始对象，并且把对象中的control属性转化为对象
                setupControl(firstMergeCell, controls);
                let validValueAmt = 0, fullValidValueAmt = 0;
                for (let i = 1; i < sameColCells.length; i++) {
                    let mergeCell = sameColCells[i].cell;
                    //含有“_AutoHeightMerge_Top”的都是每个自动合并的cell的第一行（项）
                    if (mergeCell.style.indexOf("_AutoHeightMerge_Top") < 0) {
                        fullValidValueAmt++;
                        //merge into the firstMergeCell! position & value
                        firstMergeCell.area.Bottom = mergeCell.area.Bottom;
                        if (mergeCell.Value) {
                            firstMergeCell.Value = firstMergeCell.Value + "|" + mergeCell.Value;
                            validValueAmt++;
                        }
                        rst.push(sameColCells[i].cellIdx); //记下Cell的位置，在函数外消除
                        //如果到了最后一条数据，得判断firstMergeCell是否满格（即数据是满的，有可能有些格数据也有折行但不是自动行高判断指标）
                        //不满格的cell的Vertical强制设置为 'center'
                        if (i === sameColCells.length - 1 && validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
                            if (typeof firstMergeCell.control !== 'string') {
                                firstMergeCell.control.VerticalForExcel = 'center';
                            }
                        }
                    }
                    else {
                        //碰到新开始的自动行高行，判断原先的firstMergeCell是否满格（即数据是满的，有可能有些格数据也有折行但不是自动行高判断指标）
                        //不满格的cell的Vertical强制设置为 'center'
                        if (validValueAmt !== fullValidValueAmt && (fullValidValueAmt / validValueAmt > 2.5)) {
                            if (typeof firstMergeCell.control !== 'string') {
                                firstMergeCell.control.VerticalForExcel = 'center';
                            }
                        }
                        firstMergeCell = sameColCells[i].cell;
                        firstMergeCell.style = firstMergeCell.style.slice(0, firstMergeCell.style.indexOf("_AutoHeightMerge"));
                        setupControl(firstMergeCell, controls);
                        validValueAmt = 0;
                        fullValidValueAmt = 0;
                    }
                }
            }
        }
        rst.sort(function (i1, i2) {
            return (i1 > i2) ? 1 : -1;
        });
    }
    return rst;
}

class JpcBillTabSrvClass {
    disp_fields_idx;
    constructor() {
        this.disp_fields_idx = []; // typescript的class属性初始化都要放constructor里，不然总报错
    }
    ;
    // 该方法主要是通过账单报表的信息，获取相对应于报表模板信息中的数据信息的数组的序号，以便后面取值计算
    sorting(rptTpl) {
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.账单式表_信息.账单式表_数据.bill_field_s, [], this.disp_fields_idx, false);
    }
    ;
    // 获取总页数
    //问题：为什么dataFields第一个元素就可以确定总页数
    paging(rptTpl, dataObj) {
        let rst = 0;
        function _getDataLength(fields_str) {
            let dataFields = dataObj[fields_str];
            if (dataFields && dataFields.length > 0) {
                rst = dataFields[0].length;
            }
        }
        if (rptTpl.指标_数据_映射) {
            if (rptTpl.指标_数据_映射.从数据指标_集合) {
                _getDataLength(exports.IDataObjProps.detail_data);
            }
            else if (rptTpl.指标_数据_映射.主数据指标_集合) {
                _getDataLength(exports.IDataObjProps.master_data);
            }
            else if (rptTpl.指标_数据_映射.离散指标_集合) {
                _getDataLength(exports.IDataObjProps.discrete_data);
            }
            else if (rptTpl.指标_数据_映射.离散参数_集合) {
                rst = 1;
            }
        }
        return rst;
    }
    ;
    outputAsPreviewPage(rptTpl, bands, controls, $CURRENT_RPT) {
        let me = this, rst = [];
        //只预览第一页的数据
        let pageStatus = [true, true, false, true, false, false, false, false]; //？？
        JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        rst = rst.concat(me.outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus));
        rst = rst.concat(JpcDiscreteHelper.outputPreviewDiscreteInfo(rptTpl.账单式表_信息.离散信息, bands, unitFactor, pageStatus));
        return rst;
    }
    ;
    outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], tabRstLst = [];
        //1 calculate the band position
        let pageStatus = [true, false, false, false, false, false, false, false];
        JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, false, false);
        //2. start to output detail-part
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        //2.1 output content
        tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, pageStatus, $CURRENT_RPT, customizeCfg));
        //2.2 output discrete
        tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl.账单式表_信息.离散信息, bands, dataObj, unitFactor, pageStatus, page - 1, 1, 0, $CURRENT_RPT, customizeCfg));
        for (let i = 0; i < tabRstLst.length; i++) {
            rst = rst.concat(tabRstLst[i]);
            tabRstLst[i] = null;
        }
        return rst;
    }
    ;
    outputPreviewContent(rptTpl, bands, unitFactor, controls, pageStatus) {
        let rst = [];
        let tab = rptTpl.账单式表_信息.账单式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            if (pageStatus[(band.DisplayType)]) {
                let tab_fields = tab.bill_field_s;
                for (let i = 0; i < tab_fields.length; i++) {
                    let tab_field = tab_fields[i];
                    if (!(tab_field.Hidden)) {
                        let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, "", controls);
                        cellItem.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                        rst.push(cellItem);
                    }
                }
                if (tab.text) {
                    rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, 1, 0, 1, 0));
                }
                if (tab.text_s) {
                    for (let j = 0; j < tab.text_s.length; j++) {
                        rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, 1, 0, 1, 0));
                    }
                }
                if (tab.离散信息) {
                    rst = rst.concat(JpcDiscreteHelper.outputPreviewDiscreteInfo(tab.离散信息, bands, unitFactor, pageStatus));
                }
            }
        }
        return rst;
    }
    ;
    outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, pageStatus, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        let tab = rptTpl.账单式表_信息.账单式表_数据;
        let band = bands[tab.BandName];
        if (band) {
            if (pageStatus[(band.DisplayType)]) {
                let tab_fields = tab.bill_field_s;
                // let data_details = null;//bylish
                let data_details = [];
                if (rptTpl.指标_数据_映射.从数据指标_集合) {
                    data_details = dataObj[exports.IDataObjProps.detail_data];
                }
                else if (rptTpl.指标_数据_映射.主数据指标_集合) {
                    data_details = dataObj[exports.IDataObjProps.master_data];
                }
                let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
                for (let i = 0; i < tab_fields.length; i++) {
                    let tab_field = tab_fields[i];
                    let data_field = null, map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                    if (me.disp_fields_idx.length > i && me.disp_fields_idx[i] !== JV.BLANK_FIELD_INDEX && (typeof me.disp_fields_idx[i] !== 'object')) {
                        data_field = data_details[me.disp_fields_idx[i]];
                    }
                    else {
                        if (map_data_field) {
                            data_field = map_data_field.data_field;
                        }
                    }
                    if (map_data_field && map_data_field.Precision && map_data_field.flexiblePrecisionRefObj && map_data_field.Precision.flexibleRefFieldID) { //加了最后一个判断  by lish
                        if (flexiblePrecisionRefObj === null) {
                            flexiblePrecisionRefObj = {};
                            flexibleRefField = JE.F(map_data_field.Precision.flexibleRefFieldID, $CURRENT_RPT);
                            if (flexibleRefField)
                                precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
                            for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                            }
                        }
                        JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, page - 1, customizeCfg);
                    }
                    else {
                        if (page === 1)
                            JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                    }
                    if (!(tab_field.Hidden)) {
                        let val = JpcFieldHelper.getValue(data_field, page - 1);
                        let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
                        cellItem.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                        rst.push(cellItem);
                    }
                }
                if (tab.text) {
                    rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, 1, 0, 1, 0));
                }
                if (tab.text_s) {
                    for (let j = 0; j < tab.text_s.length; j++) {
                        rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, 1, 0, 1, 0));
                    }
                }
                if (tab.离散信息) {
                    rst = rst.concat(JpcDiscreteHelper.outputDiscreteInfo(tab.离散信息, bands, dataObj, unitFactor, pageStatus, page - 1, 1, 0, $CURRENT_RPT, customizeCfg));
                }
            }
        }
        return rst;
    }
}

let JpcCrossTabHelper = {
    getColIDX: function (cl, val) {
        let rst = -1;
        for (let i = 0; i < cl.length; i++) {
            let ca = cl[i];
            for (let j = 0; j < ca.length; j++) {
                if (ca[j] == val) {
                    rst = i;
                    break;
                }
            }
            if (rst != -1) {
                break;
            }
        }
        return rst;
    },
    pushToSeg: function (segArr, dataSeq, segIdx, sIdx, eIdx) {
        let arrIdx = [];
        for (let k = sIdx; k < eIdx; k++) {
            arrIdx.push(dataSeq[segIdx][k]);
        }
        segArr.push(arrIdx);
    },
    sortFieldValue: function (sIDX, eIDX, sortOrder, dataField, dataValSeq) {
        let tmpSeq = [];
        if ((sortOrder) && (sortOrder !== JV.TAB_FIELD_PROP_SORT_VAL_NOSORT)) {
            if (sIDX >= 0 && eIDX >= sIDX && dataValSeq.length > eIDX) {
                let reversed = 1;
                if (sortOrder === JV.TAB_FIELD_PROP_SORT_VAL_DESC) {
                    reversed = -1;
                }
                for (let i = sIDX; i <= eIDX; i++) {
                    tmpSeq.push(dataValSeq[i]);
                }
                tmpSeq.sort(function (idx1, idx2) {
                    let rst = 0;
                    // if (isNaN(parseFloat(dataField[idx1])) || isNaN(parseFloat(dataField[idx1]))) {
                    if (typeof (dataField[idx1]) === 'string' || typeof (dataField[idx1]) === 'string') {
                        if (dataField[idx1] > dataField[idx2]) {
                            rst = reversed;
                        }
                        else if (dataField[idx1] < dataField[idx2]) {
                            rst = -reversed;
                        }
                    }
                    else {
                        if ((1.0 * dataField[idx1]) > (1.0 * dataField[idx2])) {
                            rst = reversed;
                        }
                        else if ((1.0 * dataField[idx1]) < (1.0 * dataField[idx2])) {
                            rst = -reversed;
                        }
                    }
                    return rst;
                });
            }
        }
        if (tmpSeq.length > 0) {
            for (let i = sIDX; i <= eIDX; i++) {
                dataValSeq[i] = tmpSeq[i - sIDX];
            }
        }
        return tmpSeq;
    },
    checkIfEqual: function (dataFields, seq1, seq2) {
        let rst = true;
        for (let i = 0; i < dataFields.length; i++) {
            if ((dataFields[i][seq1] !== dataFields[i][seq2])) {
                rst = false;
                break;
            }
        }
        return rst;
    },
    //暂定
    sortTabFields: function (tabFields, fieldSeqs, data_details, dataSeq, $CURRENT_RPT) {
        let me = this;
        let sIDX = 0, eIDX = -1, isFirstSort = true;
        for (let i = 0; i < tabFields.length; i++) {
            let tabField = tabFields[i];
            if (tabField.Sort !== JV.TAB_FIELD_PROP_SORT_VAL_NOSORT) {
                if (isFirstSort) {
                    isFirstSort = false;
                    //first field, should sort all data items
                    for (let j = 0; j < dataSeq.length; j++) {
                        sIDX = 0;
                        eIDX = dataSeq[j].length - 1;
                        //sort the field value here
                        if (typeof (fieldSeqs[i]) === "object") {
                            let exFirstField = JE.F(fieldSeqs[i].ID, $CURRENT_RPT);
                            if (exFirstField) {
                                me.sortFieldValue(sIDX, eIDX, tabField.Sort, exFirstField.data_field, dataSeq[j]);
                            }
                        }
                        else {
                            me.sortFieldValue(sIDX, eIDX, tabField.Sort, data_details[fieldSeqs[i]], dataSeq[j]);
                        }
                        // me.sortFieldValue(sIDX, eIDX, tabField.Sort,data_details[fieldSeqs[i]], dataSeq[j]);
                    }
                }
                else {
                    //then sort the rest fields one by one
                    for (let j = 0; j < dataSeq.length; j++) {
                        let chkFields = [];
                        for (let k = 0; k < i; k++) {
                            if (typeof (fieldSeqs[k]) === "object") {
                                let exField = JE.F(fieldSeqs[k].ID, $CURRENT_RPT);
                                if (exField) {
                                    chkFields.push(exField.data_field);
                                }
                                else {
                                    chkFields.push(null);
                                }
                            }
                            else {
                                chkFields.push(data_details[fieldSeqs[k]]);
                            }
                            // chkFields.push(data_details[fieldSeqs[k]]);
                        }
                        sIDX = 0, eIDX = -1;
                        for (let m = 1; m < dataSeq[j].length; m++) {
                            if (!(me.checkIfEqual(chkFields, dataSeq[j][m - 1], dataSeq[j][m]))) {
                                eIDX = m - 1;
                            }
                            else if (m == dataSeq[j].length - 1) {
                                eIDX = m;
                            }
                            if (eIDX >= sIDX) {
                                if (eIDX != sIDX) {
                                    if (typeof (fieldSeqs[i]) === "object") {
                                        let exOtherField = JE.F(fieldSeqs[i].ID, $CURRENT_RPT);
                                        if (exOtherField) {
                                            me.sortFieldValue(sIDX, eIDX, tabField.Sort, exOtherField.data_field, dataSeq[j]);
                                        }
                                    }
                                    else {
                                        me.sortFieldValue(sIDX, eIDX, tabField.Sort, data_details[fieldSeqs[i]], dataSeq[j]);
                                    }
                                    // me.sortFieldValue(sIDX, eIDX, tabField.Sort,data_details[fieldSeqs[i]], dataSeq[j]);
                                }
                                sIDX = m;
                                eIDX = m - 1; //for protection purpose
                            }
                        }
                    }
                }
            }
        }
    },
    getMaxRowsPerPage: function (bands, rptTpl) {
        let rst = 1;
        let band = bands[rptTpl.交叉表_信息.交叉行.BandName];
        if (band) {
            rst = getMaxTabCntPerPage(rptTpl, '交叉行', 'CommonHeight', band.Bottom - band.Top);
        }
        return rst;
    },
    getMaxColsPerPage: function (bands, rptTpl) {
        let rst = 1;
        let band = bands[rptTpl.交叉表_信息.交叉列.BandName];
        if (band) {
            rst = getMaxTabCntPerPage(rptTpl, '交叉列', 'CommonWidth', band.Right - band.Left);
        }
        return rst;
    },
    getActualRowsHeight: function (bands, rptTpl, segments, page) {
        let rst = 1;
        let band = bands[rptTpl.交叉表_信息.交叉行.BandName];
        if (band) {
            rst = getActualContentAreaMeasurement(rptTpl, '交叉行', 'CommonHeight', band.Bottom - band.Top, segments, page);
        }
        return rst;
    },
    getActualColsWidth: function (bands, rptTpl, segments, page) {
        let rst = 1;
        let band = bands[rptTpl.交叉表_信息.交叉列.BandName];
        if (band) {
            rst = getActualContentAreaMeasurement(rptTpl, JV.NODE_CROSS_COL, JV.PROP_CMN_WIDTH, band.Right - band.Left, segments, page);
        }
        return rst;
    },
    chkTabEnd: function (tabType, rptTpl, bands, sortedSequence, segIdx, preRec, nextRec) {
        let me = this, rst = true;
        let remainAmt = preRec + nextRec - sortedSequence[segIdx].length;
        rst = me.hasEnoughSpace(tabType, rptTpl, bands, remainAmt);
        return rst;
    },
    hasEnoughSpace: function (tabType, rptTpl, bands, remainAmt) {
        if (remainAmt < 0)
            return false;
        let rst = true, measurement = 1.0, douDiffForCompare = 0.00001;
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        let band = null;
        if (rptTpl.交叉表_信息[tabType]) {
            band = bands[rptTpl.交叉表_信息[tabType].BandName];
        }
        if (band != null && band != undefined) {
            if (tabType === JV.NODE_CROSS_ROW_SUM || tabType === JV.NODE_CROSS_ROW_EXT) {
                measurement = 1.0 * rptTpl.交叉表_信息.交叉行.CommonHeight * unitFactor;
                let spareHeight = measurement * remainAmt;
                let douH = 1.0 * (band.Bottom - band.Top);
                rst = (spareHeight >= douH) || (spareHeight - douH <= douDiffForCompare);
            }
            else if (tabType === JV.NODE_CROSS_COL_SUM) {
                measurement = 1.0 * rptTpl.交叉表_信息.交叉列.CommonWidth * unitFactor;
                let spareWidth = measurement * remainAmt;
                let douW = 1.0 * (band.Right - band.Left);
                rst = (spareWidth >= douW) || (spareWidth - douW <= douDiffForCompare);
            }
        }
        return rst;
    },
    initialPageStatus: function (pageStatus) {
        pageStatus[JV.STATUS_NORMAL] = true;
        pageStatus[JV.STATUS_REPORT_START] = false;
        pageStatus[JV.STATUS_REPORT_END] = false;
        pageStatus[JV.STATUS_SEGMENT_START] = false;
        pageStatus[JV.STATUS_SEGMENT_END] = false;
        pageStatus[JV.STATUS_GROUP] = false;
        pageStatus[JV.STATUS_CROSS_ROW_END] = false;
        pageStatus[JV.STATUS_CROSS_COL_END] = false;
    }
};
function getMaxTabCntPerPage(rptTpl, tabNodeName, tabMeasurePropName, measureForCal) {
    let rst = 1;
    if (rptTpl.交叉表_信息[tabNodeName]) {
        let tab = rptTpl.交叉表_信息[tabNodeName];
        let maxFieldMeasure = 1.0;
        if (JV.CAL_TYPE_ABSTRACT === JpcCommonHelper.getPosCalculationType(tab[JV.PROP_CALCULATION])) {
            let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
            maxFieldMeasure = 1.0 * rptTpl.交叉表_信息[tabNodeName][tabMeasurePropName] * unitFactor;
        }
        else {
            maxFieldMeasure = measureForCal * rptTpl.交叉表_信息[tabNodeName][tabMeasurePropName] / JV.HUNDRED_PERCENT;
        }
        rst = Math.floor(measureForCal / maxFieldMeasure);
    }
    if (rst <= 0)
        rst = 1;
    return rst;
}
function getActualContentAreaMeasurement(rptTpl, tabNodeName, tabMeasurePropName, measureForCal, segments, page) {
    let rst = 1;
    if (rptTpl.交叉表_信息[tabNodeName]) {
        let tab = rptTpl.交叉表_信息[tabNodeName];
        let maxFieldMeasure = 1.0;
        if (JV.CAL_TYPE_ABSTRACT === JpcCommonHelper.getPosCalculationType(tab[JV.PROP_CALCULATION])) {
            let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
            maxFieldMeasure = 1.0 * rptTpl.交叉表_信息[tabNodeName][tabMeasurePropName] * unitFactor;
        }
        else {
            maxFieldMeasure = measureForCal * rptTpl.交叉表_信息[tabNodeName][tabMeasurePropName] / JV.HUNDRED_PERCENT;
        }
        if (segments.length >= page) {
            rst = segments[page - 1].length * maxFieldMeasure;
        }
    }
    return rst;
}

class JpcCrossTabClass {
    dispValueIdxLst_Row;
    dispValueIdxLst_Col;
    dispValueIdxLst_Content;
    dispSerialIdxLst_Row;
    col_sum_fields_idx;
    col_sum_fields_value_total;
    dispSumValueLst_Col;
    page_seg_map;
    row_fields_idx;
    row_fields_adhoc_idx;
    col_fields_idx;
    content_fields_idx;
    row_extension_fields_idx;
    row_sum_extension_fields_idx;
    sortedRowSequence;
    sortedColSequence;
    sortedContentSequence;
    crsOrient;
    pageStatusLst;
    paging_option;
    constructor() {
        this.dispValueIdxLst_Row = [];
        this.dispValueIdxLst_Col = [];
        this.dispValueIdxLst_Content = [];
        this.dispSerialIdxLst_Row = [];
        this.col_sum_fields_idx = [];
        this.col_sum_fields_value_total = [];
        this.dispSumValueLst_Col = [];
        this.page_seg_map = [];
        this.row_fields_idx = [];
        this.row_fields_adhoc_idx = [];
        this.col_fields_idx = [];
        this.content_fields_idx = [];
        this.row_extension_fields_idx = [];
        this.row_sum_extension_fields_idx = [];
        this.sortedRowSequence = [];
        this.sortedColSequence = [];
        this.sortedContentSequence = [];
        this.crsOrient = JV.PAGE_ORIENTATION_V_FIRST;
        this.pageStatusLst = [];
        this.paging_option = JV.PAGING_OPTION_NORMAL;
    }
    ;
    sorting(rptTpl, dataObj, dataSeq, $CURRENT_RPT) {
        let me = this;
        //IMPORTANT: the data should be sorted in SQL/NoSQL level!
        me.sortedRowSequence = _SortAndOptimize(rptTpl, dataObj, dataSeq, JV.NODE_CROSS_ROW, me.row_fields_idx, $CURRENT_RPT);
        _SortAndOptimize(rptTpl, dataObj, dataSeq, JV.NODE_CROSS_ROW_AD_HOC, me.row_fields_adhoc_idx, $CURRENT_RPT);
        me.sortedColSequence = _SortAndOptimize(rptTpl, dataObj, dataSeq, JV.NODE_CROSS_COL, me.col_fields_idx, $CURRENT_RPT);
        me.sortedContentSequence = _SortForDisplayContent(rptTpl, me.sortedRowSequence, me.sortedColSequence, me.content_fields_idx);
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.交叉表_信息.交叉列合计.cross_field_s, null, me.col_sum_fields_idx, false);
        //pre-sum the data(for col sum display)
        let data_details = dataObj.detail_data, data_fields = [];
        for (let i = 0; i < me.col_sum_fields_idx.length; i++) {
            let data_field = null;
            if (typeof me.col_sum_fields_idx[i] === 'object') {
                let exField = JE.F(me.col_sum_fields_idx[i].ID, $CURRENT_RPT);
                if (exField) {
                    data_field = exField.data_field;
                }
            }
            else {
                data_field = data_details[me.col_sum_fields_idx[i]];
            }
            data_fields.push(data_field);
        }
        for (let i = 0; i < me.sortedRowSequence.length; i++) { //seg level
            if (me.sortedRowSequence[i].length > 0) {
                me.col_sum_fields_value_total.push([]);
                for (let j = 0; j < me.sortedRowSequence[i].length; j++) {
                    let rowGrandTotal = [];
                    for (let di = 0; di < data_fields.length; di++) {
                        rowGrandTotal.push(0.0);
                        for (let k = 0; k < me.sortedRowSequence[i][j].length; k++) {
                            // 3. start to sum
                            let vTtl = parseFloat(JpcFieldHelper.getValue(data_fields[di], me.sortedRowSequence[i][j][k]));
                            if (isNaN(vTtl)) {
                                vTtl = 0;
                            }
                            rowGrandTotal[di] = rowGrandTotal[di] + vTtl;
                        }
                    }
                    me.col_sum_fields_value_total[i].push(rowGrandTotal);
                }
            }
        }
    }
    ;
    preSetupPages(rptTpl, defProperties, option) {
        let me = this, rst = 0;
        me.paging_option = option || JV.PAGING_OPTION_NORMAL;
        //1. original initialize
        let maxRowRec = 1, maxColRec = 1, counterRowRec = 0, counterColRec = 0, pageIdx = 0, segCnt = me.sortedContentSequence.length;
        let pageStatus = [true, true, false, true, false, false, false, false];
        //2. calculate the page info one by one
        let bands = JpcBand.createNew(rptTpl, defProperties);
        function private_resetBandArea() {
            JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, false, false);
            maxRowRec = JpcCrossTabHelper.getMaxRowsPerPage(bands, rptTpl);
            maxColRec = JpcCrossTabHelper.getMaxColsPerPage(bands, rptTpl);
        }
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.交叉表_信息.交叉行拓展.cross_field_s, null, me.row_extension_fields_idx, false);
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl.交叉表_信息.交叉行拓展合计.cross_field_s, null, me.row_sum_extension_fields_idx, false);
        if (me.paging_option === JV.PAGING_OPTION_INFINITY) ;
        else {
            for (let segIdx = 0; segIdx < segCnt; segIdx++) {
                //2.1. seg level initialize
                private_resetBandArea();
                let orgMaxRowRec = maxRowRec, orgMaxColRec = maxColRec;
                let rowSplitCnt = Math.ceil(1.0 * me.sortedRowSequence[segIdx].length / maxRowRec);
                let colSplitCnt = Math.ceil(1.0 * me.sortedColSequence[segIdx].length / maxColRec);
                pageStatus[JV.STATUS_CROSS_ROW_END] = true;
                private_resetBandArea();
                let hasAdHocRow = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
                if (hasAdHocRow) {
                    hasAdHocRow = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_EXT, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
                }
                pageStatus[JV.STATUS_CROSS_ROW_END] = false;
                pageStatus[JV.STATUS_CROSS_COL_END] = true;
                private_resetBandArea();
                let hasAdHocCol = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
                pageStatus[JV.STATUS_CROSS_COL_END] = false;
                private_resetBandArea();
                if (hasAdHocRow)
                    rowSplitCnt++;
                if (hasAdHocCol)
                    colSplitCnt++;
                //2.2
                if (rptTpl.主信息.打印页面_信息.cross_display_order === JV.PAGE_ORIENTATION_H_FIRST) {
                    for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
                        pageStatus[JV.STATUS_CROSS_ROW_END] = (rowIdx === (rowSplitCnt - 1));
                        private_resetBandArea();
                        counterRowRec = orgMaxRowRec * rowIdx;
                        let currentSortedRowSequence = me.sortedRowSequence;
                        let currentSortedContentSequence = me.sortedContentSequence;
                        if (hasAdHocRow && rowIdx === (rowSplitCnt - 1)) {
                            currentSortedRowSequence = null;
                            currentSortedContentSequence = null;
                            counterRowRec = 0;
                        }
                        for (let colIdx = 0; colIdx < colSplitCnt; colIdx++) {
                            pageStatus[JV.STATUS_CROSS_COL_END] = (colIdx === (colSplitCnt - 1));
                            private_resetBandArea();
                            counterColRec = orgMaxColRec * colIdx;
                            let currentSortedColSequence = me.sortedColSequence;
                            if (hasAdHocCol && colIdx === (colSplitCnt - 1)) {
                                currentSortedColSequence = null;
                                currentSortedContentSequence = null;
                                counterColRec = 0;
                            }
                            me.pageStatusLst.push(pageStatus.slice(0));
                            pageIdx++;
                            _addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
                            _addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, null, null);
                            _addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
                        }
                    }
                }
                else {
                    for (let colIdx = 0; colIdx < colSplitCnt; colIdx++) {
                        pageStatus[JV.STATUS_CROSS_COL_END] = (colIdx === (colSplitCnt - 1));
                        private_resetBandArea();
                        counterColRec = orgMaxColRec * colIdx;
                        let currentSortedContentSequence = me.sortedContentSequence;
                        let currentSortedColSequence = me.sortedColSequence;
                        if (hasAdHocCol && colIdx === (colSplitCnt - 1)) {
                            currentSortedColSequence = null;
                            currentSortedContentSequence = null;
                            counterColRec = 0;
                        }
                        for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
                            pageStatus[JV.STATUS_CROSS_ROW_END] = (rowIdx === (rowSplitCnt - 1));
                            private_resetBandArea();
                            me.pageStatusLst.push(pageStatus.slice(0));
                            pageIdx++;
                            counterRowRec = orgMaxRowRec * rowIdx;
                            let currentSortedRowSequence = me.sortedRowSequence;
                            if (hasAdHocRow && rowIdx === (rowSplitCnt - 1)) {
                                currentSortedRowSequence = null;
                                currentSortedContentSequence = null;
                                counterRowRec = 0;
                            }
                            _addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
                            _addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, null, null);
                            _addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
                        }
                    }
                }
                JpcCrossTabHelper.initialPageStatus(pageStatus);
            }
            //3. set pageSeq and return the result
            rst = pageIdx;
        }
        // bands = null;
        return rst;
    }
    ;
    outputAsPreviewPage(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        let pageStatus = [true, true, true, true, true, true, true, true];
        me.pageStatusLst.push(pageStatus);
        // JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS], null, me.disp_fields_idx, false);
        JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, true, false);
        let maxRowRec = JpcCrossTabHelper.getMaxRowsPerPage(bands, rptTpl);
        let maxColRec = JpcCrossTabHelper.getMaxColsPerPage(bands, rptTpl);
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        //1. 交叉行
        rst = rst.concat(me.outputPreviewRowTab(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, unitFactor));
        //2. 交叉列
        rst = rst.concat(me.outputPreviewColTab(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxColRec, unitFactor));
        //3. 交叉数据
        rst = rst.concat(me.outputPreviewContent(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, maxColRec, unitFactor));
        //4. 交叉行拓展
        rst = rst.concat(me.outputPreviewTabExt(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxColRec, unitFactor));
        //5. 交叉行拓展合计
        rst = rst.concat(me.outputPreviewSumTabExt(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, unitFactor));
        //6. 交叉列合计
        rst = rst.concat(me.outputPreviewTabSum(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, '交叉列合计', unitFactor));
        //7. 离散
        rst = rst.concat(JpcDiscreteHelper.outputPreviewDiscreteInfo(rptTpl.交叉表_信息.离散信息, bands, unitFactor, pageStatus));
        return rst;
    }
    ;
    outputPreviewContent(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, maxColRec, unitFactor) {
        return this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, maxColRec, rptTpl.交叉表_信息.交叉数据, unitFactor);
    }
    ;
    outputPreviewRowTab(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, unitFactor) {
        let rst = this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, 1, rptTpl.交叉表_信息.交叉行, unitFactor);
        rst = rst.concat(this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, 1, rptTpl.交叉表_信息.交叉行AD_HOC, unitFactor));
        return rst;
    }
    ;
    outputPreviewColTab(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxColRec, unitFactor) {
        return this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, 1, maxColRec, rptTpl.交叉表_信息.交叉列, unitFactor);
    }
    ;
    outputPreviewTabExt(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxColRec, unitFactor) {
        //交叉行拓展
        return this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, 1, maxColRec, rptTpl.交叉表_信息.交叉行拓展, unitFactor);
    }
    ;
    outputPreviewSumTabExt(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, unitFactor) {
        //交叉行拓展合计
        return this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, 1, 1, rptTpl.交叉表_信息.交叉行拓展合计, unitFactor);
    }
    ;
    outputPreviewTabSum(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, tabNodeName, unitFactor) {
        return this.private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, 1, rptTpl.交叉表_信息[tabNodeName], unitFactor);
    }
    ;
    private_OutputPreviewCommon(rptTpl, bands, controls, $CURRENT_RPT, customizeCfg, maxRowRec, maxColRec, tab, unitFactor) {
        let me = this, rst = [];
        let band = (tab) ? bands[tab.BandName] : null;
        if (band) {
            let tab_fields = tab.cross_field_s;
            for (let rowIdx = 0; rowIdx < maxRowRec; rowIdx++) {
                for (let i = 0; i < tab_fields.length; i++) {
                    let tab_field = tab_fields[i];
                    if (!(tab_field.Hidden)) {
                        for (let colIdx = 0; colIdx < maxColRec; colIdx++) {
                            if (tab_field.isSerial) {
                                rst.push(me.outputTabField(band, tab_field, [rowIdx + 1], 0, -1, maxRowRec, rowIdx, maxColRec, colIdx, unitFactor, false, controls));
                            }
                            else {
                                rst.push(me.outputTabField(band, tab_field, null, -1, -1, maxRowRec, rowIdx, maxColRec, colIdx, unitFactor, false, controls));
                            }
                        }
                    }
                }
                if (tab.text_s) {
                    for (let j = 0; j < tab.text_s.length; j++) {
                        for (let colIdx = 0; colIdx < maxColRec; colIdx++) {
                            rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, maxRowRec, rowIdx, maxColRec, colIdx, 1, 0));
                        }
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], tabRstLst = [];
        let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
        if (me.paging_option === JV.PAGING_OPTION_INFINITY) ;
        else {
            let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
            //1 calculate the band position
            JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], false, false);
            //2. start to output detail-part
            //2.1 Row-Tab
            //tabRstLst.push(me.outputRowTab(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            tabRstLst.push(me.outputRowTabCommon(rptTpl, dataObj, page, bands, JV.NODE_CROSS_ROW, me.row_fields_idx, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            tabRstLst.push(me.outputRowTabCommon(rptTpl, dataObj, page, bands, JV.NODE_CROSS_ROW_AD_HOC, me.row_fields_adhoc_idx, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            //2.2 Col-Tab
            tabRstLst.push(me.outputColTab(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            //2.3 Content-Tab
            tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            //2.4 Sum-Tab Row
            //2.4 Sum-tab Col
            tabRstLst.push(me.outputTabSum(rptTpl, dataObj, page, bands, unitFactor, JV.NODE_CROSS_COL_SUM, controls, $CURRENT_RPT, customizeCfg));
            //2.x row tab ext
            tabRstLst.push(me.outputTabExt(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
            tabRstLst.push(me.outputSumTabExt(rptTpl, dataObj, page, bands, unitFactor, segIdx, controls, $CURRENT_RPT, customizeCfg));
            //2.5 Discrete
            tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl.交叉表_信息.离散信息, bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, 1, 0, $CURRENT_RPT, customizeCfg));
        }
        for (let i = 0; i < tabRstLst.length; i++) {
            rst = rst.concat(tabRstLst[i]);
            tabRstLst[i] = null;
        }
        return rst;
    }
    ;
    outputTabSum(rptTpl, dataObj, page, bands, unitFactor, tabNodeName, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], tab = rptTpl.交叉表_信息[tabNodeName], band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true) {
                let tab_fields = tab.cross_field_s;
                for (let i = 0; i < me.dispSumValueLst_Col[page - 1].length; i++) {
                    if (i === 0) {
                        for (let tfIdx = 0; tfIdx < tab_fields.length; tfIdx++) {
                            let map_data_field = JE.F(tab_fields[tfIdx].FieldID, $CURRENT_RPT);
                            JpcFieldHelper.resetFormat(tab_fields[tfIdx], map_data_field, customizeCfg);
                        }
                    }
                    if (me.dispSumValueLst_Col[page - 1][i] !== null) {
                        for (let j = 0; j < me.dispSumValueLst_Col[page - 1][i].length; j++) {
                            let tab_field = tab_fields[j];
                            let val = me.dispSumValueLst_Col[page - 1][i][j];
                            let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
                            cellItem.area = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, me.dispSumValueLst_Col[page - 1].length, i, 1, 0, 1, 0, true, false);
                            rst.push(cellItem);
                        }
                    }
                    else {
                        let sumL = 1;
                        for (let si = 0; si < me.dispSumValueLst_Col.length; si++) {
                            if (me.dispSumValueLst_Col[si][0] !== null) {
                                sumL = me.dispSumValueLst_Col[si][0].length;
                                break;
                            }
                        }
                        for (let j = 0; j < sumL; j++) {
                            let tab_field = tab_fields[j];
                            let val = null;
                            let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
                            cellItem.area = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, me.dispSumValueLst_Col[page - 1].length, i, 1, 0, 1, 0, true, false);
                            rst.push(cellItem);
                        }
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputTabExt(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], firstTextOutput = true, tab = rptTpl.交叉表_信息.交叉行拓展;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true) {
                let tab_fields = tab.cross_field_s, data_details = dataObj[exports.IDataObjProps.detail_data], valuesIdx = me.dispValueIdxLst_Col[page - 1];
                for (let i = 0; i < me.row_extension_fields_idx.length; i++) {
                    let tab_field = tab_fields[i];
                    let data_field = null;
                    let map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                    if (typeof me.row_extension_fields_idx[i] !== 'object') {
                        data_field = data_details[me.row_extension_fields_idx[i]];
                    }
                    else {
                        if (map_data_field) {
                            data_field = map_data_field.data_field;
                        }
                    }
                    if (!(tab_field.Hidden)) {
                        let cols = valuesIdx.length;
                        for (let colIdx = 0; colIdx < cols; colIdx++) {
                            if (colIdx === 0)
                                JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                            rst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[colIdx], -1, 1, 0, cols, colIdx, unitFactor, false, controls));
                            //2. output texts if has
                            if (firstTextOutput) {
                                if (tab.text) {
                                    rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                }
                                if (tab.text_s) {
                                    for (let j = 0; j < tab.text_s.length; j++) {
                                        rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                    }
                                }
                            }
                        }
                        firstTextOutput = false;
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputSumTabExt(rptTpl, dataObj, page, bands, unitFactor, segIdx, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], tab = rptTpl.交叉表_信息.交叉行拓展合计;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true && pageStatus[6] === true) {
                let tab_fields = tab.cross_field_s, data_details = dataObj[exports.IDataObjProps.detail_data], data_fields = [];
                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 tab_field = tab_fields[i];
                    let data_field = null;
                    let map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                    if (typeof me.row_sum_extension_fields_idx[i] !== 'object') {
                        data_field = data_details[me.row_sum_extension_fields_idx[i]];
                    }
                    else {
                        if (map_data_field) {
                            data_field = map_data_field.data_field;
                        }
                    }
                    JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                    data_fields.push(data_field);
                }
                //2. initialize grand total value
                let rowGrandTotal = [];
                for (let di = 0; di < data_fields.length; di++) {
                    rowGrandTotal[di] = 0.0;
                    //3. start to sum
                    for (let i = 0; i < me.sortedColSequence[segIdx].length; i++) {
                        //me.sortedColSequence[segIdx][i][0] //this is the data field value index!
                        rowGrandTotal[di] = rowGrandTotal[di] + 1.0 * parseFloat(JpcFieldHelper.getValue(data_fields[di], me.sortedColSequence[segIdx][i][0]));
                    }
                }
                //4. output
                for (let di = 0; di < tab_fields.length; di++) {
                    let tab_field = tab_fields[di];
                    if (!tab_field.Hidden) {
                        let val = rowGrandTotal[di];
                        let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
                        cellItem.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                        rst.push(cellItem);
                    }
                }
                //output texts if has
                if (tab.text) {
                    rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, 1, 0, 1, 0));
                }
                if (tab.text_s) {
                    for (let j = 0; j < tab.text_s.length; j++) {
                        rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, 1, 0, 1, 0));
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        let tab = rptTpl.交叉表_信息.交叉数据;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true) {
                let tab_fields = tab.cross_field_s;
                let data_details = dataObj[exports.IDataObjProps.detail_data];
                let contentValuesIdx = me.dispValueIdxLst_Content[page - 1];
                let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
                for (let i = 0; i < tab_fields.length; i++) {
                    let tab_field = tab_fields[i];
                    let data_field = null;
                    let map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                    if (typeof me.content_fields_idx[i] !== 'object') {
                        data_field = data_details[me.content_fields_idx[i]];
                    }
                    else {
                        if (map_data_field) {
                            data_field = map_data_field.data_field;
                        }
                    }
                    if (!(tab_field.Hidden)) {
                        let rows = contentValuesIdx.length;
                        for (let rowIdx = 0; rowIdx < rows; rowIdx++) {
                            let cols = contentValuesIdx[rowIdx].length;
                            for (let colIdx = 0; colIdx < cols; colIdx++) {
                                if (map_data_field && map_data_field.Precision && map_data_field.flexiblePrecisionRefObj && map_data_field.Precision.flexibleRefFieldID) {
                                    if (flexiblePrecisionRefObj === null) {
                                        flexiblePrecisionRefObj = {};
                                        flexibleRefField = JE.F(map_data_field.Precision.flexibleRefFieldID, $CURRENT_RPT);
                                        if (flexibleRefField && flexibleRefField.DataSeq)
                                            precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
                                        for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                            flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                        }
                                    }
                                    JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, contentValuesIdx[rowIdx][colIdx], customizeCfg);
                                }
                                else {
                                    if (colIdx === 0)
                                        JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                                }
                                rst.push(me.outputTabField(band, tab_field, data_field, contentValuesIdx[rowIdx][colIdx], -1, rows, rowIdx, cols, colIdx, unitFactor, true, controls));
                            }
                        }
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputColTab(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [], firstTextOutput = true;
        let tab = rptTpl.交叉表_信息.交叉列;
        let band = bands[tab.BandName];
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true) {
                let tab_fields = tab.cross_field_s;
                let data_details = dataObj[exports.IDataObjProps.detail_data];
                let valuesIdx = me.dispValueIdxLst_Col[page - 1];
                let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
                for (let i = 0; i < me.col_fields_idx.length; i++) {
                    let tab_field = tab_fields[i];
                    if (!(tab_field.Hidden)) {
                        let mergedRst = [];
                        let data_field = null;
                        let map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                        if (typeof me.col_fields_idx[i] !== 'object') {
                            data_field = data_details[me.col_fields_idx[i]];
                        }
                        else {
                            if (map_data_field) {
                                data_field = map_data_field.data_field;
                            }
                        }
                        let cols = valuesIdx.length;
                        for (let colIdx = 0; colIdx < cols; colIdx++) {
                            if (map_data_field && map_data_field.Precision && map_data_field.flexiblePrecisionRefObj && map_data_field.Precision.flexibleRefFieldID) {
                                if (flexiblePrecisionRefObj === null) {
                                    flexiblePrecisionRefObj = {};
                                    flexibleRefField = JE.F(map_data_field.Precision.flexibleRefFieldID, $CURRENT_RPT);
                                    if (flexibleRefField && flexibleRefField.DataSeq)
                                        precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
                                    for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                        flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                    }
                                }
                                JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, valuesIdx[colIdx], customizeCfg);
                            }
                            else {
                                if (colIdx === 0)
                                    JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                            }
                            mergedRst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[colIdx], -1, 1, 0, cols, colIdx, unitFactor, false, controls));
                            //rst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[colIdx], -1, 1, 0, cols, colIdx, unitFactor, false, controls));
                            //2. output texts
                            if (firstTextOutput) {
                                if (tab.text) {
                                    // mergedRst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                    rst.push(JpcTextHelper.outputText(tab.text, band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                }
                                if (tab.text_s) {
                                    for (let j = 0; j < tab.text_s.length; j++) {
                                        // mergedRst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                        rst.push(JpcTextHelper.outputText(tab.text_s[j], band, unitFactor, 1, 0, cols, colIdx, 1, 0));
                                    }
                                }
                            }
                        }
                        firstTextOutput = false;
                        //判断是否需要合并
                        if (tab_field.isMerge && mergedRst.length > 1) {
                            let lastCell = mergedRst[mergedRst.length - 1];
                            for (let mergeIdx = mergedRst.length - 2; mergeIdx >= 0; mergeIdx--) {
                                if (lastCell.Value === mergedRst[mergeIdx].Value) {
                                    mergedRst[mergeIdx].area.Right = lastCell.area.Right;
                                    mergedRst.splice(mergeIdx + 1, 1);
                                }
                                lastCell = mergedRst[mergeIdx];
                            }
                        }
                        rst = rst.concat(mergedRst);
                    }
                }
            }
        }
        return rst;
    }
    ;
    outputRowTabCommon(rptTpl, dataObj, page, bands, tabStr, rowFieldsIdxArr, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
        let me = this, rst = [];
        let tab = rptTpl.交叉表_信息[tabStr];
        let band = (tab) ? bands[tab.BandName] : null;
        if (band) {
            let pageStatus = me.pageStatusLst[page - 1];
            if (pageStatus[(band.DisplayType)] === true) {
                let tab_fields = tab.cross_field_s;
                let data_details = dataObj[exports.IDataObjProps.detail_data];
                let valuesIdx = me.dispValueIdxLst_Row[page - 1];
                let serialsIdx = me.dispSerialIdxLst_Row[page - 1];
                let flexiblePrecisionRefObj = null, flexibleRefField = null, precision_ref_data = null;
                for (let i = 0; i < rowFieldsIdxArr.length; i++) {
                    let tab_field = tab_fields[i];
                    if (!(tab_field.Hidden)) {
                        let data_field = null;
                        let map_data_field = JE.F(tab_field.FieldID, $CURRENT_RPT);
                        if (typeof rowFieldsIdxArr[i] !== 'object') {
                            data_field = data_details[rowFieldsIdxArr[i]];
                        }
                        else {
                            if (map_data_field) {
                                data_field = map_data_field.data_field;
                            }
                        }
                        let rows = valuesIdx.length;
                        for (let rowIdx = 0; rowIdx < rows; rowIdx++) {
                            if (map_data_field && map_data_field.Precision && map_data_field.flexiblePrecisionRefObj && map_data_field.Precision.flexibleRefFieldID) {
                                if (flexiblePrecisionRefObj === null) {
                                    flexiblePrecisionRefObj = {};
                                    flexibleRefField = JE.F(map_data_field.Precision.flexibleRefFieldID, $CURRENT_RPT);
                                    if (flexibleRefField && flexibleRefField.DataSeq)
                                        precision_ref_data = dataObj[map_data_field.DataNodeName][flexibleRefField.DataSeq];
                                    for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
                                        flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
                                    }
                                }
                                JpcFieldHelper.resetFlexibleFormat(tab_field, precision_ref_data, flexiblePrecisionRefObj, valuesIdx[rowIdx], customizeCfg);
                            }
                            else {
                                if (rowIdx === 0)
                                    JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
                            }
                            rst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[rowIdx], serialsIdx[rowIdx], rows, rowIdx, 1, 0, unitFactor, true, controls));
                        }
                    }
                }
            }
        }
        return rst;
    }
    ;
    //暂定
    outputTabField(band, tab_field, data_field, valueIdx, serialIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls) {
        let rst = null;
        if (isRow === true && tab_field.isSerial && tab_field.isSerial === true) {
            if (serialIdx >= 0) {
                rst = JpcCommonOutputHelper.createCommonOutput(tab_field, serialIdx + 1, null);
            }
            else
                rst = JpcCommonOutputHelper.createCommonOutput(tab_field, "", controls);
        }
        else {
            rst = JpcCommonOutputHelper.createCommonOutput(tab_field, JpcFieldHelper.getValue(data_field, valueIdx), controls);
        }
        //position
        if (isRow === true) {
            rst.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, rows, rowIdx, cols, colIdx, 1, 0, true, false);
        }
        else {
            rst.area = JpcAreaHelper.outputArea(tab_field.area, band, unitFactor, rows, rowIdx, cols, colIdx, 1, 0, false, false);
        }
        return rst;
    }
    ;
}
function _addTabValue(tabValuedIdxLst, sortedSequence, segIdx, preRec, nextRec, dispSerialIdxLst, sorted_sum_value_Lst, rst_sum_value_Lst) {
    if (tabValuedIdxLst) {
        let serial1stTier = null;
        if (dispSerialIdxLst)
            serial1stTier = [];
        let pgseg1stTier = [];
        let sumVal = [];
        let sumValL = 1;
        if (sortedSequence) {
            let arrDupVals = sortedSequence[segIdx];
            let arrDupSumVals = null;
            if (sorted_sum_value_Lst !== null) {
                arrDupSumVals = sorted_sum_value_Lst[segIdx];
                sumValL = arrDupSumVals[0].length;
            }
            for (let i = 0; i < nextRec; i++) {
                if (arrDupVals.length <= preRec + i) {
                    pgseg1stTier[i] = JV.BLANK_VALUE_INDEX;
                    sumVal[i] = [];
                    for (let ei = 0; ei < sumValL; ei++) {
                        sumVal[i][ei] = null;
                    }
                    if (serial1stTier !== null) {
                        serial1stTier[i] = JV.BLANK_VALUE_INDEX;
                    }
                    continue;
                }
                let duplicateValueArr = arrDupVals[preRec + i];
                pgseg1stTier[i] = duplicateValueArr[0];
                if (arrDupSumVals !== null)
                    sumVal[i] = arrDupSumVals[preRec + i];
                if (serial1stTier !== null) {
                    serial1stTier[i] = preRec + i;
                }
            }
            tabValuedIdxLst.push(pgseg1stTier);
            if (dispSerialIdxLst !== null) {
                dispSerialIdxLst.push(serial1stTier);
            }
            if (sorted_sum_value_Lst !== null && rst_sum_value_Lst !== null) {
                rst_sum_value_Lst.push(sumVal);
            }
        }
        else {
            //should push blank value index rather than null
            for (let i = 0; i < nextRec; i++) {
                pgseg1stTier[i] = JV.BLANK_VALUE_INDEX;
                sumVal[i] = null;
                if (serial1stTier !== null) {
                    serial1stTier[i] = JV.BLANK_VALUE_INDEX;
                }
            }
            tabValuedIdxLst.push(pgseg1stTier);
            if (dispSerialIdxLst !== null) {
                dispSerialIdxLst.push(serial1stTier);
            }
            if (sorted_sum_value_Lst !== null && rst_sum_value_Lst !== null) {
                rst_sum_value_Lst.push(sumVal);
            }
        }
    }
}
function _addContentValue(dispValueIdxLst_Content, sortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, page_seg_map, pageIdx) {
    if (dispValueIdxLst_Content !== null) {
        page_seg_map.push([pageIdx, segIdx]);
        let arrContents = [];
        if (sortedContentSequence !== null) {
            let arrAllContent = sortedContentSequence[segIdx];
            for (let i = 0; i < maxRowRec; i++) {
                arrContents.push([]);
                for (let j = 0; j < maxColRec; j++) {
                    if (arrAllContent.length <= counterRowRec + i || arrAllContent[counterRowRec + i].length <= counterColRec + j) {
                        arrContents[i][j] = JV.BLANK_VALUE_INDEX;
                    }
                    else {
                        arrContents[i][j] = arrAllContent[counterRowRec + i][counterColRec + j];
                    }
                }
            }
            dispValueIdxLst_Content.push(arrContents);
        }
        else {
            //should push blank value index rather than null
            for (let i = 0; i < maxRowRec; i++) {
                arrContents.push([]);
                for (let j = 0; j < maxColRec; j++) {
                    arrContents[i][j] = JV.BLANK_VALUE_INDEX;
                }
            }
            dispValueIdxLst_Content.push(arrContents);
        }
    }
}
function _SortAndOptimize(rptTpl, dataObj, dataSeq, sortTab, rstFieldsIdx, $CURRENT_RPT) {
    let result = [];
    let tab = rptTpl.交叉表_信息[sortTab];
    if (tab) {
        let sIDX = 0;
        //1. prepare and sort by tab-field
        let fields = [];
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, tab.cross_field_s, fields, rstFieldsIdx, false);
        let data_details = dataObj[exports.IDataObjProps.detail_data];
        JpcCrossTabHelper.sortTabFields(fields, rstFieldsIdx, data_details, dataSeq, $CURRENT_RPT);
        //2. distinguish sort tab fields value
        let b1 = false;
        for (let i = 0; i < dataSeq.length; i++) {
            sIDX = 0;
            let segArr = [];
            if (dataSeq[i].length === 1) {
                JpcCrossTabHelper.pushToSeg(segArr, dataSeq, i, 0, 1);
            }
            else {
                for (let j = 1; j < dataSeq[i].length; j++) {
                    b1 = false;
                    for (let k = 0; k < rstFieldsIdx.length; k++) {
                        if (fields[k].hasOwnProperty(JV.TAB_FIELD_PROP_SORT)) {
                            //只有被选择了作为排序字段的才进入排序及优化
                            if (typeof (rstFieldsIdx[k]) === 'object') {
                                let map_data_field = JE.F(rstFieldsIdx[k].ID, $CURRENT_RPT);
                                if (map_data_field && map_data_field.data_field[dataSeq[i][j - 1]] !== map_data_field.data_field[dataSeq[i][j]]) {
                                    b1 = true;
                                    break;
                                }
                            }
                            else {
                                if (data_details[rstFieldsIdx[k]][dataSeq[i][j - 1]] !== data_details[rstFieldsIdx[k]][dataSeq[i][j]]) {
                                    b1 = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (b1) {
                        JpcCrossTabHelper.pushToSeg(segArr, dataSeq, i, sIDX, j);
                        sIDX = j;
                        if (j === dataSeq[i].length - 1) {
                            JpcCrossTabHelper.pushToSeg(segArr, dataSeq, i, j, dataSeq[i].length);
                        }
                    }
                    else if (j === dataSeq[i].length - 1) {
                        JpcCrossTabHelper.pushToSeg(segArr, dataSeq, i, sIDX, dataSeq[i].length);
                    }
                }
            }
            if (segArr.length > 0)
                result.push(segArr);
        }
    }
    return result;
}
function _SortForDisplayContent(rptTpl, rowSeq, colSeq, rstFieldsIdx) {
    let result = [];
    let tab = rptTpl.交叉表_信息.交叉数据;
    if (tab) {
        JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, tab.cross_field_s, [], rstFieldsIdx, false);
    }
    for (let i = 0; i < rowSeq.length; i++) {
        let rl = rowSeq[i], cl = colSeq[i];
        let ds = [];
        //1. initialize to blank value index
        for (let j = 0; j < rl.length; j++) {
            ds.push([]);
            for (let k = 0; k < cl.length; k++) {
                ds[j].push(JV.BLANK_VALUE_INDEX);
            }
        }
        //2. then fill up the right index
        for (let j = 0; j < rl.length; j++) {
            let ra = rl[j];
            for (let k = 0; k < ra.length; k++) {
                let colIdx = JpcCrossTabHelper.getColIDX(cl, ra[k]);
                if (colIdx >= 0) {
                    ds[j][colIdx] = ra[k];
                }
            }
        }
        result.push(ds);
    }
    return result;
}

const JpcField = {
    createNew(rptTpl) {
        let me = this;
        let JpcFieldResult = {
            离散指标_集合: {},
            主数据指标_集合: {},
            从数据指标_集合: {},
            无映射离散指标_集合: {},
            主数据指标_拓展集合: {},
            从数据指标_拓展集合: {}
        };
        if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.离散指标_集合) {
            for (let i = 0; i < rptTpl.指标_数据_映射.离散指标_集合.length; i++) {
                me.createSingle(rptTpl.指标_数据_映射.离散指标_集合[i], JpcFieldResult.离散指标_集合, exports.IDataObjProps.discrete_data, i);
            }
        }
        if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_集合) {
            for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_集合.length; i++) {
                me.createSingle(rptTpl.指标_数据_映射.主数据指标_集合[i], JpcFieldResult.主数据指标_集合, exports.IDataObjProps.master_data, i);
            }
        }
        if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_集合) {
            for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_集合.length; i++) {
                me.createSingle(rptTpl.指标_数据_映射.从数据指标_集合[i], JpcFieldResult.从数据指标_集合, exports.IDataObjProps.detail_data, i);
            }
        }
        if (rptTpl.无映射离散指标_集合) {
            for (let i = 0; i < rptTpl.无映射离散指标_集合.length; i++) {
                me.createSingle(rptTpl.无映射离散指标_集合[i], JpcFieldResult.无映射离散指标_集合, "NA", -10);
            }
        }
        if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.主数据指标_拓展集合) {
            for (let i = 0; i < rptTpl.指标_数据_映射.主数据指标_拓展集合.length; i++) {
                me.createSingle(rptTpl.指标_数据_映射.主数据指标_拓展集合[i], JpcFieldResult.主数据指标_拓展集合, exports.IDataObjProps.master_data_ex, i);
            }
        }
        if (rptTpl.指标_数据_映射 && rptTpl.指标_数据_映射.从数据指标_拓展集合) {
            for (let i = 0; i < rptTpl.指标_数据_映射.从数据指标_拓展集合.length; i++) {
                me.createSingle(rptTpl.指标_数据_映射.从数据指标_拓展集合[i], JpcFieldResult.从数据指标_拓展集合, exports.IDataObjProps.detail_data_ex, i);
            }
        }
        //NODE_MASTER_FIELDS_EX
        return JpcFieldResult;
    },
    createSingle(fieldNode, parentObj, dataNodeName, sequence) {
        if (fieldNode && fieldNode.ID) {
            let item = {
                ID: fieldNode.ID,
                Name: fieldNode.Name,
                DataType: fieldNode.DataType,
                // Precision : null//  edit by lish
                Precision: {}
            };
            if (fieldNode.Precision) {
                item.Precision = {};
                item.Precision.type = fieldNode.Precision.type;
                if (fieldNode.Precision.type === 'fixed') {
                    item.fixedPrecisionNum = fieldNode.fixedPrecisionNum;
                }
                else {
                    item.Precision.flexibleRefFieldID = fieldNode.Precision.flexibleRefFieldID;
                    item.flexiblePrecisionRefObj = fieldNode.flexiblePrecisionRefObj;
                }
            }
            item.DataNodeName = dataNodeName;
            item.DataSeq = sequence;
            parentObj["ID_" + fieldNode.ID] = item;
        }
    }
};

const JpcParam = {
    createNew(rptTpl) {
        let JpcParamResult = {};
        let me = this;
        if (rptTpl.离散参数_集合) {
            for (let i = 0; i < rptTpl.离散参数_集合.length; i++) {
                me.createSingle(rptTpl.离散参数_集合[i], JpcParamResult, i);
            }
        }
        return JpcParamResult;
    },
    createSingle(paramNode, parentObj, sequence) {
        if (paramNode && paramNode.ID) {
            const item = {
                ID: paramNode.ID,
                Name: paramNode.Name,
                DataType: paramNode.DataType,
                Default_Value: (paramNode.Default_Value) ? paramNode.Default_Value : null,
                DataSeq: sequence
            };
            parentObj[JV.PROP_ID + '_' + paramNode.ID] = item;
        }
    }
};

const JpcFunc = {
    createNew(rptTpl) {
        let rst = [];
        if (rptTpl.计算式_集合) {
            for (let i = 0; i < rptTpl.计算式_集合.length; i++) {
                let item = { ...rptTpl.计算式_集合[i] }; // 新的copy规范
                // let propArr = Object.getOwnPropertyNames(rptTpl[JV.NODE_FORMULAS][i]);
                // for (let key of propArr) {
                //     item[key] = rptTpl[JV.NODE_FORMULAS][i][key];
                // }
                rst.push(item);
            }
        }
        return rst;
    }
};

/**
 * Created by Tony on 2019/5/17.
 */
const JpcEvent = {
    createNew(rptTpl) {
        let rst = {
            GRP_ON_CREATE: {},
            FLOW_CONTENT_ON_CREATE: {} //bylish
        };
        if (rptTpl.事件_集合) {
            for (let i = 0; i < rptTpl.事件_集合.length; i++) {
                let item = { ...rptTpl.事件_集合[i] };
                // let propArr = Object.getOwnPropertyNames(rptTpl[JV.NODE_EVENTS][i]);
                // for (let key of propArr) {
                //     item[key] = rptTpl[JV.NODE_EVENTS][i][key];
                // }
                const event_type = [exports.IEventType.GRP_ON_CREATE, exports.IEventType.FLOW_CONTENT_ON_CREATE];
                switch (event_type.indexOf(item.type)) {
                    case JV.EVENT_IDX_GRP_ON_CREATE:
                        rst.FLOW_CONTENT_ON_CREATE = item;
                        break;
                    case JV.EVENT_IDX_FLOW_CONTENT_ON_CREATE:
                        rst.FLOW_CONTENT_ON_CREATE = item;
                        break;
                }
                //rst.push(item);
            }
        }
        return rst;
    }
};

const JpcData = {
    createNew() {
        let JpcDataRst = {
            dataSeq: [],
            exDataSeq: [],
            analyzeData(rptTpl, dataObj) {
                let me = this;
                let _analyse = function (MASTER_FIELD_STR, DETAIL_FIELD_STR, MASTER_DATA_STR, DETAIL_DATA_STR, dataSeqArr) {
                    //1. get ID fields
                    let masterIDs = [];
                    if (rptTpl.指标_数据_映射[MASTER_FIELD_STR]) {
                        for (let i = 0; i < rptTpl.指标_数据_映射[MASTER_FIELD_STR].length; i++) {
                            let mstFieldObj = rptTpl.指标_数据_映射[MASTER_FIELD_STR][i];
                            if (JpcCommonHelper.getBoolean(mstFieldObj.isID)) {
                                masterIDs.push({ "idx": i, "seq": mstFieldObj.IDSeq });
                            }
                        }
                    }
                    let detailIDs = [];
                    if (rptTpl.指标_数据_映射[DETAIL_FIELD_STR]) {
                        for (let i = 0; i < rptTpl.指标_数据_映射[DETAIL_FIELD_STR].length; i++) {
                            let dtlFieldObj = rptTpl.指标_数据_映射[DETAIL_FIELD_STR][i];
                            if (JpcCommonHelper.getBoolean(dtlFieldObj.isID)) {
                                detailIDs.push({ "idx": i, "seq": dtlFieldObj.IDSeq });
                            }
                        }
                    }
                    //2. sort the ID fields
                    if (masterIDs.length > 1) {
                        masterIDs.sort(function (a, b) {
                            return 1 * a["seq"] - 1 * b["seq"];
                        });
                    }
                    if (detailIDs.length > 1) {
                        detailIDs.sort(function (a, b) {
                            return 1 * a["seq"] - 1 * b["seq"];
                        });
                    }
                    //3. prepare data sequence
                    if (masterIDs.length > 0) {
                        let mst_dt_len = 0, dtl_dt_len = 0, mst_fields = [];
                        for (let i = 0; i < masterIDs.length; i++) {
                            mst_fields.push(dataObj[MASTER_DATA_STR][masterIDs[i]["idx"]]);
                            mst_dt_len = dataObj[MASTER_DATA_STR][masterIDs[i]["idx"]].length;
                        }
                        let dtl_fields = [];
                        for (let i = 0; i < detailIDs.length; i++) {
                            dtl_fields.push(dataObj[DETAIL_DATA_STR][detailIDs[i]["idx"]]);
                            dtl_dt_len = dataObj[DETAIL_DATA_STR][detailIDs[i]["idx"]].length;
                        }
                        let sIdx = 0;
                        let isEqual = true;
                        for (let i = 0; i < mst_dt_len; i++) {
                            dataSeqArr.push([]);
                            //then compare the master/detail ID-field value
                            for (let j = sIdx; j < dtl_dt_len; j++) {
                                isEqual = true;
                                for (let k = 0; k < mst_fields.length; k++) {
                                    if (!(mst_fields[k][i] === dtl_fields[k][j])) {
                                        isEqual = false;
                                        break;
                                    }
                                }
                                if (isEqual) {
                                    dataSeqArr[i].push(j);
                                }
                                else {
                                    sIdx = j;
                                    //below logic is for the data robustness purpose, to avoid those strange record(detail level) which could not match even one of the master record!
                                    if (i < mst_dt_len - 1 && j < dtl_dt_len - 1) {
                                        for (let j1 = j; j1 < dtl_dt_len; j1++) {
                                            isEqual = true;
                                            for (let k = 0; k < mst_fields.length; k++) {
                                                if (!(mst_fields[k][i + 1] === dtl_fields[k][j1])) {
                                                    isEqual = false;
                                                    break;
                                                }
                                            }
                                            if (isEqual) {
                                                sIdx = j1;
                                                break;
                                            }
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else { //if no master data
                        if (dataObj && dataObj[DETAIL_DATA_STR] && dataObj[DETAIL_DATA_STR].length > 0) {
                            //may be bill type report which may only have discrete fields!
                            let field = dataObj[DETAIL_DATA_STR][0];
                            dataSeqArr.push([]);
                            for (let i = 0; i < field.length; i++) {
                                dataSeqArr[0].push(i);
                            }
                        }
                    }
                };
                if ((rptTpl) && (dataObj)) {
                    _analyse('主数据指标_集合', '从数据指标_集合', exports.IDataObjProps.master_data, exports.IDataObjProps.detail_data, me.dataSeq);
                    if (rptTpl.流水式表_拓展信息) {
                        _analyse('主数据指标_拓展集合', '从数据指标_拓展集合', exports.IDataObjProps.master_data_ex, exports.IDataObjProps.detail_data_ex, me.exDataSeq);
                    }
                }
            }
        };
        return JpcDataRst;
    }
};

class JpcExClass {
    flowTab;
    flowTabEx;
    billTab;
    crossTab;
    isFollowMode = false;
    totalPages = 0;
    exTotalPages = 0;
    runTimePageData;
    fields;
    params;
    formulas;
    events;
    formulasObject = {};
    constructor(rptTpl) {
        if (rptTpl.流水式表_信息) {
            this.flowTab = new JpcFlowTabClass(false);
            this.isFollowMode = false;
        }
        if (rptTpl.流水式表_拓展信息) {
            this.flowTabEx = new JpcFlowTabClass(true);
            if (rptTpl.流水式表_拓展信息.流水拓展显示模式 === '紧随模式') {
                this.isFollowMode = true;
            }
        }
        if (rptTpl.账单式表_信息) {
            this.billTab = new JpcBillTabSrvClass();
        }
        //let dt1 = new Date();
        if (rptTpl.交叉表_信息) {
            this.crossTab = new JpcCrossTabClass();
        }
        this.runTimePageData = {};
        this.fields = JpcField.createNew(rptTpl);
        this.params = JpcParam.createNew(rptTpl);
        this.formulas = JpcFunc.createNew(rptTpl);
        this.events = JpcEvent.createNew(rptTpl);
    }
    analyzeData(rptTpl, dataObj, defProperties, option, outputType) {
        let me = this, dftPagingOption = option || exports.IPagingOption.normal;
        //1. data object
        let dataHelper = JpcData.createNew();
        // 主要是通过计算rptTpl参数里面的 指标_数据_映射 属性中的公式，赋值于dataObj中的相对应（根据）的属性
        me.executeFormulas('before_analyzing', rptTpl, dataObj, me); //在分析前运行，主要是增加灵活性，比如：重新编排数据的主从关系
        if (me.crossTab) {
            me.executeFormulas('before_paging', rptTpl, dataObj, me);
            dataHelper.analyzeData(rptTpl, dataObj);
            me.crossTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
        }
        else {
            dataHelper.analyzeData(rptTpl, dataObj);
            //2. tab object
            //pre-condition: the data should be sorted in SQL/NoSQL level!
            //let dt1 = new Date();
            if (me.flowTab) {
                me.flowTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
                if (me.flowTabEx) {
                    me.flowTabEx.sorting(rptTpl, dataObj, dataHelper.exDataSeq.slice(0), me);
                }
            }
            if (me.billTab) {
                // 先记录下账单式表_信息.账单式表_数据中的数据相对应于从 数据指标_集合 中的相对应的数组序号，后面便于计算
                // me.billTab.sorting(rptTpl, dataObj, dataHelper.dataSeq.slice(0), me);
                //edit by lish,方法中需要的参数只有一个，但是这里存入了4个
                me.billTab.sorting(rptTpl);
            }
            //3. formulas
            // 主要是通过计算rptTpl参数里面的 指标_数据_映射 属性中的公式，赋值于dataObj中的相对应（根据）的属性
            me.executeFormulas('before_paging', rptTpl, dataObj, me);
        }
        //4. paging
        //获取总页数
        me.paging(rptTpl, dataObj, defProperties, dftPagingOption);
        //alert('analyzeData was completed!');
        //for garbage collection:
        dataHelper = null;
    }
    //获取总页数
    paging(rptTpl, dataObj, defProperties, option) {
        let me = this, dftPagingOption = option || exports.IPagingOption.normal;
        if (me.flowTab) {
            if (me.isFollowMode) {
                me.totalPages = me.flowTab.preSetupPages(rptTpl, dataObj, defProperties, dftPagingOption, me, me.flowTabEx);
            }
            else {
                me.totalPages = me.flowTab.preSetupPages(rptTpl, dataObj, defProperties, dftPagingOption, me, null);
                if (me.flowTabEx) {
                    me.exTotalPages = me.flowTabEx.preSetupPages(rptTpl, dataObj, defProperties, dftPagingOption, me, null);
                    //console.log('ad-hoc flow pages: ' + me.exTotalPages);
                }
                me.totalPages += me.exTotalPages;
            }
        }
        else if (me.crossTab) {
            //me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, dftPagingOption);
            me.totalPages = me.crossTab.preSetupPages(rptTpl, defProperties, exports.IPagingOption.normal); //infinity对交叉表来说无意义
        }
        else if (me.billTab) {
            me.totalPages = me.billTab.paging(rptTpl, dataObj);
        }
    }
    //根据步骤，对formulas中的计算式进行处理，并赋值到相应属性中
    executeFormulas(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT) {
        return formulaExec(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT);
    }
    outputAsPreviewPage(rptTpl, defProperties) {
        let me = this, rst = {};
        rst.control_collection = private_buildDftControls(rptTpl, defProperties === null ? null : defProperties.ctrls);
        rst.style_collection = private_buildDftStyles(rptTpl, defProperties === null ? null : defProperties.styles);
        rst.font_collection = private_buildDftFonts(rptTpl, defProperties === null ? null : defProperties.fonts);
        rst.打印页面_信息 = {};
        rst.打印页面_信息.报表名称 = rptTpl.主信息.报表名称;
        rst.打印页面_信息.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
        rst.打印页面_信息.页边距 = rptTpl.主信息.页边距;
        rst.items = [];
        let bands = JpcBand.createNew(rptTpl, defProperties);
        try {
            function getPageMergeBorder() {
                let mergeRst = {};
                if (bands.MergeBand) {
                    let mergedBand = bands.MergeBand;
                    mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
                    mergeRst.Right = parseInt(mergedBand.Right.toFixed(0));
                    mergeRst.Top = parseInt(mergedBand.Top.toFixed(0));
                    mergeRst.Bottom = parseInt(mergedBand.Bottom.toFixed(0));
                }
                return null;
            }
            //1.
            let rstPage = {
                cells: [],
            };
            rstPage.page_seq = 1;
            if (me.flowTab) {
                rstPage.cells = me.flowTab.outputAsPreviewPage(rptTpl, bands, rst.control_collection, me);
            }
            else if (me.crossTab) {
                rstPage.cells = me.crossTab.outputAsPreviewPage(rptTpl, bands, rst.control_collection, me, null); //方法中定义了5个参数，这里只传进去了4个参数，故加一个参数，by lish
            }
            else if (me.billTab) {
                rstPage.cells = me.billTab.outputAsPreviewPage(rptTpl, bands, rst.control_collection, me);
            }
            let pageMergeBorder = getPageMergeBorder();
            if (pageMergeBorder) ;
            rst.items.push(rstPage);
            //2.
            if (bands.MergeBand) {
                let band = bands.MergeBand;
                let mergedBand = {
                    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;
            }
        }
        catch (exception) {
            console.log(exception);
        }
        finally {
            bands = null;
        }
        return rst;
    }
    outputAsSimpleJSONPageArray(rptTpl, dataObj, startPage, endPage, defProperties, customizeCfg) {
        let me = this, rst = {};
        if (startPage > 0 && startPage <= endPage && endPage <= me.totalPages) {
            rst.control_collection = private_buildDftControls(rptTpl, defProperties === null ? null : defProperties.ctrls);
            rst.style_collection = private_buildDftStyles(rptTpl, defProperties === null ? null : defProperties.styles);
            rst.font_collection = private_buildDftFonts(rptTpl, defProperties === null ? null : defProperties.fonts);
            rst.打印页面_信息 = {};
            rst.打印页面_信息.报表名称 = rptTpl.主信息.报表名称;
            rst.打印页面_信息.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
            rst.打印页面_信息.页边距 = rptTpl.主信息.页边距;
            rst.items = [];
            //初始化band（每个大板块的属性）
            let bands = JpcBand.createNew(rptTpl, defProperties);
            try {
                for (let page = startPage; page <= endPage; page++) {
                    me.runTimePageData.currentPage = page;
                    this.formulasObject = me.executeFormulas('before_output', rptTpl, dataObj, me);
                    // console.log('=======================');
                    rst.items.push(me.outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, rst.control_collection, customizeCfg));
                }
                if (bands.MergeBand) {
                    let band = bands.MergeBand;
                    let mergedBand = {
                        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;
                }
            }
            catch (exception) {
                console.log(exception);
            }
            finally {
                bands = null;
            }
        }
        return rst;
    }
    outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, controls, customizeCfg) {
        let me = this, rst = null;
        function getPageMergeBorder() {
            // let mergeRst = null;
            let mergeRst = {};
            if (bands.MergeBand) {
                let mergedBand = bands.MergeBand;
                mergeRst.Left = parseInt(mergedBand.Left.toFixed(0));
                mergeRst.Right = parseInt(mergedBand.Right.toFixed(0));
                mergeRst.Top = parseInt(mergedBand.Top.toFixed(0));
                mergeRst.Bottom = parseInt(mergedBand.Bottom.toFixed(0));
            }
            return mergeRst;
            // return false;
        }
        if (me.totalPages >= page) {
            rst = {};
            rst.page_seq = page;
            //rst.cells = [];
            let adHocMergePos = null;
            if (me.flowTab) {
                if (me.totalPages - me.exTotalPages >= page) {
                    if (me.flowTab.paging_option === JV.PAGING_OPTION_INFINITY) {
                        adHocMergePos = {};
                    }
                    rst.cells = me.flowTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, adHocMergePos, me, customizeCfg);
                    if (adHocMergePos) {
                        adHocMergePos.纸张宽高 = JpcCommonHelper.getPageSize(rptTpl);
                        rst.page_merge_pos = adHocMergePos;
                    }
                }
                else {
                    if (!me.isFollowMode) {
                        rst.cells = me.flowTabEx.outputAsSimpleJSONPage(rptTpl, dataObj, page - (me.totalPages - me.exTotalPages), bands, controls, adHocMergePos, me, customizeCfg);
                    }
                }
            }
            else if (me.crossTab) {
                rst.cells = me.crossTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, me, customizeCfg);
            }
            else if (me.billTab) {
                rst.cells = me.billTab.outputAsSimpleJSONPage(rptTpl, dataObj, page, bands, controls, me, customizeCfg);
            }
            if (!(me.flowTab && me.flowTab.paging_option === exports.IPagingOption.infinity)) {
                let pageMergeBorder = getPageMergeBorder();
                if (pageMergeBorder) {
                    rst.page_merge_border = pageMergeBorder;
                }
            }
        }
        return rst;
    }
}
//暂定
const private_buildDftItems = (rptTpl, dftCollection, nodeName) => {
    const rst = {};
    if (dftCollection) {
        for (let i = 0; i < dftCollection.length; i++) {
            const { ID, ...dftCollectionProps } = dftCollection[i];
            rst[dftCollection[i].ID] = { ...dftCollectionProps };
        }
        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++) {
                const rptDftItem = rptTpl[nodeName][i];
                if (rst[rptDftItem.ID] === undefined) {
                    const item = {};
                    for (let j = 0; j < propArray.length; j++) {
                        item[propArray[j]] = rptDftItem[propArray[j]];
                    }
                    rst[rptDftItem.ID] = item;
                }
            }
        }
    }
    return rst;
};
function private_buildDftControls(rptTpl, dftControlCollection) {
    return private_buildDftItems(rptTpl, dftControlCollection, 'control_collection');
}
function private_buildDftFonts(rptTpl, dftFontCollection) {
    return private_buildDftItems(rptTpl, dftFontCollection, 'font_collection');
}
function private_buildDftStyles(rptTpl, dftStyleCollection) {
    const rst = {};
    function private_CopyBorder(destItem, srcItem) {
        destItem.LineWeight = srcItem.LineWeight;
        destItem.DashStyle = srcItem.DashStyle;
        destItem.Color = srcItem.Color;
    }
    if (dftStyleCollection) {
        for (let i = 0; i < dftStyleCollection.length; i++) {
            const item = {};
            if (dftStyleCollection[i].border_style &&
                dftStyleCollection[i].border_style.length > 0) {
                for (let j = 0; j < dftStyleCollection[i].border_style.length; j++) {
                    const borderItem = {};
                    private_CopyBorder(borderItem, dftStyleCollection[i].border_style[j]);
                    item[dftStyleCollection[i].border_style[j].Position] = borderItem;
                }
            }
            rst[dftStyleCollection[i].ID] = item;
        }
        if (rptTpl &&
            rptTpl.style_collection &&
            rptTpl.style_collection.length > 0) {
            for (let i = 0; i < rptTpl.style_collection.length; i++) {
                const rptDftItem = rptTpl.style_collection[i];
                if (rst[rptDftItem.ID] === undefined) {
                    if (rptDftItem.ID.indexOf('_AutoHeightMerge_Top') > 0) {
                        const key = rptDftItem.ID.substr(0, rptDftItem.ID.indexOf('_AutoHeightMerge_Top'));
                        if (rst[key]) {
                            const item = {};
                            if (rst[key].Left) {
                                item.Left = {};
                                private_CopyBorder(item.Left, rst[key].Left);
                            }
                            if (rst[key].Right) {
                                item.Right = {};
                                private_CopyBorder(item.Right, rst[key].Right);
                            }
                            if (rst[key].Top) {
                                item.Top = {};
                                private_CopyBorder(item.Top, rst[key].Top);
                            }
                            rst[rptDftItem.ID] = item;
                        }
                    }
                    else if (rptDftItem.ID.indexOf('_AutoHeightMerge_Middle') > 0) {
                        const key = rptDftItem.ID.substr(0, rptDftItem.ID.indexOf('_AutoHeightMerge_Middle'));
                        if (rst[key]) {
                            const item = {};
                            if (rst[key].Left) {
                                item.Left = {};
                                private_CopyBorder(item.Left, rst[key].Left);
                            }
                            if (rst[key].Right) {
                                item.Right = {};
                                private_CopyBorder(item.Right, rst[key].Right);
                            }
                            rst[rptDftItem.ID] = item;
                        }
                    }
                    else if (rptDftItem.ID.indexOf('_AutoHeightMerge_Bottom') > 0) {
                        const key = rptDftItem.ID.substr(0, rptDftItem.ID.indexOf('_AutoHeightMerge_Bottom'));
                        if (rst[key]) {
                            const item = {};
                            if (rst[key].Left) {
                                item.Left = {};
                                private_CopyBorder(item.Left, rst[key].Left);
                            }
                            if (rst[key].Right) {
                                item.Right = {};
                                private_CopyBorder(item.Right, rst[key].Right);
                            }
                            if (rst[key].Bottom) {
                                item.Bottom = {};
                                private_CopyBorder(item.Bottom, rst[key].Bottom);
                            }
                            rst[rptDftItem.ID] = item;
                        }
                    }
                    else {
                        const item = {};
                        for (let j = 0; j < rptDftItem.border_style.length; j++) {
                            const borderItem = {};
                            private_CopyBorder(borderItem, rptDftItem.border_style[j]);
                            item[rptDftItem.border_style[j].Position] = borderItem;
                        }
                        rst[rptDftItem.ID] = item;
                    }
                }
            }
        }
    }
    return rst;
}

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',
    'rations',
    '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'`,
    `'costTreeData'`
];
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$1 = {
    ration: 1,
    volumePrice: 2,
    gljRation: 3,
    install: 4,
    overHeight: 5,
    itemIncrease: 6 //子目增加
};

// 部分数据从main_consts.js中抽出来，因为除了造价书界面，有一些页面也需要用到其中的变量
// 但是其他页面直接引入整个main_consts.js不合理，且会报错（main_consts.js正常运行依赖main.html的一些内容）
// 清单固定行
const fixedFlag = {
    // 分部分项工程
    SUB_ENGINERRING: 1,
    // 措施项目
    MEASURE: 2,
    // 施工技术措施项目
    CONSTRUCTION_TECH: 3,
    // 安全文明施工按实计算费用
    SAFETY_CONSTRUCTION_ACTUAL: 4,
    // 施工组织措施专项费用
    CONSTRUCTION_ORGANIZATION: 5,
    // 安全文明施工专项费用
    SAFETY_CONSTRUCTION: 6,
    // 其他项目
    OTHER: 7,
    // 暂列金额
    PROVISIONAL: 8,
    // 暂估价
    ESTIMATE: 9,
    // 材料（工程设备）暂估价
    MATERIAL_PROVISIONAL: 10,
    // 专业工程暂估价
    ENGINEERING_ESITIMATE: 11,
    // 计日工
    DAYWORK: 12,
    // 总承包服务费
    TURN_KEY_CONTRACT: 13,
    // 索赔与现场签证
    CLAIM_VISA: 14,
    // 规费
    CHARGE: 15,
    // 社会保险费及住房公积金 Social insurance fee and housing accumulation fund
    SOCIAL_INSURANCE_HOUSING_FUND: 16,
    // 工程排污费 charges for disposing pollutants
    POLLUTANTS: 17,
    // 税金
    TAX: 18,
    // 工程造价
    ENGINEERINGCOST: 19,
    // 增值税
    ADDED_VALUE_TAX: 20,
    // 专项技术措施暂估价
    SPECIAL_TECH_PROVISIONAL: 21,
    // 专业发包工程管理费
    LET_CONTRACT_MANAGEMENT: 22,
    // 人工
    LABOUR: 23,
    // 材料
    MATERIAL: 24,
    // 施工机械
    MACHINE: 25,
    // 索赔
    CLAIM: 26,
    // 现场签证
    VISA: 27,
    // 附加税
    ADDITIONAL_TAX: 28,
    // 环境保护税
    ENVIRONMENTAL_PROTECTION_TAX: 29,
    // 建设工程竣工档案编制费
    PROJECT_COMPLETE_ARCH_FEE: 30,
    // 住宅工程质量分户验收费
    HOUSE_QUALITY_ACCEPT_FEE: 31,
    // 组织措施费
    ORGANIZATION: 32,
    // 其他措施费
    OTHER_MEASURE_FEE: 33,
    // 绿色施工安全防护措施费
    GREEN_MEASURE_FEE: 34,
    // 预算包干费
    BUDGET_INCLUDE_WORK_FEE: 35,
    // 工程优质费
    PROJECT_HIGH_QUALITY_FEE: 36,
    // 概算幅度差
    BUDGET_ESTIMATE_DIFF: 37,
    // 其他费用（与其他项目不同，参考广东的用法）
    OTHER_FEE: 38,
};
// 清单类型
const billType = {
    DXFY: 1,
    FB: 2,
    FX: 3,
    BILL: 4,
    BX: 5, // 补项
};
// 定额类型
const rationType = {
    ration: 1,
    volumePrice: 2,
    gljRation: 3,
    install: 4,
    overHeight: 5,
    itemIncrease: 6, // 子目增加
};
// 项目类型
const projectType = {
    Folder: 'Folder',
    Project: 'Project',
    Engineering: 'Engineering',
    Tender: 'Tender',
};
// 计税方式
const TaxType = {
    NORMAL: 1,
    SIMPLE: 2,
};
// 供货方式
const supplyType = {
    // 自行采购
    ZXCG: 0,
    // 部分甲供
    BFJG: 1,
    // 完全甲供
    WQJG: 2,
    // 甲供材料 （“完全甲供”改文字为“甲供材料”）
    JGCL: 2,
    // 甲定乙供
    JDYG: 3,
};
const supplyText = {
    // 自行采购
    ZXCG: '自行采购',
    // 部分甲供
    BFJG: '部分甲供',
    // 完全甲供
    WQJG: '完全甲供',
    // 甲定乙供
    JDYG: '甲定乙供',
};
const SourceType = {
    BILLS: 'bills',
    RATION: 'ration',
};
const DEFAULT_REGION = '全省';
// 补充人材机库
const COMPLEMENTARY_LIB = 'complementaryLib';
// 费用定额
const COMPILATION = 'compilation';
// 缓存key
const StorageKey = {
    // 主界面一旦出现这个缓存，马上提示
    ONCE_MAIN_LOADED: 'onceMainLoaded',
};
// 分享权限变更的类型
const SharePermissionChangeType = {
    UPDATE_COOPERATE: 1,
    UPDATE_COPY: 2,
    CANCEL: 3,
    SHARE: 4,
    READ: 5,
};
// 页面目标
const PageTarget = {
    PM: 1,
    MAIN: 2, // 造价书
};
const BlankType = {
    NOT_FOUND: 1,
    SHARE_CANCEL: 2,
};
// 分享库类型
const ShareLibType = {
    RATION_LIB: 1,
    GLJ_LIB: 2,
    BLOCK_LIB: 3,
};
var commonConstants = {
    fixedFlag,
    billType,
    rationType,
    projectType,
    TaxType,
    supplyType,
    supplyText,
    SourceType,
    DEFAULT_REGION,
    COMPILATION,
    COMPLEMENTARY_LIB,
    StorageKey,
    SharePermissionChangeType,
    PageTarget,
    BlankType,
    ShareLibType,
};

// import StringUtil from './stringUtil';
// const stringUtil = new StringUtil();
// 为Date对象绑定转换日期的方法
setupDateFormat();
class RptCommon {
    template;
    currentDataObj;
    initialize(rptTpl, currentDataObj) {
        this.template = rptTpl;
        this.currentDataObj = currentDataObj;
    }
    multiply(val1, val2, fixFormat) {
        const rst = [];
        let maxLen = val1.length;
        let minLen = val2.length;
        if (minLen > maxLen) {
            maxLen += minLen;
            minLen = maxLen - minLen;
            maxLen -= minLen;
        }
        for (let i = 0; i < maxLen; i++) {
            let value = (i < val1.length ? val1[i] : val1[minLen - 1]) *
                (i < val2.length ? val2[i] : val2[minLen - 1]);
            if (value === null || value === undefined) {
                value = 0;
            }
            if (fixFormat)
                value = parseFloat(value.toFixed(fixFormat));
            rst.push(value);
        }
        return rst;
    }
    divide(val1, val2, fixFormat) {
        const rst = [];
        let maxLen = val1.length;
        let minLen = val2.length;
        if (minLen > maxLen) {
            maxLen += minLen;
            minLen = maxLen - minLen;
            maxLen -= minLen;
        }
        for (let i = 0; i < maxLen; i++) {
            let value = (i < val1.length ? val1[i] : val1[minLen - 1]) /
                (i < val2.length ? val2[i] : val2[minLen - 1]);
            if (fixFormat)
                value = parseFloat(value.toFixed(fixFormat));
            rst.push(value);
        }
        return rst;
    }
    plus(val1, val2, fixFormat) {
        const rst = [];
        let maxLen = val1.length;
        let minLen = val2.length;
        if (minLen > maxLen) {
            maxLen += minLen;
            minLen = maxLen - minLen;
            maxLen -= minLen;
        }
        for (let i = 0; i < maxLen; i++) {
            let value = (i < val1.length ? val1[i] : val1[minLen - 1]) +
                (i < val2.length ? val2[i] : val2[minLen - 1]);
            if (fixFormat)
                value = parseFloat(value.toFixed(fixFormat));
            rst.push(value);
        }
        return rst;
    }
    multiPlus(arrVal, fixFormat) {
        const rst = [];
        for (let i = 0; i < arrVal.length; i++) {
            const valItem = arrVal[i];
            if (i === 0) {
                for (const dtl of valItem) {
                    let value = dtl;
                    if (fixFormat)
                        value = parseFloat(value.toFixed(fixFormat));
                    rst.push(value);
                }
            }
            else {
                for (let j = 0; j < valItem.length; j++) {
                    if (j < rst.length) {
                        let value = rst[j] + valItem[j];
                        if (fixFormat)
                            value = parseFloat(value.toFixed(fixFormat));
                        rst[j] = value;
                    }
                    else {
                        let value = valItem[j];
                        if (fixFormat)
                            value = parseFloat(value.toFixed(fixFormat));
                        rst.push(value);
                    }
                }
            }
        }
        return rst;
    }
    minus(val1, val2, fixFormat) {
        const rst = [];
        let maxLen = val1.length;
        let minLen = val2.length;
        if (minLen > maxLen) {
            maxLen += minLen;
            minLen = maxLen - minLen;
            maxLen -= minLen;
        }
        for (let i = 0; i < maxLen; i++) {
            let value = (i < val1.length ? val1[i] : val1[minLen - 1]) -
                (i < val2.length ? val2[i] : val2[minLen - 1]);
            if (fixFormat)
                value = parseFloat(value.toFixed(fixFormat));
            rst.push(value);
        }
        return rst;
    }
    formatString(arrVal, formatStr) {
        const rst = [];
        for (const val of arrVal) {
            rst.push(replaceAll$1(formatStr, '%S', val));
        }
        return rst;
    }
    getSupplyType(srcValArr) {
        const rst = [];
        for (const val of srcValArr) {
            let hasKey = false;
            const { supplyType } = commonConstants;
            for (const propKey in supplyType) {
                if (lodash.get(supplyType, propKey) === val) {
                    hasKey = true;
                    rst.push(lodash.get(supplyType, propKey));
                    break;
                }
            }
            if (!hasKey) {
                rst.push('未知方式');
            }
        }
        return rst;
    }
}

exports.ANTI_VERTICAL_ANGLE = ANTI_VERTICAL_ANGLE;
exports.ANTI_VERTICAL_ANGLE_INT = ANTI_VERTICAL_ANGLE_INT;
exports.IDX_BOTTOM = IDX_BOTTOM;
exports.IDX_LEFT = IDX_LEFT;
exports.IDX_RIGHT = IDX_RIGHT;
exports.IDX_TOP = IDX_TOP;
exports.JE = JE;
exports.JV = JV;
exports.JpcBand = JpcBand;
exports.JpcBillTabSrvClass = JpcBillTabSrvClass;
exports.JpcCrossTabClass = JpcCrossTabClass;
exports.JpcData = JpcData;
exports.JpcEvent = JpcEvent;
exports.JpcExClass = JpcExClass;
exports.JpcField = JpcField;
exports.JpcFlowTabClass = JpcFlowTabClass;
exports.JpcFunc = JpcFunc;
exports.JpcParam = JpcParam;
exports.PROP_FONT = PROP_FONT;
exports.ReportDate = ReportDate;
exports.RptCommon = RptCommon;
exports.VERTICAL_ANGLE = VERTICAL_ANGLE;
exports.VERTICAL_ANGLE_INT = VERTICAL_ANGLE_INT;
exports.comdify = comdify$1;
exports.commonConst = commonConst;
exports.convertStrToBoolean = convertStrToBoolean;
exports.convertToCaptionNum = convertToCaptionNum;
exports.formatNumber = formatNumber;
exports.getPinYinCamelChars = getPinYinCamelChars;
exports.getPinYinFullChars = getPinYinFullChars;
exports.gljKeyArray = gljKeyArray;
exports.isEmptyString = isEmptyString;
exports.leftTrim = leftTrim;
exports.projectConst = projectConst;
exports.projectConstList = projectConstList;
exports.projectFieldConstList = projectFieldConstList;
exports.rationKeyArray = rationKeyArray;
exports.rationType = rationType$1;
exports.replaceAll = replaceAll$1;
exports.rightTrim = rightTrim;
exports.setupDateFormat = setupDateFormat;
exports.summaryConstList = summaryConstList;
exports.trim = trim;
