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
0ab7f234
authored
Dec 12, 2024
by
芋道源码
Committed by
Gitee
Dec 12, 2024
Browse files
Options
Browse Files
Download
Plain Diff
!616 bpmn设计器优化(添加CallActivity配置支持)
Merge pull request !616 from Lesan/feature/bpm
parents
d76df547
a389392c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
322 additions
and
5 deletions
+322
-5
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+25
-0
src/components/bpmnProcessDesigner/package/designer/plugins/palette/CustomPalette.js
+6
-0
src/components/bpmnProcessDesigner/package/designer/plugins/translate/zh.js
+1
-0
src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue
+1
-1
src/components/bpmnProcessDesigner/package/penal/task/data.ts
+9
-4
src/components/bpmnProcessDesigner/package/penal/task/task-components/CallActivity.vue
+280
-0
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
View file @
0ab7f234
...
@@ -406,6 +406,31 @@
...
@@ -406,6 +406,31 @@
"name"
:
"variableMappingDelegateExpression"
,
"name"
:
"variableMappingDelegateExpression"
,
"isAttr"
:
true
,
"isAttr"
:
true
,
"type"
:
"String"
"type"
:
"String"
},
{
"name"
:
"calledElementType"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"processInstanceName"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"inheritBusinessKey"
,
"isAttr"
:
true
,
"type"
:
"Boolean"
},
{
"name"
:
"businessKey"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"inheritVariables"
,
"isAttr"
:
true
,
"type"
:
"Boolean"
}
}
]
]
},
},
...
...
src/components/bpmnProcessDesigner/package/designer/plugins/palette/CustomPalette.js
View file @
0ab7f234
...
@@ -165,6 +165,12 @@ F.prototype.getPaletteEntries = function () {
...
@@ -165,6 +165,12 @@ F.prototype.getPaletteEntries = function () {
'bpmn-icon-user-task'
,
'bpmn-icon-user-task'
,
translate
(
'Create User Task'
)
translate
(
'Create User Task'
)
),
),
'create.call-activity'
:
createAction
(
'bpmn:CallActivity'
,
'activity'
,
'bpmn-icon-call-activity'
,
translate
(
'Create Call Activity'
)
),
'create.service-task'
:
createAction
(
'create.service-task'
:
createAction
(
'bpmn:ServiceTask'
,
'bpmn:ServiceTask'
,
'activity'
,
'activity'
,
...
...
src/components/bpmnProcessDesigner/package/designer/plugins/translate/zh.js
View file @
0ab7f234
...
@@ -56,6 +56,7 @@ export default {
...
@@ -56,6 +56,7 @@ export default {
'Create EndEvent'
:
'创建结束事件'
,
'Create EndEvent'
:
'创建结束事件'
,
'Create Task'
:
'创建任务'
,
'Create Task'
:
'创建任务'
,
'Create User Task'
:
'创建用户任务'
,
'Create User Task'
:
'创建用户任务'
,
'Create Call Activity'
:
'创建调用活动'
,
'Create Service Task'
:
'创建服务任务'
,
'Create Service Task'
:
'创建服务任务'
,
'Create Gateway'
:
'创建网关'
,
'Create Gateway'
:
'创建网关'
,
'Create DataObjectReference'
:
'创建数据对象'
,
'Create DataObjectReference'
:
'创建数据对象'
,
...
...
src/components/bpmnProcessDesigner/package/penal/task/ElementTask.vue
View file @
0ab7f234
...
@@ -70,7 +70,7 @@ watch(
...
@@ -70,7 +70,7 @@ watch(
()
=>
props
.
type
,
()
=>
props
.
type
,
()
=>
{
()
=>
{
if
(
props
.
type
)
{
if
(
props
.
type
)
{
witchTaskComponent
.
value
=
installedComponent
[
props
.
type
].
componet
witchTaskComponent
.
value
=
installedComponent
[
props
.
type
].
compone
n
t
}
}
},
},
{
immediate
:
true
}
{
immediate
:
true
}
...
...
src/components/bpmnProcessDesigner/package/penal/task/data.ts
View file @
0ab7f234
...
@@ -2,23 +2,28 @@ import UserTask from './task-components/UserTask.vue'
...
@@ -2,23 +2,28 @@ import UserTask from './task-components/UserTask.vue'
import
ServiceTask
from
'./task-components/ServiceTask.vue'
import
ServiceTask
from
'./task-components/ServiceTask.vue'
import
ScriptTask
from
'./task-components/ScriptTask.vue'
import
ScriptTask
from
'./task-components/ScriptTask.vue'
import
ReceiveTask
from
'./task-components/ReceiveTask.vue'
import
ReceiveTask
from
'./task-components/ReceiveTask.vue'
import
CallActivity
from
'./task-components/CallActivity.vue'
export
const
installedComponent
=
{
export
const
installedComponent
=
{
UserTask
:
{
UserTask
:
{
name
:
'用户任务'
,
name
:
'用户任务'
,
componet
:
UserTask
compone
n
t
:
UserTask
},
},
ServiceTask
:
{
ServiceTask
:
{
name
:
'服务任务'
,
name
:
'服务任务'
,
componet
:
ServiceTask
compone
n
t
:
ServiceTask
},
},
ScriptTask
:
{
ScriptTask
:
{
name
:
'脚本任务'
,
name
:
'脚本任务'
,
componet
:
ScriptTask
compone
n
t
:
ScriptTask
},
},
ReceiveTask
:
{
ReceiveTask
:
{
name
:
'接收任务'
,
name
:
'接收任务'
,
componet
:
ReceiveTask
component
:
ReceiveTask
},
CallActivity
:
{
name
:
'调用活动'
,
component
:
CallActivity
}
}
}
}
...
...
src/components/bpmnProcessDesigner/package/penal/task/task-components/CallActivity.vue
0 → 100644
View file @
0ab7f234
<
template
>
<div>
<el-form
label-width=
"100px"
>
<el-form-item
label=
"实例名称"
prop=
"processInstanceName"
>
<el-input
v-model=
"formData.processInstanceName"
clearable
placeholder=
"请输入实例名称"
@
change=
"updateCallActivityAttr('processInstanceName')"
/>
</el-form-item>
<!-- TODO 需要可选择已存在的流程 -->
<el-form-item
label=
"被调用流程"
prop=
"calledElement"
>
<el-input
v-model=
"formData.calledElement"
clearable
placeholder=
"请输入被调用流程"
@
change=
"updateCallActivityAttr('calledElement')"
/>
</el-form-item>
<el-form-item
label=
"继承变量"
prop=
"inheritVariables"
>
<el-switch
v-model=
"formData.inheritVariables"
@
change=
"updateCallActivityAttr('inheritVariables')"
/>
</el-form-item>
<el-form-item
label=
"继承业务键"
prop=
"inheritBusinessKey"
>
<el-switch
v-model=
"formData.inheritBusinessKey"
@
change=
"updateCallActivityAttr('inheritBusinessKey')"
/>
</el-form-item>
<el-form-item
v-if=
"!formData.inheritBusinessKey"
label=
"业务键表达式"
prop=
"businessKey"
>
<el-input
v-model=
"formData.businessKey"
clearable
placeholder=
"请输入业务键表达式"
@
change=
"updateCallActivityAttr('businessKey')"
/>
</el-form-item>
<el-divider
/>
<div>
<div
class=
"flex mb-10px"
>
<el-text>
输入参数
</el-text>
<XButton
class=
"ml-auto"
type=
"primary"
preIcon=
"ep:plus"
title=
"添加参数"
size=
"small"
@
click=
"openVariableForm('in', null, -1)"
/>
</div>
<el-table
:data=
"inVariableList"
max-height=
"240"
fit
border
>
<el-table-column
label=
"源"
prop=
"source"
min-width=
"100px"
show-overflow-tooltip
/>
<el-table-column
label=
"目标"
prop=
"target"
min-width=
"100px"
show-overflow-tooltip
/>
<el-table-column
label=
"操作"
width=
"110px"
>
<template
#
default=
"scope"
>
<el-button
link
@
click=
"openVariableForm('in', scope.row, scope.$index)"
size=
"small"
>
编辑
</el-button>
<el-divider
direction=
"vertical"
/>
<el-button
link
size=
"small"
style=
"color: #ff4d4f"
@
click=
"removeVariable('in', scope.$index)"
>
移除
</el-button>
</
template
>
</el-table-column>
</el-table>
</div>
<el-divider
/>
<div>
<div
class=
"flex mb-10px"
>
<el-text>
输出参数
</el-text>
<XButton
class=
"ml-auto"
type=
"primary"
preIcon=
"ep:plus"
title=
"添加参数"
size=
"small"
@
click=
"openVariableForm('out', null, -1)"
/>
</div>
<el-table
:data=
"outVariableList"
max-height=
"240"
fit
border
>
<el-table-column
label=
"源"
prop=
"source"
min-width=
"100px"
show-overflow-tooltip
/>
<el-table-column
label=
"目标"
prop=
"target"
min-width=
"100px"
show-overflow-tooltip
/>
<el-table-column
label=
"操作"
width=
"110px"
>
<
template
#
default=
"scope"
>
<el-button
link
@
click=
"openVariableForm('out', scope.row, scope.$index)"
size=
"small"
>
编辑
</el-button>
<el-divider
direction=
"vertical"
/>
<el-button
link
size=
"small"
style=
"color: #ff4d4f"
@
click=
"removeVariable('out', scope.$index)"
>
移除
</el-button>
</
template
>
</el-table-column>
</el-table>
</div>
</el-form>
<!-- 添加或修改参数 -->
<el-dialog
v-model=
"variableDialogVisible"
title=
"参数配置"
width=
"600px"
append-to-body
destroy-on-close
>
<el-form
:model=
"varialbeFormData"
label-width=
"80px"
ref=
"varialbeFormRef"
>
<el-form-item
label=
"源:"
prop=
"source"
>
<el-input
v-model=
"varialbeFormData.source"
clearable
/>
</el-form-item>
<el-form-item
label=
"目标:"
prop=
"target"
>
<el-input
v-model=
"varialbeFormData.target"
clearable
/>
</el-form-item>
</el-form>
<
template
#
footer
>
<el-button
@
click=
"variableDialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"saveVariable"
>
确 定
</el-button>
</
template
>
</el-dialog>
</div>
</template>
<
script
lang=
"ts"
setup
>
defineOptions
({
name
:
'CallActivity'
})
const
props
=
defineProps
({
id
:
String
,
type
:
String
})
const
prefix
=
inject
(
'prefix'
)
const
message
=
useMessage
()
const
formData
=
ref
({
processInstanceName
:
''
,
calledElement
:
''
,
inheritVariables
:
false
,
businessKey
:
''
,
inheritBusinessKey
:
false
,
calledElementType
:
'key'
})
const
inVariableList
=
ref
()
const
outVariableList
=
ref
()
const
variableType
=
ref
()
// 参数类型
const
editingVariableIndex
=
ref
(
-
1
)
// 编辑参数下标
const
variableDialogVisible
=
ref
(
false
)
const
varialbeFormRef
=
ref
()
const
varialbeFormData
=
ref
({
source
:
''
,
target
:
''
})
const
bpmnInstances
=
()
=>
(
window
as
any
)?.
bpmnInstances
const
bpmnElement
=
ref
()
const
otherExtensionList
=
ref
()
const
initCallActivity
=
()
=>
{
bpmnElement
.
value
=
bpmnInstances
().
bpmnElement
console
.
log
(
bpmnElement
.
value
.
businessObject
,
'callActivity'
)
// 初始化所有配置项
Object
.
keys
(
formData
.
value
).
forEach
((
key
)
=>
{
formData
.
value
[
key
]
=
bpmnElement
.
value
.
businessObject
[
key
]
??
formData
.
value
[
key
]
})
otherExtensionList
.
value
=
[]
// 其他扩展配置
inVariableList
.
value
=
[]
outVariableList
.
value
=
[]
// 初始化输入参数
bpmnElement
.
value
.
businessObject
?.
extensionElements
?.
values
?.
forEach
((
ex
)
=>
{
if
(
ex
.
$type
===
`
${
prefix
}
:In`
)
{
inVariableList
.
value
.
push
(
ex
)
}
else
if
(
ex
.
$type
===
`
${
prefix
}
:Out`
)
{
outVariableList
.
value
.
push
(
ex
)
}
else
{
otherExtensionList
.
value
.
push
(
ex
)
}
})
// 默认添加
// bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
// calledElementType: 'key'
// })
}
const
updateCallActivityAttr
=
(
attr
)
=>
{
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
[
attr
]:
formData
.
value
[
attr
]
})
}
const
openVariableForm
=
(
type
,
data
,
index
)
=>
{
editingVariableIndex
.
value
=
index
variableType
.
value
=
type
varialbeFormData
.
value
=
index
===
-
1
?
{}
:
{
...
data
}
variableDialogVisible
.
value
=
true
}
const
removeVariable
=
async
(
type
,
index
)
=>
{
try
{
await
message
.
delConfirm
()
if
(
type
===
'in'
)
{
inVariableList
.
value
.
splice
(
index
,
1
)
}
if
(
type
===
'out'
)
{
outVariableList
.
value
.
splice
(
index
,
1
)
}
updateElementExtensions
()
}
catch
{}
}
const
saveVariable
=
()
=>
{
if
(
editingVariableIndex
.
value
===
-
1
)
{
if
(
variableType
.
value
===
'in'
)
{
inVariableList
.
value
.
push
(
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:In`
,
{
...
varialbeFormData
.
value
})
)
}
if
(
variableType
.
value
===
'out'
)
{
outVariableList
.
value
.
push
(
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:Out`
,
{
...
varialbeFormData
.
value
})
)
}
updateElementExtensions
()
}
else
{
if
(
variableType
.
value
===
'in'
)
{
inVariableList
.
value
[
editingVariableIndex
.
value
].
source
=
varialbeFormData
.
value
.
source
inVariableList
.
value
[
editingVariableIndex
.
value
].
target
=
varialbeFormData
.
value
.
target
}
if
(
variableType
.
value
===
'out'
)
{
outVariableList
.
value
[
editingVariableIndex
.
value
].
source
=
varialbeFormData
.
value
.
source
outVariableList
.
value
[
editingVariableIndex
.
value
].
target
=
varialbeFormData
.
value
.
target
}
}
variableDialogVisible
.
value
=
false
}
const
updateElementExtensions
=
()
=>
{
const
extensions
=
bpmnInstances
().
moddle
.
create
(
'bpmn:ExtensionElements'
,
{
values
:
[...
inVariableList
.
value
,
...
outVariableList
.
value
,
...
otherExtensionList
.
value
]
})
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
extensionElements
:
extensions
})
}
watch
(
()
=>
props
.
id
,
(
val
)
=>
{
val
&&
val
.
length
&&
nextTick
(()
=>
{
initCallActivity
()
})
},
{
immediate
:
true
}
)
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
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