base.ts 8.7 KB

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