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