base.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. import { IProjectGlj } from './glj';
  2. import { IBill, IBookmark } from './bill';
  3. import { IProject, IProjectPermission } from './project';
  4. import { IGljQtyCoe, IRation } from './ration';
  5. import { IFeeRateFile } from './feeRate';
  6. import { ICalcProgramFile } from './calculation';
  7. import { IConfigMaterial } from './configMaterial';
  8. import { IQuantityDetail } from './quantityDetail';
  9. import { IInstallationFee } from './installation';
  10. import { IProcessBackupData } from './process';
  11. export interface IAny {
  12. [prop: string]: any;
  13. }
  14. export interface ITreeScm {
  15. ID: string;
  16. parentID: string;
  17. seq: number;
  18. }
  19. export interface IFileRef {
  20. ID: string;
  21. name: string;
  22. type?: number;
  23. isDefault?: boolean;
  24. }
  25. export interface INumFileRef {
  26. ID: number;
  27. name: string;
  28. type?: number;
  29. isDefault?: boolean;
  30. }
  31. export enum DeleteEnum {
  32. NORMAL = 1,
  33. DELETED,
  34. COMPLETEDELETED,
  35. }
  36. // 返回数据接口
  37. export interface IResult<T = any> {
  38. errno: number;
  39. message: string;
  40. data: T;
  41. }
  42. export enum FromType {
  43. STD = 'std',
  44. CPT = 'cpt',
  45. }
  46. export enum RationPrefix {
  47. EMT = '',
  48. BOR = '借',
  49. CPT = '补',
  50. REP = '换',
  51. }
  52. // 工料机生成的类型
  53. export enum GljCreateType {
  54. NORMAL = 'normal',
  55. ADD = 'add',
  56. REPLACE = 'replace',
  57. }
  58. export enum CreateLocation {
  59. CSXM = 1, // 模板子目分别放在措施项目下
  60. FBFX = 2, // 模板子目分别放在分部分项下
  61. HNTZM = 3, // 模板子目分别放在对应混凝土子目下
  62. }
  63. export enum BRType { // 1 :大项费用 2:分部 3分项 4清单;5补项 6 定额、7 量价、8 工料机定额
  64. DXFY = 1, // 大项费用
  65. FB = 2, // 分部
  66. FX = 3, // 分项
  67. BILL = 4, // 清单
  68. BX = 5, // 这个补项因为旧版本是后定义的,所以放在后面,为了统一不混淆
  69. CS = 6, // 分类
  70. DT = 7, // 费用明细
  71. RATION = 20, // 定额
  72. INST = 21, // 安装增加费生成的定额
  73. VP = 22, // 量价
  74. GLJ = 23, // 工料机
  75. OH = 24, // 超高子目
  76. ITEM = 25, // 子目增加
  77. // 虚拟节点,主材、设备,只是显示
  78. MAIN = 50, // 主材
  79. EQUIP = 51, // 设备
  80. }
  81. export enum SupplyType {
  82. ZXCG = 1, // 自行采购
  83. BFJG, // 部分甲供
  84. WQJG, // 完全甲供
  85. JGCL, // 甲供材料 (“完全甲供”改文字为“甲供材料”)
  86. JDYG, // 甲定乙供
  87. }
  88. export interface IUpdate<T extends IAny = any> {
  89. filter: T;
  90. update: T;
  91. }
  92. export interface ICreate<T extends IAny = any> {
  93. document: T;
  94. }
  95. export interface IDelete<T extends IAny = any> {
  96. filter: T;
  97. }
  98. export interface IBulkWrite<T extends IAny = any> {
  99. update?: IUpdate<T>[];
  100. create?: ICreate<T>[];
  101. remove?: IDelete<T>[];
  102. }
  103. export enum CptModelName {
  104. projects = 'projects',
  105. quantityNumSheets = 'quantityNumSheets',
  106. bills = 'bills',
  107. billCodeSeqs = 'billCodeSeqs',
  108. rations = 'rations',
  109. rationGljs = 'rationGljs',
  110. unitPriceFile = 'unitPriceFile',
  111. feeRateFile = 'feeRateFile',
  112. labourCoeFile = 'labourCoeFile',
  113. importLogs = 'importLogs',
  114. cptGljLib = 'cptGljLib',
  115. cptGlj = 'cptGlj',
  116. cptGljTree = 'cptGljTree',
  117. cptRationLib = 'cptRationLib',
  118. cptRationTree = 'cptRationTree',
  119. cptRation = 'cptRation',
  120. cptRationCoe = 'cptRationCoe',
  121. cptRationChapterTrees = 'cptRationChapterTrees',
  122. configMaterials = 'configMaterials',
  123. projectGljs = 'projectGljs',
  124. calcProgramFile = 'calcProgramFile',
  125. options = 'options',
  126. installationFee = 'installationFee',
  127. financialProject = 'financialProject',
  128. approval = 'approval', // 后台设置的流程,相关于模板
  129. projectApproval = 'projectApproval', // 上报后项目实际使用的流程
  130. financialProjectType = 'financialProjectType',
  131. editLogs = 'editLogs', // 项目修改记录
  132. processData = 'processData', // 流程备份数据
  133. }
  134. // 无数据表的模块名称的枚举
  135. export enum SubModelName {
  136. bookmarks = 'bookmarks', // 书签批注
  137. components = 'components', // 组成物
  138. rationSubs = 'rationSubs', // 定额的子项
  139. }
  140. export enum ActionType {
  141. ADD = 'add',
  142. UPDATE = 'update',
  143. REPLACE = 'replace', // 和update不同,如替换定额,替换清单等,操作不一样
  144. DELETE = 'delete',
  145. }
  146. // 特殊的action
  147. export enum ActionName {
  148. // 项目属性相关
  149. RESET_COL_METAS = 'resetColMetas', // 重置默认列设置
  150. UPDATE_PROPERTY = 'updateProperty', // 更新项目属性
  151. // ration相关property
  152. ADD_LIB_RATIONS = 'addLibRations', // 添加标准/补充定额
  153. ADD_GLJ_RATIONS = 'addGljRations', // 插入工料机类型的定额
  154. CLEAN_ZMHS = 'cleanZmhs', // 清空子目换算
  155. RESET_INSTALL_FEE = 'resetInstallFee', // 重置安装增加费设置
  156. CALC_AREA_INCREASE = 'calcAreaIncrease', // 计算面积增加费
  157. // 定额工料机相关
  158. UPDATE_INDEX_KEY = 'updateIndexKey', // 修改定额工料机的名称,规格,单位
  159. ADD_RATION_GLJS = 'addRationGljs', // 添加定额工料机(多个)
  160. REPLACE_RATION_GLJ = 'replaceRationGlj', // 替换定额工料机(单个)
  161. // 项目工料机相关
  162. APPLY_ALL_INFO_PRICE = 'applyAllInfoPrice', // 批量套用信息价
  163. PROJECT_GLJ_EXIST_CHECK = 'projectGljExistCheck', // 检查工料机是否已经存在
  164. // 安装增加费
  165. CALC_INSTALL_FEE = 'calcInstallFee', // 计算安装增加费
  166. // 清单相关
  167. ADD_STD_BILLS = 'addStdBills', // 添加标准清单
  168. PASTE_BLOCK = 'pasteBlock', // 复制整块
  169. IMPORT_EXCEL_BILL = 'importExcelBill', // 导入excel清单
  170. BILL_CHECK = 'billCheck', // 清单检测
  171. // 费率相关
  172. RESET_FEE_RATE = 'resetFeeRate', // 重选标准
  173. // 补充人材机相关
  174. CHANGE_CPT_RATION_TREE = 'changeCptRationTree', // 补充定额章节树数据变更
  175. CHANGE_CPT_RATION = 'changeCptRation', // 补充定额数据变更
  176. CHANGE_CPT_RATION_GLJ = 'changeCptRationGlj', // 补充定额人材机变更
  177. CHANGE_CPT_RATION_COE = 'changeCptRationCoe', // 补充定额子目换算变更
  178. CHANGE_CPT_COE = 'changeCptCoe', // 补充子目换算数据变更
  179. ADD_RATION_COE_TO_SECTION = 'addRationCoeToSection', // 添加子目换算到本节其他定额
  180. UPDATE_CALCPROGRAM_TEMPLATE = 'updateCalcProgramTemplate',
  181. UPDATE_CALCPROGRAM_CALCITEM = 'updateCalcProgramCalcItem',
  182. }
  183. export interface IBaseFilter {
  184. ID: string;
  185. prop?: string;
  186. }
  187. export interface IFilter {
  188. ID: string;
  189. [key: string]: string;
  190. }
  191. // 统一subject更新提交数据入口,为撤销功能做准备
  192. export interface ISetData<T = any, F = any, R = any> {
  193. projectID: string; // 考虑到可能会跨项目更新,提高一层
  194. module: CptModelName | SubModelName;
  195. action: ActionType;
  196. createLog?: boolean; // 是否生成这个setData包的修改记录
  197. prop?: string; // 用来指表中的数组属性名,针对如configMaterial里,一个collections 里有多个数组数据的情况
  198. actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
  199. filter?: F; // 查询条件
  200. update?: Partial<T>; // 和update类型对应,
  201. documents?: T[]; // add 类型对应,批量插入
  202. oDocs?: any[]; // 存放撤销的原始数据?
  203. oldData?: T; // 旧数据,造价书中节点是引用同一个对象,编辑后是直接修改源数据,生成log时取不到旧数据
  204. result?: R; // 特殊的返回结果
  205. }
  206. export interface IColumnMeta {
  207. ID: string;
  208. title: string;
  209. data: string;
  210. renderer?: string;
  211. editor?: string;
  212. readOnly?: boolean;
  213. width: number;
  214. type?: string;
  215. numericFormat?: { pattern?: string; zeroFormat?: string };
  216. visible?: boolean;
  217. source?: string[];
  218. }
  219. // subject getData数据接口
  220. export interface ISubjectGetData {
  221. project: IProject;
  222. [CptModelName.bills]: IBill[];
  223. [CptModelName.rations]: IRation[];
  224. [CptModelName.projectGljs]: IProjectGlj[];
  225. [CptModelName.feeRateFile]: IFeeRateFile;
  226. [CptModelName.calcProgramFile]: ICalcProgramFile;
  227. [CptModelName.configMaterials]: IConfigMaterial;
  228. [CptModelName.installationFee]: IInstallationFee;
  229. [CptModelName.processData]?: IProcessBackupData[];
  230. }
  231. // getData数据接口
  232. export interface IGetData {
  233. subject: ISubjectGetData;
  234. construction: { project?: IProject };
  235. treeData: IProject[];
  236. isManager: boolean;
  237. projectsPermission: IProjectPermission[];
  238. }
  239. // 费用字段
  240. export interface IFees {
  241. [key: string]: {
  242. tenderTotalFee: number;
  243. tenderUnitPrice: number;
  244. totalFee: number;
  245. unitPrice: number;
  246. };
  247. }
  248. // 定额和清单共有的属性,造价书中很多地方需要
  249. export interface IBRBase {
  250. ID: string;
  251. parentID: string;
  252. seq: number;
  253. kind: BRType;
  254. stdID?: string; // 原始数据存在库中的ID(补充定额时也共用这个字段)
  255. repositoryID?: number | string; // 定额库/清单库 ID
  256. unit?: string;
  257. code?: string;
  258. name?: string;
  259. quantity?: number;
  260. quantityEXP?: string;
  261. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  262. // 是否记取面积增加费
  263. areaIncreaseFee?: boolean | null; // { type: Schema.Types.Mixed; default: false }; // true 是,false否,null 不确定,三个状态
  264. fees?: IFees; // 费用字段
  265. bookmarks?: IBookmark[]; // 书签批注
  266. overHeight?: string; // 超高降效
  267. targetUnitPrice?: number; // 调价:目标综合单价
  268. targetTotalFee?: number; // 调价:目标综合合价
  269. readjustUnitPrice?: number; // 调价:调整后综合单价
  270. readjustTotalFee?: number; // 调价:调整后综合合价
  271. rationQtyCoe?: number; // 调价:子目工程量调整系数
  272. gljQtyCoe?: IGljQtyCoe; // 调价:工料机消耗量调整系数
  273. }
  274. export const SeparateString = '|----|';