Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1d4339fa
authored
Nov 22, 2024
by
Lesan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bpm设计器适配Simple设计器,审批人拒绝时
parent
47f1f13c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
7 deletions
+154
-7
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+28
-0
src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
+1
-1
src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue
+125
-6
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
View file @
1d4339fa
...
...
@@ -1225,6 +1225,34 @@
"isBody"
:
true
}
]
},
{
"name"
:
"RejectHandlerType"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"Integer"
,
"isBody"
:
true
}
]
},
{
"name"
:
"RejectReturnTaskId"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"String"
,
"isBody"
:
true
}
]
}
],
"emumerations"
:
[]
...
...
src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
View file @
1d4339fa
<
template
>
<div
class=
"process-panel__container"
:style=
"
{ width: `${width}px` }">
<div
class=
"process-panel__container"
:style=
"
{ width: `${width}px`
,maxHeight: '700px'
}">
<el-collapse
v-model=
"activeTab"
>
<el-collapse-item
name=
"base"
>
<!-- class="panel-tab__title" -->
...
...
src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue
View file @
1d4339fa
<!-- UserTask 自定义配置:
1. 审批人与提交人为同一人时
2. 审批人拒绝时
-->
<
template
>
<div
class=
"panel-tab__content"
>
<el-divider
content-position=
"left"
>
审批人拒绝时
</el-divider>
<el-form-item
prop=
"rejectHandlerType"
>
<el-radio-group
v-model=
"rejectHandlerType"
:disabled=
"returnTaskList.length === 0"
@
change=
"updateRejectHandlerType"
>
<div
class=
"flex-col"
>
<div
v-for=
"(item, index) in REJECT_HANDLER_TYPES"
:key=
"index"
>
<el-radio
:key=
"item.value"
:value=
"item.value"
:label=
"item.label"
/>
</div>
</div>
</el-radio-group>
</el-form-item>
<el-form-item
v-if=
"rejectHandlerType == RejectHandlerType.RETURN_USER_TASK"
label=
"驳回节点"
prop=
"returnNodeId"
>
<el-select
v-model=
"returnNodeId"
clearable
style=
"width: 100%"
@
change=
"updateReturnNodeId"
>
<el-option
v-for=
"item in returnTaskList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-divider
content-position=
"left"
>
审批人与提交人为同一人时
</el-divider>
<el-radio-group
v-model=
"assignStartUserHandlerType"
@
change=
"updateAssignStartUserHandlerType"
>
<div
class=
"flex-col"
>
...
...
@@ -15,7 +45,11 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ASSIGN_START_USER_HANDLER_TYPES
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
import
{
ASSIGN_START_USER_HANDLER_TYPES
,
RejectHandlerType
,
REJECT_HANDLER_TYPES
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
defineOptions
({
name
:
'ElementCustomConfig'
})
const
props
=
defineProps
({
...
...
@@ -24,31 +58,62 @@ const props = defineProps({
})
const
prefix
=
inject
(
'prefix'
)
const
elExtensionElements
=
ref
()
// 审批人与提交人为同一人时
const
assignStartUserHandlerTypeEl
=
ref
()
const
assignStartUserHandlerType
=
ref
()
// 审批人拒绝时
const
rejectHandlerTypeEl
=
ref
()
const
rejectHandlerType
=
ref
()
const
returnNodeIdEl
=
ref
()
const
returnNodeId
=
ref
()
const
returnTaskList
=
ref
([])
const
elExtensionElements
=
ref
()
const
otherExtensions
=
ref
()
const
bpmnElement
=
ref
()
const
bpmnInstances
=
()
=>
(
window
as
any
)?.
bpmnInstances
const
reset
Attributes
List
=
()
=>
{
const
reset
CustomConfig
List
=
()
=>
{
bpmnElement
.
value
=
bpmnInstances
().
bpmnElement
// 获取可回退的列表
returnTaskList
.
value
=
findAllPredecessorsExcludingStart
(
bpmnElement
.
value
.
id
,
bpmnInstances
().
modeler
)
// 获取元素扩展属性 或者 创建扩展属性
elExtensionElements
.
value
=
bpmnElement
.
value
.
businessObject
?.
extensionElements
??
bpmnInstances
().
moddle
.
create
(
'bpmn:ExtensionElements'
,
{
values
:
[]
})
// 审批人与提交人为同一人时
assignStartUserHandlerTypeEl
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:AssignStartUserHandlerType`
)?.[
0
]
||
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:AssignStartUserHandlerType`
,
{
value
:
1
})
assignStartUserHandlerType
.
value
=
assignStartUserHandlerTypeEl
.
value
.
value
// 审批人拒绝时
rejectHandlerTypeEl
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:RejectHandlerType`
)?.[
0
]
||
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:RejectHandlerType`
,
{
value
:
1
})
rejectHandlerType
.
value
=
rejectHandlerTypeEl
.
value
.
value
returnNodeIdEl
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:RejectReturnTaskId`
)?.[
0
]
||
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:RejectReturnTaskId`
,
{
value
:
''
})
returnNodeId
.
value
=
returnNodeIdEl
.
value
.
value
// 保留剩余扩展元素,便于后面更新该元素对应属性
otherExtensions
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
!==
`
${
prefix
}
:AssignStartUserHandlerType`
(
ex
)
=>
ex
.
$type
!==
`
${
prefix
}
:AssignStartUserHandlerType`
&&
ex
.
$type
!==
`
${
prefix
}
:RejectHandlerType`
&&
ex
.
$type
!==
`
${
prefix
}
:RejectReturnTaskId`
)
??
[]
// 更新元素扩展属性,避免后续报错
...
...
@@ -61,9 +126,29 @@ const updateAssignStartUserHandlerType = () => {
updateElementExtensions
()
}
const
updateRejectHandlerType
=
()
=>
{
rejectHandlerTypeEl
.
value
.
value
=
rejectHandlerType
.
value
returnNodeId
.
value
=
returnTaskList
.
value
[
0
].
id
returnNodeIdEl
.
value
.
value
=
returnNodeId
.
value
updateElementExtensions
()
}
const
updateReturnNodeId
=
()
=>
{
returnNodeIdEl
.
value
.
value
=
returnNodeId
.
value
updateElementExtensions
()
}
const
updateElementExtensions
=
()
=>
{
const
extensions
=
bpmnInstances
().
moddle
.
create
(
'bpmn:ExtensionElements'
,
{
values
:
otherExtensions
.
value
.
concat
([
assignStartUserHandlerTypeEl
.
value
])
values
:
[
...
otherExtensions
.
value
,
assignStartUserHandlerTypeEl
.
value
,
rejectHandlerTypeEl
.
value
,
returnNodeIdEl
.
value
,
]
})
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
extensionElements
:
extensions
...
...
@@ -76,9 +161,43 @@ watch(
val
&&
val
.
length
&&
nextTick
(()
=>
{
reset
Attributes
List
()
reset
CustomConfig
List
()
})
},
{
immediate
:
true
}
)
function
findAllPredecessorsExcludingStart
(
elementId
,
modeler
)
{
const
elementRegistry
=
modeler
.
get
(
'elementRegistry'
)
const
allConnections
=
elementRegistry
.
filter
((
element
)
=>
element
.
type
===
'bpmn:SequenceFlow'
)
const
predecessors
=
new
Set
()
// 使用 Set 来避免重复节点
// 检查是否是开始事件节点
function
isStartEvent
(
element
)
{
return
element
.
type
===
'bpmn:StartEvent'
}
function
findPredecessorsRecursively
(
element
)
{
// 获取与当前节点相连的所有连接
const
incomingConnections
=
allConnections
.
filter
((
connection
)
=>
connection
.
target
===
element
)
incomingConnections
.
forEach
((
connection
)
=>
{
const
source
=
connection
.
source
// 获取前置节点
// 只添加不是开始事件的前置节点
if
(
!
isStartEvent
(
source
))
{
predecessors
.
add
(
source
.
businessObject
)
// 递归查找前置节点
findPredecessorsRecursively
(
source
)
}
})
}
const
targetElement
=
elementRegistry
.
get
(
elementId
)
if
(
targetElement
)
{
findPredecessorsRecursively
(
targetElement
)
}
return
Array
.
from
(
predecessors
)
// 返回前置节点数组
}
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment