process.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. import { ReportTree } from './report';
  2. import { CptModelName, SubModelName, ActionType } from './base';
  3. import { BusinessTypeKey } from './gather';
  4. import { executorMember } from './approvalStatus';
  5. import { IProcessMatter, IStepMatter } from './matter';
  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. BACK_STAGE_ENABLE = 'backstageEnable', // 小后台权限
  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. // 流程中的一个环节
  102. export interface IProcess {
  103. ID: string;
  104. name: string;
  105. sectorType: SectorType;
  106. seq?: number;
  107. createdByProcess?: string; // 上环节ID, 表示哪个环节创建的(上环节添加的)
  108. time?: number; // 当前环节完成时间(仅当审批通过或审批退回时会有时间)
  109. participantInfo: IParticipantInfo;
  110. afterAuditMoney?: number; // 审后的金额
  111. }
  112. export interface Members {
  113. ID: string;
  114. approvalStatus: string;
  115. approvalTime: number | string;
  116. approvalComment: string;
  117. name?: string;
  118. institutionID?: string;
  119. institutionName?: string;
  120. }
  121. // 3合1执行者
  122. export interface IProcessExecutor {
  123. ID: string;
  124. permission: string[];
  125. configure: string[];
  126. businessType: BusinessTypeKey;
  127. gatherID: string;
  128. setType: string;
  129. participantMode: string;
  130. name: string;
  131. reportTime?: string; // 三合一审批流程第一位的上报时间
  132. scope?: string;
  133. members?: Members[];
  134. // 事项中组件及其权限
  135. inProcessMatters?: IProcessMatter[];
  136. // 事项后组件及其权限
  137. afterProcessMatters?: IProcessMatter[];
  138. }
  139. export interface SimpleDynamicStep {
  140. stepID: string;
  141. stepName: string;
  142. executorID?: string;
  143. executorName?: string;
  144. }
  145. // export interface ICollaboratorPermission {
  146. // matterID: string;
  147. // form: string[];
  148. // cost: string[];
  149. // profile: string[];
  150. // }
  151. // 3合1协审人信息
  152. export interface ICollaborator {
  153. ID: string; // 用户ID
  154. institutionID?: string; // 机构ID,只在协审角色为审批单位的时候存在
  155. name?: string; // 用户姓名
  156. deadline: string; // 截至时间
  157. // 事项中组件及其权限
  158. inProcessMatters?: IProcessMatter[];
  159. // 事项后组件及其权限
  160. afterProcessMatters?: IProcessMatter[];
  161. }
  162. // 3合1添加协审下拉选项
  163. export interface ICollaboratorItem {
  164. institutionID?: string;
  165. institutionName?: string;
  166. approvalMembers: string[];
  167. approverName?: string;
  168. }
  169. // 三合一协审人范围
  170. export interface ICollaboratorScope {
  171. type: string;
  172. accounts: string[];
  173. institutionRoles: string[];
  174. }
  175. // 3合1参与者信息
  176. export interface IProcedureParticipantInfo {
  177. approvalWay: string;
  178. executor: {
  179. ID: string;
  180. configure: string[];
  181. members?: Members[];
  182. reportTime?: string;
  183. approvaledPermission?: string[]; // 事项后原始数据
  184. inProcessMatters?: IProcessMatter[];
  185. afterProcessMatters?: IProcessMatter[];
  186. };
  187. collaborators: ICollaborator[];
  188. dynamicSteps: SimpleDynamicStep[];
  189. stepMatters?: IStepMatter[];
  190. }
  191. // 3合1分支判断信息
  192. export interface IConditionItem {
  193. ID: string;
  194. field: string;
  195. type: string;
  196. symbol: string;
  197. value: string;
  198. }
  199. // 3合1分支条件信息
  200. // eslint-disable-next-line prettier/prettier, no-use-before-define
  201. export interface IConditionInfoItem<T = IProcedureProcess> {
  202. ID: string;
  203. conditions: IConditionItem[];
  204. // eslint-disable-next-line prettier/prettier, no-use-before-define
  205. process: T[];
  206. }
  207. // 3合1步骤中的一个环节
  208. export interface IProcedureProcess {
  209. ID: string;
  210. referenceID: string;
  211. name: string;
  212. sectorType: SectorType;
  213. isReportProcess?: boolean; // 是否上报环节(因为上报环节是特殊的,所以加个字段方便处理)
  214. participantInfo?: IProcedureParticipantInfo;
  215. conditionInfo?: IConditionInfoItem[];
  216. condition?: {
  217. ID: string;
  218. processID: string;
  219. field: string;
  220. fieldValue: string;
  221. };
  222. // 步骤事项中的造价是否可编辑
  223. costEditable?: boolean;
  224. }
  225. export interface IProcedureItem {
  226. ID: string;
  227. approvalStatus: string;
  228. content: string;
  229. approvalTime: string;
  230. executor?: IProcessExecutor;
  231. collaborators?: ICollaborator[];
  232. isReportProcess?: boolean;
  233. // members?: executorMember[];
  234. approvalWay?: string;
  235. dynamicSteps?: SimpleDynamicStep[];
  236. stepMatters?: IStepMatter[];
  237. nextProcessSectorType?: SectorType;
  238. conclusion?: string;
  239. addition?: string;
  240. reduction?: string;
  241. configure?: [];
  242. }
  243. export interface IApproval {
  244. ID: string;
  245. name: string;
  246. createdID: string;
  247. createdTime: number;
  248. process: IProcess[];
  249. templateProcess?: IProcedureProcess[]; // 三合一需要用的流程模板
  250. subjectID?: string;
  251. businessType?: BusinessTypeKey;
  252. }
  253. export enum ApprovalStatus {
  254. CREATED = 'created', // 创建完成
  255. PROCESSING = 'processing', // 正在审批
  256. APPROVED = 'approved', // 审批通过
  257. }
  258. // 审核费用类型
  259. export enum AuditMoneyType {
  260. // 建设项目相关费用
  261. CONSTRUCTION = 'construction',
  262. // 费用项
  263. FEE_ITEM = 'feeItem',
  264. }
  265. export interface IProcessAuditMoney {
  266. ID: string;
  267. type: AuditMoneyType;
  268. // 来源ID,有的数据是基于某条数据拷贝而来的,sourceID为被拷贝数据的ID,方便查找源数据
  269. sourceID?: string;
  270. processID: string;
  271. data: any[];
  272. }
  273. // 复制到项目里的流程
  274. export interface IProjectApproval extends IApproval {
  275. financialProjectID: string; // 财审项目ID
  276. constructionID: string; // 建设项目ID
  277. projectIDs: string[]; // 包含在流程里的项目(单位工程)
  278. status: ApprovalStatus; // 状态
  279. approvalTime?: number; // 审批通过时间
  280. currentProcessID?: string; // 当前正处于哪个环节ID
  281. businessID?: string; // 业务ID
  282. gatherID?: string;
  283. }
  284. // 三合一项目里的流程
  285. export interface IProcedureApproval {
  286. ID: string;
  287. gatherID: string;
  288. businessType: BusinessTypeKey;
  289. businessID: string;
  290. templateProcess: IProcedureProcess[];
  291. process: IProcedureProcess[];
  292. }
  293. // 流程过程中存储的数据
  294. export interface IProcessData {
  295. ID: string;
  296. module: CptModelName | SubModelName; // 编辑的模块
  297. action: ActionType; // 动作,增删改等
  298. oDoc: any; // 存放删除时或者修改时的数据
  299. createTime: number; // 创建时间
  300. }
  301. // 备份数据集合
  302. export interface IProcessDataDoc {
  303. projectID: string;
  304. processID: string;
  305. index: number;
  306. processData: IProcessData[];
  307. }
  308. // 环节状态(精简)
  309. export enum SimpleProcessStatus {
  310. APPROVED = 'approved', // 审批通过
  311. FAILED = 'failed', // 失败
  312. REPORTED = 'reported', // 上报
  313. }
  314. // 审批待办类型
  315. export enum ApprovalType {
  316. APPROVER = 'approver', // 审批
  317. COREVIEW = 'coreview', // 协审
  318. REPORT = 'report', // 上报
  319. }
  320. export enum FinancialProjectStatus {
  321. UNREPORTED = 'unreported',
  322. APPROVING = 'approving',
  323. COMPLETION = 'completion',
  324. }
  325. // 流程环节待办列表项
  326. export interface IApprovalTodoData {
  327. approvalID: string; // 流程 id
  328. processID: string; // 环节 id
  329. financialProjectID: string; // 项目 ID
  330. constructionID?: string; // 建设项目 ID
  331. projectName?: string; // 项目名称
  332. reporterID?: string; // 发起人ID
  333. reporterName?: string; // 发起人名称
  334. lastID?: string; // 上环节ID(暂定为上环节用户ID,之后可能为上环节ID)
  335. lastName?: string; // 上环节名称(暂定为上环节用户名称,之后可能为上环节名称) 三合一是上环节名称
  336. nextID?: string; // 下一个步骤ID(三合一)
  337. nextName?: string; // 下一个步骤名称(三合一)
  338. reportTime?: number; // 上报时间
  339. lastStatus?: SimpleProcessStatus; // 上一环节的状态
  340. approveTime?: number; // 当前环节审批时间
  341. approveType?: SimpleProcessStatus; // 审批办结状态
  342. moveUserID?: string; // 环节流转(用户ID)
  343. moveUserName?: string; // 环节流转(用户名)
  344. approvalStatus?: ApprovalStatus; // 审批流程的状态
  345. type: ApprovalType; // 审批待办类型
  346. gatherID?: string;
  347. }
  348. export interface IApprovalTodoData2 {
  349. approvalID: string; // 流程 id
  350. processID: string; // 环节 id
  351. financialProjectID: string; // 项目 ID
  352. constructionID: string; // 建设项目 ID
  353. projectName?: string; // 项目名称
  354. // reporterID: string; // 发起人ID (删)
  355. // reporterName: string; // 发起人名称(删)
  356. lastID?: string; // 为上环节用户ID
  357. lastName?: string; // 上环节用户名称
  358. // reportTime: number; // 上报时间(删)
  359. lastStatus?: SimpleProcessStatus; // 上环节办结状态
  360. // approveTime: number; // 审批办结时间(删)
  361. approveType?: SimpleProcessStatus; // 审批办结状态
  362. // approvalStatus: ApprovalStatus; // 审批流程的状态(删)
  363. moveUserID?: string; // 环节流转(用户ID)
  364. moveUserName?: string; // 环节流转(用户名)
  365. type: ApprovalType; // 审批待办类型
  366. }
  367. export enum TodoType {
  368. APPROVAL = 'approval',
  369. }
  370. export enum TodoStatus {
  371. REMAIN = 'remain',
  372. COMPLETED = 'completed',
  373. }
  374. export interface ITodo {
  375. ID: string; // 待办 ID
  376. userID: string; // 用户 ID
  377. createdTime: number; // 创建时间(相当于环节流转时间)
  378. completedTime: number; // 完成时间(相当于审批办结时间)
  379. todoType: TodoType;
  380. data: any;
  381. status: TodoStatus;
  382. }
  383. export interface IApprovalTodo extends ITodo {
  384. data: IApprovalTodoData;
  385. }
  386. export enum ChangeRecord {
  387. CURRENT = 'current', // 当前清单
  388. ALLBILLS = 'all-bills', // 全部清单
  389. ALLGLJS = 'all-gljs', // 全部材价
  390. }
  391. export enum BusinessType {
  392. /** 预算 */
  393. BUDGET = 'undo',
  394. /** 结算 */
  395. SETTLEMENT = 'doing',
  396. /** 决算 */
  397. FINAL = 'done',
  398. }
  399. export enum BusinessStatus {
  400. /** 未上报 */
  401. UNREPORTED = 'unreported',
  402. /** 审批中 */
  403. APPROVING = 'approving',
  404. /** 审批完成 */
  405. COMPLETION = 'completion',
  406. }
  407. export interface IBusinessApprovalItem {
  408. ID?: string;
  409. name?: string;
  410. code?: string;
  411. gatherID?: string;
  412. businessType?: BusinessType;
  413. status?: BusinessStatus;
  414. /** 送审时间 */
  415. sendReviewTime?: string;
  416. /** 审结时间 */
  417. completionTime?: string;
  418. /** 送审金额 */
  419. reportMoney?: string;
  420. /** 审结金额 */
  421. conclusion?: string;
  422. /** 审增金额 */
  423. addition?: string;
  424. /** 审减金额 */
  425. reduction?: string;
  426. created?: string;
  427. createdID?: string;
  428. createTime?: string;
  429. }
  430. export interface IConditionSetting {
  431. ID: string;
  432. gatherID: string;
  433. schema?: string;
  434. }
  435. // 审核金额 核减、增金额数据
  436. export interface IAuditSummaryDiff {
  437. // 核减金额
  438. decFee: string;
  439. // 核增金额
  440. incFee: string;
  441. // 核减率
  442. decRate: string;
  443. // 核减率提示
  444. decRateTips?: string;
  445. // 核增率
  446. incRate: string;
  447. // 核增率提示
  448. incRateTips?: string;
  449. }
  450. // 审批金额汇总表数据
  451. export interface IAuditSummaryItem {
  452. // 阶段
  453. stage: string;
  454. // 执行者名称
  455. executor: string;
  456. // 执行者单位
  457. institution: string;
  458. // 审核步骤名称
  459. process: string;
  460. // 审结时间
  461. approvalTime: string;
  462. // 金额
  463. fee: string;
  464. // 大写金额
  465. feeInWords: string;
  466. // 与上一阶段对比
  467. compareToPrev: IAuditSummaryDiff;
  468. // 与上送审对比
  469. compareToReport: IAuditSummaryDiff;
  470. }
  471. // 审核明细数据
  472. export interface IAuditDetailItem {
  473. // 唯一标识,table渲染需要
  474. ID: string;
  475. // 步骤名
  476. process: string;
  477. // 单位
  478. institution: string;
  479. // 姓名
  480. userName: string;
  481. // 角色:负责人、协审
  482. role: string;
  483. // 起始金额
  484. beginFee: string;
  485. // 结束金额
  486. endFee: string;
  487. // 审增
  488. incFee: string;
  489. // 审减
  490. decFee: string;
  491. // 增减比例
  492. rate: string;
  493. // 状态文本
  494. status: string;
  495. // 审核状态
  496. approvalStatus: string;
  497. // 协审为子项
  498. children: IAuditDetailItem[];
  499. }
  500. // 审核意见表(入库数据)
  501. export interface IAuditComment {
  502. ID: string;
  503. // 业务ID
  504. businessID: string;
  505. // 关联模板步骤ID(一个步骤只有一份意见,所以得用模板ID,不能用全环节中的步骤)
  506. refProcessID: string;
  507. // 富文本
  508. richText: string;
  509. // 创建时间
  510. createTime: number;
  511. // 更新时间
  512. updateTime: number;
  513. // 富文本模板(只有第一版才有内容,方便还原模板)
  514. template?: string;
  515. }
  516. // 审核意见历史
  517. export interface IAuditCommentHistory {
  518. // 意见ID
  519. commentID: string;
  520. // 步骤
  521. process: string;
  522. // 版本(第几版)
  523. version: string;
  524. // 执行者
  525. executor: string;
  526. // 单位
  527. institution: string;
  528. // 审批通过时间
  529. approvalTime?: string;
  530. // 审批状态
  531. status: ProcessStatus;
  532. }
  533. // 传统结算未上报数据
  534. export interface ISettlementItem {
  535. // 建设项目ID
  536. constructionID: string;
  537. // 名称
  538. name: string;
  539. // 项目原报金额
  540. orgFee: string;
  541. // 当前步骤审核金额
  542. curFee: string;
  543. // 清单检测合格率
  544. billCheckRate: string;
  545. // 费用项ID
  546. feeID?: string;
  547. // 费用类型
  548. type?: AuditMoneyType;
  549. // 备注
  550. remark?: string;
  551. }
  552. // 传统结算已上报审核数据
  553. export interface ISettlementAuditItem {
  554. // 唯一标识,table渲染需要
  555. ID: string;
  556. // 建设项目ID
  557. constructionID?: string;
  558. // 名称
  559. name: string;
  560. // 起始金额
  561. beginFee?: string;
  562. // 结束金额
  563. endFee?: string;
  564. // 增减金额
  565. incFee?: string;
  566. decFee?: string;
  567. // 增减率
  568. incRate?: string;
  569. decRate?: string;
  570. // 审核通过时间
  571. approvalTime?: string;
  572. // 用户信息
  573. user?: {
  574. name: string;
  575. institution: string;
  576. executor: string;
  577. };
  578. // 审核状态
  579. approvalStatus?: string;
  580. children: ISettlementAuditItem[];
  581. // 数据是否是原始数据(有的费用项是从上一步拷贝而来的,不给删除)
  582. isOriginal?: boolean;
  583. // 费用项ID
  584. feeID?: string;
  585. // 费用类型
  586. type?: AuditMoneyType;
  587. // 备注
  588. remark?: string;
  589. }
  590. // 概算预算阶段造价对比 审核明细表格数据
  591. export interface IBudgetEstimateTableItem {
  592. name: string;
  593. // 原报金额
  594. reportFee: string;
  595. // 审核金额
  596. curFee: string;
  597. // 增减金额
  598. incFee?: string;
  599. decFee?: string;
  600. // 增减率
  601. incRate?: string;
  602. decRate?: string;
  603. // 审核状态
  604. approvalStatus?: string;
  605. // 审核状态文本
  606. approvalStatusText?: string;
  607. }