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
5968fc5f
authored
Aug 22, 2024
by
GoldenZqqq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 审批通过/拒绝以popover的形式来填写审批意见等信息并进行二次确认
parent
38e2063f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
212 additions
and
118 deletions
+212
-118
src/views/bpm/processInstance/detail/index_new.vue
+212
-118
No files found.
src/views/bpm/processInstance/detail/index_new.vue
View file @
5968fc5f
...
@@ -24,10 +24,7 @@
...
@@ -24,10 +24,7 @@
<el-row
:gutter=
"10"
>
<el-row
:gutter=
"10"
>
<el-col
:span=
"18"
class=
"!flex !flex-col"
>
<el-col
:span=
"18"
class=
"!flex !flex-col"
>
<!-- 表单信息 -->
<!-- 表单信息 -->
<div
<div
v-loading=
"processInstanceLoading"
class=
"form-box flex flex-col mb-30px flex-1"
>
v-loading=
"processInstanceLoading"
class=
"form-box border-1 border-solid border-[#ccc] p-20px flex flex-col mb-30px"
>
<!-- 情况一:流程表单 -->
<!-- 情况一:流程表单 -->
<el-col
<el-col
v-if=
"processInstance?.processDefinition?.formType === 10"
v-if=
"processInstance?.processDefinition?.formType === 10"
...
@@ -47,98 +44,167 @@
...
@@ -47,98 +44,167 @@
</div>
</div>
</div>
</div>
<!-- 审批信息 -->
<div
class=
"h-60px"
>
<el-divider
content-position=
"center"
v-if=
"runningTask"
>
<el-divider
class=
"!my-8px"
/>
<div
class=
"text-16px font-1000"
>
审批意见
</div>
<div
class=
"text-14px flex items-center color-#32373c font-bold btn-container"
>
</el-divider>
<el-popover
:visible=
"passVisible"
placement=
"top-end"
:width=
"500"
trigger=
"click"
>
<div
class=
"flex flex-col flex-1"
v-loading=
"processInstanceLoading"
>
<template
#
reference
>
<el-form
<el-button
plain
type=
"success"
@
click=
"openPopover('1')"
>
class=
"mb-auto"
<Icon
icon=
"ep:select"
/>
通过
ref=
"formRef"
</el-button>
:model=
"auditForm"
:rules=
"auditRule"
label-width=
"100px"
>
<el-form-item
v-if=
"processInstance && processInstance.startUser"
label=
"流程发起人"
>
{{
processInstance
?.
startUser
.
nickname
}}
<el-tag
size=
"small"
type=
"info"
class=
"ml-8px"
>
{{
processInstance
?.
startUser
.
deptName
}}
</el-tag>
</el-form-item>
<el-card
v-if=
"runningTask.formId > 0"
class=
"mb-15px !-mt-10px"
>
<template
#
header
>
<span
class=
"el-icon-picture-outline"
>
填写表单【
{{
runningTask
?.
formName
}}
】
</span>
</
template
>
</
template
>
<form-create
<div
class=
"flex flex-col flex-1 pt-20px px-20px"
v-loading=
"formLoading"
>
v-model=
"approveForm.value"
<el-form
v-model:api=
"approveFormFApi"
label-position=
"top"
:option=
"approveForm.option"
class=
"mb-auto"
:rule=
"approveForm.rule"
ref=
"formRef"
/>
:model=
"auditForm"
</el-card>
:rules=
"auditRule"
<el-form-item
label=
"审批建议"
prop=
"reason"
>
label-width=
"100px"
<el-input
>
v-model=
"auditForm.reason"
<el-form-item
placeholder=
"请输入审批建议"
v-if=
"processInstance && processInstance.startUser"
type=
"textarea"
label=
"流程发起人"
/>
>
</el-form-item>
{{ processInstance?.startUser.nickname }}
<el-form-item
label=
"抄送人"
prop=
"copyUserIds"
>
<el-tag
size=
"small"
type=
"info"
class=
"ml-8px"
>
<el-select
v-model=
"auditForm.copyUserIds"
multiple
placeholder=
"请选择抄送人"
>
{{ processInstance?.startUser.deptName }}
<el-option
</el-tag>
v-for=
"itemx in userOptions"
</el-form-item>
:key=
"itemx.id"
<el-card
v-if=
"runningTask.formId > 0"
class=
"mb-15px !-mt-10px"
>
:label=
"itemx.nickname"
<
template
#
header
>
:value=
"itemx.id"
<span
class=
"el-icon-picture-outline"
>
/>
填写表单【
{{
runningTask
?.
formName
}}
】
</el-select>
</span>
</el-form-item>
</
template
>
</el-form>
<form-create
<div
class=
"h-60px"
>
v-model=
"approveForm.value"
<el-divider
class=
"!my-8px"
/>
v-model:api=
"approveFormFApi"
<div
class=
"text-14px flex items-center color-#32373c font-bold"
>
:option=
"approveForm.option"
<el-button
plain
type=
"success"
@
click=
"handleAudit(true)"
>
:rule=
"approveForm.rule"
<Icon
icon=
"ep:select"
/>
通过
/>
</el-button>
</el-card>
<el-button
class=
"mr-20px"
plain
type=
"danger"
@
click=
"handleAudit(false)"
>
<el-form-item
label=
"审批建议"
prop=
"reason"
>
<Icon
icon=
"ep:close"
/>
拒绝
<el-input
</el-button>
v-model=
"auditForm.reason"
<div
placeholder=
"请输入审批建议"
class=
"mx-15px cursor-pointer !hover:color-#6db5ff flex items-center"
type=
"textarea"
@
click=
"handleSend"
/>
>
</el-form-item>
<Icon
:size=
"14"
icon=
"svg-icon:send"
/>
抄送
<el-form-item
label=
"抄送人"
prop=
"copyUserIds"
>
</div>
<el-select
<div
v-model=
"auditForm.copyUserIds"
class=
"mx-15px cursor-pointer !hover:color-#6db5ff flex items-center"
multiple
@
click=
"openTaskUpdateAssigneeForm"
placeholder=
"请选择抄送人"
>
>
<Icon
:size=
"14"
icon=
"fa:share-square-o"
/>
转交
<el-option
</div>
v-for=
"itemx in userOptions"
<div
:key=
"itemx.id"
class=
"mx-15px cursor-pointer !hover:color-#6db5ff flex items-center"
:label=
"itemx.nickname"
@
click=
"handleDelegate"
:value=
"itemx.id"
>
/>
<Icon
:size=
"14"
icon=
"ep:position"
/>
委派
</el-select>
</div>
</el-form-item>
<div
class=
"mx-15px cursor-pointer !hover:color-#6db5ff flex items-center"
<el-form-item>
@
click=
"handleSign"
<el-button
>
:disabled=
"formLoading"
<Icon
:size=
"14"
icon=
"ep:plus"
/>
加签
type=
"primary"
@
click=
"handleAudit(true)"
>
通过
</el-button>
<el-button
@
click=
"passVisible = false"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
</div>
<div
</el-popover>
class=
"mx-15px cursor-pointer !hover:color-#6db5ff flex items-center"
<el-popover
@
click=
"handleBack"
:visible=
"rejectVisible"
>
placement=
"top-end"
<Icon
:size=
"14"
icon=
"fa:mail-reply"
/>
退回
:width=
"500"
trigger=
"click"
>
<
template
#
reference
>
<el-button
class=
"mr-20px"
plain
type=
"danger"
@
click=
"openPopover('2')"
>
<Icon
icon=
"ep:close"
/>
拒绝
</el-button>
</
template
>
<div
class=
"flex flex-col flex-1 pt-20px px-20px"
v-loading=
"formLoading"
>
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"formRef"
:model=
"auditForm"
:rules=
"auditRule"
label-width=
"100px"
>
<el-form-item
v-if=
"processInstance && processInstance.startUser"
label=
"流程发起人"
>
{{ processInstance?.startUser.nickname }}
<el-tag
size=
"small"
type=
"info"
class=
"ml-8px"
>
{{ processInstance?.startUser.deptName }}
</el-tag>
</el-form-item>
<el-card
v-if=
"runningTask.formId > 0"
class=
"mb-15px !-mt-10px"
>
<
template
#
header
>
<span
class=
"el-icon-picture-outline"
>
填写表单【
{{
runningTask
?.
formName
}}
】
</span>
</
template
>
<form-create
v-model=
"approveForm.value"
v-model:api=
"approveFormFApi"
:option=
"approveForm.option"
:rule=
"approveForm.rule"
/>
</el-card>
<el-form-item
label=
"审批建议"
prop=
"reason"
>
<el-input
v-model=
"auditForm.reason"
placeholder=
"请输入审批建议"
type=
"textarea"
/>
</el-form-item>
<el-form-item
label=
"抄送人"
prop=
"copyUserIds"
>
<el-select
v-model=
"auditForm.copyUserIds"
multiple
placeholder=
"请选择抄送人"
>
<el-option
v-for=
"itemx in userOptions"
:key=
"itemx.id"
:label=
"itemx.nickname"
:value=
"itemx.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
:disabled=
"formLoading"
type=
"danger"
@
click=
"handleAudit(false)"
>
拒绝
</el-button>
<el-button
@
click=
"rejectVisible = false"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-popover>
<div
@
click=
"handleSend"
>
<Icon
:size=
"14"
icon=
"svg-icon:send"
/>
抄送
</div>
<div
@
click=
"openTaskUpdateAssigneeForm"
>
<Icon
:size=
"14"
icon=
"fa:share-square-o"
/>
转交
</div>
</div>
<div
@
click=
"handleDelegate"
>
<Icon
:size=
"14"
icon=
"ep:position"
/>
委派
</div>
<div
@
click=
"handleSign"
>
<Icon
:size=
"14"
icon=
"ep:plus"
/>
加签
</div>
<div
@
click=
"handleBack"
>
<Icon
:size=
"14"
icon=
"fa:mail-reply"
/>
退回
</div>
</div>
</div>
</div>
</div>
</el-col>
</el-col>
...
@@ -245,12 +311,16 @@ const { proxy } = getCurrentInstance() as any
...
@@ -245,12 +311,16 @@ const { proxy } = getCurrentInstance() as any
const
userId
=
useUserStore
().
getUser
.
id
// 当前登录的编号
const
userId
=
useUserStore
().
getUser
.
id
// 当前登录的编号
const
id
=
query
.
id
as
unknown
as
string
// 流程实例的编号
const
id
=
query
.
id
as
unknown
as
string
// 流程实例的编号
const
processInstanceLoading
=
ref
(
false
)
// 流程实例的加载中
const
processInstanceLoading
=
ref
(
false
)
// 流程实例的加载中
const
formLoading
=
ref
(
false
)
// 表单加载中
const
passVisible
=
ref
(
false
)
// 是否显示
const
rejectVisible
=
ref
(
false
)
// 是否显示
const
processInstance
=
ref
<
any
>
({})
// 流程实例
const
processInstance
=
ref
<
any
>
({})
// 流程实例
const
bpmnXml
=
ref
(
''
)
// BPMN XML
const
bpmnXml
=
ref
(
''
)
// BPMN XML
const
tasksLoad
=
ref
(
true
)
// 任务的加载中
const
tasksLoad
=
ref
(
true
)
// 任务的加载中
const
tasks
=
ref
<
any
[]
>
([])
// 任务列表
const
tasks
=
ref
<
any
[]
>
([])
// 任务列表
// ========== 审批信息 ==========
// ========== 审批信息 ==========
const
runningTask
=
ref
<
any
>
({})
// 运行中的任务
const
runningTask
=
ref
<
any
>
({})
// 运行中的任务
const
formRef
=
ref
()
const
auditForm
=
ref
<
any
>
({})
// 审批任务的表单
const
auditForm
=
ref
<
any
>
({})
// 审批任务的表单
const
auditRule
=
reactive
({
const
auditRule
=
reactive
({
reason
:
[{
required
:
true
,
message
:
'审批建议不能为空'
,
trigger
:
'blur'
}]
reason
:
[{
required
:
true
,
message
:
'审批建议不能为空'
,
trigger
:
'blur'
}]
...
@@ -280,35 +350,40 @@ watch(
...
@@ -280,35 +350,40 @@ watch(
/** 处理审批通过和不通过的操作 */
/** 处理审批通过和不通过的操作 */
const
handleAudit
=
async
(
pass
)
=>
{
const
handleAudit
=
async
(
pass
)
=>
{
const
auditFormRef
=
proxy
.
$refs
[
'formRef'
]
formLoading
.
value
=
true
// 1.2 校验表单
try
{
const
elForm
=
unref
(
auditFormRef
)
const
auditFormRef
=
proxy
.
$refs
[
'formRef'
]
if
(
!
elForm
)
return
// 1.2 校验表单
const
valid
=
await
elForm
.
validate
()
const
elForm
=
unref
(
auditFormRef
)
if
(
!
valid
)
return
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
// 2.1 提交审批
// 2.1 提交审批
const
data
=
{
const
data
=
{
id
:
runningTask
.
value
.
id
,
id
:
runningTask
.
value
.
id
,
reason
:
auditForm
.
value
.
reason
,
reason
:
auditForm
.
value
.
reason
,
copyUserIds
:
auditForm
.
value
.
copyUserIds
copyUserIds
:
auditForm
.
value
.
copyUserIds
}
}
if
(
pass
)
{
if
(
pass
)
{
// 审批通过,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
// 审批通过,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
const
formCreateApi
=
approveFormFApi
.
value
const
formCreateApi
=
approveFormFApi
.
value
if
(
formCreateApi
)
{
if
(
formCreateApi
)
{
await
formCreateApi
.
validate
()
await
formCreateApi
.
validate
()
// @ts-ignore
// @ts-ignore
data
.
variables
=
approveForm
.
value
.
value
data
.
variables
=
approveForm
.
value
.
value
}
await
TaskApi
.
approveTask
(
data
)
message
.
success
(
'审批通过成功'
)
}
else
{
await
TaskApi
.
rejectTask
(
data
)
message
.
success
(
'审批不通过成功'
)
}
}
await
TaskApi
.
approveTask
(
data
)
// 2.2 加载最新数据
message
.
success
(
'审批通过成功'
)
getDetail
()
}
else
{
}
finally
{
await
TaskApi
.
rejectTask
(
data
)
formLoading
.
value
=
false
message
.
success
(
'审批不通过成功'
)
}
}
// 2.2 加载最新数据
getDetail
()
}
}
/** 转派审批人 */
/** 转派审批人 */
...
@@ -457,6 +532,13 @@ const loadRunningTask = (tasks) => {
...
@@ -457,6 +532,13 @@ const loadRunningTask = (tasks) => {
/* 抄送 TODO */
/* 抄送 TODO */
const
handleSend
=
()
=>
{}
const
handleSend
=
()
=>
{}
const
openPopover
=
(
flag
)
=>
{
passVisible
.
value
=
false
rejectVisible
.
value
=
false
formRef
.
value
.
resetFields
()
flag
===
'1'
?
(
passVisible
.
value
=
true
)
:
(
rejectVisible
.
value
=
true
)
}
/** 初始化 */
/** 初始化 */
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -507,4 +589,16 @@ const activities = [
...
@@ -507,4 +589,16 @@ const activities = [
border
:
none
;
border
:
none
;
}
}
}
}
.btn-container
{
>
div
{
margin
:
0
15px
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
&:hover
{
color
:
#6db5ff
;
}
}
}
</
style
>
</
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