process.ts 18 KB

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