process.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. }
  117. // 3合1执行者
  118. export interface IProcessExecutor {
  119. ID: string;
  120. permission: string[];
  121. configure: string[];
  122. businessType: BusinessTypeKey;
  123. gatherID: string;
  124. setType: string;
  125. name: string;
  126. reportTime?: string; // 三合一审批流程第一位的上报时间
  127. approvaledPermission: IExecutorApprovaledPermission[];
  128. scope?: string;
  129. members?: Members[];
  130. }
  131. export interface SimpleDynamicStep {
  132. stepID: string;
  133. stepName: string;
  134. executorID: string;
  135. }
  136. // 3合1参与者信息
  137. export interface IProcedureParticipantInfo {
  138. approvalWay: string;
  139. executor: {
  140. ID: string;
  141. configure: string[];
  142. members?: Members[];
  143. reportTime?: string;
  144. isReporter?: boolean;
  145. };
  146. dynamicSteps: SimpleDynamicStep[];
  147. stepMatters: IStepMatter[];
  148. }
  149. // 3合1分支判断信息
  150. export interface IConditionItem {
  151. field: string;
  152. type: string;
  153. symbol: string;
  154. value: string;
  155. }
  156. // 3合1分支条件信息
  157. export interface IConditionInfoItem {
  158. ID: string;
  159. conditions: IConditionItem[];
  160. // eslint-disable-next-line prettier/prettier, no-use-before-define
  161. process: IProcedureProcess[];
  162. }
  163. // 3合1步骤中的一个环节
  164. export interface IProcedureProcess {
  165. ID: string;
  166. referenceID: string;
  167. name: string;
  168. sectorType: SectorType;
  169. participantInfo?: IProcedureParticipantInfo;
  170. conditionInfo?: IConditionInfoItem[];
  171. condition?: {
  172. ID: string;
  173. processID: string;
  174. field: string;
  175. fieldValue: string;
  176. };
  177. }
  178. export interface IProcedureItem {
  179. ID: string;
  180. approvalStatus: string;
  181. content: string;
  182. approvalTime: string;
  183. executor?: IProcessExecutor;
  184. // members?: executorMember[];
  185. approvalWay?: string;
  186. dynamicSteps?: SimpleDynamicStep[];
  187. stepMatters?: IStepMatter[];
  188. nextProcessSectorType?: SectorType;
  189. }
  190. export interface IApproval {
  191. ID: string;
  192. name: string;
  193. createdID: string;
  194. createdTime: number;
  195. process: IProcess[];
  196. templateProcess?: IProcedureProcess[]; // 三合一需要用的流程模板
  197. subjectID?: string;
  198. businessType?: BusinessTypeKey;
  199. }
  200. export enum ApprovalStatus {
  201. CREATED = 'created', // 创建完成
  202. PROCESSING = 'processing', // 正在审批
  203. APPROVED = 'approved', // 审批通过
  204. }
  205. export interface IProcessAuditMoney {
  206. processID: string;
  207. data: any[];
  208. }
  209. // 复制到项目里的流程
  210. export interface IProjectApproval extends IApproval {
  211. financialProjectID: string; // 财审项目ID
  212. constructionID: string; // 建设项目ID
  213. projectIDs: string[]; // 包含在流程里的项目(单位工程)
  214. status: ApprovalStatus; // 状态
  215. approvalTime?: number; // 审批通过时间
  216. currentProcessID?: string; // 当前正处于哪个环节ID
  217. businessID?: string; // 业务ID
  218. gatherID?: string;
  219. }
  220. // 流程过程中存储的数据
  221. export interface IProcessData {
  222. ID: string;
  223. module: CptModelName | SubModelName; // 编辑的模块
  224. action: ActionType; // 动作,增删改等
  225. oDoc: any; // 存放删除时或者修改时的数据
  226. createTime: number; // 创建时间
  227. }
  228. // 备份数据集合
  229. export interface IProcessDataDoc {
  230. projectID: string;
  231. processID: string;
  232. index: number;
  233. processData: IProcessData[];
  234. }
  235. // 环节状态(精简)
  236. export enum SimpleProcessStatus {
  237. APPROVED = 'approved', // 审批通过
  238. FAILED = 'failed', // 失败
  239. REPORTED = 'reported', // 上报
  240. }
  241. // 审批待办类型
  242. export enum ApprovalType {
  243. APPROVER = 'approver', // 审批
  244. COREVIEW = 'coreview', // 协审
  245. REPORT = 'report', // 上报
  246. }
  247. export enum FinancialProjectStatus {
  248. UNREPORTED = 'unreported',
  249. APPROVING = 'approving',
  250. COMPLETION = 'completion',
  251. }
  252. // 流程环节待办列表项
  253. export interface IApprovalTodoData {
  254. approvalID: string; // 流程 id
  255. processID: string; // 环节 id
  256. financialProjectID: string; // 项目 ID
  257. constructionID: string; // 建设项目 ID
  258. projectName?: string; // 项目名称
  259. reporterID?: string; // 发起人ID
  260. reporterName?: string; // 发起人名称
  261. lastID?: string; // 上环节ID(暂定为上环节用户ID,之后可能为上环节ID)
  262. lastName?: string; // 上环节名称(暂定为上环节用户名称,之后可能为上环节名称) 三合一是上环节名称
  263. nextID?: string; // 下一个步骤ID(三合一)
  264. nextName?: string; // 下一个步骤名称(三合一)
  265. reportTime?: number; // 上报时间
  266. lastStatus?: SimpleProcessStatus; // 上一环节的状态
  267. approveTime?: number; // 当前环节审批时间
  268. approveType?: SimpleProcessStatus; // 审批办结状态
  269. moveUserID?: string; // 环节流转(用户ID)
  270. moveUserName?: string; // 环节流转(用户名)
  271. approvalStatus?: ApprovalStatus; // 审批流程的状态
  272. type: ApprovalType; // 审批待办类型
  273. gatherID?: string;
  274. }
  275. export interface IApprovalTodoData2 {
  276. approvalID: string; // 流程 id
  277. processID: string; // 环节 id
  278. financialProjectID: string; // 项目 ID
  279. constructionID: string; // 建设项目 ID
  280. projectName?: string; // 项目名称
  281. // reporterID: string; // 发起人ID (删)
  282. // reporterName: string; // 发起人名称(删)
  283. lastID?: string; // 为上环节用户ID
  284. lastName?: string; // 上环节用户名称
  285. // reportTime: number; // 上报时间(删)
  286. lastStatus?: SimpleProcessStatus; // 上环节办结状态
  287. // approveTime: number; // 审批办结时间(删)
  288. approveType?: SimpleProcessStatus; // 审批办结状态
  289. // approvalStatus: ApprovalStatus; // 审批流程的状态(删)
  290. moveUserID?: string; // 环节流转(用户ID)
  291. moveUserName?: string; // 环节流转(用户名)
  292. type: ApprovalType; // 审批待办类型
  293. }
  294. export enum TodoType {
  295. APPROVAL = 'approval',
  296. }
  297. export enum TodoStatus {
  298. REMAIN = 'remain',
  299. COMPLETED = 'completed',
  300. }
  301. export interface ITodo {
  302. ID: string; // 待办 ID
  303. userID: string; // 用户 ID
  304. createdTime: number; // 创建时间(相当于环节流转时间)
  305. completedTime: number; // 完成时间(相当于审批办结时间)
  306. todoType: TodoType;
  307. data: any;
  308. status: TodoStatus;
  309. }
  310. export interface IApprovalTodo extends ITodo {
  311. data: IApprovalTodoData;
  312. }
  313. export enum ChangeRecord {
  314. CURRENT = 'current', // 当前清单
  315. ALLBILLS = 'all-bills', // 全部清单
  316. ALLGLJS = 'all-gljs', // 全部材价
  317. }
  318. export enum BusinessType {
  319. /** 预算 */
  320. BUDGET = 'undo',
  321. /** 结算 */
  322. SETTLEMENT = 'doing',
  323. /** 决算 */
  324. FINAL = 'done',
  325. }
  326. export enum BusinessStatus {
  327. /** 未上报 */
  328. UNREPORTED = 'unreported',
  329. /** 审批中 */
  330. APPROVING = 'approving',
  331. /** 审批完成 */
  332. COMPLETION = 'completion',
  333. }
  334. export interface IBusinessApprovalItem {
  335. ID?: string;
  336. name?: string;
  337. code?: string;
  338. gatherID?: string;
  339. businessType?: BusinessType;
  340. status?: BusinessStatus;
  341. /** 送审时间 */
  342. sendReviewTime?: string;
  343. /** 审结时间 */
  344. completionTime?: string;
  345. /** 送审金额 */
  346. reportMoney?: string;
  347. /** 审结金额 */
  348. conclusion?: string;
  349. /** 审增金额 */
  350. addition?: string;
  351. /** 审减金额 */
  352. reduction?: string;
  353. created?: string;
  354. createdID?: string;
  355. createTime?: string;
  356. }
  357. export interface IConditionSetting {
  358. ID: string;
  359. gatherID: string;
  360. schema?: string;
  361. }