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
88356c7b
authored
Jun 21, 2024
by
jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仿钉钉设计器- 节点增加校验逻辑
parent
ea1e51a6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
348 additions
and
202 deletions
+348
-202
src/components/SimpleProcessDesignerV2/src/NodeHandler.vue
+13
-9
src/components/SimpleProcessDesignerV2/src/consts.ts
+1
-1
src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue
+122
-77
src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue
+212
-115
No files found.
src/components/SimpleProcessDesignerV2/src/NodeHandler.vue
View file @
88356c7b
...
@@ -81,15 +81,16 @@ const addNode = (type: number) => {
...
@@ -81,15 +81,16 @@ const addNode = (type: number) => {
type
:
NodeType
.
USER_TASK_NODE
,
type
:
NodeType
.
USER_TASK_NODE
,
approveMethod
:
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
,
approveMethod
:
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
,
candidateStrategy
:
CandidateStrategy
.
USER
,
candidateStrategy
:
CandidateStrategy
.
USER
,
candidateParam
:
undefined
,
//
candidateParam: undefined,
fieldsPermission
:
undefined
,
//
fieldsPermission: undefined,
// 超时处理
// 超时处理
timeoutHandler
:
{
enable
:
false
},
rejectHandler
:
{
rejectHandler
:
{
type
:
RejectHandlerType
.
FINISH_PROCESS
type
:
RejectHandlerType
.
FINISH_PROCESS
},
},
timeoutHandler
:
{
enable
:
false
},
childNode
:
props
.
childNode
childNode
:
props
.
childNode
// 审批节点配置
// 审批节点配置
// attributes: {
// attributes: {
...
@@ -114,12 +115,15 @@ const addNode = (type: number) => {
...
@@ -114,12 +115,15 @@ const addNode = (type: number) => {
name
:
NODE_DEFAULT_NAME
.
get
(
NodeType
.
COPY_TASK_NODE
)
as
string
,
name
:
NODE_DEFAULT_NAME
.
get
(
NodeType
.
COPY_TASK_NODE
)
as
string
,
showText
:
''
,
showText
:
''
,
type
:
NodeType
.
COPY_TASK_NODE
,
type
:
NodeType
.
COPY_TASK_NODE
,
// 审批节点配置
attributes
:
{
candidateStrategy
:
CandidateStrategy
.
USER
,
candidateStrategy
:
CandidateStrategy
.
USER
,
candidateParam
:
undefined
,
candidateParam
:
undefined
,
fieldsPermission
:
undefined
fieldsPermission
:
undefined
,
},
// 审批节点配置
// attributes: {
// candidateStrategy: CandidateStrategy.USER,
// candidateParam: undefined,
// fieldsPermission: undefined
// },
childNode
:
props
.
childNode
childNode
:
props
.
childNode
}
}
emits
(
'update:childNode'
,
data
)
emits
(
'update:childNode'
,
data
)
...
...
src/components/SimpleProcessDesignerV2/src/consts.ts
View file @
88356c7b
...
@@ -181,7 +181,7 @@ export type SimpleFlowNode = {
...
@@ -181,7 +181,7 @@ export type SimpleFlowNode = {
// 多人审批方式
// 多人审批方式
approveMethod
?:
ApproveMethodType
approveMethod
?:
ApproveMethodType
//通过比例
//通过比例
approveRatio
:
number
approveRatio
?
:
number
// 表单权限
// 表单权限
fieldsPermission
?:
any
[]
fieldsPermission
?:
any
[]
// 审批任务超时处理
// 审批任务超时处理
...
...
src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue
View file @
88356c7b
...
@@ -17,18 +17,21 @@
...
@@ -17,18 +17,21 @@
v-model=
"currentNode.name"
v-model=
"currentNode.name"
:placeholder=
"currentNode.name"
:placeholder=
"currentNode.name"
/>
/>
<div
v-else
class=
"node-name"
>
{{
currentNode
.
name
}}
<Icon
class=
"ml-1"
icon=
"ep:edit-pen"
:size=
"16"
@
click=
"clickIcon()"
/></div>
<div
v-else
class=
"node-name"
>
{{
currentNode
.
name
}}
<Icon
class=
"ml-1"
icon=
"ep:edit-pen"
:size=
"16"
@
click=
"clickIcon()"
/></div>
<div
class=
"divide-line"
></div>
<div
class=
"divide-line"
></div>
</div>
</div>
</
template
>
</
template
>
<el-tabs
type=
"border-card"
>
<el-tabs
type=
"border-card"
v-model=
"activeTabName"
>
<el-tab-pane
label=
"抄送人"
>
<el-tab-pane
label=
"抄送人"
name=
"user"
>
<div>
<div>
<el-form
label-position=
"top
"
>
<el-form
ref=
"formRef"
:model=
"configForm"
label-position=
"top"
:rules=
"formRules
"
>
<el-form-item
label=
"抄送人设置"
prop=
"candidateStrategy"
>
<el-form-item
label=
"抄送人设置"
prop=
"candidateStrategy"
>
<el-radio-group
<el-radio-group
v-model=
"c
urrentNode.attributes
.candidateStrategy"
v-model=
"c
onfigForm
.candidateStrategy"
@
change=
"changeCandidateStrategy"
@
change=
"changeCandidateStrategy"
>
>
<el-radio
<el-radio
...
@@ -43,11 +46,16 @@
...
@@ -43,11 +46,16 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.attributes
.candidateStrategy == CandidateStrategy.ROLE"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.ROLE"
label=
"指定角色"
label=
"指定角色"
prop=
"candidateParam"
prop=
"candidateParamArray"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in roleOptions"
v-for=
"item in roleOptions"
:key=
"item.id"
:key=
"item.id"
...
@@ -58,16 +66,16 @@
...
@@ -58,16 +66,16 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"
v-if=
"
c
urrentNode.attributes
.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
c
onfigForm
.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
c
urrentNode.attributes
.candidateStrategy == CandidateStrategy.DEPT_LEADER
c
onfigForm
.candidateStrategy == CandidateStrategy.DEPT_LEADER
"
"
label=
"指定部门"
label=
"指定部门"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-tree-select
<el-tree-select
ref=
"treeRef"
ref=
"treeRef"
v-model=
"candidateParamArray"
v-model=
"c
onfigForm.c
andidateParamArray"
:data=
"deptTreeOptions"
:data=
"deptTreeOptions"
:props=
"defaultProps"
:props=
"defaultProps"
empty-text=
"加载中,请稍后"
empty-text=
"加载中,请稍后"
...
@@ -78,28 +86,33 @@
...
@@ -78,28 +86,33 @@
/>
/>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.attributes
.candidateStrategy == CandidateStrategy.POST"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.POST"
label=
"指定岗位"
label=
"指定岗位"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in postOptions"
v-for=
"item in postOptions"
:key=
"item.id"
:key=
"item.id"
:label=
"item.name"
:label=
"item.name"
:value=
"item.id"
:value=
"item.id
!
"
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.attributes
.candidateStrategy == CandidateStrategy.USER"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.USER"
label=
"指定用户"
label=
"指定用户"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-select
<el-select
v-model=
"candidateParamArray"
v-model=
"c
onfigForm.c
andidateParamArray"
clearable
clearable
multiple
multiple
style=
"width: 100%"
style=
"width: 100%"
...
@@ -113,11 +126,16 @@
...
@@ -113,11 +126,16 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.attributes
.candidateStrategy === CandidateStrategy.USER_GROUP"
v-if=
"c
onfigForm
.candidateStrategy === CandidateStrategy.USER_GROUP"
label=
"指定用户组"
label=
"指定用户组"
prop=
"candidateParam"
prop=
"candidateParamArray"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in userGroupOptions"
v-for=
"item in userGroupOptions"
:key=
"item.id"
:key=
"item.id"
...
@@ -128,46 +146,43 @@
...
@@ -128,46 +146,43 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.attributes
.candidateStrategy === CandidateStrategy.EXPRESSION"
v-if=
"c
onfigForm
.candidateStrategy === CandidateStrategy.EXPRESSION"
label=
"流程表达式"
label=
"流程表达式"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
>
>
<el-input
<el-input
type=
"textarea"
type=
"textarea"
v-model=
"candidateParamArray[0]"
v-model=
"c
onfigForm.c
andidateParamArray[0]"
clearable
clearable
style=
"width: 100%"
style=
"width: 100%"
/>
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"表单字段权限"
v-if
=
"formType === 10"
>
<el-tab-pane
label=
"表单字段权限"
name=
"fields"
v-if
=
"formType === 10"
>
<div
class=
"field-setting-pane"
>
<div
class=
"field-setting-pane"
>
<div
class=
"field-setting-desc"
>
字段权限
</div>
<div
class=
"field-setting-desc"
>
字段权限
</div>
<div
class=
"field-permit-title"
>
<div
class=
"field-permit-title"
>
<div
class=
"setting-title-label first-title"
>
<div
class=
"setting-title-label first-title"
>
字段名称
</div>
字段名称
</div>
<div
class=
"other-titles"
>
<div
class=
"other-titles"
>
<span
class=
"setting-title-label"
>
可编辑
</span>
<span
class=
"setting-title-label"
>
只读
</span>
<span
class=
"setting-title-label"
>
只读
</span>
<span
class=
"setting-title-label"
>
可编辑
</span>
<span
class=
"setting-title-label"
>
隐藏
</span>
<span
class=
"setting-title-label"
>
隐藏
</span>
</div>
</div>
</div>
</div>
<div
<div
class=
"field-setting-item"
class=
"field-setting-item"
v-for=
"(item, index) in c
urrentNode.attributes
.fieldsPermission"
v-for=
"(item, index) in c
onfigForm
.fieldsPermission"
:key=
"index"
:key=
"index"
>
>
<div
class=
"field-setting-item-label"
>
{{ item.title }}
</div>
<div
class=
"field-setting-item-label"
>
{{ item.title }}
</div>
<el-radio-group
class=
"field-setting-item-group"
v-model=
"item.permission"
>
<el-radio-group
class=
"field-setting-item-group"
v-model=
"item.permission"
>
<div
class=
"item-radio-wrap"
>
<div
class=
"item-radio-wrap"
>
<el-radio
value=
"1"
size=
"large"
label=
"1"
disabled
><span></span></el-radio>
<el-radio
value=
"1"
size=
"large"
label=
"1"
><span></span></el-radio>
</div>
</div>
<div
class=
"item-radio-wrap"
>
<div
class=
"item-radio-wrap"
>
<el-radio
value=
"2"
size=
"large"
label=
"2"
><span></span></el-radio>
<el-radio
value=
"2"
size=
"large"
label=
"2"
disabled
><span></span></el-radio>
</div>
</div>
<div
class=
"item-radio-wrap"
>
<div
class=
"item-radio-wrap"
>
<el-radio
value=
"3"
size=
"large"
label=
"3"
><span></span></el-radio>
<el-radio
value=
"3"
size=
"large"
label=
"3"
><span></span></el-radio>
...
@@ -186,8 +201,8 @@
...
@@ -186,8 +201,8 @@
</
template
>
</
template
>
</el-drawer>
</el-drawer>
</template>
</template>
<
script
setup
lang=
'ts'
>
<
script
setup
lang=
"ts"
>
import
{
SimpleFlowNode
,
CandidateStrategy
,
NodeType
,
NODE_DEFAULT_NAME
}
from
'../consts'
import
{
SimpleFlowNode
,
CandidateStrategy
,
NodeType
,
NODE_DEFAULT_NAME
}
from
'../consts'
import
{
getDefaultFieldsPermission
}
from
'../utils'
import
{
getDefaultFieldsPermission
}
from
'../utils'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
*
as
RoleApi
from
'@/api/system/role'
import
*
as
RoleApi
from
'@/api/system/role'
...
@@ -196,6 +211,7 @@ import * as PostApi from '@/api/system/post'
...
@@ -196,6 +211,7 @@ import * as PostApi from '@/api/system/post'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserGroupApi
from
'@/api/bpm/userGroup'
import
*
as
UserGroupApi
from
'@/api/bpm/userGroup'
import
{
defaultProps
}
from
'@/utils/tree'
import
{
defaultProps
}
from
'@/utils/tree'
import
{
cloneDeep
}
from
'lodash-es'
defineOptions
({
defineOptions
({
name
:
'CopyTaskNodeConfig'
name
:
'CopyTaskNodeConfig'
})
})
...
@@ -219,53 +235,80 @@ const formType = inject('formType') // 表单类型
...
@@ -219,53 +235,80 @@ const formType = inject('formType') // 表单类型
const
formFields
=
inject
<
Ref
<
string
[]
>>
(
'formFields'
)
const
formFields
=
inject
<
Ref
<
string
[]
>>
(
'formFields'
)
// 抄送人策略, 去掉发起人自选 和 发起人自己
// 抄送人策略, 去掉发起人自选 和 发起人自己
const
copyUserStrategies
=
computed
(
()
=>
{
const
copyUserStrategies
=
computed
(()
=>
{
return
getIntDictOptions
(
DICT_TYPE
.
BPM_TASK_CANDIDATE_STRATEGY
)
return
getIntDictOptions
(
DICT_TYPE
.
BPM_TASK_CANDIDATE_STRATEGY
).
filter
(
.
filter
(
item
=>
item
.
value
!==
CandidateStrategy
.
START_USER_SELECT
&&
item
.
value
!==
CandidateStrategy
.
START_USER
);
(
item
)
=>
item
.
value
!==
CandidateStrategy
.
START_USER_SELECT
&&
item
.
value
!==
CandidateStrategy
.
START_USER
)
})
})
// 激活的 Tab 标签页
const
activeTabName
=
ref
(
'user'
)
const
formRef
=
ref
()
// 表单 Ref
// 选中的参数
const
configForm
=
ref
<
any
>
({
const
candidateParamArray
=
ref
<
any
[]
>
([])
candidateParamArray
:
[],
candidateStrategy
:
CandidateStrategy
.
USER
,
fieldsPermission
:
[]
})
// 表单校验规则
const
formRules
=
reactive
({
candidateStrategy
:
[{
required
:
true
}],
candidateParamArray
:
[{
required
:
true
,
message
:
'选项不能为空'
,
trigger
:
'blur'
}]
})
// 关闭
// 关闭
const
closeDrawer
=
()
=>
{
const
closeDrawer
=
()
=>
{
settingVisible
.
value
=
false
settingVisible
.
value
=
false
}
}
// 保存配置
// 保存配置
const
saveConfig
=
()
=>
{
const
saveConfig
=
async
()
=>
{
currentNode
.
value
.
attributes
.
candidateParam
=
candidateParamArray
.
value
?.
join
(
','
)
activeTabName
.
value
=
'user'
currentNode
.
value
.
showText
=
getShowText
()
if
(
!
formRef
)
return
false
const
valid
=
await
formRef
.
value
.
validate
()
if
(
!
valid
)
return
false
const
showText
=
getShowText
()
if
(
!
showText
)
return
false
currentNode
.
value
.
candidateParam
=
configForm
.
value
.
candidateParamArray
?.
join
(
','
)
currentNode
.
value
.
candidateStrategy
=
configForm
.
value
.
candidateStrategy
currentNode
.
value
.
showText
=
showText
currentNode
.
value
.
fieldsPermission
=
configForm
.
value
.
fieldsPermission
settingVisible
.
value
=
false
settingVisible
.
value
=
false
return
true
}
}
const
open
=
()
=>
{
const
open
=
()
=>
{
settingVisible
.
value
=
true
settingVisible
.
value
=
true
}
}
// 修改当前编辑的节点, 由父组件传过来
// 修改当前编辑的节点, 由父组件传过来
const
setCurrentNode
=
(
node
:
SimpleFlowNode
)
=>
{
const
setCurrentNode
=
(
node
:
SimpleFlowNode
)
=>
{
currentNode
.
value
=
node
;
currentNode
.
value
=
node
currentNode
.
value
.
attributes
.
fieldsPermission
=
node
.
attributes
.
fieldsPermission
||
getDefaultFieldsPermission
(
formFields
?.
value
)
configForm
.
value
.
fieldsPermission
=
const
strCandidateParam
=
node
.
attributes
?.
candidateParam
cloneDeep
(
node
.
fieldsPermission
)
||
getDefaultFieldsPermission
(
formFields
?.
value
)
if
(
strCandidateParam
)
{
configForm
.
value
.
candidateStrategy
=
node
.
candidateStrategy
candidateParamArray
.
value
=
strCandidateParam
.
split
(
','
).
map
(
item
=>
+
item
)
const
strCandidateParam
=
node
?.
candidateParam
if
(
node
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
configForm
.
value
.
candidateParamArray
[
0
]
=
strCandidateParam
}
else
{
if
(
strCandidateParam
)
{
configForm
.
value
.
candidateParamArray
=
strCandidateParam
.
split
(
','
).
map
((
item
)
=>
+
item
)
}
}
}
}
}
defineExpose
({
open
,
setCurrentNode
})
// 暴露方法给父组件
defineExpose
({
open
,
setCurrentNode
})
// 暴露方法给父组件
const
changeCandidateStrategy
=
()
=>
{
const
changeCandidateStrategy
=
()
=>
{
c
andidateParamArray
.
value
=
[]
c
onfigForm
.
value
.
candidateParamArray
=
[]
}
}
// TODO 貌似可以和 UserTaskNodeConfig 重复了, 如何共用??
// TODO 貌似可以和 UserTaskNodeConfig 重复了, 如何共用??
const
getShowText
=
()
:
string
=>
{
const
getShowText
=
():
string
=>
{
let
showText
=
''
let
showText
=
''
// 指定成员
// 指定成员
if
(
c
urrentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
userOptions
?.
value
.
forEach
((
item
)
=>
{
userOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
nickname
)
candidateNames
.
push
(
item
.
nickname
)
}
}
})
})
...
@@ -273,11 +316,11 @@ const getShowText = () : string => {
...
@@ -273,11 +316,11 @@ const getShowText = () : string => {
}
}
}
}
// 指定角色
// 指定角色
if
(
c
urrentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
ROLE
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
ROLE
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
roleOptions
?.
value
.
forEach
((
item
)
=>
{
roleOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -285,16 +328,18 @@ const getShowText = () : string => {
...
@@ -285,16 +328,18 @@ const getShowText = () : string => {
}
}
}
}
// 指定部门
// 指定部门
if
(
currentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
if
(
||
currentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
DEPT_LEADER
)
{
configForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
||
if
(
candidateParamArray
.
value
?.
length
>
0
)
{
configForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_LEADER
)
{
if
(
configForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
deptOptions
?.
value
.
forEach
((
item
)
=>
{
deptOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
if
(
currentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
)
{
if
(
currentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
)
{
showText
=
`部门成员:
${
candidateNames
.
join
(
','
)}
`
showText
=
`部门成员:
${
candidateNames
.
join
(
','
)}
`
}
else
{
}
else
{
showText
=
`部门的负责人:
${
candidateNames
.
join
(
','
)}
`
showText
=
`部门的负责人:
${
candidateNames
.
join
(
','
)}
`
...
@@ -302,11 +347,11 @@ const getShowText = () : string => {
...
@@ -302,11 +347,11 @@ const getShowText = () : string => {
}
}
}
}
// 指定岗位
// 指定岗位
if
(
currentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
POST
)
{
if
(
configForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
POST
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
postOptions
?.
value
.
forEach
((
item
)
=>
{
postOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -314,11 +359,11 @@ const getShowText = () : string => {
...
@@ -314,11 +359,11 @@ const getShowText = () : string => {
}
}
}
}
// 指定用户组
// 指定用户组
if
(
c
urrentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
USER_GROUP
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER_GROUP
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
userGroupOptions
?.
value
.
forEach
((
item
)
=>
{
userGroupOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -326,9 +371,9 @@ const getShowText = () : string => {
...
@@ -326,9 +371,9 @@ const getShowText = () : string => {
}
}
}
}
// 流程表达式
// 流程表达式
if
(
c
urrentNode
.
value
.
attributes
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
showText
=
`流程表达式:
${
c
andidateParamArray
.
value
[
0
]}
`
showText
=
`流程表达式:
${
c
onfigForm
.
value
.
candidateParamArray
[
0
]}
`
}
}
}
}
return
showText
return
showText
...
@@ -337,14 +382,14 @@ const getShowText = () : string => {
...
@@ -337,14 +382,14 @@ const getShowText = () : string => {
const
showInput
=
ref
(
false
)
const
showInput
=
ref
(
false
)
const
clickIcon
=
()
=>
{
const
clickIcon
=
()
=>
{
showInput
.
value
=
true
;
showInput
.
value
=
true
}
}
// 输入框失去焦点
// 输入框失去焦点
const
blurEvent
=
()
=>
{
const
blurEvent
=
()
=>
{
showInput
.
value
=
false
showInput
.
value
=
false
currentNode
.
value
.
name
=
currentNode
.
value
.
name
||
NODE_DEFAULT_NAME
.
get
(
NodeType
.
COPY_TASK_NODE
)
as
string
currentNode
.
value
.
name
=
currentNode
.
value
.
name
||
(
NODE_DEFAULT_NAME
.
get
(
NodeType
.
COPY_TASK_NODE
)
as
string
)
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue
View file @
88356c7b
...
@@ -26,13 +26,13 @@
...
@@ -26,13 +26,13 @@
<div
class=
"divide-line"
></div>
<div
class=
"divide-line"
></div>
</div>
</div>
</
template
>
</
template
>
<el-tabs
type=
"border-card"
>
<el-tabs
type=
"border-card"
v-model=
"activeTabName"
>
<el-tab-pane
label=
"审批人"
>
<el-tab-pane
label=
"审批人"
name=
"user"
>
<div>
<div>
<el-form
label-position=
"top
"
>
<el-form
ref=
"formRef"
:model=
"configForm"
label-position=
"top"
:rules=
"formRules
"
>
<el-form-item
label=
"审批人设置"
prop=
"candidateStrategy"
>
<el-form-item
label=
"审批人设置"
prop=
"candidateStrategy"
>
<el-radio-group
<el-radio-group
v-model=
"c
urrentNode
.candidateStrategy"
v-model=
"c
onfigForm
.candidateStrategy"
@
change=
"changeCandidateStrategy"
@
change=
"changeCandidateStrategy"
>
>
<el-radio
<el-radio
...
@@ -47,11 +47,16 @@
...
@@ -47,11 +47,16 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode
.candidateStrategy == CandidateStrategy.ROLE"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.ROLE"
label=
"指定角色"
label=
"指定角色"
prop=
"candidateParam"
prop=
"candidateParamArray"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in roleOptions"
v-for=
"item in roleOptions"
:key=
"item.id"
:key=
"item.id"
...
@@ -62,16 +67,16 @@
...
@@ -62,16 +67,16 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"
v-if=
"
c
urrentNode
.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
c
onfigForm
.candidateStrategy == CandidateStrategy.DEPT_MEMBER ||
c
urrentNode
.candidateStrategy == CandidateStrategy.DEPT_LEADER
c
onfigForm
.candidateStrategy == CandidateStrategy.DEPT_LEADER
"
"
label=
"指定部门"
label=
"指定部门"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-tree-select
<el-tree-select
ref=
"treeRef"
ref=
"treeRef"
v-model=
"candidateParamArray"
v-model=
"c
onfigForm.c
andidateParamArray"
:data=
"deptTreeOptions"
:data=
"deptTreeOptions"
:props=
"defaultProps"
:props=
"defaultProps"
empty-text=
"加载中,请稍后"
empty-text=
"加载中,请稍后"
...
@@ -82,28 +87,33 @@
...
@@ -82,28 +87,33 @@
/>
/>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode
.candidateStrategy == CandidateStrategy.POST"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.POST"
label=
"指定岗位"
label=
"指定岗位"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in postOptions"
v-for=
"item in postOptions"
:key=
"item.id"
:key=
"item.id"
:label=
"item.name"
:label=
"item.name"
:value=
"item.id"
:value=
"item.id
!
"
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode
.candidateStrategy == CandidateStrategy.USER"
v-if=
"c
onfigForm
.candidateStrategy == CandidateStrategy.USER"
label=
"指定用户"
label=
"指定用户"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
span=
"24"
span=
"24"
>
>
<el-select
<el-select
v-model=
"candidateParamArray"
v-model=
"c
onfigForm.c
andidateParamArray"
clearable
clearable
multiple
multiple
style=
"width: 100%"
style=
"width: 100%"
...
@@ -118,11 +128,16 @@
...
@@ -118,11 +128,16 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode
.candidateStrategy === CandidateStrategy.USER_GROUP"
v-if=
"c
onfigForm
.candidateStrategy === CandidateStrategy.USER_GROUP"
label=
"指定用户组"
label=
"指定用户组"
prop=
"candidateParam"
prop=
"candidateParamArray"
>
<el-select
v-model=
"configForm.candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
>
<el-select
v-model=
"candidateParamArray"
clearable
multiple
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in userGroupOptions"
v-for=
"item in userGroupOptions"
:key=
"item.id"
:key=
"item.id"
...
@@ -132,19 +147,19 @@
...
@@ -132,19 +147,19 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode
.candidateStrategy === CandidateStrategy.EXPRESSION"
v-if=
"c
onfigForm
.candidateStrategy === CandidateStrategy.EXPRESSION"
label=
"流程表达式"
label=
"流程表达式"
prop=
"candidateParam"
prop=
"candidateParam
Array
"
>
>
<el-input
<el-input
type=
"textarea"
type=
"textarea"
v-model=
"candidateParamArray[0]"
v-model=
"c
onfigForm.c
andidateParamArray[0]"
clearable
clearable
style=
"width: 100%"
style=
"width: 100%"
/>
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"多人审批方式"
prop=
"approveMethod"
>
<el-form-item
label=
"多人审批方式"
prop=
"approveMethod"
>
<el-radio-group
v-model=
"c
urrentNode
.approveMethod"
@
change=
"approveMethodChanged"
>
<el-radio-group
v-model=
"c
onfigForm
.approveMethod"
@
change=
"approveMethodChanged"
>
<div
class=
"flex-col"
>
<div
class=
"flex-col"
>
<div
<div
v-for=
"(item, index) in APPROVE_METHODS"
v-for=
"(item, index) in APPROVE_METHODS"
...
@@ -161,24 +176,26 @@
...
@@ -161,24 +176,26 @@
>
>
{{ item.label }}
{{ item.label }}
</el-radio>
</el-radio>
<el-form-item
prop=
"approveRatio"
>
<el-input-number
<el-input-number
v-model=
"currentNode
.approveRatio"
v-model=
"configForm
.approveRatio"
:min=
"10"
:min=
"10"
:max=
"100"
:max=
"100"
:step=
"10"
:step=
"10"
size=
"small"
size=
"small"
v-if=
"
v-if=
"
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
currentNode
.approveMethod === ApproveMethodType.APPROVE_BY_RATIO
configForm
.approveMethod === ApproveMethodType.APPROVE_BY_RATIO
"
"
/>
/>
</el-form-item>
</div>
</div>
</div>
</div>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-divider
content-position=
"left"
>
审批人拒绝时
</el-divider>
<el-divider
content-position=
"left"
>
审批人拒绝时
</el-divider>
<el-form-item
prop=
"rejectHandler"
>
<el-form-item
prop=
"rejectHandler
Type
"
>
<el-radio-group
v-model=
"c
urrentNode.rejectHandler!.t
ype"
>
<el-radio-group
v-model=
"c
onfigForm.rejectHandlerT
ype"
>
<div
class=
"flex-col"
>
<div
class=
"flex-col"
>
<div
v-for=
"(item, index) in REJECT_HANDLER_TYPES"
:key=
"index"
>
<div
v-for=
"(item, index) in REJECT_HANDLER_TYPES"
:key=
"index"
>
<el-radio
:key=
"item.value"
:value=
"item.value"
:label=
"item.label"
/>
<el-radio
:key=
"item.value"
:value=
"item.value"
:label=
"item.label"
/>
...
@@ -188,15 +205,11 @@
...
@@ -188,15 +205,11 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
v-if=
"c
urrentNode.rejectHandler!.t
ype == RejectHandlerType.RETURN_USER_TASK"
v-if=
"c
onfigForm.rejectHandlerT
ype == RejectHandlerType.RETURN_USER_TASK"
label=
"驳回节点"
label=
"驳回节点"
prop=
"rejectHandlerNode"
prop=
"returnNodeId"
>
<el-select
v-model=
"currentNode.rejectHandler!.returnNodeId"
clearable
style=
"width: 100%"
>
>
<el-select
v-model=
"configForm.returnNodeId"
clearable
style=
"width: 100%"
>
<el-option
<el-option
v-for=
"item in returnTaskList"
v-for=
"item in returnTaskList"
:key=
"item.id"
:key=
"item.id"
...
@@ -208,7 +221,7 @@
...
@@ -208,7 +221,7 @@
<el-divider
content-position=
"left"
>
审批人超时未处理时
</el-divider>
<el-divider
content-position=
"left"
>
审批人超时未处理时
</el-divider>
<el-form-item
label=
"启用开关"
prop=
"timeoutHandlerEnable"
>
<el-form-item
label=
"启用开关"
prop=
"timeoutHandlerEnable"
>
<el-switch
<el-switch
v-model=
"c
urrentNode.timeoutHandler!.e
nable"
v-model=
"c
onfigForm.timeoutHandlerE
nable"
active-text=
"开启"
active-text=
"开启"
inactive-text=
"关闭"
inactive-text=
"关闭"
@
change=
"timeoutHandlerChange"
@
change=
"timeoutHandlerChange"
...
@@ -217,9 +230,12 @@
...
@@ -217,9 +230,12 @@
<el-form-item
<el-form-item
label=
"执行动作"
label=
"执行动作"
prop=
"timeoutHandlerAction"
prop=
"timeoutHandlerAction"
v-if=
"currentNode.timeoutHandler?.enable"
v-if=
"configForm.timeoutHandlerEnable"
>
<el-radio-group
v-model=
"configForm.timeoutHandlerAction"
@
change=
"timeoutActionChanged"
>
>
<el-radio-group
v-model=
"currentNode.timeoutHandler!.action"
>
<el-radio-button
<el-radio-button
v-for=
"item in TIMEOUT_HANDLER_ACTION_TYPES"
v-for=
"item in TIMEOUT_HANDLER_ACTION_TYPES"
:key=
"item.value"
:key=
"item.value"
...
@@ -228,19 +244,17 @@
...
@@ -228,19 +244,17 @@
/>
/>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
label=
"超时时间设置"
v-if=
"configForm.timeoutHandlerEnable"
>
label=
"超时时间设置"
prop=
"timeoutHandlerTimeDuration"
v-if=
"currentNode.timeoutHandler?.enable"
>
<span
class=
"mr-2"
>
当超过
</span>
<span
class=
"mr-2"
>
当超过
</span>
<el-form-item
prop=
"timeDuration"
>
<el-input-number
<el-input-number
class=
"mr-2"
class=
"mr-2"
:style=
"{ width: '100px' }"
:style=
"{ width: '100px' }"
v-model=
"
timeDuration"
v-model=
"configForm.
timeDuration"
:min=
"1"
:min=
"1"
controls-position=
"right"
controls-position=
"right"
/>
/>
</el-form-item>
<el-select
<el-select
v-model=
"timeUnit"
v-model=
"timeUnit"
class=
"mr-2"
class=
"mr-2"
...
@@ -258,19 +272,15 @@
...
@@ -258,19 +272,15 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
label=
"最大提醒次数"
label=
"最大提醒次数"
prop=
"
timeoutHandlerM
axRemindCount"
prop=
"
m
axRemindCount"
v-if=
"c
urrentNode.timeoutHandler?.enable && currentNode.timeoutHandler?.a
ction === 1"
v-if=
"c
onfigForm.timeoutHandlerEnable && configForm.timeoutHandlerA
ction === 1"
>
>
<el-input-number
<el-input-number
v-model=
"configForm.maxRemindCount"
:min=
"1"
:max=
"10"
/>
v-model=
"currentNode.timeoutHandler!.maxRemindCount"
:min=
"1"
:max=
"10"
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"表单字段权限"
v-if=
"formType === 10"
>
<el-tab-pane
label=
"表单字段权限"
name=
"fields"
v-if=
"formType === 10"
>
<div
class=
"field-setting-pane"
>
<div
class=
"field-setting-pane"
>
<div
class=
"field-setting-desc"
>
字段权限
</div>
<div
class=
"field-setting-desc"
>
字段权限
</div>
<div
class=
"field-permit-title"
>
<div
class=
"field-permit-title"
>
...
@@ -283,7 +293,7 @@
...
@@ -283,7 +293,7 @@
</div>
</div>
<div
<div
class=
"field-setting-item"
class=
"field-setting-item"
v-for=
"(item, index) in c
urrentNode
.fieldsPermission"
v-for=
"(item, index) in c
onfigForm
.fieldsPermission"
:key=
"index"
:key=
"index"
>
>
<div
class=
"field-setting-item-label"
>
{{ item.title }}
</div>
<div
class=
"field-setting-item-label"
>
{{ item.title }}
</div>
...
@@ -334,6 +344,7 @@ import * as DeptApi from '@/api/system/dept'
...
@@ -334,6 +344,7 @@ import * as DeptApi from '@/api/system/dept'
import
*
as
PostApi
from
'@/api/system/post'
import
*
as
PostApi
from
'@/api/system/post'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserGroupApi
from
'@/api/bpm/userGroup'
import
*
as
UserGroupApi
from
'@/api/bpm/userGroup'
import
{
cloneDeep
}
from
'lodash-es'
defineOptions
({
defineOptions
({
name
:
'UserTaskNodeConfig'
name
:
'UserTaskNodeConfig'
...
@@ -359,27 +370,76 @@ const userGroupOptions = inject<Ref<UserGroupApi.UserGroupVO[]>>('userGroupList'
...
@@ -359,27 +370,76 @@ const userGroupOptions = inject<Ref<UserGroupApi.UserGroupVO[]>>('userGroupList'
const
deptTreeOptions
=
inject
(
'deptTree'
)
// 部门树
const
deptTreeOptions
=
inject
(
'deptTree'
)
// 部门树
const
formType
=
inject
(
'formType'
)
// 表单类型
const
formType
=
inject
(
'formType'
)
// 表单类型
const
formFields
=
inject
<
Ref
<
string
[]
>>
(
'formFields'
)
const
formFields
=
inject
<
Ref
<
string
[]
>>
(
'formFields'
)
const
candidateParamArray
=
ref
<
any
[]
>
([])
const
returnTaskList
=
ref
<
SimpleFlowNode
[]
>
([])
const
returnTaskList
=
ref
<
SimpleFlowNode
[]
>
([])
const
formRef
=
ref
()
// 表单 Ref
const
activeTabName
=
ref
(
'user'
)
// 激活的 Tab 标签页
const
configForm
=
ref
<
any
>
({
candidateParamArray
:
[],
candidateStrategy
:
CandidateStrategy
.
USER
,
approveMethod
:
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
,
approveRatio
:
100
,
rejectHandlerType
:
RejectHandlerType
.
FINISH_PROCESS
,
returnNodeId
:
''
,
timeoutHandlerEnable
:
false
,
timeoutHandlerAction
:
1
,
timeDuration
:
6
,
// 默认 6小时
maxRemindCount
:
1
,
// 默认 提醒 1次
fieldsPermission
:
[]
})
// 表单校验规则
const
formRules
=
reactive
({
candidateStrategy
:
[{
required
:
true
}],
candidateParamArray
:
[{
required
:
true
,
message
:
'该选项不能为空'
,
trigger
:
'change'
}],
approveMethod
:
[{
required
:
true
,
message
:
'多人审批方式不能为空'
,
trigger
:
'change'
}],
approveRatio
:
[{
required
:
true
,
message
:
'通过比例不能为空'
,
trigger
:
'blur'
}],
returnNodeId
:
[{
required
:
true
,
message
:
'驳回节点不能为空'
,
trigger
:
'change'
}],
timeoutHandlerEnable
:
[{
required
:
true
}],
timeoutHandlerAction
:
[{
required
:
true
}],
timeDuration
:
[{
required
:
true
,
message
:
'超时时间不能为空'
,
trigger
:
'blur'
}],
maxRemindCount
:
[{
required
:
true
,
message
:
'提醒次数不能为空'
,
trigger
:
'blur'
}]
})
// 关闭
const
closeDrawer
=
()
=>
{
const
closeDrawer
=
()
=>
{
settingVisible
.
value
=
false
settingVisible
.
value
=
false
}
}
const
saveConfig
=
()
=>
{
// 保存配置
currentNode
.
value
.
candidateParam
=
candidateParamArray
.
value
?.
join
(
','
)
const
saveConfig
=
async
()
=>
{
if
(
currentNode
.
value
.
timeoutHandler
?.
enable
)
{
activeTabName
.
value
=
'user'
currentNode
.
value
.
timeoutHandler
.
timeDuration
=
isoTimeDuration
.
value
if
(
!
formRef
)
return
false
}
const
valid
=
await
formRef
.
value
.
validate
()
if
(
!
valid
)
return
false
const
showText
=
getShowText
()
if
(
!
showText
)
return
false
currentNode
.
value
.
candidateStrategy
=
configForm
.
value
.
candidateStrategy
currentNode
.
value
.
candidateParam
=
configForm
.
value
.
candidateParamArray
?.
join
(
','
)
// 设置拒绝处理
currentNode
.
value
.
rejectHandler
=
{
type
:
configForm
.
value
.
rejectHandlerType
,
returnNodeId
:
configForm
.
value
.
returnNodeId
}
// 设置超时处理
currentNode
.
value
.
timeoutHandler
=
{
enable
:
configForm
.
value
.
timeoutHandlerEnable
,
action
:
cTimeoutAction
.
value
,
timeDuration
:
isoTimeDuration
.
value
,
maxRemindCount
:
cTimeoutMaxRemindCount
.
value
}
// 设置表单权限
currentNode
.
value
.
fieldsPermission
=
configForm
.
value
.
fieldsPermission
currentNode
.
value
.
showText
=
getShowText
()
currentNode
.
value
.
showText
=
getShowText
()
settingVisible
.
value
=
false
settingVisible
.
value
=
false
return
true
}
}
const
getShowText
=
():
string
=>
{
const
getShowText
=
():
string
=>
{
let
showText
=
''
let
showText
=
''
// 指定成员
// 指定成员
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
userOptions
?.
value
.
forEach
((
item
)
=>
{
userOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
nickname
)
candidateNames
.
push
(
item
.
nickname
)
}
}
})
})
...
@@ -387,11 +447,11 @@ const getShowText = (): string => {
...
@@ -387,11 +447,11 @@ const getShowText = (): string => {
}
}
}
}
// 指定角色
// 指定角色
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
ROLE
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
ROLE
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
roleOptions
?.
value
.
forEach
((
item
)
=>
{
roleOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -400,17 +460,17 @@ const getShowText = (): string => {
...
@@ -400,17 +460,17 @@ const getShowText = (): string => {
}
}
// 指定部门
// 指定部门
if
(
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
||
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
||
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_LEADER
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_LEADER
)
{
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
deptOptions
?.
value
.
forEach
((
item
)
=>
{
deptOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
DEPT_MEMBER
)
{
showText
=
`部门成员:
${
candidateNames
.
join
(
','
)}
`
showText
=
`部门成员:
${
candidateNames
.
join
(
','
)}
`
}
else
{
}
else
{
showText
=
`部门的负责人:
${
candidateNames
.
join
(
','
)}
`
showText
=
`部门的负责人:
${
candidateNames
.
join
(
','
)}
`
...
@@ -419,11 +479,11 @@ const getShowText = (): string => {
...
@@ -419,11 +479,11 @@ const getShowText = (): string => {
}
}
// 指定岗位
// 指定岗位
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
POST
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
POST
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
postOptions
?.
value
.
forEach
((
item
)
=>
{
postOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -431,11 +491,11 @@ const getShowText = (): string => {
...
@@ -431,11 +491,11 @@ const getShowText = (): string => {
}
}
}
}
// 指定用户组
// 指定用户组
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER_GROUP
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER_GROUP
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
const
candidateNames
:
string
[]
=
[]
const
candidateNames
:
string
[]
=
[]
userGroupOptions
?.
value
.
forEach
((
item
)
=>
{
userGroupOptions
?.
value
.
forEach
((
item
)
=>
{
if
(
c
andidateParamArray
.
value
.
includes
(
item
.
id
))
{
if
(
c
onfigForm
.
value
.
candidateParamArray
.
includes
(
item
.
id
))
{
candidateNames
.
push
(
item
.
name
)
candidateNames
.
push
(
item
.
name
)
}
}
})
})
...
@@ -444,18 +504,18 @@ const getShowText = (): string => {
...
@@ -444,18 +504,18 @@ const getShowText = (): string => {
}
}
// 发起人自选
// 发起人自选
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER_SELECT
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER_SELECT
)
{
showText
=
`发起人自选`
showText
=
`发起人自选`
}
}
// 发起人自己
// 发起人自己
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER
)
{
showText
=
`发起人自己`
showText
=
`发起人自己`
}
}
// 流程表达式
// 流程表达式
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
if
(
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
if
(
c
andidateParamArray
.
value
?.
length
>
0
)
{
if
(
c
onfigForm
.
value
.
candidateParamArray
?.
length
>
0
)
{
showText
=
`流程表达式:
${
c
andidateParamArray
.
value
[
0
]}
`
showText
=
`流程表达式:
${
c
onfigForm
.
value
.
candidateParamArray
[
0
]}
`
}
}
}
}
return
showText
return
showText
...
@@ -466,28 +526,39 @@ const open = () => {
...
@@ -466,28 +526,39 @@ const open = () => {
// 修改当前编辑的节点, 由父组件传过来
// 修改当前编辑的节点, 由父组件传过来
const
setCurrentNode
=
(
node
:
SimpleFlowNode
)
=>
{
const
setCurrentNode
=
(
node
:
SimpleFlowNode
)
=>
{
currentNode
.
value
=
node
currentNode
.
value
=
node
currentNode
.
value
.
fieldsPermission
=
configForm
.
value
.
fieldsPermission
=
node
.
fieldsPermission
||
getDefaultFieldsPermission
(
formFields
?.
value
)
cloneDeep
(
node
.
fieldsPermission
)
||
getDefaultFieldsPermission
(
formFields
?.
value
)
configForm
.
value
.
candidateStrategy
=
node
.
candidateStrategy
const
strCandidateParam
=
node
?.
candidateParam
const
strCandidateParam
=
node
?.
candidateParam
if
(
node
.
candidateStrategy
===
CandidateStrategy
.
EXPRESSION
)
{
configForm
.
value
.
candidateParamArray
[
0
]
=
strCandidateParam
}
else
{
if
(
strCandidateParam
)
{
if
(
strCandidateParam
)
{
candidateParamArray
.
value
=
strCandidateParam
.
split
(
','
).
map
((
item
)
=>
+
item
)
configForm
.
value
.
candidateParamArray
=
strCandidateParam
.
split
(
','
).
map
((
item
)
=>
+
item
)
}
configForm
.
value
.
candidateStrategy
=
node
.
candidateStrategy
}
}
if
(
if
(
(
c
andidateParamArray
.
value
.
length
<=
1
&&
(
c
onfigForm
.
value
.
candidateParamArray
?
.
length
<=
1
&&
currentNode
.
valu
e
.
candidateStrategy
===
CandidateStrategy
.
USER
)
||
nod
e
.
candidateStrategy
===
CandidateStrategy
.
USER
)
||
currentNode
.
valu
e
.
candidateStrategy
===
CandidateStrategy
.
START_USER
nod
e
.
candidateStrategy
===
CandidateStrategy
.
START_USER
)
{
)
{
notAllowedMultiApprovers
.
value
=
true
notAllowedMultiApprovers
.
value
=
true
}
else
{
}
else
{
notAllowedMultiApprovers
.
value
=
false
notAllowedMultiApprovers
.
value
=
false
}
}
if
(
currentNode
.
value
.
timeoutHandler
?.
enable
&&
currentNode
.
value
.
timeoutHandler
?.
timeDuration
)
{
configForm
.
value
.
rejectHandlerType
=
node
.
rejectHandler
?.
type
const
strTimeDuration
=
currentNode
.
value
.
timeoutHandler
.
timeDuration
configForm
.
value
.
returnNodeId
=
node
.
rejectHandler
?.
returnNodeId
configForm
.
value
.
timeoutHandlerEnable
=
node
.
timeoutHandler
?.
enable
if
(
node
.
timeoutHandler
?.
enable
&&
node
.
timeoutHandler
?.
timeDuration
)
{
const
strTimeDuration
=
node
.
timeoutHandler
.
timeDuration
let
parseTime
=
strTimeDuration
.
slice
(
2
,
strTimeDuration
.
length
-
1
)
let
parseTime
=
strTimeDuration
.
slice
(
2
,
strTimeDuration
.
length
-
1
)
let
parseTimeUnit
=
strTimeDuration
.
slice
(
strTimeDuration
.
length
-
1
)
let
parseTimeUnit
=
strTimeDuration
.
slice
(
strTimeDuration
.
length
-
1
)
timeDuration
.
value
=
parseInt
(
parseTime
)
configForm
.
value
.
timeDuration
=
parseInt
(
parseTime
)
timeUnit
.
value
=
convertTimeUnit
(
parseTimeUnit
)
timeUnit
.
value
=
convertTimeUnit
(
parseTimeUnit
)
}
}
configForm
.
value
.
timeoutHandlerAction
=
node
.
timeoutHandler
?.
action
configForm
.
value
.
maxRemindCount
=
node
.
timeoutHandler
?.
maxRemindCount
// 查找可以驳回的用户节点
// 查找可以驳回的用户节点
const
matchNodeList
=
[]
const
matchNodeList
=
[]
emits
(
'find:returnTaskNodes'
,
matchNodeList
)
emits
(
'find:returnTaskNodes'
,
matchNodeList
)
...
@@ -497,11 +568,11 @@ const setCurrentNode = (node: SimpleFlowNode) => {
...
@@ -497,11 +568,11 @@ const setCurrentNode = (node: SimpleFlowNode) => {
defineExpose
({
open
,
setCurrentNode
})
// 暴露方法给父组件
defineExpose
({
open
,
setCurrentNode
})
// 暴露方法给父组件
const
changeCandidateStrategy
=
()
=>
{
const
changeCandidateStrategy
=
()
=>
{
c
andidateParamArray
.
value
=
[]
c
onfigForm
.
value
.
candidateParamArray
=
[]
c
urrentNode
.
value
.
approveMethod
=
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
c
onfigForm
.
value
.
approveMethod
=
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
if
(
if
(
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER
||
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
START_USER
||
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
)
{
notAllowedMultiApprovers
.
value
=
true
notAllowedMultiApprovers
.
value
=
true
}
else
{
}
else
{
...
@@ -511,11 +582,11 @@ const changeCandidateStrategy = () => {
...
@@ -511,11 +582,11 @@ const changeCandidateStrategy = () => {
const
changedCandidateUsers
=
()
=>
{
const
changedCandidateUsers
=
()
=>
{
if
(
if
(
c
andidateParamArray
.
value
?.
length
<=
1
&&
c
onfigForm
.
value
.
candidateParamArray
?.
length
<=
1
&&
c
urrentNode
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
c
onfigForm
.
value
.
candidateStrategy
===
CandidateStrategy
.
USER
)
{
)
{
c
urrentNode
.
value
.
approveMethod
=
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
c
onfigForm
.
value
.
approveMethod
=
ApproveMethodType
.
RRANDOM_SELECT_ONE_APPROVE
c
urrentNode
.
value
.
rejectHandler
!
.
t
ype
=
RejectHandlerType
.
FINISH_PROCESS
c
onfigForm
.
value
.
rejectHandlerT
ype
=
RejectHandlerType
.
FINISH_PROCESS
notAllowedMultiApprovers
.
value
=
true
notAllowedMultiApprovers
.
value
=
true
}
else
{
}
else
{
notAllowedMultiApprovers
.
value
=
false
notAllowedMultiApprovers
.
value
=
false
...
@@ -534,37 +605,63 @@ const blurEvent = () => {
...
@@ -534,37 +605,63 @@ const blurEvent = () => {
currentNode
.
value
.
name
||
(
NODE_DEFAULT_NAME
.
get
(
NodeType
.
USER_TASK_NODE
)
as
string
)
currentNode
.
value
.
name
||
(
NODE_DEFAULT_NAME
.
get
(
NodeType
.
USER_TASK_NODE
)
as
string
)
}
}
const
approveMethodChanged
=
()
=>
{
const
approveMethodChanged
=
()
=>
{
currentNode
.
value
.
rejectHandler
!
.
type
=
RejectHandlerType
.
FINISH_PROCESS
configForm
.
value
.
rejectHandlerType
=
RejectHandlerType
.
FINISH_PROCESS
const
approveMethod
=
currentNode
.
value
?.
approveMethod
if
(
configForm
.
value
.
approveMethod
===
ApproveMethodType
.
APPROVE_BY_RATIO
)
{
if
(
approveMethod
===
ApproveMethodType
.
APPROVE_BY_RATIO
)
{
configForm
.
value
.
approveRatio
=
100
currentNode
.
value
.
approveRatio
=
100
}
}
formRef
.
value
.
clearValidate
(
'approveRatio'
)
}
}
// 默认 6小时
const
timeDuration
=
ref
(
6
)
const
timeUnit
=
ref
(
TimeUnitType
.
HOUR
)
const
timeUnit
=
ref
(
TimeUnitType
.
HOUR
)
// 超时时间的 ISO 表示
const
isoTimeDuration
=
computed
(()
=>
{
const
isoTimeDuration
=
computed
(()
=>
{
if
(
!
configForm
.
value
.
timeoutHandlerEnable
)
{
return
undefined
}
let
strTimeDuration
=
'PT'
let
strTimeDuration
=
'PT'
if
(
timeUnit
.
value
===
TimeUnitType
.
MINUTE
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
MINUTE
)
{
strTimeDuration
+=
timeDuration
.
value
+
'M'
strTimeDuration
+=
configForm
.
value
.
timeDuration
+
'M'
}
}
if
(
timeUnit
.
value
===
TimeUnitType
.
HOUR
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
HOUR
)
{
strTimeDuration
+=
timeDuration
.
value
+
'H'
strTimeDuration
+=
configForm
.
value
.
timeDuration
+
'H'
}
}
if
(
timeUnit
.
value
===
TimeUnitType
.
DAY
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
DAY
)
{
strTimeDuration
+=
timeDuration
.
value
+
'D'
strTimeDuration
+=
configForm
.
value
.
timeDuration
+
'D'
}
}
return
strTimeDuration
return
strTimeDuration
})
})
// 超时执行的动作
const
cTimeoutAction
=
computed
(()
=>
{
if
(
!
configForm
.
value
.
timeoutHandlerEnable
)
{
return
undefined
}
return
configForm
.
value
.
timeoutHandlerAction
})
// 超时最大提醒次数
const
cTimeoutMaxRemindCount
=
computed
(()
=>
{
if
(
!
configForm
.
value
.
timeoutHandlerEnable
)
{
return
undefined
}
if
(
configForm
.
value
.
timeoutHandlerAction
!==
1
)
{
return
undefined
}
return
configForm
.
value
.
maxRemindCount
})
// 超时开关改变
// 超时开关改变
const
timeoutHandlerChange
=
()
=>
{
const
timeoutHandlerChange
=
()
=>
{
if
(
c
urrentNode
.
value
.
timeoutHandler
?.
e
nable
)
{
if
(
c
onfigForm
.
value
.
timeoutHandlerE
nable
)
{
timeUnit
.
value
=
2
timeUnit
.
value
=
2
timeDuration
.
value
=
6
configForm
.
value
.
timeDuration
=
6
currentNode
.
value
.
timeoutHandler
.
action
=
1
configForm
.
value
.
timeoutHandlerAction
=
1
currentNode
.
value
.
timeoutHandler
.
maxRemindCount
=
1
configForm
.
value
.
maxRemindCount
=
1
}
}
// 超时处理动作改变
const
timeoutActionChanged
=
()
=>
{
if
(
configForm
.
value
.
timeoutHandlerAction
===
1
)
{
configForm
.
value
.
maxRemindCount
=
1
// 超时提醒次数,默认为1
}
}
}
}
...
@@ -572,15 +669,15 @@ const timeoutHandlerChange = () => {
...
@@ -572,15 +669,15 @@ const timeoutHandlerChange = () => {
const
timeUnitChange
=
()
=>
{
const
timeUnitChange
=
()
=>
{
// 分钟,默认是 60 分钟
// 分钟,默认是 60 分钟
if
(
timeUnit
.
value
===
TimeUnitType
.
MINUTE
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
MINUTE
)
{
timeDuration
.
value
=
60
configForm
.
value
.
timeDuration
=
60
}
}
// 小时,默认是 6 个小时
// 小时,默认是 6 个小时
if
(
timeUnit
.
value
===
TimeUnitType
.
HOUR
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
HOUR
)
{
timeDuration
.
value
=
6
configForm
.
value
.
timeDuration
=
6
}
}
// 天, 默认 1天
// 天, 默认 1天
if
(
timeUnit
.
value
===
TimeUnitType
.
DAY
)
{
if
(
timeUnit
.
value
===
TimeUnitType
.
DAY
)
{
timeDuration
.
value
=
1
configForm
.
value
.
timeDuration
=
1
}
}
}
}
...
...
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