Forráskód Böngészése

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/SCCommon

# Conflicts:
#	handsontable/package.json
zhangweicheng 4 éve
szülő
commit
68da2adf36

+ 1 - 1
handsontable/handsontable.d.ts

@@ -38,7 +38,7 @@ declare namespace _Handsontable {
 
     destroy(): void;
 
-    destroyEditor(revertOriginal?: boolean, prepareEditorIfNeeded?: boolean): void;
+    destroyEditor(revertOriginal?: boolean, prepareEditorIfNeeded?: boolean, isOutClick? : boolean): void;
 
     emptySelectedCells(): void;
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 140 - 135
handsontable/src/core.js


+ 2 - 0
handsontable/src/plugins/contextMenu/menu.js

@@ -101,6 +101,8 @@ class Menu {
    */
   open() {
     this.runLocalHooks('beforeOpen');
+    // 2021-02-24  zhang createContainer里面先查找是否存在,有则返回。 如果不这样做的话,element-tabs 设置成lazy后,后加载的页面会冲掉之前页面的右键菜单
+    this.container = this.createContainer(this.options.name);
     this.container.removeAttribute('style');
     this.container.style.display = 'block';
 

+ 1 - 1
handsontable/src/tableView.js

@@ -170,7 +170,7 @@ function TableView(instance) {
     if (outsideClickDeselects) {
       instance.deselectCell();
     } else {
-      instance.destroyEditor(false, false);
+      instance.destroyEditor(false, false, true);
       instance.unlisten();// 点击tab等其它handsontable外的元素时,handsontable要解除监听键盘等事件. handsontable只在mouseup事件通过isOutsideInput只针对input 等几个输入元素
     }
   });

+ 1 - 1
report/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/report",
-  "version": "3.0.3",
+  "version": "3.0.4",
   "description": "Smartcost Report Relative Module",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

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

@@ -84,7 +84,7 @@ const D = (fieldID: number, valIndex?: number, newValue?: any) => {
             if (!F(fieldID)) P(fieldID);
             if (DData[fieldID]) {
                 if (DData[fieldID].length >= valIndex) {
-                    if (!DData[fieldID][valIndex]) return null;
+                    if (!DData[fieldID][valIndex]&&DData[fieldID][valIndex]!==0) return '';
                     return DData[fieldID][valIndex];
                 } else {
                     console.log(`指标id:${fieldID},${valIndex}>${DData[fieldID].length},请检查`)
@@ -236,7 +236,6 @@ const removeFieldValue = (fieldID: number, valIdx: number) => {
     const fField: (IGroupField) = <IGroupField>F(fieldID);
     if (fField) {
         DData[fieldID].splice(valIdx, 1);
-        setFieldValue(fField, valIdx, DData[fieldID])
     } else {
         console.log(`指标${fieldID}的数据不支持removeFieldValue操作`);
     }
@@ -246,7 +245,6 @@ const insertFieldValue = (fieldID: number, valIdx: number, newValue: number) =>
     let field = <IGroupField>F(fieldID);
     if (field) {
         DData[fieldID].splice(valIdx, 0, newValue);
-        setFieldValue(field, valIdx, DData[fieldID])
     } else {
         console.log(`指标${fieldID}的数据不支持insertFieldValue操作`);
     }

+ 83 - 0
report/src/core/formulasFun.ts

@@ -0,0 +1,83 @@
+import JE from './jpc_rte';
+import formulasDataSetter from './formulasDataSetter';
+import stringUtil from '../public/stringUtil'
+import useReportDate from '../public/ReportDate'
+import { ICurrent_RPT, IRptTpl, IDataObj, Fields } from '../interface/basic'
+
+
+export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_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,
+        replaceAll,
+        comdify,
+        convertToCaptionNum,
+        convertStrToBoolean,
+        formatNumber,
+    } = stringUtil;
+    const $JE = JE;
+    const ReportDate = useReportDate;
+    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 {
+                    const { format } = $ME;
+                    console.log(expression);
+                    //临时处理
+                    if (expression.indexOf(`new Date(`)) {
+                        expression.replaceAll(`new Date(`, `new ReportDate(`)
+                    }
+                    eval(expression);
+                } catch (ex) {
+                    console.log(ex);
+                }
+            }
+        }
+    }
+    formulasDataSetter.resetData();
+}
+
+export const combinedGridFormula = ($RUN_TYPE: String, $TEXT: Fields, $TIMES: number, $CURRENT_RPT: ICurrent_RPT) => {
+    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) {
+                    let $ME = $CURRENT_RPT.formulas[execFmlIdx];
+                    try {
+                        eval(expression);
+                    } catch (ex) {
+                        console.log(ex);
+                    }
+                }
+            }
+        }
+    }
+    formulasDataSetter.resetData();
+}
+export default {};

