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
Unverified
Commit
4835316f
authored
Dec 07, 2024
by
芋道源码
Committed by
Gitee
Dec 07, 2024
Browse files
Options
Browse Files
Download
Plain Diff
!610 bpmn设计器适配simple设计器
Merge pull request !610 from Lesan/feature/bpm
parents
9bdafb0f
e8315e28
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
241 additions
and
13 deletions
+241
-13
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+56
-0
src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
+1
-1
src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTask.vue
+8
-7
src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue
+126
-4
src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
+50
-1
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
View file @
4835316f
...
...
@@ -1357,6 +1357,62 @@
"isBody"
:
true
}
]
},
{
"name"
:
"ApproveType"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"Integer"
,
"isBody"
:
true
}
]
},
{
"name"
:
"ApproveMethod"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"Integer"
,
"isBody"
:
true
}
]
},
{
"name"
:
"CandidateStrategy"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"Integer"
,
"isBody"
:
true
}
]
},
{
"name"
:
"CandidateParam"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"value"
,
"type"
:
"String"
,
"isBody"
:
true
}
]
}
],
"emumerations"
:
[]
...
...
src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
View file @
4835316f
...
...
@@ -36,7 +36,7 @@
key=
"multiInstance"
>
<
template
#
title
><Icon
icon=
"ep:help-filled"
/>
多实例(会签配置)
</
template
>
<element-multi-instance
:business-object=
"elementBusinessObject"
:type=
"elementType"
/>
<element-multi-instance
:
id=
"elementId"
:
business-object=
"elementBusinessObject"
:type=
"elementType"
/>
</el-collapse-item>
<el-collapse-item
name=
"listeners"
key=
"listeners"
>
<
template
#
title
><Icon
icon=
"ep:bell-filled"
/>
执行监听器
</
template
>
...
...
src/components/bpmnProcessDesigner/package/penal/custom-config/components/UserTask.vue
View file @
4835316f
...
...
@@ -193,7 +193,7 @@ const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayName
useButtonsSetting
()
// 字段权限
const
fieldsPermissionEl
=
ref
()
const
fieldsPermissionEl
=
ref
(
[]
)
const
{
formType
,
fieldsPermissionConfig
,
getNodeConfigFormFields
}
=
useFormFieldsPermission
(
FieldPermissionType
.
READ
)
...
...
@@ -246,7 +246,7 @@ const resetCustomConfigList = () => {
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:AssignEmptyUserIds`
)?.[
0
]
||
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:AssignEmptyUserIds`
,
{
value
:
''
})
assignEmptyUserIds
.
value
=
assignEmptyUserIdsEl
.
value
.
value
.
split
(
','
).
map
((
item
)
=>
{
assignEmptyUserIds
.
value
=
assignEmptyUserIdsEl
.
value
.
value
?
.
split
(
','
).
map
((
item
)
=>
{
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
let
num
=
Number
(
item
)
return
num
>
Number
.
MAX_SAFE_INTEGER
||
num
<
-
Number
.
MAX_SAFE_INTEGER
?
item
:
num
...
...
@@ -270,18 +270,19 @@ const resetCustomConfigList = () => {
// 字段权限
if
(
formType
.
value
===
10
)
{
fieldsPermissionEl
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
const
fieldsPermissionList
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:FieldsPermission`
)
if
(
fieldsPermissionEl
.
value
.
length
===
0
)
{
fieldsPermissionEl
.
value
=
[]
getNodeConfigFormFields
()
fieldsPermissionConfig
.
value
.
forEach
((
el
)
=>
{
fieldsPermissionConfig
.
value
.
forEach
((
element
)
=>
{
element
.
permission
=
fieldsPermissionList
?.
find
((
obj
)
=>
obj
.
field
===
element
.
field
)?.
permission
??
'1'
fieldsPermissionEl
.
value
.
push
(
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:FieldsPermission`
,
el
)
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:FieldsPermission`
,
element
)
)
})
}
}
// 保留剩余扩展元素,便于后面更新该元素对应属性
otherExtensions
.
value
=
...
...
src/components/bpmnProcessDesigner/package/penal/multi-instance/ElementMultiInstance.vue
View file @
4835316f
<
template
>
<div
class=
"panel-tab__content"
>
<el-form
label-width=
"90px"
>
<el-radio-group
v-model=
"approveMethod"
@
change=
"onApproveMethodChange"
>
<div
class=
"flex-col"
>
<div
v-for=
"(item, index) in APPROVE_METHODS"
:key=
"index"
>
<el-radio
:value=
"item.value"
:label=
"item.value"
>
{{
item
.
label
}}
</el-radio>
<el-form-item
prop=
"approveRatio"
>
<el-input-number
v-model=
"approveRatio"
:min=
"10"
:max=
"100"
:step=
"10"
size=
"small"
v-if=
"
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
"
@
change=
"onApproveRatioChange"
/>
</el-form-item>
</div>
</div>
</el-radio-group>
<!-- 与Simple设计器配置合并,保留以前的代码 -->
<el-form
label-width=
"90px"
style=
"display: none"
>
<el-form-item
label=
"快捷配置"
>
<el-button
size=
"small"
@
click=
"changeConfig('依次审批')"
>
依次审批
</el-button>
<el-button
size=
"small"
@
click=
"changeConfig('会签')"
>
会签
</el-button>
...
...
@@ -76,11 +100,14 @@
</template>
<
script
lang=
"ts"
setup
>
import
{
ApproveMethodType
,
APPROVE_METHODS
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
defineOptions
({
name
:
'ElementMultiInstance'
})
const
props
=
defineProps
({
businessObject
:
Object
,
type
:
String
type
:
String
,
id
:
String
})
const
prefix
=
inject
(
'prefix'
)
const
loopCharacteristics
=
ref
(
''
)
...
...
@@ -267,16 +294,111 @@ const changeConfig = (config) => {
}
}
/**
* -----新版本多实例-----
*/
const
approveMethod
=
ref
()
const
approveRatio
=
ref
(
100
)
const
otherExtensions
=
ref
()
const
getElementLoopNew
=
()
=>
{
const
extensionElements
=
bpmnElement
.
value
.
businessObject
?.
extensionElements
??
[]
approveMethod
.
value
=
extensionElements
.
values
.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:ApproveMethod`
)?.[
0
]?.
value
otherExtensions
.
value
=
extensionElements
.
values
.
filter
((
ex
)
=>
ex
.
$type
!==
`
${
prefix
}
:ApproveMethod`
)
??
[]
}
const
onApproveMethodChange
=
()
=>
{
approveRatio
.
value
=
100
updateLoopCharacteristics
()
}
const
onApproveRatioChange
=
()
=>
{
updateLoopCharacteristics
()
}
const
updateLoopCharacteristics
=
()
=>
{
// 根据ApproveMethod生成multiInstanceLoopCharacteristics节点
if
(
approveMethod
.
value
===
ApproveMethodType
.
RANDOM_SELECT_ONE_APPROVE
)
{
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
loopCharacteristics
:
null
})
}
else
{
if
(
approveMethod
.
value
===
ApproveMethodType
.
APPROVE_BY_RATIO
)
{
multiLoopInstance
.
value
=
bpmnInstances
().
moddle
.
create
(
'bpmn:MultiInstanceLoopCharacteristics'
,
{
isSequential
:
false
,
collection
:
'${coll_userList}'
}
)
multiLoopInstance
.
value
.
completionCondition
=
bpmnInstances
().
moddle
.
create
(
'bpmn:FormalExpression'
,
{
body
:
'${ nrOfCompletedInstances/nrOfInstances >= '
+
approveRatio
.
value
/
100
+
'}'
}
)
}
if
(
approveMethod
.
value
===
ApproveMethodType
.
ANY_APPROVE
)
{
multiLoopInstance
.
value
=
bpmnInstances
().
moddle
.
create
(
'bpmn:MultiInstanceLoopCharacteristics'
,
{
isSequential
:
false
,
collection
:
'${coll_userList}'
}
)
multiLoopInstance
.
value
.
completionCondition
=
bpmnInstances
().
moddle
.
create
(
'bpmn:FormalExpression'
,
{
body
:
'${ nrOfCompletedInstances > 0 }'
}
)
}
if
(
approveMethod
.
value
===
ApproveMethodType
.
SEQUENTIAL_APPROVE
)
{
multiLoopInstance
.
value
=
bpmnInstances
().
moddle
.
create
(
'bpmn:MultiInstanceLoopCharacteristics'
,
{
isSequential
:
true
,
collection
:
'${coll_userList}'
}
)
multiLoopInstance
.
value
.
loopCardinality
=
bpmnInstances
().
moddle
.
create
(
'bpmn:FormalExpression'
,
{
body
:
'1'
}
)
multiLoopInstance
.
value
.
completionCondition
=
bpmnInstances
().
moddle
.
create
(
'bpmn:FormalExpression'
,
{
body
:
'${ nrOfCompletedInstances >= nrOfInstances }'
}
)
}
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
loopCharacteristics
:
toRaw
(
multiLoopInstance
.
value
)
})
}
// 添加ApproveMethod到ExtensionElements
const
extensions
=
bpmnInstances
().
moddle
.
create
(
'bpmn:ExtensionElements'
,
{
values
:
[
...
otherExtensions
.
value
,
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:ApproveMethod`
,
{
value
:
approveMethod
.
value
})
]
})
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
extensionElements
:
extensions
})
}
onBeforeUnmount
(()
=>
{
multiLoopInstance
.
value
=
null
bpmnElement
.
value
=
null
})
watch
(
()
=>
props
.
businessObject
,
()
=>
props
.
id
,
(
val
)
=>
{
if
(
val
)
{
nextTick
(()
=>
{
bpmnElement
.
value
=
bpmnInstances
().
bpmnElement
getElementLoop
(
val
)
// getElementLoop(val)
getElementLoopNew
()
})
}
},
{
immediate
:
true
}
)
...
...
src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
View file @
4835316f
...
...
@@ -142,6 +142,7 @@ const props = defineProps({
id
:
String
,
type
:
String
})
const
prefix
=
inject
(
'prefix'
)
const
userTaskForm
=
ref
({
candidateStrategy
:
undefined
,
// 分配规则
candidateParam
:
[]
// 分配选项
...
...
@@ -154,12 +155,43 @@ const deptTreeOptions = ref() // 部门树
const
postOptions
=
ref
<
PostApi
.
PostVO
[]
>
([])
// 岗位列表
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
const
userGroupOptions
=
ref
<
UserGroupApi
.
UserGroupVO
[]
>
([])
// 用户组列表
const
otherExtensions
=
ref
()
const
resetTaskForm
=
()
=>
{
const
businessObject
=
bpmnElement
.
value
.
businessObject
if
(
!
businessObject
)
{
return
}
const
extensionElements
=
businessObject
?.
extensionElements
??
[]
userTaskForm
.
value
.
candidateStrategy
=
extensionElements
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:CandidateStrategy`
)?.[
0
]?.
value
const
candidateParamStr
=
extensionElements
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:CandidateParam`
)?.[
0
]?.
value
if
(
candidateParamStr
&&
candidateParamStr
.
length
>
0
)
{
if
(
userTaskForm
.
value
.
candidateStrategy
===
60
)
{
// 特殊:流程表达式,只有一个 input 输入框
userTaskForm
.
value
.
candidateParam
=
[
candidateParamStr
]
}
else
{
userTaskForm
.
value
.
candidateParam
=
candidateParamStr
.
split
(
','
).
map
((
item
)
=>
{
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
let
num
=
Number
(
item
)
return
num
>
Number
.
MAX_SAFE_INTEGER
||
num
<
-
Number
.
MAX_SAFE_INTEGER
?
item
:
num
})
}
}
else
{
userTaskForm
.
value
.
candidateParam
=
[]
}
otherExtensions
.
value
=
extensionElements
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
!==
`
${
prefix
}
:CandidateStrategy`
&&
ex
.
$type
!==
`
${
prefix
}
:CandidateParam`
)
??
[]
// 改用通过extensionElements来存储数据
return
if
(
businessObject
.
candidateStrategy
!=
undefined
)
{
userTaskForm
.
value
.
candidateStrategy
=
parseInt
(
businessObject
.
candidateStrategy
)
as
any
}
else
{
...
...
@@ -172,7 +204,7 @@ const resetTaskForm = () => {
}
else
{
userTaskForm
.
value
.
candidateParam
=
businessObject
.
candidateParam
.
split
(
','
)
.
map
((
item
)
=>
+
item
)
.
map
((
item
)
=>
item
)
}
}
else
{
userTaskForm
.
value
.
candidateParam
=
[]
...
...
@@ -187,6 +219,23 @@ const changeCandidateStrategy = () => {
/** 选中某个 options 时候,更新 bpmn 图 */
const
updateElementTask
=
()
=>
{
const
extensions
=
bpmnInstances
().
moddle
.
create
(
'bpmn:ExtensionElements'
,
{
values
:
[
...
otherExtensions
.
value
,
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:CandidateStrategy`
,
{
value
:
userTaskForm
.
value
.
candidateStrategy
}),
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:CandidateParam`
,
{
value
:
userTaskForm
.
value
.
candidateParam
.
join
(
','
)
})
]
})
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
extensionElements
:
extensions
})
// 改用通过extensionElements来存储数据
return
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
candidateStrategy
:
userTaskForm
.
value
.
candidateStrategy
,
candidateParam
:
userTaskForm
.
value
.
candidateParam
.
join
(
','
)
...
...
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