base.ts 5.6 KB

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