+ 0 - 1
report/src/core/helper/jpc_helper_common.ts

@@ -43,7 +43,6 @@ const JpcCommonHelper = {
     },
     getControl(controlName: string, dftControls: IControlSubCollection[], rptTpl?: IRptTpl) {
         let me = this, list: IControlSubCollection[][] = [];
-        if (rptTpl) debugger;
         //  list.push(rptTpl.control_collection);
         list.push(dftControls);
         return me.getResultByID(controlName, list);

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

@@ -6,20 +6,17 @@ import JpcFlowTab from './jpc_flow_tab';
 import JpcBillTab from './jpc_bill_tab';
 import JpcCrossTab from './jpc_cross_tab';
 import JpcField from './jpc_field';
-
 import JpcParam from './jpc_param';
 import JpcFunc from './jpc_function';
 import JpcEvent from './jpc_event';
 import JpcData from './jpc_data';
 import JpcCommonHelper from './helper/jpc_helper_common';
-import useReportDate from '../public/ReportDate'
-
 import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICustomizeCfg, ITargetFields, IRptTpl, IDataObj, IBands, IControlCollection, IStyles, BorderStyle, IFontSubCollection, IControlSubCollection, IRstPage, IMergeBand } from '../interface/basic'
 import { IFlowTabClass, IBillTabClass, ICostTabClass } from '../interface/classType';
 import {  IPagingOption } from '../interface/enum';
 import { Key } from 'readline';
