浏览代码

feat(types): 修改定义

zhangweicheng 5 年之前
父节点
当前提交
b24c9d9892
共有 2 个文件被更改,包括 49 次插入1 次删除
  1. 46 0
      types/src/interface/base.ts
  2. 3 1
      types/src/interface/bill.ts

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

@@ -84,3 +84,49 @@ export interface IBulkWrite<T extends IAny> {
   create?: ICreate<T>[];
   remove?: IDelete<T>[];
 }
+
+export enum CptModelName {
+  projects = 'projects',
+  bills = 'bills',
+  rations = 'rations',
+  rationGljs = 'rationGljs',
+  shareList = 'shareList',
+  unitPriceFile = 'unitPriceFile',
+  feeRateFile = 'feeRateFile',
+  labourCoeFile = 'labourCoeFile',
+  importLogs = 'importLogs',
+  cptRationSectionTpl = 'cptRationSectionTpl',
+  cptGljLib = 'cptGljLib',
+  cptGljSection = 'cptGljSection',
+  cptGljSectionTpl = 'cptGljSectionTpl',
+  cptRationCoeList = 'cptRationCoeList',
+  cptRationInstallation = 'cptRationInstallation',
+  cptRationInstallationSection = 'cptRationInstallationSection',
+  cptRationItems = 'cptRationItems',
+  cptRationChapterTrees = 'cptRationChapterTrees',
+  configMaterials = 'configMaterials',
+  projectGljs = 'projectGljs',
+  calcProgramFile = 'calcProgramFile',
+  options = 'options',
+  installationFee = 'installationFee',
+}
+
+export enum ActionType {
+  ADD = 'add',
+  UPDATE = 'update',
+  REPLACE = 'replace', // 和update不同,如替换定额,替换清单等,操作不一样
+  DELETE = 'delete',
+}
+
+// 统一subject更新提交数据入口,为撤销功能做准备
+export interface ISetData<T> {
+  projectID: string; // 考虑到可能会跨项目更新,提高一层
+  module: CptModelName;
+  action: ActionType;
+  actionName?: string; // 除了增删改查,还会有更复杂的操作,用这个来区分
+  filter?: T; // 查询条件
+  update?: T; // 和update类型对应,
+  documents?: T[]; // add 类型对应,批量插入
+  odocs?: any[]; // 存放撤销的原始数据?
+  result?: any; // 特殊的返回结果
+}

+ 3 - 1
types/src/interface/bill.ts

@@ -5,10 +5,12 @@ export interface IBill {
   parentID: string;
   seq: number;
   kind: BRType;
+  unit?: string;
   code?: string;
   name?: string;
   quantity?: number;
-  unit: string;
+  recharge?: string; // 补注
+  ruleText?: string; // 工程量计算规则
   [key: string]: any; // 剩下的之后补充
 }