base.ts 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. bills = 'bills',
  105. billCodeSeqs = 'billCodeSeqs',
  106. rations = 'rations',
  107. rationGljs = 'rationGljs',
  108. shareList = 'shareList',
  109. shareProject = 'shareProject',
  110. shareLib = 'shareLib',
  111. shareLink = 'shareLink',
  112. unitPriceFile = 'unitPriceFile',
  113. feeRateFile = 'feeRateFile',
  114. labourCoeFile = 'labourCoeFile',
  115. importLogs = 'importLogs',
  116. cptGljLib = 'cptGljLib',
  117. cptGlj = 'cptGlj',
  118. cptGljTree = 'cptGljTree',
  119. cptRationLib = 'cptRationLib',
  120. cptRationTree = 'cptRationTree',
  121. cptRation = 'cptRation',
  122. cptRationCoe = 'cptRationCoe',
  123. cptRationChapterTrees = 'cptRationChapterTrees',
  124. configMaterials = 'configMaterials',
  125. projectGljs = 'projectGljs',
  126. calcProgramFile = 'calcProgramFile',
  127. options = 'options',
  128. installationFee = 'installationFee',
  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. }
  176. export interface IBaseFilter {
  177. ID: string;
  178. prop?: string;
  179. }
  180. export interface IFilter {
  181. ID: string;
  182. [key: string]: string;
  183. }
  184. // 统一subject更新提交数据入口,为撤销功能做准备
  185. export interface ISetData<T = any, F = any, R = any> {
  186. projectID: string; // 考虑到可能会跨项目更新,提高一层
  187. module: CptModelName | SubModelName;
  188. action: ActionType;
  189. prop?: string; // 用来指表中的数组属性名,针对如configMaterial里,一个collections 里有多个数组数据的情况
  190. actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
  191. filter?: F; // 查询条件
  192. update?: Partial<T>; // 和update类型对应,
  193. documents?: T[]; // add 类型对应,批量插入
  194. odocs?: any[]; // 存放撤销的原始数据?
  195. result?: R; // 特殊的返回结果
  196. }
  197. export interface IColumnMeta {
  198. title: string;
  199. data: string;
  200. renderer?: string;
  201. editor?: string;
  202. readOnly?: boolean;
  203. width: number;
  204. type?: string;
  205. numericFormat?: { pattern?: string; zeroFormat?: string };
  206. visible?: boolean;
  207. source?: string[];
  208. }
  209. // subject getData数据接口
  210. export interface ISubjectGetData {
  211. project: IProject;
  212. [CptModelName.bills]: IBill[];
  213. [CptModelName.rations]: IRation[];
  214. [CptModelName.projectGljs]: IProjectGlj[];
  215. [CptModelName.feeRateFile]: IFeeRateFile;
  216. [CptModelName.calcProgramFile]: ICalcProgramFile;
  217. [CptModelName.configMaterials]: IConfigMaterial;
  218. [CptModelName.installationFee]: IInstallationFee;
  219. }
  220. // getData数据接口
  221. export interface IGetData {
  222. subject: ISubjectGetData;
  223. construction: { project?: IProject };
  224. treeData: IProject[];
  225. isManager: boolean;
  226. projectsPermission: IProjectPermission[];
  227. }
  228. // 定额和清单共有的属性,造价书中很多地方需要
  229. export interface IBRBase {
  230. ID: string;
  231. parentID: string;
  232. seq: number;
  233. kind: BRType;
  234. stdID?: string; // 原始数据存在库中的ID(补充定额时也共用这个字段)
  235. repositoryID?: number | string; // 定额库/清单库 ID
  236. unit?: string;
  237. code?: string;
  238. name?: string;
  239. quantity?: number;
  240. quantityEXP?: string;
  241. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  242. // 是否记取面积增加费
  243. areaIncreaseFee?: boolean | null; // { type: Schema.Types.Mixed; default: false }; // true 是,false否,null 不确定,三个状态
  244. fees?: {
  245. [key: string]: {
  246. tenderTotalFee: number;
  247. tenderUnitPrice: number;
  248. totalFee: number;
  249. unitPrice: number;
  250. };
  251. }; // 费用字段
  252. bookmarks?: IBookmark[]; // 书签批注
  253. targetUnitPrice?: number; // 调价:目标综合单价
  254. targetTotalFee?: number; // 调价:目标综合合价
  255. readjustUnitPrice?: number; // 调价:调整后综合单价
  256. readjustTotalFee?: number; // 调价:调整后综合合价
  257. rationQtyCoe?: number; // 调价:子目工程量调整系数
  258. gljQtyCoe?: IGljQtyCoe; // 调价:工料机消耗量调整系数
  259. }
  260. export const SeparateString = '|----|';