import { defineStore } from 'pinia' interface BasicInfoIndex { [key: string]: any } const basicInfo: BasicInfoIndex = { processKey: '', // 唯一标识 processName: '', // 流程定义名称 processIcon: 'approval', // 流程图标 categoryId: '', // 流程组分类ID remark: '', // 备注说明 createTime: '', // 创建时间 useScope: 0, // 使用范围 0,全员 1,指定人员(业务关联) 2,均不可提交 processActorList: [ { actorId: 0, // 参与者ID actorName: '', // 参与者 actorType: 0 // 参与者类型 0,用户 1,部门 2,用户组 } ], // 流程参与者,当使用范围为指定人员时候设置 processPermissionList: [ { userId: 0, // 用户ID userName: '', // 用户名 operateApproval: 0, // 允许编辑/停用/删除审批 0,否 1, operateOwner: 0, // 允许添加/移除审批负责人 0,否 1,是 operateData: 0 // 允许审批数据查询与操作 0,否 1,是 } ] // 流程定义权限 } // 审核条目 export const useFlowStore = defineStore({ id: 'flow', state: () => { return { storeInfoName: '', flowProcessId: '', flowName: '', //头部展示的流程名称 basicInfo, cacheSwitch: false, // 缓存开关 modelContent: '', // 流程模型定义JSON内容 processForm: '', // 流程定义表单 processSetting: { allowRevocation: true, // 允许撤销审批中的申请 allowRevocationDay: true, // 允许撤销指定天内通过的审批 allowUpdateDay: true, // 允许修改指定天内通过的审批 allowDelegate: true, // 允许代他人提交 allowBatchOperate: true, // 允许审批人批量处理 secondOperatePrompt: true, // 开启秒批提示 repeatOperateSkip: true // 重复审批跳过 } //流程定义配置 } }, getters: {}, actions: { initState(title: string) { console.log('init materialInfoStore') this.storeInfoName = title || '流程审核' }, // 基本信息 setKeysBasicInfo(key: string, value: any) { if (key === null) { this.basicInfo = value return } this.basicInfo[key] = value }, // 流程ID setFlowProcessId(value: string) { console.log(value, '=======///////==='); this.flowProcessId = value }, // 表单信息 setProcessForm(value: any) { this.processForm = value }, // 流程设计 setModelContent(value: any) { this.modelContent = value } }, persist: true }) export default useFlowStore