process.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. import { ReportTree } from './report';
  2. import { CptModelName, SubModelName, ActionType } from './base';
  3. import { BusinessTypeKey } from './gather';
  4. import { IExecutorApprovaledPermission } from './gatherExecutor';
  5. import { executorMember } from './approvalStatus';
  6. import { IStepMatter } from './matter';
  7. // 环节类型
  8. export enum SectorType {
  9. APPROVAL = 'approval', // 审批
  10. CONDITION = 'condition', // 条件
  11. }
  12. export enum ProcessStatus {
  13. WAITING = 'waiting', // 待审批
  14. APPROVED = 'approved', // 审批通过
  15. ACTIVATING = 'activating', // 当前流程
  16. FAILED = 'failed', // 审批退回
  17. }
  18. // 审批方式
  19. export enum ApprovalWay {
  20. REPORT = 'report', // 上报审批
  21. ACCOUNT = 'account', // 指定用户
  22. JOINTLYSIGN = 'jointlySign', // 会签
  23. ORSIGN = 'orSign', // 或签
  24. ORDERAPPROVAL = 'orderApproval', // 依次审批
  25. PREACCOUNT = 'prevAccount', // 上一审批人设置
  26. }
  27. // 角色权限
  28. export enum RolePermission {
  29. MY_REPORT = 'report', // 我的项目-项目上报
  30. MY_FREE_REPORT = 'freeReport', // 我的项目-指定审批人
  31. MY_ADD_PROJECT = 'addProject', // 我的项目-新建项目
  32. MY_EDIT_PROJECT = 'editProject', // 我的项目-编辑项目
  33. MY_EXPORT_PROJECT = 'exportProject', // 我的项目-导出项目
  34. MY_DEL_PROJECT = 'delProject', // 我的项目-删除项目
  35. MY_VIEW_PROJECT = 'viewProject', // 我的项目-查看项目
  36. MY_VIEW_APPROVAL = 'viewApproval', // 我的项目-审批进度
  37. MY_SAVE_INDEX = 'viewZbkProject', // 我的项目-指标入库
  38. JOIN_VIEW_PARTICIPATING_PROJECT = 'viewParticipatingProject', // 我参与的项目-查看项目
  39. JOIN_SAVE_INDEX = 'saveIndex', // 我参与的项目-指标入库
  40. JOIN_EXPORT_PARTICIPATING_PROJECT = 'exportParticipatingProject', // 我参与的项目-导出项目
  41. ALL_SET_PROJECT = 'setProjects', // 全部项目-项目设置
  42. ALL_VIEW_ALL_PROJECTS = 'viewAllProjects', // 全部项目-查看项目
  43. ALL_SAVE_INDEX = 'saveIndexAll', // 全部项目-指标入库
  44. ALL_EXPORT_PROJECTS = 'exportProjects', // 全部项目-导出项目
  45. ZBK_ENABLE = 'zbkEnable', // 指标库启用
  46. ZBK_EDIT = 'zbkEdit', // 指标库-编辑
  47. CJK_ENABLE = 'cjkEnable', // 材价库-启用
  48. CJK_EDIT = 'cjkEdit', // 材价库-编辑
  49. // TODO 指标库 区间对数
  50. }
  51. // 系统角色
  52. export enum RoleType {
  53. SYSTEM = 'system',
  54. SYSTEM_NORMAL = 'systemNormal',
  55. NORMAL = 'normal',
  56. }
  57. // 角色
  58. export interface IRole {
  59. ID: string;
  60. name: string;
  61. roleType: RoleType;
  62. frontPermission: RolePermission[];
  63. }
  64. // 参与者模式
  65. export enum ParticipantMode {
  66. ACCOUNT = 'account', // 用户模式
  67. ROLE = 'role', // 角色模式(未来)
  68. }
  69. export enum AccountConfigure {
  70. SKIP = 'skip', // 允许跳过
  71. RETURN = 'return', // 允许退回
  72. REVOKE = 'revoke', // 允许撤回
  73. ASSISTAUDIT = 'assistAudit', // 协审
  74. ADDSIGN = 'addSign', // 加签
  75. NEXTSECTOR = 'nextSector', // 是否可添加环节
  76. }
  77. export interface ICoreView {
  78. ID: string; // 用户ID
  79. projectIDs: string[]; // 充许协审的单位工程ID,为空数组时表示可以协审当前环节的所有项目
  80. }
  81. export interface IProcessAccount {
  82. // ID 账号ID name 名称institutionID 企事业ID
  83. ID: string;
  84. name: string; // 曾用名,不会变动
  85. institutionID?: string; // 单位ID(可能不会用到)
  86. institutionName?: string; // 单位名称(不要保存到数据库,而是在使用的时候通过ID去查)
  87. status: ProcessStatus; // 审批状态
  88. alreadyAddProcess?: boolean; // 是否已经添加了新环节(暂时用的,用于标记是否添加了环节,以后可能删除)
  89. configure: AccountConfigure[]; // 权限配置
  90. remark: string; // 审批意见(肯定有,会有默认值)
  91. coreViews: ICoreView[]; // 协审人信息
  92. projectIDs: string[]; // 允许审批的单位工程ID,为空数组时表示可以审批当前环节的所有项目
  93. }
  94. // 参与者信息
  95. export interface IParticipantInfo {
  96. approvalWay: ApprovalWay;
  97. participantMode: ParticipantMode;
  98. accounts: IProcessAccount[];
  99. }
  100. // 流程中的一个环节
  101. export interface IProcess {
  102. ID: string;
  103. name: string;
  104. sectorType: SectorType;
  105. seq?: number;
  106. createdByProcess?: string; // 上环节ID, 表示哪个环节创建的(上环节添加的)
  107. time?: number; // 当前环节完成时间(仅当审批通过或审批退回时会有时间)
  108. participantInfo: IParticipantInfo;
  109. afterAuditMoney?: number; // 审后的金额
  110. }
  111. export interface Members {
  112. ID: string;
  113. approvalStatus: string;
  114. approvalTime: number | string;
  115. approvalComment: string;
  116. name?: string;
  117. institutionID?: string;
  118. institutionName?: string;
  119. }
  120. // 3合1执行者
  121. export interface IProcessExecutor {
  122. ID: string;
  123. permission: string[];
  124. configure: string[];
  125. businessType: BusinessTypeKey;
  126. gatherID: string;
  127. setType: string;
  128. name: string;
  129. reportTime?: string; // 三合一审批流程第一位的上报时间
  130. approvaledPermission: IExecutorApprovaledPermission[];
  131. scope?: string;
  132. members?: Members[];
  133. }
  134. export interface SimpleDynamicStep {
  135. stepID: string;
  136. stepName: string;
  137. executorID?: string;
  138. executorName?: string;
  139. }
  140. // 3合1参与者信息
  141. export interface IProcedureParticipantInfo {
  142. approvalWay: string;
  143. executor: {
  144. ID: string;
  145. configure: string[];
  146. members?: Members[];
  147. reportTime?: string;
  148. };
  149. dynamicSteps: SimpleDynamicStep[];
  150. stepMatters: IStepMatter[];
  151. }
  152. // 3合1分支判断信息
  153. export interface IConditionItem {
  154. field: string;
  155. type: string;
  156. symbol: string;
  157. value: string;
  158. }
  159. // 3合1分支条件信息
  160. export interface IConditionInfoItem {
  161. ID: string;
  162. conditions: IConditionItem[];
  163. // eslint-disable-next-line prettier/prettier, no-use-before-define
  164. process: IProcedureProcess[];
  165. }
  166. // 3合1步骤中的一个环节
  167. export interface IProcedureProcess {
  168. ID: string;
  169. referenceID: string;
  170. name: string;
  171. sectorType: SectorType;
  172. isReportProcess?: boolean; // 是否上报环节(因为上报环节是特殊的,所以加个字段方便处理)
  173. participantInfo?: IProcedureParticipantInfo;
  174. conditionInfo?: IConditionInfoItem[];
  175. condition?: {
  176. ID: string;
  177. processID: string;
  178. field: string;
  179. fieldValue: string;
  180. };
  181. }
  182. export interface IProcedureItem {
  183. ID: string;
  184. approvalStatus: string;
  185. content: string;
  186. approvalTime: string;
  187. executor?: IProcessExecutor;
  188. // members?: executorMember[];
  189. approvalWay?: string;
  190. dynamicSteps?: SimpleDynamicStep[];
  191. stepMatters?: IStepMatter[];
  192. nextProcessSectorType?: SectorType;
  193. }
  194. export interface IApproval {
  195. ID: string;
  196. name: string;
  197. createdID: string;
  198. createdTime: number;
  199. process: IProcess[];
  200. templateProcess?: IProcedureProcess[]; // 三合一需要用的流程模板
  201. subjectID?: string;
  202. businessType?: BusinessTypeKey;
  203. }
  204. export enum ApprovalStatus {
  205. CREATED = 'created', // 创建完成
  206. PROCESSING = 'processing', // 正在审批
  207. APPROVED = 'approved', // 审批通过
  208. }
  209. export interface IProcessAuditMoney {
  210. processID: string;
  211. data: any[];
  212. }
  213. // 复制到项目里的流程
  214. export interface IProjectApproval extends IApproval {
  215. financialProjectID: string; // 财审项目ID
  216. constructionID: string; // 建设项目ID
  217. projectIDs: string[]; // 包含在流程里的项目(单位工程)
  218. status: ApprovalStatus; // 状态
  219. approvalTime?: number; // 审批通过时间
  220. currentProcessID?: string; // 当前正处于哪个环节ID
  221. businessID?: string; // 业务ID
  222. gatherID?: string;
  223. }
  224. // 三合一项目里的流程
  225. export interface IProcedureApproval {
  226. ID: string;
  227. gatherID: string;
  228. businessType: BusinessTypeKey;
  229. businessID: string;
  230. templateProcess: IProcedureProcess[];
  231. process: IProcedureProcess[];
  232. }
  233. // 流程过程中存储的数据
  234. export interface IProcessData {
  235. ID: string;
  236. module: CptModelName | SubModelName; // 编辑的模块
  237. action: ActionType; // 动作,增删改等
  238. oDoc: any; // 存放删除时或者修改时的数据
  239. createTime: number; // 创建时间
  240. }
  241. // 备份数据集合
  242. export interface IProcessDataDoc {
  243. projectID: string;
  244. processID: string;
  245. index: number;
  246. processData: IProcessData[];
  247. }
  248. // 环节状态(精简)
  249. export enum SimpleProcessStatus {
  250. APPROVED = 'approved', // 审批通过
  251. FAILED = 'failed', // 失败
  252. REPORTED = 'reported', // 上报
  253. }
  254. // 审批待办类型
  255. export enum ApprovalType {
  256. APPROVER = 'approver', // 审批
  257. COREVIEW = 'coreview', // 协审
  258. REPORT = 'report', // 上报
  259. }
  260. export enum FinancialProjectStatus {
  261. UNREPORTED = 'unreported',
  262. APPROVING = 'approving',
  263. COMPLETION = 'completion',
  264. }
  265. // 流程环节待办列表项
  266. export interface IApprovalTodoData {
  267. approvalID: string; // 流程 id
  268. processID: string; // 环节 id
  269. financialProjectID: string; // 项目 ID
  270. constructionID: string; // 建设项目 ID
  271. projectName?: string; // 项目名称
  272. reporterID?: string; // 发起人ID
  273. reporterName?: string; // 发起人名称
  274. lastID?: string; // 上环节ID(暂定为上环节用户ID,之后可能为上环节ID)
  275. lastName?: string; // 上环节名称(暂定为上环节用户名称,之后可能为上环节名称) 三合一是上环节名称
  276. nextID?: string; // 下一个步骤ID(三合一)
  277. nextName?: string; // 下一个步骤名称(三合一)
  278. reportTime?: number; // 上报时间
  279. lastStatus?: SimpleProcessStatus; // 上一环节的状态
  280. approveTime?: number; // 当前环节审批时间
  281. approveType?: SimpleProcessStatus; // 审批办结状态
  282. moveUserID?: string; // 环节流转(用户ID)
  283. moveUserName?: string; // 环节流转(用户名)
  284. approvalStatus?: ApprovalStatus; // 审批流程的状态
  285. type: ApprovalType; // 审批待办类型
  286. gatherID?: string;
  287. }
  288. export interface IApprovalTodoData2 {
  289. approvalID: string; // 流程 id
  290. processID: string; // 环节 id
  291. financialProjectID: string; // 项目 ID
  292. constructionID: string; // 建设项目 ID
  293. projectName?: string; // 项目名称
  294. // reporterID: string; // 发起人ID (删)
  295. // reporterName: string; // 发起人名称(删)
  296. lastID?: string; // 为上环节用户ID
  297. lastName?: string; // 上环节用户名称
  298. // reportTime: number; // 上报时间(删)
  299. lastStatus?: SimpleProcessStatus; // 上环节办结状态
  300. // approveTime: number; // 审批办结时间(删)
  301. approveType?: SimpleProcessStatus; // 审批办结状态
  302. // approvalStatus: ApprovalStatus; // 审批流程的状态(删)
  303. moveUserID?: string; // 环节流转(用户ID)
  304. moveUserName?: string; // 环节流转(用户名)
  305. type: ApprovalType; // 审批待办类型
  306. }
  307. export enum TodoType {
  308. APPROVAL = 'approval',
  309. }
  310. export enum TodoStatus {
  311. REMAIN = 'remain',
  312. COMPLETED = 'completed',
  313. }
  314. export interface ITodo {
  315. ID: string; // 待办 ID
  316. userID: string; // 用户 ID
  317. createdTime: number; // 创建时间(相当于环节流转时间)
  318. completedTime: number; // 完成时间(相当于审批办结时间)
  319. todoType: TodoType;
  320. data: any;
  321. status: TodoStatus;
  322. }
  323. export interface IApprovalTodo extends ITodo {
  324. data: IApprovalTodoData;
  325. }
  326. export enum ChangeRecord {
  327. CURRENT = 'current', // 当前清单
  328. ALLBILLS = 'all-bills', // 全部清单
  329. ALLGLJS = 'all-gljs', // 全部材价
  330. }
  331. export enum BusinessType {
  332. /** 预算 */
  333. BUDGET = 'undo',
  334. /** 结算 */
  335. SETTLEMENT = 'doing',
  336. /** 决算 */
  337. FINAL = 'done',
  338. }
  339. export enum BusinessStatus {
  340. /** 未上报 */
  341. UNREPORTED = 'unreported',
  342. /** 审批中 */
  343. APPROVING = 'approving',
  344. /** 审批完成 */
  345. COMPLETION = 'completion',
  346. }
  347. export interface IBusinessApprovalItem {
  348. ID?: string;
  349. name?: string;
  350. code?: string;
  351. gatherID?: string;
  352. businessType?: BusinessType;
  353. status?: BusinessStatus;
  354. /** 送审时间 */
  355. sendReviewTime?: string;
  356. /** 审结时间 */
  357. completionTime?: string;
  358. /** 送审金额 */
  359. reportMoney?: string;
  360. /** 审结金额 */
  361. conclusion?: string;
  362. /** 审增金额 */
  363. addition?: string;
  364. /** 审减金额 */
  365. reduction?: string;
  366. created?: string;
  367. createdID?: string;
  368. createTime?: string;
  369. }
  370. export interface IConditionSetting {
  371. ID: string;
  372. gatherID: string;
  373. schema?: string;
  374. }