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
fae712b9
authored
Jun 27, 2024
by
jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仿钉钉流程设计- 表单字段权限设置
parent
6ad29c6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
5 deletions
+61
-5
src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue
+10
-0
src/views/bpm/processInstance/detail/index.vue
+51
-5
No files found.
src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue
View file @
fae712b9
...
@@ -413,6 +413,11 @@ const saveConfig = async () => {
...
@@ -413,6 +413,11 @@ const saveConfig = async () => {
if
(
!
showText
)
return
false
if
(
!
showText
)
return
false
currentNode
.
value
.
candidateStrategy
=
configForm
.
value
.
candidateStrategy
currentNode
.
value
.
candidateStrategy
=
configForm
.
value
.
candidateStrategy
currentNode
.
value
.
candidateParam
=
configForm
.
value
.
candidateParamArray
?.
join
(
','
)
currentNode
.
value
.
candidateParam
=
configForm
.
value
.
candidateParamArray
?.
join
(
','
)
// 设置审批方式
currentNode
.
value
.
approveMethod
=
configForm
.
value
.
approveMethod
if
(
configForm
.
value
.
approveMethod
===
ApproveMethodType
.
APPROVE_BY_RATIO
)
{
currentNode
.
value
.
approveRatio
=
configForm
.
value
.
approveRatio
}
// 设置拒绝处理
// 设置拒绝处理
currentNode
.
value
.
rejectHandler
=
{
currentNode
.
value
.
rejectHandler
=
{
type
:
configForm
.
value
.
rejectHandlerType
,
type
:
configForm
.
value
.
rejectHandlerType
,
...
@@ -547,6 +552,11 @@ const setCurrentNode = (node: SimpleFlowNode) => {
...
@@ -547,6 +552,11 @@ const setCurrentNode = (node: SimpleFlowNode) => {
}
else
{
}
else
{
notAllowedMultiApprovers
.
value
=
false
notAllowedMultiApprovers
.
value
=
false
}
}
// 设置审批方式
configForm
.
value
.
approveMethod
=
node
.
approveMethod
if
(
node
.
approveMethod
==
ApproveMethodType
.
APPROVE_BY_RATIO
)
{
configForm
.
value
.
approveRatio
=
node
.
approveRatio
}
configForm
.
value
.
rejectHandlerType
=
node
.
rejectHandler
?.
type
configForm
.
value
.
rejectHandlerType
=
node
.
rejectHandler
?.
type
configForm
.
value
.
returnNodeId
=
node
.
rejectHandler
?.
returnNodeId
configForm
.
value
.
returnNodeId
=
node
.
rejectHandler
?.
returnNodeId
configForm
.
value
.
timeoutHandlerEnable
=
node
.
timeoutHandler
?.
enable
configForm
.
value
.
timeoutHandlerEnable
=
node
.
timeoutHandler
?.
enable
...
...
src/views/bpm/processInstance/detail/index.vue
View file @
fae712b9
...
@@ -200,7 +200,11 @@ const handleAudit = async (task, pass) => {
...
@@ -200,7 +200,11 @@ const handleAudit = async (task, pass) => {
// 1.2 校验表单
// 1.2 校验表单
const
elForm
=
unref
(
auditFormRef
)
const
elForm
=
unref
(
auditFormRef
)
if
(
!
elForm
)
return
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
let
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
// 校验申请表单
if
(
!
fApi
.
value
)
return
valid
=
await
fApi
.
value
.
validate
()
if
(
!
valid
)
return
if
(
!
valid
)
return
// 2.1 提交审批
// 2.1 提交审批
...
@@ -216,6 +220,9 @@ const handleAudit = async (task, pass) => {
...
@@ -216,6 +220,9 @@ const handleAudit = async (task, pass) => {
await
formCreateApi
.
validate
()
await
formCreateApi
.
validate
()
data
.
variables
=
approveForms
.
value
[
index
].
value
data
.
variables
=
approveForms
.
value
[
index
].
value
}
}
// 获取表单可编辑字段的值
data
.
variables
=
getWritableValueOfForm
(
task
.
fieldsPermission
)
await
TaskApi
.
approveTask
(
data
)
await
TaskApi
.
approveTask
(
data
)
message
.
success
(
'审批通过成功'
)
message
.
success
(
'审批通过成功'
)
}
else
{
}
else
{
...
@@ -251,11 +258,11 @@ const handleSign = async (task: any) => {
...
@@ -251,11 +258,11 @@ const handleSign = async (task: any) => {
}
}
/** 获得详情 */
/** 获得详情 */
const
getDetail
=
()
=>
{
const
getDetail
=
async
()
=>
{
// 1. 获得流程实例相关
// 1. 获得流程任务列表(审批记录)。 需要先获取任务,表单的权限设置需要根据任务来设置
await
getTaskList
()
// 2. 获得流程实例相关
getProcessInstance
()
getProcessInstance
()
// 2. 获得流程任务列表(审批记录)
getTaskList
()
}
}
/** 加载流程实例 */
/** 加载流程实例 */
...
@@ -283,6 +290,15 @@ const getProcessInstance = async () => {
...
@@ -283,6 +290,15 @@ const getProcessInstance = async () => {
fApi
.
value
?.
btn
.
show
(
false
)
fApi
.
value
?.
btn
.
show
(
false
)
fApi
.
value
?.
resetBtn
.
show
(
false
)
fApi
.
value
?.
resetBtn
.
show
(
false
)
fApi
.
value
?.
disabled
(
true
)
fApi
.
value
?.
disabled
(
true
)
// 设置表单权限。后续需要改造成。只处理一个运行中的任务
if
(
runningTasks
.
value
.
length
>
0
)
{
const
task
=
runningTasks
.
value
.
at
(
0
)
if
(
task
.
fieldsPermission
)
{
Object
.
keys
(
task
.
fieldsPermission
).
forEach
((
item
)
=>
{
setFieldPermission
(
item
,
task
.
fieldsPermission
[
item
])
})
}
}
})
})
}
else
{
}
else
{
// 注意:data.processDefinition.formCustomViewPath 是组件的全路径,例如说:/crm/contract/detail/index.vue
// 注意:data.processDefinition.formCustomViewPath 是组件的全路径,例如说:/crm/contract/detail/index.vue
...
@@ -353,6 +369,7 @@ const loadRunningTask = (tasks) => {
...
@@ -353,6 +369,7 @@ const loadRunningTask = (tasks) => {
if
(
!
task
.
assigneeUser
||
task
.
assigneeUser
.
id
!==
userId
)
{
if
(
!
task
.
assigneeUser
||
task
.
assigneeUser
.
id
!==
userId
)
{
return
return
}
}
// 2.3 添加到处理任务
// 2.3 添加到处理任务
runningTasks
.
value
.
push
({
...
task
})
runningTasks
.
value
.
push
({
...
task
})
auditForms
.
value
.
push
({
auditForms
.
value
.
push
({
...
@@ -371,6 +388,35 @@ const loadRunningTask = (tasks) => {
...
@@ -371,6 +388,35 @@ const loadRunningTask = (tasks) => {
})
})
}
}
/**
* 设置表单权限
*/
const
setFieldPermission
=
(
field
:
string
,
permission
:
string
)
=>
{
if
(
permission
===
'1'
)
{
fApi
.
value
?.
disabled
(
true
,
field
)
}
if
(
permission
===
'2'
)
{
fApi
.
value
?.
disabled
(
false
,
field
)
}
if
(
permission
===
'3'
)
{
fApi
.
value
?.
hidden
(
true
,
field
)
}
}
/**
* 获取可以编辑字段的值
*/
const
getWritableValueOfForm
=
(
fieldsPermission
:
Object
)
=>
{
const
fieldsValue
=
{}
if
(
fieldsPermission
&&
fApi
.
value
)
{
Object
.
keys
(
fieldsPermission
).
forEach
((
item
)
=>
{
if
(
fieldsPermission
[
item
]
===
'2'
)
{
fieldsValue
[
item
]
=
fApi
.
value
.
getValue
(
item
)
}
})
}
return
fieldsValue
}
/** 初始化 */
/** 初始化 */
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
...
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