Преглед изворни кода

feat(types): 增加projects等类型

vian пре 5 година
родитељ
комит
dae0043f01

+ 1 - 0
types/.eslintrc.js

@@ -36,5 +36,6 @@ module.exports = {
     'no-restricted-syntax': 'off',
     'no-shadow': 'off',
     '@typescript-eslint/no-shadow': 'error',
+    'max-classes-per-file': 'off',
   },
 };

+ 2 - 3
types/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/types",
-  "version": "1.0.0",
+  "version": "1.0.2",
   "description": "共用类型文件",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",
@@ -44,6 +44,5 @@
     "ts-node": "^9.0.0",
     "tslib": "^2.0.3",
     "typescript": "^4.0.3"
-  },
-  "dependencies": {}
+  }
 }

+ 5 - 0
types/src/interface/User.ts

@@ -11,6 +11,11 @@ export interface IupgradeInfo {
   [key: string]: any;
 }
 
+export enum UserType {
+  NORMAL = 'normal',
+  PROFESSIONAL = 'professional',
+}
+
 export interface IUserResult {
   _id?: string;
   ssoId?: number;

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

@@ -0,0 +1,39 @@
+export interface IAny {
+  [prop: string]: any;
+}
+
+export interface ITreeScm {
+  ID: string;
+  parentID: string;
+  seq: number;
+}
+
+export interface IFileRef {
+  id: string;
+  name: string;
+}
+
+export enum DeleteEnum {
+  NORMAL = 1,
+  DELETED,
+  COMPLETEDELETED,
+}
+
+export interface IUpdate<T extends IAny> {
+  filter: T;
+  update: T;
+}
+
+export interface ICreate<T extends IAny> {
+  document: T;
+}
+
+export interface IDelete<T extends IAny> {
+  filter: T;
+}
+
+export interface IBulkWrite<T extends IAny> {
+  update?: IUpdate<T>[];
+  create?: ICreate<T>[];
+  delete?: IDelete<T>[];
+}

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

@@ -0,0 +1,19 @@
+// 计算选项
+export interface ICalcOption {
+  calcMain: boolean;
+  calcAdd: boolean;
+  calcEst: boolean;
+}
+
+// 调价选项
+export enum TenderOption {
+  COE_BASE = 'coeBase',
+  GLJ_BASE = 'gljBase',
+  ZM_BASE = 'zmBase',
+}
+
+// 调价设置
+export interface ITenderSetting {
+  gljPriceTenderCoe: number; // 工料机单价调整系数
+  calcPriceOption: TenderOption; // 根据调整系数计算报价
+}

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

@@ -1,2 +1,6 @@
+export * from './base';
 export * from './Compliation';
 export * from './User';
+export * from './calculation';
+export * from './systemSetting';
+export * from './project';

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

@@ -0,0 +1,171 @@
+import { ITreeScm, IFileRef, DeleteEnum } from './base';
+import { ICalcOption, ITenderSetting } from './calculation';
+
+export enum ProjectType {
+  FOLDER = 1,
+  CONSTRUCTION, // 建设项目
+  SINGLE, // 单项工程
+  UNIT, // 单位工程
+}
+
+export interface IGLJCol {
+  showAdjustPrice?: boolean;
+}
+
+// 小数位数
+export interface IDecimal {
+  bills: { unitFee: number; totalFee: number };
+  ration: { quantity: number; unitFee: number; totalFee: number };
+  glj: { quantity: number; unitPriceHasMix: number; unitFee: number };
+  feeRate: number;
+  quantityDetail: number;
+  material: number; // 三材系数
+  process: number;
+}
+
+// 工程量精度
+export interface IQuantityDecimal {
+  unit: string;
+  decimal: number;
+}
+
+// 呈现选项
+export interface IDisplaySetting {
+  billsAutoHeight: boolean;
+  rationAutoHeight: boolean;
+  disPlayMainMaterial: boolean;
+}
+
+// 累进区间
+export interface IProgression {
+  interval: string; // 区间字符 eg: '(0,100]'
+  feeRate: boolean;
+}
+
+export interface IProgressiveInterval {
+  name: string;
+  progression: IProgression[];
+}
+
+// 超高降效
+export interface IOverHeight {
+  name: string;
+  code?: string;
+  unit?: string;
+  labourRate?: string;
+  machineRate?: string;
+  labourMachineRate?: string;
+  benchmark?: string;
+  extra?: string;
+  limit?: string;
+}
+
+export enum OverHeightOption {
+  SEPARATION = 1, // 对应清单或分部下(默认)
+  MEASURE, // 指定措施清单011704001
+  SPECIFIC, // 指定具体位置,显示分部分项以及措施项目的树结构显示叶子清单(分项)供勾选
+}
+
+// 工程特征、基本信息
+export interface IInfoItem {
+  key: string;
+  dispName: string;
+  value?: string;
+  required?: string;
+  readonly?: string;
+  options?: string;
+  cellType?: string;
+  items?: IInfoItem[];
+}
+
+// 承包人材料调整类型
+export enum GLJAdjustType {
+  PRICE_INFO = 'priceInfo', // 造价信息差额调整法
+  PRICE_COE = 'priceCoe', // 价格指数调整法
+}
+
+// 计税方式
+export enum TaxType {
+  GENERAL = 1,
+  SIMPLE,
+}
+
+// 文件类型
+export enum FileType {
+  BID_SUBMISSION = 1, // 投标
+  BID_INVITATION, // 招标
+}
+
+// 项目属性
+export interface IProperty {
+  rootProjectID?: string; // 建设项目ID
+  valuationID?: string; // 计价规则
+  engineeringID?: string; // 工程专业
+  taxType?: number; // 计税方式
+  rationFeeType?: number; // 定额取费专业
+  unitFeeType?: number; // 单位工程取费专业
+  calcProgram?: IFileRef; // 计算程序
+  colLibID?: number; // 列设置
+  templateLibID?: number; // 清单模板
+  unitPriceFile?: IFileRef; // 单价文件
+  feeFile?: IFileRef; // 费率文件
+  region?: string;
+  isInstall?: boolean; // 是否是安装工程
+  isItemIncrease?: boolean; // 是否是子目增加
+  isAreaIncrease?: boolean; // 是否是面积增加
+  featureLibID?: string; // 工程特征
+  indexName?: string; // 指标名称
+  engineerInfoLibID?: string; // 工程信息指标
+  engineerFeatureLibID?: string; // 工程特征指标
+  economicLibID?: string; // 主要经济指标
+  mainQuantityLibID?: string; // 主要工程量指标
+  materialLibID?: string; // 主要工料指标
+  progressiveLibID?: string; // 累进区间库
+  lockBills?: boolean; // 锁定清单
+  decimal?: IDecimal; // 小数位数
+  displaySetting?: IDisplaySetting; // 呈现选项
+  billsCalcMode?: number; // 清单计费取费方式
+  zanguCalcMode?: number; // 暂估合价计算方式
+  calcOption?: ICalcOption; // 计算选项
+  tenderSetting?: ITenderSetting; // 调价设置
+  overHeight?: IOverHeight[]; // 超高降效数据
+  overHeightOption?: OverHeightOption; // 超高降效选项
+  basicInfo?: IInfoItem[]; // 基本信息
+  feature?: IInfoItem[]; // 工程特征
+  gljAdjustType?: GLJAdjustType; // 承包人材料调整类型
+  cptIllustration?: string; // 编制说明
+}
+
+export interface IMainTreeCol {
+  cols: Array<any>;
+  headRowHeight: Array<number>;
+  treeCol?: number;
+  headRows?: number;
+  emptyRows?: number;
+}
+
+export enum ImportType {
+  NONE,
+  YBP,
+  INTERFACE,
+}
+
+export interface IProject extends ITreeScm {
+  type: ProjectType;
+  compilationID: string;
+  userID: string;
+  name: string;
+  code?: string;
+  createDate: number;
+  property?: IProperty;
+  mainTreeCol?: IMainTreeCol;
+  gljCol?: IGLJCol;
+  changeMark?: string;
+  remark?: string;
+  fileVer?: string;
+  lastFileVer?: string;
+  imported?: ImportType;
+  deleteType?: DeleteEnum;
+  deleteDate?: number;
+  deleteBy?: string;
+}

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

@@ -0,0 +1,8 @@
+enum ShareType {
+  PROJECT = 1,
+  RATION_LIB, // 补充定额库
+  GLJ_LIB, // 单项工程
+  BLOCK_LIB, // 单位工程
+}
+
+export default ShareType;

+ 20 - 0
types/src/interface/systemSetting.ts

@@ -0,0 +1,20 @@
+export const systemLimit = 100;
+
+export enum SystemLimitType {
+  PROJECT = 'project',
+  RATION = 'RATION',
+}
+
+export interface ISystemLimit {
+  project: number; // 单位工程可创建数量
+  ration: number; // 定额可创建数量
+}
+
+export interface ISystemSetting {
+  ID: string;
+  normal: ISystemLimit;
+  professional: ISystemLimit;
+  version: string;
+  product: string;
+  company: string;
+}

+ 2 - 0
types/tsconfig.json

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