Kaynağa Gözat

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

qinlaiqiao 5 yıl önce
ebeveyn
işleme
70f5a2f261

+ 1 - 1
handsontable/package.json

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

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

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

+ 5 - 1
handsontable/src/renderers/numericRenderer.js

@@ -24,7 +24,11 @@ function numericRenderer(instance, TD, row, col, prop, value, cellProperties) {
     const cellFormatPattern = numericFormat && numericFormat.pattern;
     const className = cellProperties.className || '';
     const classArr = className.length ? className.split(' ') : [];
-
+    if (numericFormat && numericFormat.zeroFormat !== undefined) {
+      numbro.zeroFormat(numericFormat.zeroFormat);
+    } else {
+      numbro.zeroFormat(null);
+    }
     if (typeof cellCulture !== 'undefined' && !numbro.languages()[cellCulture]) {
       const shortTag = cellCulture.replace('-', '');
       const langData = numbro.allLanguages ? numbro.allLanguages[cellCulture] : numbro[shortTag];

+ 1 - 0
handsontable/src/tableView.js

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

+ 1 - 1
tree/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/tree",
-  "version": "1.0.4",
+  "version": "1.0.10",
   "description": "a template for npm package coding",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

+ 6 - 3
tree/src/nodeCtx.ts

@@ -113,11 +113,14 @@ export class NodeContext {
     return this.posterity().length;
   }
 
-  // 获取节点最上层父项(起源)
-  progenitor(): TreeNode | None {
+  // 获取节点的起源节点(根节点,若该节点已为根节点,则返回自身
+  progenitor(): TreeNode {
     let parent = this.parent();
+    if (!parent) {
+      return this.ref;
+    }
     while (parent && parent.getCtx().parent()) {
-      parent = parent.getCtx().parent();
+      parent = parent.getCtx().parent() as TreeNode;
     }
     return parent;
   }

+ 82 - 8
tree/src/tree.ts

@@ -4,7 +4,7 @@ export interface TreeRaw {
   ID: string;
   parentID: string;
   seq: number;
-  [propName: string]: any;
+  [props: string]: any;
 }
 
 export interface TreeNode extends TreeRaw {
@@ -47,7 +47,7 @@ export class Tree {
   // 按照树结构拼装好、排好序的数据。实际只是原始数据进行排序,内部元素跟原始数据内部元素的引用是一致的
   data: TreeNode[];
 
-  readonly rootID: string = '-1';
+  rootID: string;
 
   // 默认初始顺序号。在对树结构进行操作后,没必要保证seq连号,只需保证正确排序就行,以减少需要更新的节点。
   readonly seqStartIndex = 0;
@@ -61,7 +61,8 @@ export class Tree {
   // 节点上下文与节点ID映射
   ctxMap: CtxIDMap;
 
-  constructor(rawData: TreeRaw[]) {
+  constructor(rawData: TreeRaw[], rootID = '-1') {
+    this.rootID = rootID;
     this.rawData = this.genNodeContext(rawData);
     this.rawData = Tree.sort(this.rawData);
     this.data = [];
@@ -308,7 +309,7 @@ export class Tree {
     this.rawData.push(...nodes);
     // 排序
     this.reSortData(nodes);
-    return this.data;
+    return nodes;
   }
 
   // 准备删除,返回所有需要删除的节点,包括嵌套节点
@@ -319,13 +320,14 @@ export class Tree {
   /**
    * 删除节点
    * @param {TreeNode[]} treeNodes - 要删除的节点,不需要包含嵌套节点
-   * @return {TreeNode[]} 返回删除节点后,树的data
+   * @return {TreeNode[]} 返回删除节点
    */
   delete(treeNodes: TreeNode[]): TreeNode[] {
     const allDeletedNodes: TreeNode[] = [];
     // 递归删除节点
     const deleteNodes = (nodes: TreeNode[]): void => {
       // 删除映射、删除数据
+      const toDels: { nodes: TreeNode[]; delNode: TreeNode }[] = [];
       nodes.forEach(node => {
         allDeletedNodes.push(node);
         delete this.IDMap[node.ID];
@@ -336,7 +338,7 @@ export class Tree {
         if (nodesInParentMap && nodesInParentMap.length) {
           const nIndex = nodesInParentMap.indexOf(node);
           if (nIndex >= 0) {
-            nodesInParentMap.splice(nIndex, 1);
+            toDels.push({ nodes: nodesInParentMap, delNode: node });
           }
         }
         const index = this.rawData.indexOf(node);
@@ -347,11 +349,18 @@ export class Tree {
           deleteNodes(children);
         }
       });
+      // 删除parentMap的数据
+      toDels.forEach(delItem => {
+        const delIndex = delItem.nodes.indexOf(delItem.delNode);
+        if (delIndex >= 0) {
+          delItem.nodes.splice(delIndex, 1);
+        }
+      });
     };
     deleteNodes(treeNodes);
     // 排序
     this.reSortData(allDeletedNodes);
-    return this.data;
+    return allDeletedNodes;
   }
 
   // IDList 返回所有需要删除的节点,包括嵌套节点
@@ -468,10 +477,12 @@ export class Tree {
     }
     // 最末节点的所有后兄弟节点,成为最末节点的子节点
     const lastNodeNextBrothers = lastNode.getCtx().nextBrothers();
+    const lastNodeLastChild = lastNode.getCtx().lastChild();
+    const lastNodeLastChildSeq = lastNodeLastChild ? lastNodeLastChild.seq : 0;
     lastNodeNextBrothers.forEach((node, index) => {
       updateData.push({
         ID: node.ID,
-        update: { parentID: lastNode.ID, seq: index },
+        update: { parentID: lastNode.ID, seq: index + lastNodeLastChildSeq },
       });
     });
     return updateData;
@@ -536,5 +547,68 @@ export class Tree {
       ...nodes
     );
     this.updateValue(updateData);
+    this.reGenData();
+  }
+
+  // 准备移动节点块(连续的兄弟节点),不维护seq连号
+  prepareMoveTo(
+    nodes: TreeNode[],
+    parent: TreeNode | None,
+    next: TreeNode | None
+  ): UpdateData[] {
+    const updateData: UpdateData[] = [];
+    let prev: TreeNode | None;
+    if (next) {
+      prev = next.getCtx().prev();
+    } else {
+      prev = parent ? parent.getCtx().lastChild() : null;
+    }
+    const baseSeq = prev ? prev.seq + 1 : this.seqStartIndex;
+    updateData.push(
+      ...nodes.map((node, index) => ({
+        ID: node.ID,
+        update: {
+          parentID: (parent && parent.ID) || this.rootID,
+          seq: baseSeq + index,
+        },
+      }))
+    );
+    const curBaseSeq = baseSeq + nodes.length;
+    const nextBrothers = prev ? prev.getCtx().nextBrothers() : [];
+    updateData.push(
+      ...nextBrothers.map((node, index) => ({
+        ID: node.ID,
+        update: {
+          seq: curBaseSeq + index,
+        },
+      }))
+    );
+    return updateData;
+  }
+
+  moveTo(
+    nodes: TreeNode[],
+    parent: TreeNode | None,
+    updateData: UpdateData[]
+  ): void {
+    const firstNode = nodes[0];
+    const newParentID = parent ? parent.ID : this.rootID;
+    const orgParentID = firstNode.parentID;
+    const orgBrothers = this.parentMap[orgParentID];
+    orgBrothers.splice(orgBrothers.indexOf(firstNode), nodes.length);
+    (this.parentMap[newParentID] || (this.parentMap[newParentID] = [])).push(
+      ...nodes
+    );
+    this.updateValue(updateData);
+    this.resortDataByID([orgParentID, newParentID]);
+  }
+
+  // 清除所有节点(不变更data引用)
+  clear(): void {
+    this.rawData.splice(0, this.rawData.length);
+    this.data.splice(0, this.data.length);
+    Object.keys(this.parentMap).forEach(key => delete this.parentMap[key]);
+    Object.keys(this.IDMap).forEach(key => delete this.IDMap[key]);
+    Object.keys(this.ctxMap).forEach(key => delete this.ctxMap[key]);
   }
 }

+ 1 - 1
types/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/types",
-  "version": "1.0.6",
+  "version": "1.0.14",
   "description": "共用类型文件",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

+ 22 - 6
types/src/interface/base.ts

@@ -54,9 +54,12 @@ export enum BRType { // 1 :大项费用 2:分部 3分项 4清单;5补项   6 
   FX = 3, // 分项
   BILL = 4, // 清单
   BX = 5, // 这个补项因为旧版本是后定义的,所以放在后面,为了统一不混淆
+  CS = 6, // 分类
+  DT = 7, // 费用明细
   RATION = 10, // 定额
-  VP = 11, // 量价
-  GLJ = 12, // 工料机
+  INST = 11, // 安装增加费生成的定额
+  VP = 12, // 量价
+  GLJ = 13, // 工料机
 }
 
 export enum supplyType {
@@ -67,20 +70,20 @@ export enum supplyType {
   JDYG, // 甲定乙供
 }
 
-export interface IUpdate<T extends IAny> {
+export interface IUpdate<T extends IAny = any> {
   filter: T;
   update: T;
 }
 
-export interface ICreate<T extends IAny> {
+export interface ICreate<T extends IAny = any> {
   document: T;
 }
 
-export interface IDelete<T extends IAny> {
+export interface IDelete<T extends IAny = any> {
   filter: T;
 }
 
-export interface IBulkWrite<T extends IAny> {
+export interface IBulkWrite<T extends IAny = any> {
   update?: IUpdate<T>[];
   create?: ICreate<T>[];
   remove?: IDelete<T>[];
@@ -131,3 +134,16 @@ export interface ISetData<T = any> {
   odocs?: any[]; // 存放撤销的原始数据?
   result?: any; // 特殊的返回结果
 }
+
+export interface IColumnMeta {
+  title: string;
+  data: string;
+  renderer?: string;
+  editor?: string;
+  readOnly?: boolean;
+  width: number;
+  type?: string;
+  numericFormat?: { pattern?: string; zeroFormat?: string };
+  visible?: boolean;
+  source?: string[];
+}

+ 85 - 0
types/src/interface/bill.ts

@@ -20,9 +20,11 @@ export interface IBill {
   parentID: string;
   seq: number;
   kind: BRType;
+  stdID?: string;
   unit?: string;
   code?: string;
   name?: string;
+  flag?: number; // 清单固定类别
   quantity?: number;
   recharge?: string; // 补注
   ruleText?: string; // 工程量计算规则
@@ -30,6 +32,9 @@ export interface IBill {
   jobContentText?: string;
   itemCharacter?: IItemCharacter[]; // 项目特征
   itemCharacterText?: string;
+  formula?: string; // 基数计算
+  formulaValue?: number; // 基数计算的值
+  tenderFormulaValue?: number; // 调价基数计算的值
   [key: string]: any; // 剩下的之后补充
 }
 
@@ -82,3 +87,83 @@ export interface IStdBill {
   quantityIndexCoe: number; // 单位转换系数
   deleted: boolean;
 }
+
+// 清单固定类别
+export enum 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,
+}

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

@@ -48,6 +48,7 @@ export interface IEngineering {
   rationLib?: INumFileRef[];
   progressiveLib?: IFileRef[];
   taxGroup: ITaxGroup[];
+  indexName?: string; // 指标专业名称
 }
 
 export interface IValuation {
@@ -72,3 +73,8 @@ export interface ICompilation {
   versionText?: string; // 版本对应的显示文字:免费版,学习版,专业版
   lockInfo?: ELockInfo; //
 }
+
+export enum ValuationType {
+  BILL = 'bill', // 清单计价
+  RATION = 'ration', // 定额计价
+}

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

@@ -32,13 +32,12 @@ export interface IFeeRate extends ITreeScm {
 
 export interface IFeeRateFile {
   ID: string;
-  rootProjectID: string;
+  projectID: string;
   userID: string;
   name: string;
   libID: string;
   libName: string;
   rates: IFeeRate[];
-  deleteType?: DeleteEnum;
 }
 
 export interface IStdSubFeeRate {

+ 138 - 0
types/src/interface/glj.ts

@@ -0,0 +1,138 @@
+import { fromType, supplyType } from './base';
+
+// 工料机类型
+export enum GljType {
+  LABOUR = 1, // 人工
+  // ==============材料类型 ↓=================
+  GENERAL_MATERIAL = 201, // 普通材料
+  CONCRETE = 202, // 混凝土
+  MORTAR = 203, // 砂浆
+  MIX_RATIO = 204, // 配合比
+  COMMERCIAL_CONCRETE = 205, // 商品混凝土
+  COMMERCIAL_MORTAR = 206, // 商品砂浆
+  OTHER_MATERIAL = 207, // 其它材料
+  // ==============材料类型 ↑=================
+  // ==============机械类型 ↓=================
+  GENERAL_MACHINE = 301, // 机械台班
+  MACHINE_COMPOSITION = 302, // 机械组成物
+  MACHINE_LABOUR = 303, // 机上人工
+  INSTRUMENT = 304, // 仪器仪表
+  FUEL_POWER_FEE = 305, // 燃料动力费
+  DEPRECIATION_FEE = 306, // 折旧费
+  INSPECTION_FEE = 307, // 检修费
+  MAINTENANCE = 308, // 维护费
+  DISMANTLING_FREIGHT_FEE = 309, // 安拆费及场外运费
+  VERIFICATION_FEE = 310, // 校验费
+  OTHER_FEE = 311, // 其他费用
+  OTHER_MACHINE_USED = 312, // 其他施工机具使用费
+  // ==============机械类型 ↑=================
+  MAIN_MATERIAL = 4, // 主材
+  EQUIPMENT = 5, // 设备
+  MANAGEMENT_FEE = 6, // 企业管理费
+  PROFIT = 7, // 利润
+  GENERAL_RISK_FEE = 8, // 一般风险费
+}
+
+export interface IBaseGlj {
+  code: string;
+  name: string;
+  specs?: string;
+  type: number;
+  unit: string;
+  [key: string]: any;
+}
+
+export interface IDisplayType {
+  [type: number]: string;
+}
+
+export const DisplayType: IDisplayType = {
+  1: '人',
+  201: '材',
+  202: '砼',
+  203: '浆',
+  204: '配比',
+  205: '商砼',
+  206: '商浆',
+  207: '材',
+  208: '外购',
+  209: '苗木',
+  301: '机',
+  302: '机',
+  303: '机人',
+  304: '仪',
+  305: '动',
+  306: '折',
+  307: '检',
+  308: '维',
+  309: '安',
+  310: '校',
+  311: '机',
+  312: '机',
+  4: '主',
+  5: '设',
+  6: '管',
+  7: '利',
+  8: '险',
+};
+
+export interface IComponent {
+  ID: string;
+  consumption: number; // 消耗量(有别于总消耗,此字段记录配合比的消耗量)
+  gljID: string; // 工料机总库对应id (关联用)
+  specs?: string; // 规格型号
+  unit: string; // 单位
+  name: string; // 名称
+  code: string; // 对应工料机code
+  type: number; // 工料机类型
+  model?: number; // 机型
+  from: fromType; // std, cpt  来自标准工料机库、补充工料机库
+}
+
+export interface IProjectGlj {
+  ID: string;
+  gljID: string; // 工料机ID
+  code: string; // 编码
+  originalCode: string; // 原始的编码
+  name: string; // 名称
+  isEvaluate?: boolean; // 是否暂估 (false为否 true为是) //这个属性考虑放弃
+  supply: supplyType; // 供货方式
+  supplyQuantity?: number; // 甲供数量
+  delivery?: string; // 交货方式
+  deliveryAddress?: string; // 送达地点
+  noAdjustPrice: boolean; // 不调价  { type: boolean; default: false }
+  nTaxEqp: boolean; // 不计税设备  { type: boolean; default: false }
+  adjCoe?: number; // 调整系数ID
+  specs: string; // 规格型号
+  type: number; // 类型
+  model?: number; // 机型
+  unit: string; // 单位
+  isAdd: boolean; // 是否新增
+  basePrice: number; // 基价单价
+  marketPrice: number; // 市场单价
+  components?: IComponent[]; // 组成物
+  taxRate?: number; // 税率
+  adjustPrice?: string; // 显示调整基价
+  quantity?: number; // 显示关联的消耗量
+  techQuantity?: string; // 技术措施项目消耗量
+  subdivisionQuantity?: string; // 分部分项消耗量
+  tenderPrice?: string; // 调整后价格
+  materialType?: number; // 三材类别
+  materialCoe?: number; // 三材系数
+  // 经济指标数据
+  materialIndexType?: string; // 工料指标类别
+  materialIndexUnit?: string; // 工料指标单位
+  materialIndexCoe: number; // 单位转换系数
+  isMainMaterial: boolean; // 是否主要材料 (0为否 1为是) { type: boolean; default: false };
+  remark?: string;
+  originPlace?: string; // 产地
+  vender?: string; // 厂家
+  qualityGrace?: string; // 质量等级
+  brand?: string; // 品牌
+  from: fromType; // std, cpt  来自标准工料机库、补充工料机库
+}
+
+export interface IProjectGljs {
+  projectID: string;
+  projectGljs: IProjectGlj[];
+}

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

@@ -6,8 +6,9 @@ export * from './systemSetting';
 export * from './project';
 export * from './increaseFee';
 export * from './labourCoe';
-export * from './unitPrice';
 export * from './feeRate';
 export * from './share';
 export * from './ration';
 export * from './bill';
+export * from './glj';
+export * from './option';

+ 8 - 0
types/src/interface/option.ts

@@ -0,0 +1,8 @@
+// 系统选项
+export interface IOptions {
+  ID: string;
+  userID: string;
+  compilationID: string;
+  rationQtyFromBillQty: boolean; // 自动根据清单工程量填写定额工程量
+  rationQtyFromRationUnit: boolean; // 自动根据定额单位转换定额工程量
+}

+ 30 - 20
types/src/interface/project.ts

@@ -1,6 +1,13 @@
+import { ValuationType } from './compilation';
 import { ILabourCoeFile } from './labourCoe';
 import { IIncreaseSetting } from './increaseFee';
-import { ITreeScm, IFileRef, DeleteEnum, INumFileRef } from './base';
+import {
+  ITreeScm,
+  IFileRef,
+  DeleteEnum,
+  INumFileRef,
+  IColumnMeta,
+} from './base';
 import { ICalcOption, ITenderSetting } from './calculation';
 
 export enum ProjectType {
@@ -95,7 +102,7 @@ export enum FileTypeName {
 
 export const FileTypeMap = {
   [FileType.SUBMISSION]: FileTypeName.SUBMISSION,
-  [FileType.INVITATION]: FileTypeName.SUBMISSION,
+  [FileType.INVITATION]: FileTypeName.INVITATION,
   [FileType.CONTROL]: FileTypeName.CONTROL,
 };
 
@@ -149,36 +156,25 @@ export interface IEconomicIndex {
 
 // 项目属性
 export interface IProperty {
-  rootProjectID?: string; // 建设项目ID
+  constructionID?: string; // 建设项目ID
+  valuationType?: ValuationType; // 计价类型
   valuationID?: string; // 计价规则
-  programID?: number; // 工程专业,填计算程序工程专业ID
   engineeringID?: string; // 工程专业ID
   fileType?: FileType; // 文件类型
   taxType?: TaxType; // 计税方式
   rationFeeType?: number; // 定额取费专业
   unitFeeType?: number; // 单位工程取费专业
   calcProgramLib?: INumFileRef; // 计算程序(标准)
-  calcProgramFile?: IFileRef; // 计算程序(用户数据)
-  colLibID?: string; // 列设置
-  templateLibID?: string; // 清单模板
-  unitPriceFile?: IFileRef; // 单价文件
-  feeFile?: IFileRef; // 费率文件
   region?: string;
+  showAdjustPrice?: boolean; // 是否显示调整价列
   isInstall?: boolean; // 是否是安装工程
   isItemIncrease?: boolean; // 是否是子目增加
   itemIncreaseSetting?: IIncreaseSetting;
   isAreaIncrease?: boolean; // 是否是面积增加
-  featureLibID?: string; // 工程特征
   indexName?: string; // 指标名称
-  engineerInfoLibID?: string; // 工程信息指标
-  engineerFeatureLibID?: string; // 工程特征指标
-  economicLibID?: string; // 主要经济指标
-  mainQuantityLibID?: string; // 主要工程量指标
-  materialLibID?: string; // 主要工料指标
-  progressiveLibID?: string; // 累进区间库
   lockBills?: boolean; // 锁定清单
   decimal?: IDecimal; // 小数位数
-  billsQuantityDecimal: IBillsQuantityDecimal[]; // 清单工程量精度
+  billsQuantityDecimal?: IBillsQuantityDecimal[]; // 清单工程量精度
   displaySetting?: IDisplaySetting; // 呈现选项
   billsCalcMode?: number; // 清单计费取费方式
   zanguCalcMode?: number; // 暂估合价计算方式
@@ -191,7 +187,6 @@ export interface IProperty {
   progressiveInterval?: IProgressiveInterval[]; // 累进区间
   gljAdjustType?: GLJAdjustType; // 承包人材料调整类型
   cptIllustration?: string; // 编制说明
-  labourCoeFile?: ILabourCoeFile; // 人工系数文件
   engineerInfos?: IInfoItem[];
   engineerFeatures?: IEngineerFeature[];
   materials?: IMaterialIndex[];
@@ -199,6 +194,7 @@ export interface IProperty {
   economics?: IEconomicIndex[];
 }
 
+// 原来的列设置太复杂了,没什么必要
 export interface IMainTreeCol {
   cols: Array<any>;
   headRowHeight: Array<number>;
@@ -221,8 +217,7 @@ export interface IProject extends ITreeScm {
   code?: string;
   createDate: number;
   property?: IProperty;
-  mainTreeCol?: IMainTreeCol;
-  gljCol?: IGLJCol;
+  colMetas?: IColumnMeta[];
   changeMark?: string;
   remark?: string;
   fileVer?: string;
@@ -231,9 +226,24 @@ export interface IProject extends ITreeScm {
   deleteType?: DeleteEnum;
   deleteDate?: number;
   deleteBy?: string;
+  // 只是为了显示,不是自身的正在数据,比如汇总信息等
+  external?: {
+    cost: number; // 工程造价
+  };
 }
 
 export interface IProjectBulkRst {
   create: IProject[];
   remove: string[];
 }
+
+// 建设项目默认设置项(可以被恢复的)
+export interface IConstructionDefaultSetting {
+  decimal: IProperty['decimal'];
+  billsQuantityDecimal: IProperty['billsQuantityDecimal'];
+  displaySetting: IProperty['displaySetting'];
+  billsCalcMode: IProperty['billsCalcMode'];
+  zanguCalcMode: IProperty['zanguCalcMode'];
+  calcOption: IProperty['calcOption'];
+  colMetas: IProject['colMetas'];
+}

+ 0 - 52
types/src/interface/ration.ts

@@ -171,15 +171,6 @@ export interface ICptComponent {
   from: fromType;
 }
 
-export interface IBaseGlj {
-  code: string;
-  name: string;
-  specs?: string;
-  type: number;
-  unit: string;
-  [key: string]: any;
-}
-
 export interface IBaseRationGlj {
   code: string;
   name: string;
@@ -226,49 +217,6 @@ export interface IRationGlj {
   from: fromType; // std, cpt  来自标准工料机库、补充工料机库
 }
 
-export interface IProjectGlj {
-  ID: string;
-  gljID: string; // 工料机ID
-  code: string; // 编码
-  originalCode: string; // 原始的编码
-  name: string; // 名称
-  isEvaluate?: boolean; // 是否暂估 (false为否 true为是) //这个属性考虑放弃
-  supply: supplyType; // 供货方式
-  supplyQuantity?: number; // 甲供数量
-  delivery?: string; // 交货方式
-  deliveryAddress?: string; // 送达地点
-  noAdjustPrice: boolean; // 不调价  { type: boolean; default: false }
-  nTaxEqp: boolean; // 不计税设备  { type: boolean; default: false }
-  adjCoe?: number; // 调整系数ID
-  specs: string; // 规格型号
-  type: number; // 类型
-  model?: number; // 机型
-  unit: string; // 单位
-  adjustPrice?: string; // 显示调整基价
-  quantity?: number; // 显示关联的消耗量
-  techQuantity?: string; // 技术措施项目消耗量
-  subdivisionQuantity?: string; // 分部分项消耗量
-  tenderPrice?: string; // 调整后价格
-  materialType?: number; // 三材类别
-  materialCoe?: number; // 三材系数
-  // 经济指标数据
-  materialIndexType?: string; // 工料指标类别
-  materialIndexUnit?: string; // 工料指标单位
-  materialIndexCoe: number; // 单位转换系数
-  isMainMaterial: boolean; // 是否主要材料 (0为否 1为是) { type: boolean; default: false };
-  remark?: string;
-  originPlace?: string; // 产地
-  vender?: string; // 厂家
-  qualityGrace?: string; // 质量等级
-  brand?: string; // 品牌
-  from: fromType; // std, cpt  来自标准工料机库、补充工料机库
-}
-
-export interface IProjectGljs {
-  projectID: string;
-  projectGljs: IProjectGlj[];
-}
-
 export interface IStdRationGlj extends IBaseRationGlj {
   ID: number;
   repositoryId: number;

+ 0 - 41
types/src/interface/unitPrice.ts

@@ -1,41 +0,0 @@
-import { DeleteEnum, fromType } from './base';
-
-export interface IComponent {
-  ID: string;
-  consumption: number; // 消耗量(有别于总消耗,此字段记录配合比的消耗量)
-  gljID: string; // 工料机总库对应id (关联用)
-  specs?: string; // 规格型号
-  unit: string; // 单位
-  name: string; // 名称
-  code: string; // 对应工料机code
-  type: number; // 工料机类型
-  model?: number; // 机型
-  from: fromType; // std, cpt  来自标准工料机库、补充工料机库
-}
-
-export interface IUnitPrice {
-  ID: string;
-  basePrice: number; // 基价单价
-  marketPrice: number; // 市场单价
-  taxRate?: number; // 税率
-  code: string; // 编码
-  originalCode: string; // 原始的编码
-  name: string; // 名称
-  specs: string; // 规格型号
-  unit: string; // 单位
-  model?: number; // 机型
-  type: number; // 类型
-  gljID: string; // 对应标准库工料机id
-  from: fromType; // std, cpt  来自标准工料机库、补充工料机库
-  components?: IComponent[]; // 组成物
-  isAdd: boolean; // 是否新增
-}
-
-export interface IUnitPriceFile {
-  ID: string;
-  name: string;
-  userID?: string;
-  rootProjectID: string;
-  unitPrices: IUnitPrice[];
-  deleteType?: DeleteEnum;
-}

mathUtil/.eslintignore → util/.eslintignore


mathUtil/.eslintrc.js → util/.eslintrc.js


mathUtil/.gitignore → util/.gitignore


mathUtil/.huskyrc.js → util/.huskyrc.js


mathUtil/README.md → util/README.md


mathUtil/commitlint.config.js → util/commitlint.config.js


mathUtil/lint-staged.config.js → util/lint-staged.config.js


+ 2 - 1
mathUtil/package.json

@@ -1,5 +1,5 @@
 {
-  "name": "@sc/math",
+  "name": "@sc/util",
   "version": "1.0.0",
   "description": "4舍5入算法,防止浮点数计算不精确问题",
   "main": "./dist/index.cjs.js",
@@ -21,6 +21,7 @@
     "@commitlint/cli": "^11.0.0",
     "@commitlint/config-conventional": "^11.0.0",
     "@types/chai": "^4.2.14",
+    "@sc/types": "^1.0.10",
     "@types/mocha": "^8.0.4",
     "@types/ms": "^0.7.31",
     "@typescript-eslint/eslint-plugin": "^4.4.1",

mathUtil/prettier.config.js → util/prettier.config.js


mathUtil/rollup.config.js → util/rollup.config.js


+ 34 - 0
util/src/bill.ts

@@ -0,0 +1,34 @@
+import { IJobContent, IItemCharacter } from '@sc/types';
+
+interface IJobsAndCharacterText {
+  jobContentText: string;
+  itemCharacterText: string;
+}
+
+export interface IJobAndCharacter extends IJobsAndCharacterText {
+  jobContents: IJobContent[];
+  itemCharacters: IItemCharacter[];
+}
+
+export const getJobsAndCharacterText = (
+  jobContents: IJobContent[],
+  itemCharacters: IItemCharacter[]
+): IJobsAndCharacterText => {
+  const jobContentText = '';
+  let itemCharacterText = '';
+  const textArray: string[] = ['[项目特征]'];
+  let i = 1;
+  for (const item of itemCharacters) {
+    if (item.isChecked) textArray.push(`${i}. ${item.character}`);
+    i += 1;
+  }
+
+  textArray.push('[工作内容]');
+  i = 1;
+  for (const job of jobContents) {
+    if (job.isChecked) textArray.push(`${i}. ${job.content}`);
+    i += 1;
+  }
+  itemCharacterText = textArray.join('\n');
+  return { jobContentText, itemCharacterText };
+};

+ 1 - 0
util/src/index.ts

@@ -0,0 +1 @@
+export * from './math';

+ 23 - 3
mathUtil/src/index.ts

@@ -1,17 +1,37 @@
+/* eslint-disable no-param-reassign */
 /* eslint-disable no-restricted-globals */
 // 判断传入的是否是数字或者可转为数字的字符串
 export const isNumber = (value: string | number): boolean => {
   return /^(-|\+)?\d+(\.\d+)?$/.test(value as string);
 };
 
+export const innerRound = (
+  num: number,
+  lenght: number,
+  decimal: number
+): number => {
+  let value;
+  let pre = 1;
+  if (lenght === 0) return num;
+  if (num < 0) pre = -1; // 负数的时候先变成正数
+  num *= pre;
+  const n = 10 ** lenght;
+  value = Math.round(num * n);
+  if (lenght <= decimal) {
+    return (value / n) * pre;
+  }
+  value = Math.round(value / 10 ** (lenght - decimal));
+  return (value / 10 ** decimal) * pre;
+};
+
 export const roundForObj = (obj: string | number, decimal: number): number => {
   let value;
   if (obj === undefined || obj === null || isNaN(obj as number)) return 0;
-  const n = 10 ** decimal;
+  const lenght = 10;
   if (obj === +obj) {
-    value = Math.round(obj * n) / n;
+    value = innerRound(obj, lenght, decimal);
   } else {
-    value = Math.round(Number(obj) * n) / n;
+    value = innerRound(Number(obj), lenght, decimal);
   }
   return value;
 };

mathUtil/tests/test.ts → util/tests/test.ts


+ 1 - 0
mathUtil/tsconfig.json

@@ -6,6 +6,7 @@
     "outDir": "./",
     "strict": true,
     "esModuleInterop": true,
+    "moduleResolution": "node",
   },
   "include": [
     "src/**/*.ts",