flow.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { defineStore } from 'pinia'
  2. interface BasicInfoIndex {
  3. [key: string]: any
  4. }
  5. const basicInfo: BasicInfoIndex = {
  6. processKey: '', // 唯一标识
  7. processName: '', // 流程定义名称
  8. processIcon: 'approval', // 流程图标
  9. categoryId: '', // 流程组分类ID
  10. remark: '', // 备注说明
  11. createTime: '', // 创建时间
  12. useScope: 0, // 使用范围 0,全员 1,指定人员(业务关联) 2,均不可提交
  13. processActorList: [
  14. {
  15. actorId: 0, // 参与者ID
  16. actorName: '', // 参与者
  17. actorType: 0 // 参与者类型 0,用户 1,部门 2,用户组
  18. }
  19. ], // 流程参与者,当使用范围为指定人员时候设置
  20. processPermissionList: [
  21. {
  22. userId: 0, // 用户ID
  23. userName: '', // 用户名
  24. operateApproval: 0, // 允许编辑/停用/删除审批 0,否 1,
  25. operateOwner: 0, // 允许添加/移除审批负责人 0,否 1,是
  26. operateData: 0 // 允许审批数据查询与操作 0,否 1,是
  27. }
  28. ] // 流程定义权限
  29. }
  30. // 审核条目
  31. export const useFlowStore = defineStore({
  32. id: 'flow',
  33. state: () => {
  34. return {
  35. storeInfoName: '',
  36. flowProcessId: '',
  37. flowName: '', //头部展示的流程名称
  38. basicInfo,
  39. cacheSwitch: false, // 缓存开关
  40. modelContent: '', // 流程模型定义JSON内容
  41. processForm: '', // 流程定义表单
  42. processSetting: {
  43. allowRevocation: true, // 允许撤销审批中的申请
  44. allowRevocationDay: true, // 允许撤销指定天内通过的审批
  45. allowUpdateDay: true, // 允许修改指定天内通过的审批
  46. allowDelegate: true, // 允许代他人提交
  47. allowBatchOperate: true, // 允许审批人批量处理
  48. secondOperatePrompt: true, // 开启秒批提示
  49. repeatOperateSkip: true // 重复审批跳过
  50. } //流程定义配置
  51. }
  52. },
  53. getters: {},
  54. actions: {
  55. initState(title: string) {
  56. console.log('init materialInfoStore')
  57. this.storeInfoName = title || '流程审核'
  58. },
  59. // 基本信息
  60. setKeysBasicInfo(key: string, value: any) {
  61. if (key === null) {
  62. this.basicInfo = value
  63. return
  64. }
  65. this.basicInfo[key] = value
  66. },
  67. // 流程ID
  68. setFlowProcessId(value: string) {
  69. console.log(value, '=======///////===');
  70. this.flowProcessId = value
  71. },
  72. // 表单信息
  73. setProcessForm(value: any) {
  74. this.processForm = value
  75. },
  76. // 流程设计
  77. setModelContent(value: any) {
  78. this.modelContent = value
  79. }
  80. },
  81. persist: true
  82. })
  83. export default useFlowStore