From e587d68fef4161e4ac285fc4cf7c4ec11a94fb89 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Mon, 25 Nov 2024 02:14:21 +0000 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E8=8A=82=E7=82=B9=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package/penal/custom-config/ElementCustomConfig.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue b/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue index e5497b08..7008e3f3 100644 --- a/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue +++ b/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue @@ -245,6 +245,7 @@ function findAllPredecessorsExcludingStart(elementId, modeler) { const elementRegistry = modeler.get('elementRegistry') const allConnections = elementRegistry.filter((element) => element.type === 'bpmn:SequenceFlow') const predecessors = new Set() // 使用 Set 来避免重复节点 + const visited = new Set() // 用于记录已访问的节点 // 检查是否是开始事件节点 function isStartEvent(element) { @@ -252,6 +253,14 @@ function findAllPredecessorsExcludingStart(elementId, modeler) { } function findPredecessorsRecursively(element) { + // 如果该节点已经访问过,直接返回,避免循环 + if (visited.has(element)) { + return + } + + // 标记当前节点为已访问 + visited.add(element) + // 获取与当前节点相连的所有连接 const incomingConnections = allConnections.filter((connection) => connection.target === element) From 41f8f0cc9adfa7510eb8048dbad3f47a7f7db7b4 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Mon, 25 Nov 2024 14:12:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20bpm=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=80=82=E9=85=8DSimple=E8=AE=BE=E8=AE=A1=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../descriptor/flowableDescriptor.json | 25 +++ .../custom-config/ElementCustomConfig.vue | 166 +++++++++++++++++- 2 files changed, 188 insertions(+), 3 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json index d1ca4a43..5544b2d0 100644 --- a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json +++ b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json @@ -1281,7 +1281,32 @@ "isBody": true } ] + }, + { + "name": "ButtonsSetting", + "superClass": ["Element"], + "meta": { + "allowedIn": ["bpmn:UserTask"] + }, + "properties": [ + { + "name": "flowable:id", + "type": "Integer", + "isAttr": true + }, + { + "name": "flowable:enable", + "type": "Boolean", + "isAttr": true + }, + { + "name": "flowable:displayName", + "type": "String", + "isAttr": true + } + ] } + ], "emumerations": [] } diff --git a/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue b/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue index 7008e3f3..9cf7e966 100644 --- a/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue +++ b/src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue @@ -2,6 +2,7 @@ 1. 审批人与提交人为同一人时 2. 审批人拒绝时 3. 审批人为空时 + 4. 操作按钮 --> @@ -74,6 +75,35 @@ + + 操作按钮 + + + 操作按钮 + 显示名称 + 启用 + + + {{ OPERATION_BUTTON_NAME.get(item.id) }} + + + {{ item.displayName }} + + + + + + @@ -83,7 +113,9 @@ import { RejectHandlerType, REJECT_HANDLER_TYPES, ASSIGN_EMPTY_HANDLER_TYPES, - AssignEmptyHandlerType + AssignEmptyHandlerType, + OPERATION_BUTTON_NAME, + DEFAULT_BUTTON_SETTING } from '@/components/SimpleProcessDesignerV2/src/consts' import * as UserApi from '@/api/system/user' @@ -111,6 +143,11 @@ const assignEmptyHandlerType = ref() const assignEmptyUserIdsEl = ref() const assignEmptyUserIds = ref() +// 操作按钮 +const buttonsSettingEl = ref() +const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayNameBlurEvent } = + useButtonsSetting() + const elExtensionElements = ref() const otherExtensions = ref() const bpmnElement = ref() @@ -165,6 +202,22 @@ const resetCustomConfigList = () => { return num > Number.MAX_SAFE_INTEGER || num < -Number.MAX_SAFE_INTEGER ? item : num }) + // 操作按钮 + buttonsSettingEl.value = elExtensionElements.value.values?.filter( + (ex) => ex.$type === `${prefix}:ButtonsSetting` + ) + if (buttonsSettingEl.value.length === 0) { + DEFAULT_BUTTON_SETTING.forEach((item) => { + buttonsSettingEl.value.push( + bpmnInstances().moddle.create(`${prefix}:ButtonsSetting`, { + 'flowable:id': item.id, + 'flowable:displayName': item.displayName, + 'flowable:enable': item.enable + }) + ) + }) + } + // 保留剩余扩展元素,便于后面更新该元素对应属性 otherExtensions.value = elExtensionElements.value.values?.filter( @@ -173,7 +226,8 @@ const resetCustomConfigList = () => { ex.$type !== `${prefix}:RejectHandlerType` && ex.$type !== `${prefix}:RejectReturnTaskId` && ex.$type !== `${prefix}:AssignEmptyHandlerType` && - ex.$type !== `${prefix}:AssignEmptyUserIds` + ex.$type !== `${prefix}:AssignEmptyUserIds` && + ex.$type !== `${prefix}:ButtonsSetting` ) ?? [] // 更新元素扩展属性,避免后续报错 @@ -221,7 +275,8 @@ const updateElementExtensions = () => { rejectHandlerTypeEl.value, returnNodeIdEl.value, assignEmptyHandlerTypeEl.value, - assignEmptyUserIdsEl.value + assignEmptyUserIdsEl.value, + ...buttonsSettingEl.value ] }) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { @@ -284,9 +339,114 @@ function findAllPredecessorsExcludingStart(elementId, modeler) { return Array.from(predecessors) // 返回前置节点数组 } +function useButtonsSetting() { + const buttonsSetting = ref() + // 操作按钮显示名称可编辑 + const btnDisplayNameEdit = ref([]) + const changeBtnDisplayName = (index: number) => { + btnDisplayNameEdit.value[index] = true + } + const btnDisplayNameBlurEvent = (index: number) => { + btnDisplayNameEdit.value[index] = false + const buttonItem = buttonsSetting.value![index] + buttonItem.displayName = buttonItem.displayName || OPERATION_BUTTON_NAME.get(buttonItem.id)! + } + return { + buttonsSetting, + btnDisplayNameEdit, + changeBtnDisplayName, + btnDisplayNameBlurEvent + } +} + const userOptions = ref([]) // 用户列表 onMounted(async () => { // 获得用户列表 userOptions.value = await UserApi.getSimpleUserList() }) + + From 513ea33f3ff27c7b9c19887df294b59d29b5c95b Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Mon, 25 Nov 2024 14:36:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E5=AE=A1=E6=89=B9=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=97=B6=E8=A1=A8=E5=8D=95=E6=97=A0=E6=B3=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=8C=E7=94=B1=E4=BA=8E=E6=8B=92=E7=BB=9D=E6=97=B6=E5=85=B1?= =?UTF-8?q?=E7=94=A8=E4=BA=86approveFormFApi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/ProcessInstanceOperationButton.vue | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue index b92be7e4..c1a69089 100644 --- a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue +++ b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue @@ -77,17 +77,6 @@ :rules="genericRule" label-width="100px" > - - - 填写表单【{{ runningTask?.formName }}】 - - -