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
cff65aa9
authored
Dec 08, 2024
by
jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【缺陷修复】修复审批意见校验的问题
parent
a6de16a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
217 additions
and
146 deletions
+217
-146
src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue
+217
-146
No files found.
src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue
View file @
cff65aa9
...
...
@@ -20,9 +20,9 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
approveF
ormRef"
:model=
"
approveReason
Form"
:rules=
"
approveReason
Rule"
label-width=
"100px"
>
<el-card
v-if=
"runningTask?.formId > 0"
class=
"mb-15px !-mt-10px"
>
...
...
@@ -38,17 +38,17 @@
</el-card>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
approveReason
Form.reason"
placeholder=
"请输入审批意见"
type=
"textarea"
:rows=
"4"
/>
</el-form-item>
<el-form-item>
<el-button
:disabled=
"formLoading"
type=
"success"
@
click=
"handleAudit(true)"
>
<el-button
:disabled=
"formLoading"
type=
"success"
@
click=
"handleAudit(true
, approveFormRef
)"
>
{{ getButtonDisplayName(OperationButtonType.APPROVE) }}
</el-button>
<el-button
@
click=
"
popOverVisible.approve = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('approve', approveFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -72,24 +72,24 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
rejectF
ormRef"
:model=
"
rejectReason
Form"
:rules=
"
rejectReason
Rule"
label-width=
"100px"
>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
rejectReason
Form.reason"
placeholder=
"请输入审批意见"
type=
"textarea"
:rows=
"4"
/>
</el-form-item>
<el-form-item>
<el-button
:disabled=
"formLoading"
type=
"danger"
@
click=
"handleAudit(false)"
>
<el-button
:disabled=
"formLoading"
type=
"danger"
@
click=
"handleAudit(false
,rejectFormRef
)"
>
{{ getButtonDisplayName(OperationButtonType.REJECT) }}
</el-button>
<el-button
@
click=
"
popOverVisible.reject = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('reject', rejectFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -113,14 +113,14 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
copyF
ormRef"
:model=
"
copy
Form"
:rules=
"
copyForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"抄送人"
prop=
"copyUserIds"
>
<el-select
v-model=
"
generic
Form.copyUserIds"
v-model=
"
copy
Form.copyUserIds"
clearable
style=
"width: 100%"
multiple
...
...
@@ -136,7 +136,7 @@
</el-form-item>
<el-form-item
label=
"抄送意见"
prop=
"copyReason"
>
<el-input
v-model=
"
generic
Form.copyReason"
v-model=
"
copy
Form.copyReason"
clearable
placeholder=
"请输入抄送意见"
type=
"textarea"
...
...
@@ -147,13 +147,13 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handleCopy"
>
{{ getButtonDisplayName(OperationButtonType.COPY) }}
</el-button>
<el-button
@
click=
"
popOverVisible.copy = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('copy', copyFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
</el-popover>
<!-- 【转
交
】按钮 -->
<!-- 【转
办
】按钮 -->
<el-popover
:visible=
"popOverVisible.transfer"
placement=
"top-start"
...
...
@@ -171,13 +171,13 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
transferF
ormRef"
:model=
"
transfer
Form"
:rules=
"
transferForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"新审批人"
prop=
"assigneeUserId"
>
<el-select
v-model=
"
generic
Form.assigneeUserId"
clearable
style=
"width: 100%"
>
<el-select
v-model=
"
transfer
Form.assigneeUserId"
clearable
style=
"width: 100%"
>
<el-option
v-for=
"item in userOptions"
:key=
"item.id"
...
...
@@ -188,7 +188,7 @@
</el-form-item>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
transfer
Form.reason"
clearable
placeholder=
"请输入审批意见"
type=
"textarea"
...
...
@@ -199,7 +199,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handleTransfer()"
>
{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
</el-button>
<el-button
@
click=
"
popOverVisible.transfer = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('transfer', transferFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -223,13 +223,13 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
delegateF
ormRef"
:model=
"
delegate
Form"
:rules=
"
delegateForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"接收人"
prop=
"delegateUserId"
>
<el-select
v-model=
"
generic
Form.delegateUserId"
clearable
style=
"width: 100%"
>
<el-select
v-model=
"
delegate
Form.delegateUserId"
clearable
style=
"width: 100%"
>
<el-option
v-for=
"item in userOptions"
:key=
"item.id"
...
...
@@ -240,7 +240,7 @@
</el-form-item>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
delegate
Form.reason"
clearable
placeholder=
"请输入审批意见"
type=
"textarea"
...
...
@@ -251,7 +251,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handleDelegate()"
>
{{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
</el-button>
<el-button
@
click=
"
popOverVisible.delegate = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('delegate', delegateFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -275,13 +275,13 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
addSignF
ormRef"
:model=
"
addSign
Form"
:rules=
"
addSignForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"加签处理人"
prop=
"addSignUserIds"
>
<el-select
v-model=
"
generic
Form.addSignUserIds"
multiple
clearable
style=
"width: 100%"
>
<el-select
v-model=
"
addSign
Form.addSignUserIds"
multiple
clearable
style=
"width: 100%"
>
<el-option
v-for=
"item in userOptions"
:key=
"item.id"
...
...
@@ -292,7 +292,7 @@
</el-form-item>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
addSign
Form.reason"
clearable
placeholder=
"请输入审批意见"
type=
"textarea"
...
...
@@ -306,7 +306,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handlerAddSign('after')"
>
向后{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
</el-button>
<el-button
@
click=
"
popOverVisible.addSign = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('addSign', addSignFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -329,13 +329,13 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
deleteSignF
ormRef"
:model=
"
deleteSign
Form"
:rules=
"
deleteSignForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"减签人员"
prop=
"deleteSignTaskId"
>
<el-select
v-model=
"
generic
Form.deleteSignTaskId"
clearable
style=
"width: 100%"
>
<el-select
v-model=
"
deleteSign
Form.deleteSignTaskId"
clearable
style=
"width: 100%"
>
<el-option
v-for=
"item in runningTask.children"
:key=
"item.id"
...
...
@@ -346,7 +346,7 @@
</el-form-item>
<el-form-item
label=
"审批意见"
prop=
"reason"
>
<el-input
v-model=
"
generic
Form.reason"
v-model=
"
deleteSign
Form.reason"
clearable
placeholder=
"请输入审批意见"
type=
"textarea"
...
...
@@ -357,7 +357,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handlerDeleteSign()"
>
减签
</el-button>
<el-button
@
click=
"
popOverVisible.deleteSign = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('deleteSign', deleteSignFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -372,7 +372,7 @@
v-if=
"runningTask && isHandleTaskStatus() && isShowButton(OperationButtonType.RETURN)"
>
<
template
#
reference
>
<div
@
click=
"open
ReturnPopover
"
class=
"hover-bg-gray-100 rounded-xl p-6px"
>
<div
@
click=
"open
Popover('return')
"
class=
"hover-bg-gray-100 rounded-xl p-6px"
>
<Icon
:size=
"14"
icon=
"ep:back"
/>
{{
getButtonDisplayName
(
OperationButtonType
.
RETURN
)
}}
</div>
...
...
@@ -381,13 +381,13 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
returnF
ormRef"
:model=
"
return
Form"
:rules=
"
returnForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"退回节点"
prop=
"targetTaskDefinitionKey"
>
<el-select
v-model=
"
generic
Form.targetTaskDefinitionKey"
clearable
style=
"width: 100%"
>
<el-select
v-model=
"
return
Form.targetTaskDefinitionKey"
clearable
style=
"width: 100%"
>
<el-option
v-for=
"item in returnList"
:key=
"item.taskDefinitionKey"
...
...
@@ -398,7 +398,7 @@
</el-form-item>
<el-form-item
label=
"退回理由"
prop=
"returnReason"
>
<el-input
v-model=
"
generic
Form.returnReason"
v-model=
"
return
Form.returnReason"
clearable
placeholder=
"请输入退回理由"
type=
"textarea"
...
...
@@ -409,7 +409,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handleReturn()"
>
{{ getButtonDisplayName(OperationButtonType.RETURN) }}
</el-button>
<el-button
@
click=
"
popOverVisible.return = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('return', returnFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -434,15 +434,15 @@
<el-form
label-position=
"top"
class=
"mb-auto"
ref=
"
f
ormRef"
:model=
"
generic
Form"
:rules=
"
generic
Rule"
ref=
"
cancelF
ormRef"
:model=
"
cancel
Form"
:rules=
"
cancelForm
Rule"
label-width=
"100px"
>
<el-form-item
label=
"取消理由"
prop=
"cancelReason"
>
<span
class=
"text-#878c93 text-12px"
>
取消后,该审批流程将自动结束
</span>
<el-input
v-model=
"
generic
Form.cancelReason"
v-model=
"
cancel
Form.cancelReason"
clearable
placeholder=
"请输入取消理由"
type=
"textarea"
...
...
@@ -453,7 +453,7 @@
<el-button
:disabled=
"formLoading"
type=
"primary"
@
click=
"handleCancel()"
>
取消
</el-button>
<el-button
@
click=
"
popOverVisible.cancel = false
"
>
取消
</el-button>
<el-button
@
click=
"
closePropover('cancel', cancelFormRef)
"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -483,11 +483,11 @@ import {
OPERATION_BUTTON_NAME
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
import
{
BpmProcessInstanceStatus
,
BpmModelFormType
}
from
'@/utils/constants'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
defineOptions
({
name
:
'ProcessInstanceBtnContainer'
})
const
router
=
useRouter
()
// 路由
const
message
=
useMessage
()
// 消息弹窗
const
{
proxy
}
=
getCurrentInstance
()
as
any
const
userId
=
useUserStoreWithOut
().
getUser
.
id
// 当前登录的编号
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
...
...
@@ -517,21 +517,99 @@ const returnList = ref([] as any) // 退回节点
// ========== 审批信息 ==========
const
runningTask
=
ref
<
any
>
()
// 运行中的任务
const
genericForm
=
ref
<
any
>
({})
// 通用表单
const
approveForm
=
ref
<
any
>
({})
// 审批通过时,额外的补充信息
const
approveFormFApi
=
ref
<
any
>
({})
// approveForms 的 fAPi
const
formRef
=
ref
()
const
genericRule
=
reactive
({
// 审批通过意见表单
const
approveFormRef
=
ref
<
FormInstance
>
()
const
approveReasonForm
=
reactive
({
reason
:
''
})
const
approveReasonRule
=
reactive
<
FormRules
<
typeof
approveReasonForm
>>
({
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
returnReason
:
[{
required
:
true
,
message
:
'退回理由不能为空'
,
trigger
:
'blur'
}],
cancelReason
:
[{
required
:
true
,
message
:
'取消理由不能为空'
,
trigger
:
'blur'
}],
copyUserIds
:
[{
required
:
true
,
message
:
'抄送人不能为空'
,
trigger
:
'change'
}],
})
// 拒绝表单
const
rejectFormRef
=
ref
<
FormInstance
>
()
const
rejectReasonForm
=
reactive
({
reason
:
''
})
const
rejectReasonRule
=
reactive
<
FormRules
<
typeof
rejectReasonForm
>>
({
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
})
// 抄送表单
const
copyFormRef
=
ref
<
FormInstance
>
()
const
copyForm
=
reactive
({
copyUserIds
:
[],
copyReason
:
''
})
const
copyFormRule
=
reactive
<
FormRules
<
typeof
copyForm
>>
({
copyUserIds
:
[{
required
:
true
,
message
:
'抄送人不能为空'
,
trigger
:
'change'
}]
})
// 转办表单
const
transferFormRef
=
ref
<
FormInstance
>
()
const
transferForm
=
reactive
({
assigneeUserId
:
undefined
,
reason
:
''
})
const
transferFormRule
=
reactive
<
FormRules
<
typeof
transferForm
>>
({
assigneeUserId
:
[{
required
:
true
,
message
:
'新审批人不能为空'
,
trigger
:
'change'
}],
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
})
// 委派表单
const
delegateFormRef
=
ref
<
FormInstance
>
()
const
delegateForm
=
reactive
({
delegateUserId
:
undefined
,
reason
:
''
})
const
delegateFormRule
=
reactive
<
FormRules
<
typeof
delegateForm
>>
({
delegateUserId
:
[{
required
:
true
,
message
:
'接收人不能为空'
,
trigger
:
'change'
}],
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
})
// 加签表单
const
addSignFormRef
=
ref
<
FormInstance
>
()
const
addSignForm
=
reactive
({
addSignUserIds
:
undefined
,
reason
:
''
})
const
addSignFormRule
=
reactive
<
FormRules
<
typeof
addSignForm
>>
({
addSignUserIds
:
[{
required
:
true
,
message
:
'加签处理人不能为空'
,
trigger
:
'change'
}],
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
})
// 减签表单
const
deleteSignFormRef
=
ref
<
FormInstance
>
()
const
deleteSignForm
=
reactive
({
deleteSignTaskId
:
undefined
,
reason
:
''
})
const
deleteSignFormRule
=
reactive
<
FormRules
<
typeof
deleteSignForm
>>
({
deleteSignTaskId
:
[{
required
:
true
,
message
:
'减签人员不能为空'
,
trigger
:
'change'
}],
targetTaskDefinitionKey
:
[{
required
:
true
,
message
:
'退回节点不能为空'
,
trigger
:
'change'
}]
})
// 表单校验规则
reason
:
[{
required
:
true
,
message
:
'审批意见不能为空'
,
trigger
:
'blur'
}],
})
// 退回表单
const
returnFormRef
=
ref
<
FormInstance
>
()
const
returnForm
=
reactive
({
targetTaskDefinitionKey
:
undefined
,
returnReason
:
''
})
const
returnFormRule
=
reactive
<
FormRules
<
typeof
returnForm
>>
({
targetTaskDefinitionKey
:
[{
required
:
true
,
message
:
'退回节点不能为空'
,
trigger
:
'change'
}],
returnReason
:
[{
required
:
true
,
message
:
'退回理由不能为空'
,
trigger
:
'blur'
}]
})
// 取消表单
const
cancelFormRef
=
ref
<
FormInstance
>
()
const
cancelForm
=
reactive
({
cancelReason
:
''
})
const
cancelFormRule
=
reactive
<
FormRules
<
typeof
cancelForm
>>
({
cancelReason
:
[{
required
:
true
,
message
:
'取消理由不能为空'
,
trigger
:
'blur'
}],
})
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
watch
(
...
...
@@ -545,71 +623,79 @@ watch(
}
)
/** 弹出退回气泡卡 */
const
openReturnPopover
=
async
()
=>
{
returnList
.
value
=
await
TaskApi
.
getTaskListByReturn
(
runningTask
.
value
.
id
)
if
(
returnList
.
value
.
length
===
0
)
{
message
.
warning
(
'当前没有可退回的节点'
)
return
}
await
openPopover
(
'return'
)
}
/** 弹出气泡卡 */
const
openPopover
=
async
(
type
:
string
)
=>
{
if
(
type
===
'approve'
)
{
// 校验流程表单
const
valid
=
await
validateNormalForm
();
if
(
!
valid
)
{
message
.
error
(
'表单校验不通过,请先完善表单!!'
)
message
.
warning
(
'表单校验不通过,请先完善表单!!'
)
return
;
}
}
if
(
type
===
'return'
)
{
// 获取退回节点
returnList
.
value
=
await
TaskApi
.
getTaskListByReturn
(
runningTask
.
value
.
id
)
if
(
returnList
.
value
.
length
===
0
)
{
message
.
warning
(
'当前没有可退回的节点'
)
return
}
}
Object
.
keys
(
popOverVisible
.
value
).
forEach
((
item
)
=>
{
popOverVisible
.
value
[
item
]
=
item
===
type
})
await
nextTick
()
formRef
.
value
.
resetFields
()
// await nextTick()
// formRef.value.resetFields()
}
/** 关闭气泡卡 */
const
closePropover
=
(
type
:
string
,
formRef
:
FormInstance
|
undefined
)
=>
{
if
(
formRef
)
{
formRef
.
resetFields
()
}
popOverVisible
.
value
[
type
]
=
false
}
/** 处理审批通过和不通过的操作 */
const
handleAudit
=
async
(
pass
:
boolean
)
=>
{
const
handleAudit
=
async
(
pass
:
boolean
,
formRef
:
FormInstance
|
undefined
)
=>
{
formLoading
.
value
=
true
try
{
// 校验审批表单
const
genericFormRef
=
proxy
.
$refs
[
'formRef'
]
const
elForm
=
unref
(
genericFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
// 提交审批
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
genericForm
.
value
.
reason
,
}
// 校验表单
if
(
!
formRef
)
return
await
formRef
.
validate
()
if
(
pass
)
{
// 获取修改的流程变量, 暂时只支持流程表单
const
variables
=
getUpdatedProcessInstanceVaiables
();
// 审批通过, 把修改的字段值赋于流程实例变量
// @ts-ignore
data
.
variables
=
variables
// 审批通过,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
const
variables
=
getUpdatedProcessInstanceVaiables
();
// 审批通过数据
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
approveReasonForm
.
reason
,
variables
// 审批通过, 把修改的字段值赋于流程实例变量
}
// 多表单处理,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
// TODO 芋艿 任务有多表单这里要如何处理,会和可编辑的字段冲突
const
formCreateApi
=
approveFormFApi
.
value
if
(
Object
.
keys
(
formCreateApi
)?.
length
>
0
)
{
await
formCreateApi
.
validate
()
// @ts-ignore
// TODO 芋艿 任务有多表单这里要如何处理,会和可编辑的字段冲突
data
.
variables
=
approveForm
.
value
.
value
}
await
TaskApi
.
approveTask
(
data
)
popOverVisible
.
value
.
approve
=
false
message
.
success
(
'审批通过成功'
)
}
else
{
// 审批不通过数据
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
rejectReasonForm
.
reason
,
}
await
TaskApi
.
rejectTask
(
data
)
popOverVisible
.
value
.
reject
=
false
message
.
success
(
'审批不通过成功'
)
}
// 2.2 加载最新数据
// 重置表单
formRef
.
resetFields
()
// 加载最新数据
reload
()
}
finally
{
formLoading
.
value
=
false
...
...
@@ -620,19 +706,17 @@ const handleAudit = async (pass: boolean) => {
const
handleCopy
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
copyFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1. 校验表单
const
elForm
=
unref
(
copyFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
copyFormRef
.
value
)
return
await
copyFormRef
.
value
.
validate
()
// 2. 提交抄送
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
genericForm
.
value
.
copyReason
,
copyUserIds
:
genericForm
.
value
.
copyUserIds
reason
:
copyForm
.
copyReason
,
copyUserIds
:
copyForm
.
copyUserIds
}
await
TaskApi
.
copyTask
(
data
)
copyFormRef
.
value
.
resetFields
()
popOverVisible
.
value
.
copy
=
false
message
.
success
(
'操作成功'
)
}
finally
{
...
...
@@ -644,20 +728,17 @@ const handleCopy = async () => {
const
handleTransfer
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
transferFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
transferFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
transferFormRef
.
value
)
return
await
transferFormRef
.
value
.
validate
()
// 1.2 提交转交
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
genericForm
.
value
.
reason
,
assigneeUserId
:
genericForm
.
value
.
assigneeUserId
reason
:
transferForm
.
reason
,
assigneeUserId
:
transferForm
.
assigneeUserId
}
await
TaskApi
.
transferTask
(
data
)
transferFormRef
.
value
.
resetFields
()
popOverVisible
.
value
.
transfer
=
false
message
.
success
(
'操作成功'
)
// 2. 加载最新数据
...
...
@@ -671,21 +752,20 @@ const handleTransfer = async () => {
const
handleDelegate
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
deletegateFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
deletegateFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
delegateFormRef
.
value
)
return
await
delegateFormRef
.
value
.
validate
()
// 1.2 处理委派
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
genericForm
.
value
.
reason
,
delegateUserId
:
genericForm
.
value
.
delegateUserId
reason
:
delegateForm
.
reason
,
delegateUserId
:
delegateForm
.
delegateUserId
}
await
TaskApi
.
delegateTask
(
data
)
popOverVisible
.
value
.
delegate
=
false
delegateFormRef
.
value
.
resetFields
()
message
.
success
(
'操作成功'
)
// 2. 加载最新数据
reload
()
...
...
@@ -698,21 +778,19 @@ const handleDelegate = async () => {
const
handlerAddSign
=
async
(
type
:
string
)
=>
{
formLoading
.
value
=
true
try
{
const
transferFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
transferFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
addSignFormRef
.
value
)
return
await
addSignFormRef
.
value
.
validate
()
// 1.2 提交加签
const
data
=
{
id
:
runningTask
.
value
.
id
,
type
,
reason
:
genericForm
.
value
.
reason
,
userIds
:
genericForm
.
value
.
addSignUserIds
reason
:
addSignForm
.
reason
,
userIds
:
addSignForm
.
addSignUserIds
}
await
TaskApi
.
signCreateTask
(
data
)
message
.
success
(
'操作成功'
)
addSignFormRef
.
value
.
resetFields
()
popOverVisible
.
value
.
addSign
=
false
// 2 加载最新数据
reload
()
...
...
@@ -725,21 +803,19 @@ const handlerAddSign = async (type: string) => {
const
handleReturn
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
returnFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
returnFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
returnFormRef
.
value
)
return
await
returnFormRef
.
value
.
validate
()
// 1.2 提交退回
const
data
=
{
id
:
runningTask
.
value
.
id
,
reason
:
genericForm
.
value
.
returnReason
,
targetTaskDefinitionKey
:
genericForm
.
value
.
targetTaskDefinitionKey
reason
:
returnForm
.
returnReason
,
targetTaskDefinitionKey
:
returnForm
.
targetTaskDefinitionKey
}
await
TaskApi
.
returnTask
(
data
)
popOverVisible
.
value
.
return
=
false
returnFormRef
.
value
.
resetFields
()
message
.
success
(
'操作成功'
)
// 2 重新加载数据
reload
()
...
...
@@ -752,19 +828,17 @@ const handleReturn = async () => {
const
handleCancel
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
cancelFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
cancelFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
cancelFormRef
.
value
)
return
await
cancelFormRef
.
value
.
validate
()
// 1.2 提交取消
await
ProcessInstanceApi
.
cancelProcessInstanceByStartUser
(
props
.
processInstance
.
id
,
genericForm
.
value
.
cancelReason
cancelForm
.
cancelReason
)
popOverVisible
.
value
.
return
=
false
message
.
success
(
'操作成功'
)
cancelFormRef
.
value
.
resetFields
()
// 2 重新加载数据
reload
()
}
finally
{
...
...
@@ -791,19 +865,17 @@ const getDeleteSignUserLabel = (task: any): string => {
const
handlerDeleteSign
=
async
()
=>
{
formLoading
.
value
=
true
try
{
const
deleteFormRef
=
proxy
.
$refs
[
'formRef'
]
// 1.1 校验表单
const
elForm
=
unref
(
deleteFormRef
)
if
(
!
elForm
)
return
const
valid
=
await
elForm
.
validate
()
if
(
!
valid
)
return
if
(
!
deleteSignFormRef
.
value
)
return
await
deleteSignFormRef
.
value
.
validate
()
// 1.2 提交减签
const
data
=
{
id
:
genericForm
.
value
.
deleteSignTaskId
,
reason
:
genericForm
.
value
.
reason
id
:
deleteSignForm
.
deleteSignTaskId
,
reason
:
deleteSignForm
.
reason
}
await
TaskApi
.
signDeleteTask
(
data
)
message
.
success
(
'减签成功'
)
deleteSignFormRef
.
value
.
resetFields
()
popOverVisible
.
value
.
deleteSign
=
false
// 2 加载最新数据
reload
()
...
...
@@ -857,7 +929,6 @@ const getButtonDisplayName = (btnType: OperationButtonType) => {
}
const
loadTodoTask
=
(
task
:
any
)
=>
{
genericForm
.
value
=
{}
approveForm
.
value
=
{}
approveFormFApi
.
value
=
{}
runningTask
.
value
=
task
...
...
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