Procházet zdrojové kódy

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

qinlaiqiao před 4 roky
rodič
revize
25903f289c

+ 1 - 1
handsontable/package.json

@@ -10,7 +10,7 @@
     "url": "https://github.com/handsontable/handsontable/issues"
   },
   "author": "Handsoncode <hello@handsontable.com>",
-  "version": "6.3.12",
+  "version": "6.3.13",
   "browser": "dist/handsontable.js",
   "main": "commonjs/index.js",
   "module": "es/index.js",

+ 1 - 1
handsontable/src/plugins/copyPaste/utils.js

@@ -77,7 +77,7 @@ export function tableToArray(element) {
 
       for (let column = 0; column < cellsLen; column += 1) {
         const cell = cells[column];
-        cell.innerHTML = cell.innerHTML.trim().replace(/<br(.|)>(\n?)/, '\n');
+        cell.innerHTML = cell.innerHTML.trim().replace(/<br(.|)>(\n?)/g, '\n');
         const cellText = cell.innerText;
 
         newRow.push(cellText);

+ 1 - 1
report/package.json

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

+ 101 - 8
report/src/core/formulasFun.ts

@@ -4,13 +4,13 @@ import formulasDataSetter from './formulasDataSetter';
 import * as stringUtil from '../public/stringUtil'
 import { ReportDate as useReportDate } from '../public/ReportDate'
 import { ICurrent_RPT, IRptTpl, IDataObj, Fields } from '../interface/basic'
-import { JV  } from './jpc_value_define';
+import { JV } from './jpc_value_define';
 
 /* eslint-disable import/prefer-default-export */
 export const replaceAll = (FindText: RegExp | string, RepText: string, str: string): string => {
     const regExp = new RegExp(FindText, 'g');
     return str.replace(regExp, RepText);
-  };
+};
 
 export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_RPT) => {
     formulasDataSetter.setupData($CURRENT_RPT, $CURRENT_DATA);
@@ -43,10 +43,10 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
         convertStrToBoolean,
         formatNumber,
     } = stringUtil;
-   
-    const $JV= JV;
+
+    const $JV = JV;
     const $JE = JE;
-    const ReportDate = useReportDate;
+    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;
@@ -54,12 +54,12 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
                 // 计算式集合,目前是放置打印信息的,用于配置属性的计算
                 let $ME = $CURRENT_RPT.formulas[execFmlIdx];
                 try {
-                    let newExpression=expression;
+                    let newExpression = expression;
                     const { format } = $ME;
                     // console.log(expression);
                     //临时处理
                     if (expression.indexOf(`new Date(`)) {
-                        newExpression= replaceAll(/new Date\(/g, `new ReportDate(`,expression)
+                        newExpression = replaceAll(/new Date\(/g, `new reportDate(`, expression)
                     }
                     eval(newExpression);
                 } catch (ex) {
@@ -69,10 +69,71 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
         }
     }
     formulasDataSetter.resetData();
-    return {$JE,$JV};
+    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
+    };
 }
 
 export const combinedGridFormula = ($RUN_TYPE: String, $TEXT: Fields, $TIMES: number, $CURRENT_RPT: ICurrent_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) {
@@ -89,5 +150,37 @@ export const combinedGridFormula = ($RUN_TYPE: String, $TEXT: Fields, $TIMES: nu
         }
     }
     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
+    };
+
 }
 export default {};

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

@@ -10,7 +10,7 @@ import { JpcFunc } from './jpc_function';
 import { JpcEvent } from './jpc_event';
 import { JpcData } from './jpc_data';
 import { JpcCommonHelper } from './helper/jpc_helper_common';
-import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICustomizeCfg, ITargetFields, IRptTpl, IDataObj, IBands, IControlCollection, IStyles, BorderStyle, IFontSubCollection, IControlSubCollection, IRstPage, IMergeBand } from '../interface/basic'
+import { IDefProperties, IFormula, IParams, ICurrent_RPT, ICustomizeCfg, ITargetFields, IRptTpl, IDataObj, IBands, IControlCollection, IStyles, BorderStyle, IFontSubCollection, IControlSubCollection, IRstPage, IMergeBand, IFormulasObject } from '../interface/basic'
 import { IFlowTabClass, IBillTabClass, ICostTabClass } from '../interface/classType';
 import {  IPagingOption } from '../interface/enum';
 import { Key } from 'readline';
