base.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. export interface IAny {
  10. [prop: string]: any;
  11. }
  12. export interface ITreeScm {
  13. ID: string;
  14. parentID: string;
  15. seq: number;
  16. }
  17. export interface IFileRef {
  18. ID: string;
  19. name: string;
  20. type?: number;
  21. }
  22. export interface INumFileRef {
  23. ID: number;
  24. name: string;
  25. type?: number;
  26. isDefault?: boolean;
  27. }
  28. export enum DeleteEnum {
  29. NORMAL = 1,
  30. DELETED,
  31. COMPLETEDELETED,
  32. }
  33. // 返回数据接口
  34. export interface IResult<T = any> {
  35. errno: number;
  36. message: string;
  37. data: T;
  38. }
  39. export enum FromType {
  40. STD = 'std',
  41. CPT = 'cpt',
  42. }
  43. export enum RationPrefix {
  44. EMT = '',
  45. BOR = '借',
  46. CPT = '补',
  47. REP = '换',
  48. }
  49. // 工料机生成的类型
  50. export enum GljCreateType {
  51. NORMAL = 'normal',
  52. ADD = 'add',
  53. REPLACE = 'replace',
  54. }
  55. export enum CreateLocation {
  56. CSXM = 1, // 模板子目分别放在措施项目下
  57. FBFX = 2, // 模板子目分别放在分部分项下
  58. HNTZM = 3, // 模板子目分别放在对应混凝土子目下
  59. }
  60. export enum BRType { // 1 :大项费用 2:分部 3分项 4清单;5补项 6 定额、7 量价、8 工料机定额
  61. DXFY = 1, // 大项费用
  62. FB = 2, // 分部
  63. FX = 3, // 分项
  64. BILL = 4, // 清单
  65. BX = 5, // 这个补项因为旧版本是后定义的,所以放在后面,为了统一不混淆
  66. CS = 6, // 分类
  67. DT = 7, // 费用明细
  68. RATION = 20, // 定额
  69. INST = 21, // 安装增加费生成的定额
  70. VP = 22, // 量价
  71. GLJ = 23, // 工料机
  72. OH = 24, // 超高子目
  73. ITEM = 25, // 子目增加
  74. // 虚拟节点,主材、设备,只是显示
  75. MAIN = 50, // 主材
  76. EQUIP = 51, // 设备
  77. }
  78. export enum SupplyType {
  79. ZXCG = 1, // 自行采购
  80. BFJG, // 部分甲供
  81. WQJG, // 完全甲供
  82. JGCL, // 甲供材料 (“完全甲供”改文字为“甲供材料”)
  83. JDYG, // 甲定乙供
  84. }
  85. export interface IUpdate<T extends IAny = any> {
  86. filter: T;
  87. update: T;
  88. }
  89. export interface ICreate<T extends IAny = any> {
  90. document: T;
  91. }
  92. export interface IDelete<T extends IAny = any> {
  93. filter: T;
  94. }
  95. export interface IBulkWrite<T extends IAny = any> {
  96. update?: IUpdate<T>[];
  97. create?: ICreate<T>[];
  98. remove?: IDelete<T>[];
  99. }
  100. export enum CptModelName {
  101. projects = 'projects',
  102. bills = 'bills',
  103. billCodeSeqs = 'billCodeSeqs',
  104. rations = 'rations',
  105. rationGljs = 'rationGljs',
  106. shareList = 'shareList',
  107. unitPriceFile = 'unitPriceFile',
  108. feeRateFile = 'feeRateFile',
  109. labourCoeFile = 'labourCoeFile',
  110. importLogs = 'importLogs',
  111. cptRationTree = 'cptRationTree',
  112. cptGlj = 'cptGlj',
  113. cptGljTree = 'cptGljTree',
  114. cptRationCoeList = 'cptRationCoeList',
  115. cptRationInstallation = 'cptRationInstallation',
  116. cptRationInstallationSection = 'cptRationInstallationSection',
  117. cptRation = 'cptRation',
  118. cptRationChapterTrees = 'cptRationChapterTrees',
  119. configMaterials = 'configMaterials',
  120. projectGljs = 'projectGljs',
  121. calcProgramFile = 'calcProgramFile',
  122. options = 'options',
  123. installationFee = 'installationFee',
  124. }
  125. // 无数据表的模块名称的枚举
  126. export enum SubModelName {
  127. bookmarks = 'bookmarks', // 书签批注
  128. components = 'components', // 组成物
  129. rationSubs = 'rationSubs', // 定额的子项
  130. }
  131. export enum ActionType {
  132. ADD = 'add',
  133. UPDATE = 'update',
  134. REPLACE = 'replace', // 和update不同,如替换定额,替换清单等,操作不一样
  135. DELETE = 'delete',
  136. }
  137. // 特殊的action
  138. export enum ActionName {
  139. // ration相关
  140. addStdRations = 'addStdRations', // 添加标准定额
  141. resetColMetas = 'resetColMetas', // 重置默认列设置
  142. updateIndexKey = 'updateIndexKey', // 修改定额工料机的名称,规格,单位
  143. addRationGljs = 'addRationGljs', // 添加定额工料机(多个)
  144. replaceRationGlj = 'replaceRationGlj', // 替换定额工料机(单个)
  145. applyAllInfoPrice = 'applyAllInfoPrice', // 批量套用信息价
  146. pasteBlock = 'pasteBlock', // 复制整块
  147. // 补充人材机相关
  148. CHANGE_CPT_RATION_TREE = 'changeCptRationTree', // 补充定额章节树数据变更
  149. CHANGE_CPT_RATION = 'changeCptRation', // 补充定额数据变更
  150. CHANGE_CPT_RATION_GLJ = 'changeCptRationGlj', // 补充定额人材机变更
  151. }
  152. export interface IBaseFilter {
  153. ID: string;
  154. prop?: string;
  155. }
  156. export interface IFilter {
  157. ID: string;
  158. [key: string]: string;
  159. }
  160. // 统一subject更新提交数据入口,为撤销功能做准备
  161. export interface ISetData<T = any, F = any, R = any> {
  162. projectID: string; // 考虑到可能会跨项目更新,提高一层
  163. module: CptModelName | SubModelName;
  164. action: ActionType;
  165. prop?: string; // 用来指表中的数组属性名,针对如configMaterial里,一个collections 里有多个数组数据的情况
  166. actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
  167. filter?: F; // 查询条件
  168. update?: T; // 和update类型对应,
  169. documents?: T[]; // add 类型对应,批量插入
  170. odocs?: any[]; // 存放撤销的原始数据?
  171. result?: R; // 特殊的返回结果
  172. }
  173. export interface IColumnMeta {
  174. title: string;
  175. data: string;
  176. renderer?: string;
  177. editor?: string;
  178. readOnly?: boolean;
  179. width: number;
  180. type?: string;
  181. numericFormat?: { pattern?: string; zeroFormat?: string };
  182. visible?: boolean;
  183. source?: string[];
  184. }
  185. // subject getData数据接口
  186. export interface ISubjectGetData {
  187. project: IProject;
  188. [CptModelName.bills]: IBill[];
  189. [CptModelName.rations]: IRation[];
  190. [CptModelName.projectGljs]: IProjectGlj[];
  191. [CptModelName.feeRateFile]: IFeeRateFile;
  192. [CptModelName.calcProgramFile]: ICalcProgramFile;
  193. [CptModelName.configMaterials]: IConfigMaterial;
  194. }
  195. // getData数据接口
  196. export interface IGetData {
  197. subject: ISubjectGetData;
  198. construction: { project?: IProject };
  199. treeData: IProject[];
  200. isOwner: boolean;
  201. projectsPermission: IProjectPermission[];
  202. }
  203. // 定额和清单共有的属性,造价书中很多地方需要
  204. export interface IBRBase {
  205. ID: string;
  206. parentID: string;
  207. seq: number;
  208. kind: BRType;
  209. stdID?: string;
  210. unit?: string;
  211. code?: string;
  212. name?: string;
  213. quantity?: number;
  214. quantityEXP?: string;
  215. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  216. fees?: any; // 费用字段
  217. gljQtyCoe?: IGljQtyCoe; // 工料机消耗量调整系数字段
  218. rationQtyCoe?: number; // 子目工程量调整系数
  219. bookmarks?: IBookmark[]; // 书签批注
  220. }