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
5f7ccd4e
authored
Mar 15, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BPM:重构流程分配人的实现,通过 BpmTaskCandidateStrategy 策略模式
parent
960f27f6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
62 deletions
+56
-62
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/activitiDescriptor.json
+2
-2
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/camundaDescriptor.json
+2
-2
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+2
-2
src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
+48
-53
src/utils/dict.ts
+1
-2
src/views/bpm/processInstance/detail/TaskCCDialogForm.vue
+1
-1
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/activitiDescriptor.json
View file @
5f7ccd4e
...
...
@@ -334,12 +334,12 @@
"type"
:
"String"
},
{
"name"
:
"
assignType
"
,
"name"
:
"
candidateStrategy
"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"
assignOptions
"
,
"name"
:
"
candidateParam
"
,
"isAttr"
:
true
,
"type"
:
"String"
}
...
...
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/camundaDescriptor.json
View file @
5f7ccd4e
...
...
@@ -321,12 +321,12 @@
"type"
:
"String"
},
{
"name"
:
"
assignType
"
,
"name"
:
"
candidateStrategy
"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"
assignOptions
"
,
"name"
:
"
candidateParam
"
,
"isAttr"
:
true
,
"type"
:
"String"
}
...
...
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
View file @
5f7ccd4e
...
...
@@ -321,12 +321,12 @@
"type"
:
"String"
},
{
"name"
:
"
assignType
"
,
"name"
:
"
candidateStrategy
"
,
"isAttr"
:
true
,
"type"
:
"String"
},
{
"name"
:
"
assignOptions
"
,
"name"
:
"
candidateParam
"
,
"isAttr"
:
true
,
"type"
:
"String"
}
...
...
src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
View file @
5f7ccd4e
<
template
>
<el-form
label-width=
"100px"
>
<el-form-item
label=
"规则类型"
prop=
"
assignType
"
>
<el-form-item
label=
"规则类型"
prop=
"
candidateStrategy
"
>
<el-select
v-model=
"userTaskForm.
assignType
"
v-model=
"userTaskForm.
candidateStrategy
"
clearable
style=
"width: 100%"
@
change=
"change
AssignType
"
@
change=
"change
candidateStrategy
"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_TASK_
ASSIGN_RULE_TYPE
)"
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_TASK_
CANDIDATE_STRATEGY
)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.assignType == 10"
label=
"指定角色"
prop=
"assignOptions"
>
<el-form-item
v-if=
"userTaskForm.candidateStrategy == 10"
label=
"指定角色"
prop=
"candidateParam"
>
<el-select
v-model=
"userTaskForm.
assignOptions
"
v-model=
"userTaskForm.
candidateParam
"
clearable
multiple
style=
"width: 100%"
...
...
@@ -27,14 +31,14 @@
</el-select>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.
assignType == 20 || userTaskForm.assignType
== 21"
v-if=
"userTaskForm.
candidateStrategy == 20 || userTaskForm.candidateStrategy
== 21"
label=
"指定部门"
prop=
"
assignOptions
"
prop=
"
candidateParam
"
span=
"24"
>
<el-tree-select
ref=
"treeRef"
v-model=
"userTaskForm.
assignOptions
"
v-model=
"userTaskForm.
candidateParam
"
:data=
"deptTreeOptions"
:props=
"defaultProps"
empty-text=
"加载中,请稍后"
...
...
@@ -45,13 +49,13 @@
/>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.
assignType
== 22"
v-if=
"userTaskForm.
candidateStrategy
== 22"
label=
"指定岗位"
prop=
"
assignOptions
"
prop=
"
candidateParam
"
span=
"24"
>
<el-select
v-model=
"userTaskForm.
assignOptions
"
v-model=
"userTaskForm.
candidateParam
"
clearable
multiple
style=
"width: 100%"
...
...
@@ -62,16 +66,16 @@
</el-form-item>
<el-form-item
v-if=
"
userTaskForm.
assignType
== 30 ||
userTaskForm.
assignType
== 31 ||
userTaskForm.
assignType
== 32
userTaskForm.
candidateStrategy
== 30 ||
userTaskForm.
candidateStrategy
== 31 ||
userTaskForm.
candidateStrategy
== 32
"
label=
"指定用户"
prop=
"
assignOptions
"
prop=
"
candidateParam
"
span=
"24"
>
<el-select
v-model=
"userTaskForm.
assignOptions
"
v-model=
"userTaskForm.
candidateParam
"
clearable
multiple
style=
"width: 100%"
...
...
@@ -85,9 +89,13 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.assignType === 40"
label=
"指定用户组"
prop=
"assignOptions"
>
<el-form-item
v-if=
"userTaskForm.candidateStrategy === 40"
label=
"指定用户组"
prop=
"candidateParam"
>
<el-select
v-model=
"userTaskForm.
assignOptions
"
v-model=
"userTaskForm.
candidateParam
"
clearable
multiple
style=
"width: 100%"
...
...
@@ -101,26 +109,14 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.assignType === 50"
label=
"指定脚本"
prop=
"assignOptions"
>
<el-select
v-model=
"userTaskForm.assignOptions"
clearable
multiple
style=
"width: 100%"
@
change=
"updateElementTask"
<el-form-item
v-if=
"userTaskForm.candidateStrategy === 60"
label=
"流程表达式"
prop=
"candidateParam"
>
<el-option
v-for=
"dict in taskAssignScriptDictDatas"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"userTaskForm.assignType === 60"
label=
"流程表达式"
prop=
"assignOptions"
>
<el-input
type=
"textarea"
v-model=
"userTaskForm.
assignOptions
[0]"
v-model=
"userTaskForm.
candidateParam
[0]"
clearable
style=
"width: 100%"
@
change=
"updateElementTask"
...
...
@@ -144,10 +140,9 @@ const props = defineProps({
type
:
String
})
const
userTaskForm
=
ref
({
assignType
:
undefined
,
// 分配规则
assignOptions
:
[]
// 分配选项
candidateStrategy
:
undefined
,
// 分配规则
candidateParam
:
[]
// 分配选项
})
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
const
bpmnElement
=
ref
()
const
bpmnInstances
=
()
=>
(
window
as
any
)?.
bpmnInstances
...
...
@@ -156,42 +151,42 @@ const deptTreeOptions = ref() // 部门树
const
postOptions
=
ref
<
PostApi
.
PostVO
[]
>
([])
// 岗位列表
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
const
userGroupOptions
=
ref
<
UserGroupApi
.
UserGroupVO
[]
>
([])
// 用户组列表
const
taskAssignScriptDictDatas
=
getIntDictOptions
(
DICT_TYPE
.
BPM_TASK_ASSIGN_SCRIPT
)
const
resetTaskForm
=
()
=>
{
const
businessObject
=
bpmnElement
.
value
.
businessObject
if
(
!
businessObject
)
{
return
}
if
(
businessObject
.
assignType
!=
undefined
)
{
userTaskForm
.
value
.
assignType
=
parseInt
(
businessObject
.
assignType
)
as
any
if
(
businessObject
.
candidateStrategy
!=
undefined
)
{
userTaskForm
.
value
.
candidateStrategy
=
parseInt
(
businessObject
.
candidateStrategy
)
as
any
}
else
{
userTaskForm
.
value
.
assignType
=
undefined
userTaskForm
.
value
.
candidateStrategy
=
undefined
}
if
(
businessObject
.
assignOptions
&&
businessObject
.
assignOptions
.
length
>
0
)
{
if
(
userTaskForm
.
value
.
assignType
===
60
)
{
userTaskForm
.
value
.
assignOptions
=
[
businessObject
.
assignOptions
]
if
(
businessObject
.
candidateParam
&&
businessObject
.
candidateParam
.
length
>
0
)
{
if
(
userTaskForm
.
value
.
candidateStrategy
===
60
)
{
// 特殊:流程表达式,只有一个 input 输入框
userTaskForm
.
value
.
candidateParam
=
[
businessObject
.
candidateParam
]
}
else
{
userTaskForm
.
value
.
assignOptions
=
businessObject
.
assignOptions
userTaskForm
.
value
.
candidateParam
=
businessObject
.
candidateParam
.
split
(
','
)
.
map
((
item
)
=>
+
item
)
}
}
else
{
userTaskForm
.
value
.
assignOptions
=
[]
userTaskForm
.
value
.
candidateParam
=
[]
}
}
/** 更新
assignType 字段时,需要清空 assignOptions
,并触发 bpmn 图更新 */
const
change
AssignType
=
()
=>
{
userTaskForm
.
value
.
assignOptions
=
[]
/** 更新
candidateStrategy 字段时,需要清空 candidateParam
,并触发 bpmn 图更新 */
const
change
candidateStrategy
=
()
=>
{
userTaskForm
.
value
.
candidateParam
=
[]
updateElementTask
()
}
/** 选中某个 options 时候,更新 bpmn 图 */
const
updateElementTask
=
()
=>
{
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
assignType
:
userTaskForm
.
value
.
assignType
,
assignOptions
:
userTaskForm
.
value
.
assignOptions
.
join
(
','
)
candidateStrategy
:
userTaskForm
.
value
.
candidateStrategy
,
candidateParam
:
userTaskForm
.
value
.
candidateParam
.
join
(
','
)
})
}
...
...
src/utils/dict.ts
View file @
5f7ccd4e
...
...
@@ -138,10 +138,9 @@ export enum DICT_TYPE {
// ========== BPM 模块 ==========
BPM_MODEL_CATEGORY
=
'bpm_model_category'
,
BPM_MODEL_FORM_TYPE
=
'bpm_model_form_type'
,
BPM_TASK_
ASSIGN_RULE_TYPE
=
'bpm_task_assign_rule_type
'
,
BPM_TASK_
CANDIDATE_STRATEGY
=
'bpm_task_candidate_strategy
'
,
BPM_PROCESS_INSTANCE_STATUS
=
'bpm_process_instance_status'
,
BPM_PROCESS_INSTANCE_RESULT
=
'bpm_process_instance_result'
,
BPM_TASK_ASSIGN_SCRIPT
=
'bpm_task_assign_script'
,
BPM_OA_LEAVE_TYPE
=
'bpm_oa_leave_type'
,
// ========== PAY 模块 ==========
...
...
src/views/bpm/processInstance/detail/TaskCCDialogForm.vue
View file @
5f7ccd4e
...
...
@@ -17,7 +17,7 @@
<el-form-item
label=
"规则类型"
prop=
"type"
>
<el-select
v-model=
"formData.type"
clearable
style=
"width: 100%"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_TASK_
ASSIGN_RULE_TYPE
)"
v-for=
"dict in getIntDictOptions(DICT_TYPE.BPM_TASK_
CANDIDATE_STRATEGY
)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
...
...
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