base.ts 10 KB

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