base.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import { IProjectGlj } from './glj';
  2. import { IBill } from './bill';
  3. import { IProject, IProjectPermission } from './project';
  4. import { IRation } from './ration';
  5. import { IFeeRateFile } from './feeRate';
  6. import { ICalcProgramFile } from './calculation';
  7. export interface IAny {
  8. [prop: string]: any;
  9. }
  10. export interface ITreeScm {
  11. ID: string;
  12. parentID: string;
  13. seq: number;
  14. }
  15. export interface IFileRef {
  16. ID: string;
  17. name: string;
  18. }
  19. export interface INumFileRef {
  20. ID: number;
  21. name: string;
  22. isDefault?: boolean;
  23. }
  24. export enum DeleteEnum {
  25. NORMAL = 1,
  26. DELETED,
  27. COMPLETEDELETED,
  28. }
  29. // 返回数据接口
  30. export interface IResult<T = any> {
  31. errno: number;
  32. message: string;
  33. data: T;
  34. }
  35. export enum fromType {
  36. STD = 'std',
  37. CPT = 'cpt',
  38. }
  39. export enum prefix {
  40. BOR = '借',
  41. CPT = '补',
  42. }
  43. // 工料机生成的类型
  44. export enum gljCreateType {
  45. NORMAL = 'normal',
  46. ADD = 'add',
  47. REPLACE = 'replace',
  48. }
  49. export enum createLocation {
  50. CSXM = 1, // 模板子目分别放在措施项目下
  51. FBFX = 2, // 模板子目分别放在分部分项下
  52. HNTZM = 3, // 模板子目分别放在对应混凝土子目下
  53. }
  54. export enum BRType { // 1 :大项费用 2:分部 3分项 4清单;5补项 6 定额、7 量价、8 工料机定额
  55. DXFY = 1, // 大项费用
  56. FB = 2, // 分部
  57. FX = 3, // 分项
  58. BILL = 4, // 清单
  59. BX = 5, // 这个补项因为旧版本是后定义的,所以放在后面,为了统一不混淆
  60. CS = 6, // 分类
  61. DT = 7, // 费用明细
  62. RATION = 10, // 定额
  63. INST = 11, // 安装增加费生成的定额
  64. VP = 12, // 量价
  65. GLJ = 13, // 工料机
  66. }
  67. export enum supplyType {
  68. ZXCG = 1, // 自行采购
  69. BFJG, // 部分甲供
  70. WQJG, // 完全甲供
  71. JGCL, // 甲供材料 (“完全甲供”改文字为“甲供材料”)
  72. JDYG, // 甲定乙供
  73. }
  74. export interface IUpdate<T extends IAny = any> {
  75. filter: T;
  76. update: T;
  77. }
  78. export interface ICreate<T extends IAny = any> {
  79. document: T;
  80. }
  81. export interface IDelete<T extends IAny = any> {
  82. filter: T;
  83. }
  84. export interface IBulkWrite<T extends IAny = any> {
  85. update?: IUpdate<T>[];
  86. create?: ICreate<T>[];
  87. remove?: IDelete<T>[];
  88. }
  89. export enum CptModelName {
  90. projects = 'projects',
  91. bills = 'bills',
  92. rations = 'rations',
  93. rationGljs = 'rationGljs',
  94. shareList = 'shareList',
  95. unitPriceFile = 'unitPriceFile',
  96. feeRateFile = 'feeRateFile',
  97. labourCoeFile = 'labourCoeFile',
  98. importLogs = 'importLogs',
  99. cptRationSectionTpl = 'cptRationSectionTpl',
  100. cptGljLib = 'cptGljLib',
  101. cptGljSection = 'cptGljSection',
  102. cptGljSectionTpl = 'cptGljSectionTpl',
  103. cptRationCoeList = 'cptRationCoeList',
  104. cptRationInstallation = 'cptRationInstallation',
  105. cptRationInstallationSection = 'cptRationInstallationSection',
  106. cptRationItems = 'cptRationItems',
  107. cptRationChapterTrees = 'cptRationChapterTrees',
  108. configMaterials = 'configMaterials',
  109. projectGljs = 'projectGljs',
  110. calcProgramFile = 'calcProgramFile',
  111. options = 'options',
  112. installationFee = 'installationFee',
  113. }
  114. // 无数据表的模块名称的枚举
  115. export enum SubModelName {
  116. bookmarks = 'bookmarks', // 书签批注
  117. components = 'components', // 组成物
  118. }
  119. export enum ActionType {
  120. ADD = 'add',
  121. UPDATE = 'update',
  122. REPLACE = 'replace', // 和update不同,如替换定额,替换清单等,操作不一样
  123. DELETE = 'delete',
  124. }
  125. // 特殊的action
  126. export enum ActionName {
  127. // ration相关
  128. addStdRations = 'addStdRations', // 添加标准定额
  129. resetColMetas = 'resetColMetas', // 重置默认列设置
  130. }
  131. // 统一subject更新提交数据入口,为撤销功能做准备
  132. export interface ISetData<T = any> {
  133. projectID: string; // 考虑到可能会跨项目更新,提高一层
  134. module: CptModelName | SubModelName;
  135. action: ActionType;
  136. actionName?: ActionName; // 除了增删改查,还会有更复杂的操作,用这个来区分
  137. filter?: any; // 查询条件
  138. update?: any; // 和update类型对应,
  139. documents?: T[]; // add 类型对应,批量插入
  140. odocs?: any[]; // 存放撤销的原始数据?
  141. result?: any; // 特殊的返回结果
  142. }
  143. export interface IColumnMeta {
  144. title: string;
  145. data: string;
  146. renderer?: string;
  147. editor?: string;
  148. readOnly?: boolean;
  149. width: number;
  150. type?: string;
  151. numericFormat?: { pattern?: string; zeroFormat?: string };
  152. visible?: boolean;
  153. source?: string[];
  154. }
  155. // subject getData数据接口
  156. export interface ISubjectGetData {
  157. project: IProject;
  158. [CptModelName.bills]: IBill[];
  159. [CptModelName.rations]: IRation[];
  160. [CptModelName.projectGljs]: IProjectGlj[];
  161. [CptModelName.feeRateFile]: IFeeRateFile;
  162. [CptModelName.calcProgramFile]: ICalcProgramFile;
  163. }
  164. // getData数据接口
  165. export interface IGetData {
  166. subject: ISubjectGetData;
  167. construction: { project?: IProject };
  168. treeData: IProject[];
  169. isOwner: boolean;
  170. projectsPermission: IProjectPermission[];
  171. }