base.ts 9.2 KB

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