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