From ac31c31fe1bdfcb856bcc7f6fdc1311298a6d795 Mon Sep 17 00:00:00 2001 From: yaoyn Date: Sat, 28 Dec 2024 11:46:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=80=80=E5=9B=9E=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E5=AE=A1=E6=89=B9=E4=BA=BA=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=9B=BE=E6=98=BE=E7=A4=BA=E6=9B=B4=E5=A4=9A=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=88=E8=8A=82=E7=82=B9=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E4=BA=BA/=E5=BD=93=E5=89=8D=E5=AE=A1=E6=89=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=EF=BC=89=20=E6=B5=81=E7=A8=8B=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E7=9A=84=E9=85=8D=E7=BD=AE=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AD=90=E6=B5=81=E7=A8=8B=E5=A4=9A=E5=AE=9E=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=EF=BC=88=E4=BC=A0=E5=8F=82isEnd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SecondDev/OpinionDialog.vue | 51 ++++++++++++++++++- src/model/workflow/bpmnConfig.ts | 8 ++- src/views/secondDev/approveFlowPage.vue | 8 ++- src/views/workflow/design/bpmn/index.vue | 5 ++ .../components/flow/ProcessInformation.vue | 19 +++++-- src/views/workflow/task/hooks/userTaskItem.ts | 10 ++-- 6 files changed, 91 insertions(+), 10 deletions(-) diff --git a/src/components/SecondDev/OpinionDialog.vue b/src/components/SecondDev/OpinionDialog.vue index bf72c35..840d815 100644 --- a/src/components/SecondDev/OpinionDialog.vue +++ b/src/components/SecondDev/OpinionDialog.vue @@ -24,6 +24,16 @@ {{ item.activityName }} + + @@ -123,9 +133,36 @@ } async function loadRejectNodeList() { + rejectNodeId.value=''; let res = await getRejectNodeList(_processId, _taskId); if (res && Array.isArray(res) && res.length > 0) { rejectNodeList.value = res; + dialogTitle.value = `退回`; + if (res?.length) { + res.forEach((nNode) => { + if (!nNode.userList?.length) { + return; + } + const selected = []; + nNode.nextAssignees = nNode.userList.map((item) => { + if (item.checked || nNode.userList.length === 1) { + // 只有一个人的时候必须选他 + selected.push(item['F_UserId']); + } + return { + value: item['F_UserId'], + label: item['F_RealName']+(item.remarks?"("+item.remarks+")":""), + item:item + }; + }); + nNode.assignees = selected; + if (!nNode.chooseAssign) { + // 不需要选审批人的时候 所有备选人都要放到下个节点 + nNode.assignees = nNode.userList.map((item) => item['F_UserId']); + } + nNode.chooseAssign = nNode.chooseAssign; + }); + } } } @@ -140,12 +177,24 @@ nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(','); }); } + if (_action.value === 'reject') { + const isChoose = rejectNodeList.value.find((node) => node.activityId==rejectNodeId.value&&node.assignees?.length); + if (!isChoose) { + return message.error('请选择审批人'); + } + rejectNodeList.value.forEach((nNode) => { + if(nNode.activityId==rejectNodeId.value){ + nextTaskUser[nNode.activityId] = isEnd.value ? '' : nNode.assignees.join(','); + } + }); + } if (_callback && typeof _callback === 'function') { loading.value = true; _callback({ opinion: formState.opinion, rejectNodeId: rejectNodeId.value, - nextTaskUser + nextTaskUser, + isEnd }); } else { isOpen.value = false; diff --git a/src/model/workflow/bpmnConfig.ts b/src/model/workflow/bpmnConfig.ts index ea278a0..5026180 100644 --- a/src/model/workflow/bpmnConfig.ts +++ b/src/model/workflow/bpmnConfig.ts @@ -51,7 +51,9 @@ export interface FormInfoItem { } export interface FlowInfo { currentTaskAssigneeNames: string; - isCountersign: boolean; + currentTaskAssignees:{}; + taskInfo:{}; + isCountersign: boolean; isAddOrSubSign: boolean; schemaInfo: { category: string; @@ -98,7 +100,9 @@ export interface TaskApproveOpinion { } export interface BpmnFlowForm { // schemaId: string; - currentTaskAssignee: string; + currentTaskAssigneeNames:string; + currentTaskAssignees: any; + currentTaskInfo:any; item: BpmnFlowFormItem; xml: string; formInfos: Array; diff --git a/src/views/secondDev/approveFlowPage.vue b/src/views/secondDev/approveFlowPage.vue index c4f116c..f3b4a83 100644 --- a/src/views/secondDev/approveFlowPage.vue +++ b/src/views/secondDev/approveFlowPage.vue @@ -52,7 +52,10 @@ - + @@ -112,6 +115,7 @@ let approvalData = reactive({ isCountersign: false, isAddOrSubSign: false, + isEnd: false, stampInfo: { stampId: '', password: '' @@ -198,6 +202,7 @@ callback: (args) => { approvalData.approvedContent = args.opinion; approvalData.nextTaskUser = args.nextTaskUser; + approvalData.isEnd=args.isEnd; onFinish('approve'); } }); @@ -408,6 +413,7 @@ /*stampId: values.stampId, stampPassword: values.password,*/ isOldSystem: system, + isEnd:approvalData.isEnd, nextTaskUser: approvalData.nextTaskUser }; } diff --git a/src/views/workflow/design/bpmn/index.vue b/src/views/workflow/design/bpmn/index.vue index d55acb8..0616294 100644 --- a/src/views/workflow/design/bpmn/index.vue +++ b/src/views/workflow/design/bpmn/index.vue @@ -482,6 +482,11 @@ const rootElementsJson = bpmnModeler.getDefinitions().rootElements; const rootElementsFlowElementsArr = rootElementsJson[0].flowElements; + //过滤不存在元素的配置 + const exitsElements=bpmnModeler.get('elementRegistry').getAll(); + const exitsElementIds=exitsElements.map(x=>x.id); + json.childNodeConfig=json.childNodeConfig.filter(x=>exitsElementIds.indexOf(x.id)>-1); + if (validateProcessConfig(rootElementsFlowElementsArr, json)) { try { const { svg } = await bpmnModeler.saveSVG({ format: true }); diff --git a/src/views/workflow/task/components/flow/ProcessInformation.vue b/src/views/workflow/task/components/flow/ProcessInformation.vue index eff7ae3..60b4e92 100644 --- a/src/views/workflow/task/components/flow/ProcessInformation.vue +++ b/src/views/workflow/task/components/flow/ProcessInformation.vue @@ -1,6 +1,15 @@