base.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. import { IProcessData, IProjectApproval } from './process';
  2. import { IProjectGlj } from './glj';
  3. import { IBill, IBookmark } from './bill';
  4. import { IProject, IProjectPermission } from './project';
  5. import { IGljQtyCoe, IRation } from './ration';
  6. import { IFeeRateFile } from './feeRate';
  7. import { ICalcProgramFile } from './calculation';
  8. import { IConfigMaterial } from './configMaterial';
  9. import { IQuantityDetail } from './quantityDetail';
  10. import { IInstallationFee } from './installation';
  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. processAuditMoney = 'processAuditMoney', // 每个环节的审批金额
  131. financialProjectType = 'financialProjectType',
  132. editLogs = 'editLogs', // 项目修改记录
  133. processData = 'processData', // 流程备份数据
  134. billIndex = 'billIndex', // 清单指标库
  135. FBIndex = 'FBIndex', // 分部指标库
  136. commonIndex = 'commonIndex', // 综合指标库
  137. }
  138. // 无数据表的模块名称的枚举
  139. export enum SubModelName {
  140. bookmarks = 'bookmarks', // 书签批注
  141. components = 'components', // 组成物
  142. rationSubs = 'rationSubs', // 定额的子项
  143. }
  144. export enum ActionType {
  145. ADD = 'add',
  146. UPDATE = 'update',
  147. REPLACE = 'replace', // 和update不同,如替换定额,替换清单等,操作不一样
  148. DELETE = 'delete',
  149. }
  150. // 特殊的action
  151. export enum ActionName {
  152. // 项目属性相关
  153. RESET_COL_METAS = 'resetColMetas', // 重置默认列设置
  154. UPDATE_PROPERTY = 'updateProperty', // 更新项目属性
  155. // ration相关property
  156. ADD_LIB_RATIONS = 'addLibRations', // 添加标准/补充定额
  157. ADD_GLJ_RATIONS = 'addGljRations', // 插入工料机类型的定额
  158. CLEAN_ZMHS = 'cleanZmhs', // 清空子目换算
  159. RESET_INSTALL_FEE = 'resetInstallFee', // 重置安装增加费设置
  160. CALC_AREA_INCREASE = 'calcAreaIncrease', // 计算面积增加费
  161. // 定额工料机相关
  162. UPDATE_INDEX_KEY = 'updateIndexKey', // 修改定额工料机的名称,规格,单位
  163. ADD_RATION_GLJS = 'addRationGljs', // 添加定额工料机(多个)
  164. REPLACE_RATION_GLJ = 'replaceRationGlj', // 替换定额工料机(单个)
  165. // 项目工料机相关
  166. APPLY_ALL_INFO_PRICE = 'applyAllInfoPrice', // 批量套用信息价
  167. PROJECT_GLJ_EXIST_CHECK = 'projectGljExistCheck', // 检查工料机是否已经存在
  168. // 安装增加费
  169. CALC_INSTALL_FEE = 'calcInstallFee', // 计算安装增加费
  170. // 清单相关
  171. ADD_STD_BILLS = 'addStdBills', // 添加标准清单
  172. PASTE_BLOCK = 'pasteBlock', // 复制整块
  173. IMPORT_EXCEL_BILL = 'importExcelBill', // 导入excel清单
  174. BILL_CHECK = 'billCheck', // 清单检测
  175. // 费率相关
  176. RESET_FEE_RATE = 'resetFeeRate', // 重选标准
  177. // 补充人材机相关
  178. CHANGE_CPT_RATION_TREE = 'changeCptRationTree', // 补充定额章节树数据变更
  179. CHANGE_CPT_RATION = 'changeCptRation', // 补充定额数据变更
  180. CHANGE_CPT_RATION_GLJ = 'changeCptRationGlj', // 补充定额人材机变更
  181. CHANGE_CPT_RATION_COE = 'changeCptRationCoe', // 补充定额子目换算变更
  182. CHANGE_CPT_COE = 'changeCptCoe', // 补充子目换算数据变更
  183. ADD_RATION_COE_TO_SECTION = 'addRationCoeToSection', // 添加子目换算到本节其他定额
  184. UPDATE_CALCPROGRAM_TEMPLATE = 'updateCalcProgramTemplate',
  185. UPDATE_CALCPROGRAM_CALCITEM = 'updateCalcProgramCalcItem',
  186. BILL_UPGRADE = 'billUpgrade',
  187. BILL_DOWNGRADE = 'billDowngrade',
  188. CHANGE_FEATRUE_PRJTYPE = 'changeFeaturePrjType',
  189. }
  190. export interface IBaseFilter {
  191. ID: string;
  192. prop?: string;
  193. }
  194. export interface IFilter {
  195. ID: string;
  196. [key: string]: string;
  197. }
  198. // 统一subject更新提交数据入口,为撤销功能做准备
  199. export interface ISetData<T = any, F = any, R = any> {
  200. projectID: string; // 考虑到可能会跨项目更新,提高一层
  201. module: CptModelName | SubModelName;
  202. action: ActionType;
  203. createLog?: boolean; // 是否生成这个setData包的修改记录
  204. prop?: string; // 用来指表中的数组属性名,针对如configMaterial里,一个collections 里有多个数组数据的情况
  205. actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
  206. filter?: F; // 查询条件
  207. update?: Partial<T>; // 和update类型对应,
  208. documents?: T[]; // add 类型对应,批量插入
  209. oDocs?: any[]; // 存放撤销的原始数据?
  210. oldData?: T; // 旧数据,造价书中节点是引用同一个对象,编辑后是直接修改源数据,生成log时取不到旧数据
  211. result?: R; // 特殊的返回结果
  212. }
  213. export interface IColumnMeta {
  214. ID: string;
  215. title: string;
  216. data: string;
  217. renderer?: string;
  218. editor?: string;
  219. readOnly?: boolean;
  220. width: number;
  221. type?: string;
  222. numericFormat?: { pattern?: string; zeroFormat?: string };
  223. visible?: boolean;
  224. source?: string[];
  225. }
  226. // subject getData数据接口
  227. export interface ISubjectGetData {
  228. project: IProject;
  229. [CptModelName.bills]: IBill[];
  230. [CptModelName.rations]: IRation[];
  231. [CptModelName.projectGljs]: IProjectGlj[];
  232. [CptModelName.feeRateFile]: IFeeRateFile;
  233. [CptModelName.calcProgramFile]: ICalcProgramFile;
  234. [CptModelName.configMaterials]: IConfigMaterial;
  235. [CptModelName.installationFee]: IInstallationFee;
  236. [CptModelName.processData]?: IProcessData[];
  237. }
  238. // getData数据接口
  239. export interface IGetData {
  240. subject: ISubjectGetData;
  241. construction: { project?: IProject };
  242. treeData: IProject[];
  243. isManager: boolean;
  244. projectsPermission: IProjectPermission[];
  245. approval?: IProjectApproval;
  246. }
  247. export interface IFee {
  248. tenderTotalFee: number;
  249. tenderUnitPrice: number;
  250. totalFee: number;
  251. unitPrice: number;
  252. }
  253. // 费用字段
  254. export interface IFees {
  255. [key: string]: IFee;
  256. }
  257. // 定额和清单共有的属性,造价书中很多地方需要
  258. export interface IBRBase {
  259. ID: string;
  260. parentID: string;
  261. seq: number;
  262. kind: BRType;
  263. stdID?: string; // 原始数据存在库中的ID(补充定额时也共用这个字段)
  264. repositoryID?: number | string; // 定额库/清单库 ID
  265. unit?: string;
  266. code?: string;
  267. name?: string;
  268. quantity?: number;
  269. quantityEXP?: string;
  270. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  271. // 是否记取面积增加费
  272. areaIncreaseFee?: boolean | null; // { type: Schema.Types.Mixed; default: false }; // true 是,false否,null 不确定,三个状态
  273. fees?: IFees; // 费用字段
  274. bookmarks?: IBookmark[]; // 书签批注
  275. overHeight?: string; // 超高降效
  276. targetUnitPrice?: number; // 调价:目标综合单价
  277. targetTotalFee?: number; // 调价:目标综合合价
  278. readjustUnitPrice?: number; // 调价:调整后综合单价
  279. readjustTotalFee?: number; // 调价:调整后综合合价
  280. rationQtyCoe?: number; // 调价:子目工程量调整系数
  281. gljQtyCoe?: IGljQtyCoe; // 调价:工料机消耗量调整系数
  282. }
  283. export const SeparateString = '|----|';
  284. // 检查subjec tree返回类型
  285. export enum CheckSubjectTreeType {
  286. // 项目被删除
  287. PROJECT_DELETED = 1,
  288. // 项目被取消分享
  289. PROJECT_CANCEL_SHARED,
  290. // 权限限制(未知情况)
  291. PERMISSION_LIMITED,
  292. }
  293. // 检查subjec tree返回结果
  294. export interface ICheckSubjectTreeRst {
  295. checkType: CheckSubjectTreeType;
  296. }