From 1f99dcd1347af4b5db252321b657c5158e2fa669 Mon Sep 17 00:00:00 2001 From: cxx Date: Mon, 20 May 2024 17:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/task.js | 15 ++- app/view/component/flow/processFlow.html | 104 ++++++++---------- .../component/select-org-user-dialog.html | 4 +- app/view/component/workflowBasicInfo.html | 18 --- app/view/page/afficheManagement.html | 53 +++++---- app/view/page/afficheViewer.html | 14 +-- 6 files changed, 97 insertions(+), 111 deletions(-) diff --git a/app/service/task.js b/app/service/task.js index 852b21f..cea54dd 100644 --- a/app/service/task.js +++ b/app/service/task.js @@ -49,6 +49,7 @@ class TaskService extends Service { await jianghuKnex('task', this.ctx).jhInsert(actionData); + // 如果首节点是抄送节点,继续往下走 if (taskConfigId.startsWith('noticeTask-')) { var data = { ...actionData, @@ -56,7 +57,7 @@ class TaskService extends Service { taskWorkflow: JSON.parse(taskWorkflow), taskFormInput: JSON.parse(taskFormInput), } - // 往下走 + await this.submitNode(data, '同意', 1, 'createTask') } } @@ -79,14 +80,18 @@ class TaskService extends Service { await this.submitNode(updateItem, '同意', 1, 'createTask') } + /** + * @ target: 提交节点 + * @ params: + * taskData: 审批单信息 + * type: 审批操作:同意/拒绝 + * times: 首次进入该方法,0:首次;1:迭代进入的 + * action: 新建/审核审批, createTask:新建审批单;updateTask:审核审批单 + */ async submitNode(taskData, type, times, action) { const { jianghuKnex } = this.app; const { updateTaskData, historyInsertData, noticeInsertData } = await this.buildNext({ taskData: taskData, type: type, times: times, action: action }) - console.log('updateTaskData------', updateTaskData); - console.log('historyInsertData------', historyInsertData); - console.log('noticeInsertData------', noticeInsertData); - await jianghuKnex.transaction(async trx => { if (updateTaskData) await trx("task", this.ctx).where({ taskId: taskData.taskId }).jhUpdate(updateTaskData); if (noticeInsertData.length > 0) await trx("notice_push", this.ctx).jhInsert(noticeInsertData); diff --git a/app/view/component/flow/processFlow.html b/app/view/component/flow/processFlow.html index 6d34674..b016f6f 100644 --- a/app/view/component/flow/processFlow.html +++ b/app/view/component/flow/processFlow.html @@ -807,18 +807,55 @@ Vue.component("process-flow", { this.isPassValidate = true const { lineList, nodeList } = this.workflowConfig; + // 不允许没有审核节点 + if(!nodeList.some(node => node.properties.type == 'approvalTask')){ + this.isPassValidate = false + this.disPassValidateText += "不允许存在无审批人的审批流程!\n" + }else{ + // 检查条件节点是否选了条件 检查审核/抄送节点是否选了类型 + for (var index = 0; index < nodeList.length; index++) { + const element = nodeList[index]; + + if(['conditionTask'].includes(element.properties.type)){ + if(!element.properties?.priority){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有设置优先级!\n` + }else{ + if(element.properties?.priority != -1 && element.properties?.conditionList?.length <= 0){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n` + } + } + }else if(['approvalTask'].includes(element.properties.type)){ + if(!element.properties.approvalType || !element.properties.approverType){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` + }else if(element.properties.approverType != '申请人自选'){ + if(!(element.properties.user && element.properties.user?.length > 0)){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` + } + } + }else if(['noticeTask'].includes(element.properties.type)){ + if(!element.properties.noticerType){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` + }else if(element.properties.noticerType != '申请人自选'){ + if(!(element.properties.user && element.properties.user?.length > 0)){ + this.isPassValidate = false + this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` + } + } + } + } + } + // 不允许单节点回环 if(lineList.filter(l => l.sourceNodeId == l.targetNodeId).length > 0){ this.isPassValidate = false this.disPassValidateText += "不允许单节点回环!\n" } - // 不允许没有审核节点 - if(!nodeList.some(node => node.properties.type == 'approvalTask')){ - this.isPassValidate = false - this.disPassValidateText += "不允许存在无审批人的审批流程!\n" - } - // 不允许孤立节点 => 除了开始节点和结束节点外,每个节点都有入线和出线 var lineBySourceNodeId = _.groupBy(lineList, 'sourceNodeId'), lineByTargetNodeId = _.groupBy(lineList, 'targetNodeId'), @@ -868,6 +905,11 @@ Vue.component("process-flow", { if(_.some(node, i => i.properties.type != "conditionTask")){ this.isPassValidate = false this.disPassValidateText += "不允许条件节点和审批/通知节点存在同一层级!\n" + }else{ + if(!_.some(node, i => i.properties?.priority == -1)){ + this.isPassValidate = false + this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n" + } } }else{ if(node.length > 1){ @@ -878,57 +920,7 @@ Vue.component("process-flow", { } } - // 不允许有条件节点的优先级没有默认优先级节点, 允许存在多个默认节点,读取顺序按放置时间的先后顺序 - var conditionNodeLineBySourceNodeId = _.groupBy(lineList.filter(i => i.targetNodeId.startsWith('conditionTask-')), 'sourceNodeId'); - for (const key in conditionNodeLineBySourceNodeId) { - if (Object.hasOwnProperty.call(conditionNodeLineBySourceNodeId, key)) { - const element = conditionNodeLineBySourceNodeId[key]; - // 拿到同一层的条件节点 - var conditionNode = element.map(l => nodeList.find(n => n.id === l.targetNodeId)) - if(!_.some(conditionNode, i => i.properties?.priority == -1)){ - this.isPassValidate = false - this.disPassValidateText += "不允许存在某层条件节点没有默认条件优先级!\n" - } - } - } - - // 检查条件节点是否选了条件 检查审核/抄送节点是否选了类型 - for (var index = 0; index < nodeList.length; index++) { - const element = nodeList[index]; - - if(['conditionTask'].includes(element.properties.type)){ - if(!element.properties?.priority){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有设置优先级!\n` - }else{ - if(element.properties?.priority != -1 && element.properties?.conditionList.length <= 0){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有设置条件组!\n` - } - } - }else if(['approvalTask'].includes(element.properties.type)){ - if(!element.properties.approvalType || !element.properties.approverType){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` - }else if(element.properties.approverType != '申请人自选'){ - if(!(element.properties.user && element.properties.user?.length > 0)){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` - } - } - }else if(['noticeTask'].includes(element.properties.type)){ - if(!element.properties.noticerType){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` - }else if(element.properties.noticerType != '申请人自选'){ - if(!(element.properties.user && element.properties.user?.length > 0)){ - this.isPassValidate = false - this.disPassValidateText += `${element.properties.label}节点没有完善信息!\n` - } - } - } - } if(!this.isPassValidate){ await window.vtoast.fail('流程设置:' + this.disPassValidateText); diff --git a/app/view/component/select-org-user-dialog.html b/app/view/component/select-org-user-dialog.html index 6be5b94..b59821e 100644 --- a/app/view/component/select-org-user-dialog.html +++ b/app/view/component/select-org-user-dialog.html @@ -169,10 +169,8 @@ }, }) ).data.appData.resultData.rows; - this.isLoading = false; - this.userList = rows; - console.log('this.userList',this.userList ); + this.isLoading = false; }, async buildTreeData() { let data = [...this.userList]; diff --git a/app/view/component/workflowBasicInfo.html b/app/view/component/workflowBasicInfo.html index 7e9ff7e..efefa8a 100644 --- a/app/view/component/workflowBasicInfo.html +++ b/app/view/component/workflowBasicInfo.html @@ -77,7 +77,6 @@ 审批过程时,当审批人账号被禁用 - 审批过程时,一人多节点自动审批配置 - - - - - @@ -163,7 +147,6 @@