@@ -30,6 +30,7 @@ export class JpcExClass {
     params: IParams;
     formulas: IFormula[];
     events: any;
+    formulasObject :IFormulasObject={};
 
     constructor(rptTpl: IRptTpl) {
         if (rptTpl.流水式表_信息) {
@@ -121,7 +122,7 @@ export class JpcExClass {
 
     //根据步骤,对formulas中的计算式进行处理,并赋值到相应属性中
     executeFormulas(runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_RPT) {
-        formulaExec(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT)
+      return formulaExec(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT);
     };
 
     outputAsPreviewPage(rptTpl: IRptTpl, defProperties: IDefProperties) {
@@ -200,7 +201,7 @@ export class JpcExClass {
             try {
                 for (let page = startPage; page <= endPage; page++) {
                     me.runTimePageData.currentPage = page;
-                    me.executeFormulas('before_output', rptTpl, dataObj, me);
+                   this.formulasObject = me.executeFormulas('before_output', rptTpl, dataObj, me);
                     // console.log('=======================');
                     rst.items.push(me.outputAsSimpleJSONPage(rptTpl, dataObj, bands, page, rst.control_collection, customizeCfg));
                 }

+ 62 - 0
report/src/core/jpc_flow_tab.ts

@@ -1143,6 +1143,38 @@ export class JpcFlowTabClass {
         }
     };
     checkCombineEvent($RUN_TYPE: String, $VER_COMB_ARRAY: number[][], $HOR_COMB_ARRAY: any[], $CURRENT_CELL_ITEMS: ICell[], $CURRENT_RPT: ICurrent_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) {
@@ -1158,6 +1190,36 @@ export class JpcFlowTabClass {
                 }
             }
         }
+        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: IRptTpl, dataObj: IDataObj | null, page: number, segIdx: number, bands: IBands, unitFactor: number, multiColIdx: number, $CURRENT_RPT: ICurrent_RPT, customizeCfg: ICustomizeCfg | null) {
         let me = this, rst: any = [];

+ 7 - 0
report/src/interface/basic.ts

@@ -336,6 +336,7 @@ export interface ICurrent_RPT {
     billTab: any;
     crossTab: any;
     runTimePageData: { currentPage?: number };
+    formulasObject:Record<string,any>;
 }
 
 export interface ICurrent_DATA {
@@ -658,4 +659,10 @@ export interface IRptCustomizeCfg {
     rptConfig:IRptConfig,
     schemeData:IRptSchemeList[]
    
+}
+
+//方法的参数
+export interface IFormulasObject{
+    [key:string]:any
+   
 }

+ 9 - 2
types/src/interface/base.ts

@@ -1,3 +1,4 @@
+import { IProcessData } from './process';
 import { IProjectGlj } from './glj';
 import { IBill, IBookmark } from './bill';
 import { IProject, IProjectPermission } from './project';
@@ -142,8 +143,11 @@ export enum CptModelName {
   options = 'options',
   installationFee = 'installationFee',
   financialProject = 'financialProject',
-  approval = 'approval',
+  approval = 'approval', // 后台设置的流程,相关于模板
+  projectApproval = 'projectApproval', // 上报后项目实际使用的流程
   financialProjectType = 'financialProjectType',
+  editLogs = 'editLogs', // 项目修改记录
+  processData = 'processData', // 流程备份数据
 }
 
 // 无数据表的模块名称的枚举
@@ -218,12 +222,14 @@ export interface ISetData<T = any, F = any, R = any> {
   projectID: string; // 考虑到可能会跨项目更新,提高一层
   module: CptModelName | SubModelName;
   action: ActionType;
+  createLog?: boolean; // 是否生成这个setData包的修改记录
   prop?: string; // 用来指表中的数组属性名,针对如configMaterial里,一个collections 里有多个数组数据的情况
   actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
   filter?: F; // 查询条件
   update?: Partial<T>; // 和update类型对应,
   documents?: T[]; // add 类型对应,批量插入
-  odocs?: any[]; // 存放撤销的原始数据?
+  oDocs?: any[]; // 存放撤销的原始数据?
+  oldData?: T; // 旧数据,造价书中节点是引用同一个对象,编辑后是直接修改源数据,生成log时取不到旧数据
   result?: R; // 特殊的返回结果
 }
 
@@ -251,6 +257,7 @@ export interface ISubjectGetData {
   [CptModelName.calcProgramFile]: ICalcProgramFile;
   [CptModelName.configMaterials]: IConfigMaterial;
   [CptModelName.installationFee]: IInstallationFee;
+  [CptModelName.processData]?: IProcessData[];
 }
 
 // getData数据接口

+ 30 - 0
types/src/interface/editLog.ts

@@ -0,0 +1,30 @@
+import { CptModelName, SubModelName, ActionType, ActionName } from './base';
+
+export interface ILogDetail<T = any> {
+  ID: string; // 自身ID
+  itemID: string; // 所编辑的行对应的ID,如定额ID,清单ID
+  module: CptModelName | SubModelName; // 编辑的模块
+  action: ActionType; // 动作,增删改等
+  oDocs?: any[]; // 存放删除时或者修改时的数据
+  actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
+  userID: string; // 用户
+  userName: string; // 用户名
+  phone: string; // 电话
+  createdTime: number; // 生成时间
+  description?: string; // 操作说明
+  newValue?: string; // 新值
+  oldValue?: string; // 旧值
+  field?: string; // 修改的field
+}
+
+export interface IEditLog {
+  projectID: string;
+  billID: string;
+  constructionID: string;
+  processID?: string; // 流程ID
+  updateTime: number; // 最后修改时间
+  code?: string;
+  name?: string;
+  unit?: string;
+  editLogs: ILogDetail[];
+}

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

@@ -26,3 +26,4 @@ export * from './financialProject';
 export * from './institution';
 export * from './process';
 export * from './structure';
+export * from './editLog';

+ 2 - 1
types/src/interface/institution.ts

@@ -11,7 +11,8 @@ export interface IInstitution {
   fax: string;
   legalPerson: string;
   idCard: string;
-  institutionAcountTotal: number;
+  institutionAcountTotal: string;
+  memberTotal: string;
   createdTime: string;
   manager: {
     ID: string;

+ 34 - 1
types/src/interface/process.ts

@@ -1,3 +1,5 @@
+import { CptModelName, SubModelName, ActionType } from './base';
+
 // 环节类型
 export enum SectorType {
   APPROVAL = 'approval', // 审批
@@ -28,7 +30,7 @@ export enum AccountConfigure {
 }
 
 export interface IProcessAccount {
-  // ID 账号IDname 名称institutionID 企事业ID
+  // ID 账号ID name 名称institutionID 企事业ID
   ID: string;
   name: string;
   institutionID?: string; // 可能不会用到
@@ -59,3 +61,34 @@ export interface IApproval {
   createdTime: number;
   process: IProcess[];
 }
+
+export enum ApprovalState {
+  CREATED = 'created', // 创建
+  PROCESSING = 'processing', // 正在审批
+  APPROVED = 'approved', // 审批通过
+  FAILED = 'failed', // 失败
+}
+// 复制到项目里的流程
+export interface IProjectApproval extends IApproval {
+  projectIDs: string[]; // 包含在流程里的项目
+  state: ApprovalState; // 状态
+  approvalTime?: number; // 审批通过时间
+  currentProcessID?: string; // 当前正处于哪个环节ID
+}
+
+// 流程过程中存储的数据
+export interface IProcessData {
+  ID: string;
+  module: CptModelName | SubModelName; // 编辑的模块
+  action: ActionType; // 动作,增删改等
+  oDoc: any; // 存放删除时或者修改时的数据
+  createTime: number; // 创建时间
+}
+
+// 备份数据集合
+export interface IProcessDataDoc {
+  projectID: string;
+  processID: string;
+  index: number;
+  processData: IProcessData[];
+}

+ 19 - 0
types/src/interface/project.ts

@@ -5,6 +5,7 @@ import { ITreeScm, DeleteEnum, INumFileRef, IColumnMeta } from './base';
 import { ICalcOption, ITenderSetting, IDistributeSetting } from './calculation';
 import { ISharePermission } from './share';
 import { IOverHeight, IOverHeightSetting } from './overHeight';
+import { IProcessAccount } from './process';
 
 // 项目类型
 export enum ProjectType {
@@ -237,6 +238,7 @@ export interface IProperty {
   fileKind?: string; // 导入进来的属性,平台导出需要维持这个值不变
   infoPriceOption?: IInfoPriceOption; // 信息价选项 只用于搜索
   recommendPriceOption?: IInfoPriceOption; // 智能材价匹配时的选项
+  saveLog?: boolean; // 记录项目编辑log
 }
 
 // 原来的列设置太复杂了,没什么必要
@@ -266,6 +268,11 @@ export enum ProjectActivity {
   RECOVER = 'recover',
 }
 
+// 对项目的权限
+export enum PermissionType {
+  READONLY = 'readonly',
+  EDIT = 'edit',
+}
 export interface IProject extends ITreeScm {
   type: ProjectType;
   compilationID: string;
@@ -288,6 +295,18 @@ export interface IProject extends ITreeScm {
   deleteDate?: number;
   deleteBy?: string;
   financialProjectID?: string; // 关联财审项目ID(不用财审项目关联此表,因为可能多个项目对应一个财审项目)
+  // 流程信息
+  processInfo?: {
+    currentApprovalID: string; // 当前正处于哪个审批流中
+    currentProcessID: string; // 当前正处于哪个环节的ID
+    processName: string; // 环节名称 冗余数据用于列表显示
+    // 当前所处流程里,哪些账号能编辑,哪些账号能查看或者审批等设置
+    processAccounts?: {
+      ID: string; // 用户ID
+      permission: PermissionType;
+    }[];
+  };
+
   // 只是为了显示,不是自身的正在数据,比如汇总信息等
   external?: {
     showShareMark?: boolean; // 是否显示分享标记

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

@@ -2,6 +2,7 @@ export interface ReportFlags {
   constructSumType?: string | null;
   taxType?: string | null;
   auditType?: string | null;
+  rptTplType?:string| null;
 }
 
 export interface ReportSubTree {