process.ts 11 KB

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