-import formulasDataSetter from './formulasDataSetter'
-import stringUtil from '../public/stringUtil'
+import {formulaExec} from './formulasFun'
+
 
 const JV=$JV;
 class JpcExClass {
@@ -126,67 +123,7 @@ class JpcExClass {
 
     //根据步骤,对formulas中的计算式进行处理,并赋值到相应属性中
     executeFormulas(runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_RPT) {
-        let execFmlMe = this;
-        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,
-            replaceAll,
-            comdify,
-            convertToCaptionNum,
-            convertStrToBoolean,
-            formatNumber,
-        } = stringUtil;
-        
-        for (let execFmlIdx = 0; execFmlIdx < execFmlMe.formulas.length; execFmlIdx++) {
-            if (execFmlMe.formulas[execFmlIdx].run_type === runType) {
-                let expression = execFmlMe.formulas[execFmlIdx].expression;
-                if (expression) {
-                    // 计算式集合,目前是放置打印信息的,用于配置属性的计算
-                    let $ME = execFmlMe.formulas[execFmlIdx];
-                    // console.log("current expression idx: " + execFmlIdx);
-                    // console.log(expression);
-                    try {
-                        const {format}=$ME;
-                        const $JE = JE;
-                        const ReportDate = useReportDate;
-                        console.log(expression);
-                        //临时处理
-                        if (expression.indexOf('Date()') > -1) {
-                            eval(expression.replace('Date()', 'ReportDate()'));
-                        } else {
-                            
-                            eval(expression);}
-                       
-
-                    } catch (ex) {
-                        console.log(ex);
-                    }
-                }
-            }
-        }
-        formulasDataSetter.resetData();
+        formulaExec(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT)
     };
 
     outputAsPreviewPage(rptTpl: IRptTpl, defProperties: IDefProperties) {

+ 5 - 19
report/src/core/jpc_flow_tab.ts

@@ -35,7 +35,7 @@ import {
     IControlSubCollection,
 
 } from '../interface/basic'
-import { IControlProps, IPositionProps } from '../index';
+import { combinedGridFormula } from './formulasFun';
 
 class JpcFlowTabClass {
     isEx: boolean;
@@ -897,7 +897,7 @@ class JpcFlowTabClass {
                             let rstCellItem = rst[rst.length - 1];
                             let cbfPos = [];
                             cbfPos.push(rstCellItem.area.Left);
-                            cbfPos.push(rstCellItem.area.Left);
+                            cbfPos.push(rstCellItem.area.Right);
                             if (tab_field.combineType === 'vertical') {
                                 verticalCombinePos.push(cbfPos);
                             } else if (tab_field.combineType === 'horizon') {
@@ -1192,6 +1192,7 @@ class JpcFlowTabClass {
         }
         return rst;
     };
+    //每页的合计
     outputPageSum(rptTpl: IRptTpl, dataObj: IDataObj, page: number, segIdx: number, bands: IBands, unitFactor: number, controls: IControlCollection, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg) {
         let me = this, rst: any = [];
         // let FLOW_NODE_STR = me.isEx?'流水式表_拓展信息':'流水式表_信息';
@@ -1283,23 +1284,8 @@ class JpcFlowTabClass {
         // console.log(rst);
         return rst;
     };
-    //暂定
-    checkGrpTxtOutEvent($RUN_TYPE: String, $TEXT: any, $TIMES: any, $CURRENT_RPT: ICurrent_RPT) {
-        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) {
-                        let $ME = $CURRENT_RPT.formulas[execFmlIdx];
-                        try {
-                            eval(expression);
-                        } catch (ex) {
-                            console.log(ex);
-                        }
-                    }
-                }
-            }
-        }
+    checkGrpTxtOutEvent($RUN_TYPE: string, $TEXT: Fields, $TIMES: number, $CURRENT_RPT: ICurrent_RPT) {
+        combinedGridFormula($RUN_TYPE, $TEXT, $TIMES, $CURRENT_RPT);
     };
     commonTabRestOutput(dataObj: IDataObj | null, page: number, segIdx: number, bands: IBands, band: IBandDetail, unitFactor: number, tab: ITab, multiColIdx: number, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg | null) {
         let me = this, rst = [];

+ 0 - 2
report/src/core/jpc_rte.ts

@@ -123,7 +123,6 @@ const JE = {
         return rst;
     },
     getFieldValueArray: function (field: Fields, dataObj: IDataObj) {
-        console.log('===================getFieldValueArray')
         let rst = null;
         if (field.DataNodeName === 'NA') {
             if (!field.data_field) {
@@ -143,7 +142,6 @@ const JE = {
         return rst;
     },
     setFieldValueArray: function (field: Fields, dataObj: IDataObj, newArr: number[]) {
-        console.log('===================setFieldValueArray')
         if (newArr instanceof Array) {
             if (field.DataNodeName === 'NA') {
                 field.data_field = newArr;

+ 81 - 33
report/src/interface/basic.ts

@@ -137,7 +137,7 @@ export interface IPageCellObj {
 }
 export interface ICell {
     font: string | IFontSubCollection;
-    control: IControlSubCollection|string;
+    control: IControlSubCollection | string;
     style: string;
     Value: number | string | null;
     area: IPosition;
@@ -153,8 +153,19 @@ export interface IStyleCollection {
     Default_Normal: IPositionExtent;
     Label_Topline: IPositionExtent;
     Label_Underline: IPositionExtent;
-    [key:string]:IPositionExtent;
+    [key: string]: IPositionExtent;
 }
+
+export interface IPreviewPageItem {
+    page_seq: number;
+    cells: ICell[];
+    page_merge_border: IPosition;
+    page_merge_pos: {
+        纸张宽高: number[]
+    }
+}
+
+
 export interface IPreviewPage {
     打印页面_信息: {
         报表名称: string;
@@ -163,18 +174,9 @@ export interface IPreviewPage {
     };
     control_collection: IControlCollection;
     font_collection: IFontCollection;
-    items: [
-        {
-            page_seq: number;
-            cells: ICell[];
-            page_merge_border: IPosition;
-            page_merge_pos:{
-                纸张宽高:number[]
-            }
-        }
-    ];
+    items: IPreviewPageItem[];
     MergeBand: IMergeBand;
-    style_collection:IStyleCollection;
+    style_collection: IStyleCollection;
     pageBreaks?: any[];
 }
 
@@ -211,7 +213,7 @@ export interface ITargetFields {
     从数据指标_拓展集合: ITargetDataSet;
     离散指标_集合: ITargetDataSet;
     无映射离散指标_集合: ITargetDataSet;
-    [key:string]:ITargetDataSet;
+    [key: string]: ITargetDataSet;
 }
 
 interface IOutputAsPreviewPage {
@@ -349,7 +351,6 @@ export interface ICurrent_DATA {
     master_data: any[];
     master_data_ex: any[];
 }
-
 export interface ICustomizeCfg {
     fillZero: boolean;
     fonts: {
@@ -364,24 +365,24 @@ export interface ICustomizeCfg {
     isNarrow: boolean;
     margins: IPosition;
     showVerticalLine: boolean;
-    userID?:string
+    userID?: string
 }
 export interface IOrgBandDetail {
     Alignment: string;
-    DisplayType:  string;
-    Height:  string;
-    MergeBorder:  string;
-    Name:  string;
+    DisplayType: string;
+    Height: string;
+    MergeBorder: string;
+    Name: string;
     control: string;
-    style:  string;
-    Width?:string;
-    CalculationType:string;
-    normalOnly?:boolean;
-    exOnly?:boolean;
-    band_s?:IOrgBandDetail[]
+    style: string;
+    Width?: string;
+    CalculationType: string;
+    normalOnly?: boolean;
+    exOnly?: boolean;
+    band_s?: IOrgBandDetail[]
 }
 
-export interface IBandDetail{
+export interface IBandDetail {
     Alignment: number;
     Bottom: number;
     CalculationType: number;
@@ -593,16 +594,63 @@ export interface IRstPage {
 }
 
 export interface IMergeBand {
-    Bottom:number;
-    Left:number;
-    Right:number;
-    Top:number;
+    Bottom: number;
+    Left: number;
+    Right: number;
+    Top: number;
     style?: any;
 }
 //丢失的interface
-export interface IPretreatment{
+export interface IPretreatment {
     [key: string]: any;
 }
-export interface ISubFilters{
+export interface ISubFilters {
     [key: string]: any;
+}
+
+
+
+//报表用户信息的内容
+// 报表显示设置参数
+export interface IRptConfig{
+    fillZero: boolean;
+    fonts: {
+        CfgDispName: string;
+        FontBold: string;
+        FontHeight: string;
+        FontItalic: string;
+        FontUnderline: string;
+        ID: string;
+        Name: string;
+    }[];
+    isNarrow: boolean;
+    margins: IPosition;
+    showVerticalLine: boolean;
+}
+export interface RptTreeNode {
+    ID: string;
+    name: string;
+    icon: string;
+    children?: RptTreeNode[];
+    userId?: string;
+    flags?: {
+      constructSumType?: string | null;
+      taxType?: string | null;
+      auditType?: string | null;
+    };
+  }
+export interface IRptSchemeList{
+    ID:string;
+    name:string;
+    typeID:string;
+    typeName:string;
+    data:RptTreeNode[];
+
+}
+//报表设置参数
+export interface IRptCustomizeCfg {
+    userID?: string;
+    rptConfig:IRptConfig,
+    schemeData:IRptSchemeList[]
+   
 }

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

@@ -3,8 +3,8 @@ import { Fields, IBandDetail, IBands, ICell, IControlCollection, ICrossTab, ICur
 export interface IFlowTabClass {
     auto_height_fields_idx: [number, Fields][];
     auto_height_info: number[][];
-    checkCombineEvent: ($RUN_TYPE: String, $VER_COMB_ARRAY: number[][], $HOR_COMB_ARRAY: any[], $CURRENT_CELL_ITEMS: ICell[], $CURRENT_RPT: ICurrent_RPT) => void;
-    checkGrpTxtOutEvent: ($RUN_TYPE: String, $TEXT: any, $TIMES: any, $CURRENT_RPT: ICurrent_RPT) => void;
+    checkCombineEvent: ($RUN_TYPE: string, $VER_COMB_ARRAY: number[][], $HOR_COMB_ARRAY: any[], $CURRENT_CELL_ITEMS: ICell[], $CURRENT_RPT: ICurrent_RPT) => void;
+    checkGrpTxtOutEvent: ($RUN_TYPE: string, $TEXT: Fields, $TIMES: number, $CURRENT_RPT: ICurrent_RPT) => void;
     combinePageCells: (rstPageCells: ICell[], verticalCombinePos: number[][], horizonCombinePos: number[][]) => void;
     commonTabRestOutput: (dataObj: IDataObj | null, page: number, segIdx: number, bands: IBands, band: IBandDetail, unitFactor: number, tab: ITab, multiColIdx: number, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg | null) => void;
     disp_fields_ex_idx: any[];

+ 78 - 5
report/src/interface/enum.ts

@@ -5,7 +5,7 @@ export enum IDataObjProps {
     discrete_data = 'discrete_data',    // 离散指标_集合
     master_data = 'master_data',        //主数据指标_集合
     master_data_ex = 'master_data_ex',  //主数据指标_拓展集合
-    NA='NA'
+    NA = 'NA'
 }
 
 export enum IEventType {
@@ -49,11 +49,84 @@ export enum IFontProps {
 }
 
 export enum IPositionProps {
-   Top,
-   Bottom,
-   Left,
-   Right
+    Top='Top',
+    Bottom='Bottom',
+    Left='Left',
+    Right='Right'
 }
 
+export enum IPositionIdx {
+    Left = 0,
+    Top = 1,
+    Right = 2,
+    Bottom = 3,
+}
+
+
+
+
+//常量,上下左右的顺序,对应于逻辑代码中某些数组的顺序
+export const IDX_LEFT = 0;
+export const IDX_TOP = 1;
+export const IDX_RIGHT = 2;
+export const IDX_BOTTOM = 3;
+
+//输出的偏移量
+export enum IOutputOffset {
+    LEFT = 2,
+    TOP = 2,
+    RIGHT = 1,
+    BOTTOM = 3,
+}
+
+//垂直角度
+export const VERTICAL_ANGLE = '90';
+export const ANTI_VERTICAL_ANGLE = '-90';
+export const VERTICAL_ANGLE_INT = 90;
+export const ANTI_VERTICAL_ANGLE_INT = -90;
+
+export enum FONT_PROPS {
+    NAME = 'Name',
+    FONT_HEIGHT = 'FontHeight',
+    FONT_COLOR = 'FontColor',
+    FONT_BOLD = 'FontBold',
+    FONT_ITALIC = 'FontItalic',
+    FONT_UNDERLINE = 'FontUnderline',
+    FONT_STRIKEOUT = 'FontStrikeOut',
+    FONT_ANGLE = 'FontAngle',
+}
+
+export enum CONTROL_PROPS {
+    SHRINK = 'Shrink',
+    SHOWZERO = 'ShowZero',
+    HORIZON = 'Horizon',
+    VERTICAL = 'Vertical',
+    WRAP = 'Wrap',
+    VERTIVAL_FOR_EXCEL = 'VerticalForExcel',
+    SHRIK_FIRST = 'ShrinkFirst',
+    CLOSE_OUTPUT = 'CloseOutput',
+}
+export const PROP_FONT = 'font';
+
+export enum PAGES_SIZE_STR {
+    A3 = 'A3',
+    A4 = 'A4',
+    A5 = 'A5',
+    B5 = 'B5',
+    LETTER = 'LETTER',
+    LEGAL = 'LEGAL',
+    EXECUTIVE = 'EXECUTIVE',
+    '16K' = '16K',
+}
+export enum PAGES_SIZE {
+    A3 = 8,
+    A4 = 9,
+    A5 = 11,
+    B5 = 13,
+    LETTER = 1,
+    LEGAL = 5,
+    EXECUTIVE = 7,
+    '16K' = 93,
+}
 
 export default {};

+ 1 - 0
types/src/interface/base.ts

@@ -175,6 +175,7 @@ export enum ActionName {
   // 清单相关
   ADD_STD_BILLS = 'addStdBills', // 添加标准清单
   PASTE_BLOCK = 'pasteBlock', // 复制整块
+  IMPORT_EXCEL_BILL = 'importExcelBill', // 导入excel清单
 
   // 费率相关
   RESET_FEE_RATE = 'resetFeeRate', // 重选标准

+ 1 - 0
types/src/interface/enterprise.ts

@@ -30,6 +30,7 @@ export interface IMember {
   exportProject: 'disabled' | 'self' | 'all';
   importProject: 'disabled' | 'self' | 'all';
   shareProject: 'disabled' | 'self' | 'all';
+  needResetPassword: boolean;
 }
 
 export interface IEnterprise {

+ 6 - 0
types/src/interface/notification.ts

@@ -0,0 +1,6 @@
+export interface INotificationListItem {
+  ID: string;
+  status: 'unread' | 'already';
+  title: string;
+  removable: boolean;
+}