【功能修改】 新审批页面增加减签
parent
6b06f320b9
commit
842fe09e8b
|
@ -9,10 +9,10 @@ export enum TaskStatusEnum {
|
|||
*/
|
||||
NOT_START = -1,
|
||||
|
||||
/**
|
||||
/**
|
||||
* 待审批
|
||||
*/
|
||||
WAIT = 0,
|
||||
WAIT = 0,
|
||||
/**
|
||||
* 审批中
|
||||
*/
|
||||
|
@ -42,8 +42,7 @@ export enum TaskStatusEnum {
|
|||
/**
|
||||
* 审批通过中
|
||||
*/
|
||||
APPROVING = 7,
|
||||
|
||||
APPROVING = 7
|
||||
}
|
||||
|
||||
export type TaskVO = {
|
||||
|
@ -111,6 +110,11 @@ export const copyTask = async (data: any) => {
|
|||
return await request.put({ url: '/bpm/task/copy', data })
|
||||
}
|
||||
|
||||
// 获取我的待办任务
|
||||
export const myTodoTask = async (processInstanceId: string) => {
|
||||
return await request.get({ url: '/bpm/task/my-todo?processInstanceId=' + processInstanceId })
|
||||
}
|
||||
|
||||
// 获取减签任务列表
|
||||
export const getChildrenTaskList = async (id: string) => {
|
||||
return await request.get({ url: '/bpm/task/list-by-parent-task-id?parentTaskId=' + id })
|
||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8.7 KiB |
|
@ -292,8 +292,8 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||
},
|
||||
{
|
||||
path: 'process-instance/detail',
|
||||
// component: () => import('@/views/bpm/processInstance/detail/index_new.vue'),
|
||||
component: () => import('@/views/bpm/processInstance/detail/index.vue'),
|
||||
component: () => import('@/views/bpm/processInstance/detail/index_new.vue'),
|
||||
//component: () => import('@/views/bpm/processInstance/detail/index.vue'),
|
||||
name: 'BpmProcessInstanceDetail',
|
||||
meta: {
|
||||
noCache: true,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div
|
||||
class="h-50px bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container"
|
||||
v-if="runningTask.id"
|
||||
v-if="runningTask && runningTask.id"
|
||||
>
|
||||
<!-- 【通过】按钮 -->
|
||||
<el-popover
|
||||
|
@ -9,7 +9,7 @@
|
|||
placement="top-end"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.APPROVE)"
|
||||
v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.APPROVE)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button plain type="success" @click="openPopover('approve')">
|
||||
|
@ -38,7 +38,12 @@
|
|||
/>
|
||||
</el-card>
|
||||
<el-form-item label="审批意见" prop="reason">
|
||||
<el-input v-model="genericForm.reason" placeholder="请输入审批意见" type="textarea" :rows="4" />
|
||||
<el-input
|
||||
v-model="genericForm.reason"
|
||||
placeholder="请输入审批意见"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="success" @click="handleAudit(true)">
|
||||
|
@ -56,7 +61,7 @@
|
|||
placement="top-end"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.REJECT)"
|
||||
v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.REJECT)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button class="mr-20px" plain type="danger" @click="openPopover('reject')">
|
||||
|
@ -85,7 +90,12 @@
|
|||
/>
|
||||
</el-card>
|
||||
<el-form-item label="审批意见" prop="reason">
|
||||
<el-input v-model="genericForm.reason" placeholder="请输入审批意见" type="textarea" :rows="4" />
|
||||
<el-input
|
||||
v-model="genericForm.reason"
|
||||
placeholder="请输入审批意见"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="danger" @click="handleAudit(false)">
|
||||
|
@ -103,10 +113,10 @@
|
|||
placement="top-start"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.COPY)"
|
||||
v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.COPY)"
|
||||
>
|
||||
<template #reference>
|
||||
<div @click="openPopover('copy')" class="hover-bg-gray-100 rounded-xl p-6px" >
|
||||
<div @click="openPopover('copy')" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||
<Icon :size="14" icon="svg-icon:send" />
|
||||
{{ getButtonDisplayName(OperationButtonType.COPY) }}
|
||||
</div>
|
||||
|
@ -120,9 +130,14 @@
|
|||
:rules="genericRule"
|
||||
label-width="100px"
|
||||
>
|
||||
|
||||
<el-form-item label="抄送人" prop="copyUserIds">
|
||||
<el-select v-model="genericForm.copyUserIds" clearable style="width: 100%" multiple placeholder="请选择抄送人">
|
||||
<el-select
|
||||
v-model="genericForm.copyUserIds"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
multiple
|
||||
placeholder="请选择抄送人"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
|
@ -132,7 +147,13 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="抄送意见" prop="copyReason">
|
||||
<el-input v-model="genericForm.copyReason" clearable placeholder="请输入抄送意见" type="textarea" :rows="3" />
|
||||
<el-input
|
||||
v-model="genericForm.copyReason"
|
||||
clearable
|
||||
placeholder="请输入抄送意见"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
|
@ -151,10 +172,10 @@
|
|||
placement="top-start"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.TRANSFER)"
|
||||
v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.TRANSFER)"
|
||||
>
|
||||
<template #reference>
|
||||
<div @click="openPopover('transfer')" class="hover-bg-gray-100 rounded-xl p-6px" >
|
||||
<div @click="openPopover('transfer')" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||
<Icon :size="14" icon="fa:share-square-o" />
|
||||
{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
|
||||
</div>
|
||||
|
@ -168,7 +189,6 @@
|
|||
:rules="genericRule"
|
||||
label-width="100px"
|
||||
>
|
||||
|
||||
<el-form-item label="新审批人" prop="assigneeUserId">
|
||||
<el-select v-model="genericForm.assigneeUserId" clearable style="width: 100%">
|
||||
<el-option
|
||||
|
@ -180,12 +200,17 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批意见" prop="reason">
|
||||
<el-input v-model="genericForm.reason" clearable placeholder="请输入审批意见" type="textarea" :rows="3" />
|
||||
<el-input
|
||||
v-model="genericForm.reason"
|
||||
clearable
|
||||
placeholder="请输入审批意见"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="primary" @click="handleTransfer()">
|
||||
<el-button :disabled="formLoading" type="primary" @click="handleTransfer()">
|
||||
{{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
|
||||
</el-button>
|
||||
<el-button @click="popOverVisible.transfer = false"> 取消 </el-button>
|
||||
|
@ -200,10 +225,10 @@
|
|||
placement="top-start"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.DELEGATE)"
|
||||
v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.DELEGATE)"
|
||||
>
|
||||
<template #reference>
|
||||
<div @click="openPopover('delegate')" class="hover-bg-gray-100 rounded-xl p-6px" >
|
||||
<div @click="openPopover('delegate')" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||
<Icon :size="14" icon="ep:position" />
|
||||
{{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
|
||||
</div>
|
||||
|
@ -230,7 +255,13 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="审批意见" prop="reason">
|
||||
<el-input v-model="genericForm.reason" clearable placeholder="请输入审批意见" type="textarea" :rows="3" />
|
||||
<el-input
|
||||
v-model="genericForm.reason"
|
||||
clearable
|
||||
placeholder="请输入审批意见"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
|
@ -241,7 +272,6 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
</el-popover>
|
||||
|
||||
<!-- 【加签】按钮 当前任务审批人为A,向前加签选了一个C,则需要C先审批,然后再是A审批,向后加签B,A审批完,需要B再审批完,才算完成这个任务节点 -->
|
||||
|
@ -250,10 +280,10 @@
|
|||
placement="top-start"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.ADD_SIGN)"
|
||||
v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.ADD_SIGN)"
|
||||
>
|
||||
<template #reference>
|
||||
<div @click="openPopover('addSign')" class="hover-bg-gray-100 rounded-xl p-6px" >
|
||||
<div @click="openPopover('addSign')" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||
<Icon :size="14" icon="ep:plus" />
|
||||
{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
|
||||
</div>
|
||||
|
@ -280,7 +310,13 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="审批意见" prop="reason">
|
||||
<el-input v-model="genericForm.reason" clearable placeholder="请输入审批意见" type="textarea" :rows="3" />
|
||||
<el-input
|
||||
v-model="genericForm.reason"
|
||||
clearable
|
||||
placeholder="请输入审批意见"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="primary" @click="handlerAddSign('before')">
|
||||
|
@ -295,17 +331,25 @@
|
|||
</div>
|
||||
</el-popover>
|
||||
|
||||
<!-- TODO @jason:减签 -->
|
||||
<!-- 【减签】按钮 -->
|
||||
<div
|
||||
@click="openChildrenTask()"
|
||||
class="hover-bg-gray-100 rounded-xl p-6px"
|
||||
v-if="runningTask.children"
|
||||
>
|
||||
<Icon :size="14" icon="ep:semi-select" /> 减签
|
||||
</div>
|
||||
|
||||
<!-- 【退回】按钮 -->
|
||||
<el-popover
|
||||
:visible="popOverVisible.return"
|
||||
placement="top-start"
|
||||
:width="420"
|
||||
trigger="click"
|
||||
v-if="isShowButton(OperationButtonType.RETURN)"
|
||||
v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.RETURN)"
|
||||
>
|
||||
<template #reference>
|
||||
<div @click="openReturnPopover" class="hover-bg-gray-100 rounded-xl p-6px" >
|
||||
<div @click="openReturnPopover" class="hover-bg-gray-100 rounded-xl p-6px">
|
||||
<Icon :size="14" icon="fa:mail-reply" />
|
||||
{{ getButtonDisplayName(OperationButtonType.RETURN) }}
|
||||
</div>
|
||||
|
@ -320,20 +364,26 @@
|
|||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="退回节点" prop="targetTaskDefinitionKey">
|
||||
<el-select v-model="genericForm.targetTaskDefinitionKey" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in returnList"
|
||||
:key="item.taskDefinitionKey"
|
||||
:label="item.name"
|
||||
:value="item.taskDefinitionKey"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select v-model="genericForm.targetTaskDefinitionKey" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in returnList"
|
||||
:key="item.taskDefinitionKey"
|
||||
:label="item.name"
|
||||
:value="item.taskDefinitionKey"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="退回理由" prop="returnReason">
|
||||
<el-input v-model="genericForm.returnReason" clearable placeholder="请输入退回理由" type="textarea" :rows="3" />
|
||||
<el-input
|
||||
v-model="genericForm.returnReason"
|
||||
clearable
|
||||
placeholder="请输入退回理由"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :disabled="formLoading" type="primary" @click="handleReturn()">
|
||||
<el-button :disabled="formLoading" type="primary" @click="handleReturn()">
|
||||
{{ getButtonDisplayName(OperationButtonType.RETURN) }}
|
||||
</el-button>
|
||||
<el-button @click="popOverVisible.return = false"> 取消 </el-button>
|
||||
|
@ -342,28 +392,28 @@
|
|||
</div>
|
||||
</el-popover>
|
||||
|
||||
<!-- 弹窗:子任务 -->
|
||||
<TaskSignList ref="taskSignListRef" @success="reload" />
|
||||
<!--TODO @jason:撤回 -->
|
||||
<!--TODO @jason:再次发起 -->
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import TaskSignList from './dialog/TaskSignList.vue'
|
||||
import { setConfAndFields2 } from '@/utils/formCreate'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import * as TaskApi from '@/api/bpm/task'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
import {
|
||||
OperationButtonType,
|
||||
OPERATION_BUTTON_NAME
|
||||
} from '@/components/SimpleProcessDesignerV2/src/consts'
|
||||
defineOptions({ name: 'ProcessInstanceBtnConatiner' })
|
||||
|
||||
const userId = useUserStore().getUser.id // 当前登录的编号
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { proxy } = getCurrentInstance() as any
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
defineProps({
|
||||
processInstance: propTypes.any, // 流程实例信息
|
||||
const props = defineProps({
|
||||
processInstanceId: propTypes.string, // 流程实例信息
|
||||
userOptions: propTypes.any
|
||||
})
|
||||
const formLoading = ref(false) // 表单加载中
|
||||
|
@ -374,7 +424,7 @@ const popOverVisible = ref({
|
|||
transfer: false,
|
||||
delegate: false,
|
||||
addSign: false,
|
||||
return : false,
|
||||
return: false,
|
||||
copy: false
|
||||
})
|
||||
/** 退回节点 */
|
||||
|
@ -390,7 +440,7 @@ const genericRule = reactive({
|
|||
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
||||
returnReason: [{ required: true, message: '退回理由不能为空', trigger: 'blur' }],
|
||||
copyUserIds: [{ required: true, message: '抄送人不能为空', trigger: 'change' }],
|
||||
assigneeUserId:[{ required: true, message: '新审批人不能为空', trigger: 'change' }],
|
||||
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
|
||||
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
|
||||
addSignUserIds: [{ required: true, message: '加签处理人不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
@ -407,43 +457,25 @@ watch(
|
|||
}
|
||||
)
|
||||
|
||||
// TODO @jaosn:具体的审批任务,要不改成后端返回。让前端弱化下
|
||||
/**
|
||||
* 设置 runningTasks 中的任务
|
||||
*/
|
||||
const loadRunningTask = (tasks: any[]) => {
|
||||
runningTask.value = {}
|
||||
genericForm.value = {}
|
||||
approveForm.value = {}
|
||||
approveFormFApi.value = {}
|
||||
tasks.forEach((task: any) => {
|
||||
if (!isEmpty(task.children)) {
|
||||
loadRunningTask(task.children)
|
||||
}
|
||||
// 2.1 只有待处理才需要
|
||||
if (task.status !== 1 && task.status !== 6) {
|
||||
return
|
||||
}
|
||||
// 2.2 自己不是处理人
|
||||
if (!task.assigneeUser || task.assigneeUser.id !== userId) {
|
||||
return
|
||||
}
|
||||
// 2.3 添加到处理任务
|
||||
runningTask.value = { ...task }
|
||||
genericForm.value = {
|
||||
reason: '',
|
||||
copyUserIds: []
|
||||
}
|
||||
|
||||
// 2.4 处理 approve 表单
|
||||
if (task.formId && task.formConf) {
|
||||
const tempApproveForm = {}
|
||||
setConfAndFields2(tempApproveForm, task.formConf, task.formFields, task.formVariables)
|
||||
approveForm.value = tempApproveForm
|
||||
/** 弹出退回气泡卡 */
|
||||
const openReturnPopover = async () => {
|
||||
returnList.value = await TaskApi.getTaskListByReturn(runningTask.value.id)
|
||||
if (returnList.value.length === 0) {
|
||||
message.warning('当前没有可退回的节点')
|
||||
return
|
||||
}
|
||||
openPopover('return')
|
||||
}
|
||||
/** 弹出气泡卡 */
|
||||
const openPopover = (type: string) => {
|
||||
Object.keys(popOverVisible.value).forEach((item) => {
|
||||
if (item === type) {
|
||||
popOverVisible.value[item] = true
|
||||
} else {
|
||||
approveForm.value = {} // 占位,避免为空
|
||||
popOverVisible.value[item] = false
|
||||
}
|
||||
})
|
||||
formRef.value.resetFields()
|
||||
}
|
||||
|
||||
/** 处理审批通过和不通过的操作 */
|
||||
|
@ -479,7 +511,7 @@ const handleAudit = async (pass: boolean) => {
|
|||
message.success('审批不通过成功')
|
||||
}
|
||||
// 2.2 加载最新数据
|
||||
getDetail()
|
||||
reload()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
@ -511,7 +543,6 @@ const handleCopy = async () => {
|
|||
|
||||
/** 处理转交 */
|
||||
const handleTransfer = async () => {
|
||||
|
||||
formLoading.value = true
|
||||
try {
|
||||
const transferFormRef = proxy.$refs['formRef']
|
||||
|
@ -531,7 +562,7 @@ const handleTransfer = async () => {
|
|||
popOverVisible.value.transfer = false
|
||||
message.success('操作成功')
|
||||
// 2. 加载最新数据
|
||||
getDetail()
|
||||
reload()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
@ -539,30 +570,30 @@ 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
|
||||
// 1.2 处理委派
|
||||
const data = {
|
||||
id: runningTask.value.id,
|
||||
reason: genericForm.value.reason,
|
||||
delegateUserId: genericForm.value.delegateUserId
|
||||
}
|
||||
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
|
||||
// 1.2 处理委派
|
||||
const data = {
|
||||
id: runningTask.value.id,
|
||||
reason: genericForm.value.reason,
|
||||
delegateUserId: genericForm.value.delegateUserId
|
||||
}
|
||||
|
||||
await TaskApi.delegateTask(data)
|
||||
popOverVisible.value.delegate = false
|
||||
message.success('操作成功')
|
||||
// 2. 加载最新数据
|
||||
getDetail()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
await TaskApi.delegateTask(data)
|
||||
popOverVisible.value.delegate = false
|
||||
message.success('操作成功')
|
||||
// 2. 加载最新数据
|
||||
reload()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 处理加签 */
|
||||
const handlerAddSign = async (type: string) => {
|
||||
|
@ -585,7 +616,7 @@ const handlerAddSign = async (type: string) => {
|
|||
message.success('操作成功')
|
||||
popOverVisible.value.addSign = false
|
||||
// 2 加载最新数据
|
||||
getDetail()
|
||||
reload()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
@ -611,39 +642,37 @@ const handleReturn = async () => {
|
|||
await TaskApi.returnTask(data)
|
||||
popOverVisible.value.return = false
|
||||
message.success('操作成功')
|
||||
// 2 加载最新数据
|
||||
getDetail()
|
||||
// 2 重新加载数据
|
||||
reload()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 弹出退回气泡卡 */
|
||||
const openReturnPopover = async () => {
|
||||
returnList.value = await TaskApi.getTaskListByReturn(runningTask.value.id)
|
||||
if (returnList.value.length === 0) {
|
||||
message.warning('当前没有可退回的节点')
|
||||
return
|
||||
}
|
||||
openPopover('return')
|
||||
}
|
||||
/** 弹出气泡卡 */
|
||||
const openPopover = (type: string ) => {
|
||||
Object.keys(popOverVisible.value).forEach( item => {
|
||||
if( item === type) {
|
||||
popOverVisible.value[item] = true
|
||||
} else {
|
||||
popOverVisible.value[item] = false
|
||||
}
|
||||
})
|
||||
formRef.value.resetFields()
|
||||
/** 子任务 */
|
||||
const taskSignListRef = ref()
|
||||
const openChildrenTask = () => {
|
||||
taskSignListRef.value.open(runningTask.value)
|
||||
}
|
||||
|
||||
/** 获得详情 */
|
||||
const getDetail = () => {
|
||||
/** 重新加载数据 */
|
||||
const reload = () => {
|
||||
getMyTodoTask()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
/** 任务是否为处理中状态 */
|
||||
const isHandleTaskStatus = () => {
|
||||
let canHandle = false
|
||||
if (
|
||||
TaskApi.TaskStatusEnum.RUNNING === runningTask.value.status ||
|
||||
TaskApi.TaskStatusEnum.DELEGATE === runningTask.value.status
|
||||
) {
|
||||
canHandle = true
|
||||
}
|
||||
return canHandle
|
||||
}
|
||||
|
||||
/** 是否显示按钮 */
|
||||
const isShowButton = (btnType: OperationButtonType): boolean => {
|
||||
let isShow = true
|
||||
|
@ -662,7 +691,26 @@ const getButtonDisplayName = (btnType: OperationButtonType) => {
|
|||
return displayName
|
||||
}
|
||||
|
||||
defineExpose({ loadRunningTask })
|
||||
/** 获取我的待办任务 */
|
||||
const getMyTodoTask = async () => {
|
||||
genericForm.value = {}
|
||||
approveForm.value = {}
|
||||
approveFormFApi.value = {}
|
||||
const data = await TaskApi.myTodoTask(props.processInstanceId)
|
||||
runningTask.value = data
|
||||
// 处理 approve 表单.
|
||||
if (data && data.formId && data.formConf) {
|
||||
const tempApproveForm = {}
|
||||
setConfAndFields2(tempApproveForm, data.formConf, data.formFields, data.formVariables)
|
||||
approveForm.value = tempApproveForm
|
||||
} else {
|
||||
approveForm.value = {} // 占位,避免为空
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getMyTodoTask()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<el-drawer v-model="drawerVisible" title="子任务" size="880px">
|
||||
<!-- 当前任务 -->
|
||||
<template #header>
|
||||
<h4>【{{ parentTask.name }} 】审批人:{{ parentTask?.assigneeUser?.nickname }}</h4>
|
||||
<h4>【{{ parentTask.name }} 】审批人:{{ parentTask?.ownerUser?.nickname }}</h4>
|
||||
<el-button
|
||||
style="margin-left: 5px"
|
||||
v-if="isSignDeleteButtonVisible(parentTask)"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<div class="text-#878c93"> {{ formatDate(processInstance.startTime) }} 提交 </div>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeTab" @tab-change="onTabChange">
|
||||
<el-tabs v-model="activeTab">
|
||||
<!-- 表单信息 -->
|
||||
<el-tab-pane label="审批详情" name="form">
|
||||
<div class="form-scroll-area">
|
||||
|
@ -104,8 +104,7 @@
|
|||
<div class="b-t-solid border-t-1px border-[var(--el-border-color)]">
|
||||
<!-- 操作栏按钮 -->
|
||||
<ProcessInstanceOperationButton
|
||||
ref="operationButtonRef"
|
||||
:processInstance="processInstance"
|
||||
:process-instance-id="id"
|
||||
:userOptions="userOptions"
|
||||
@success="refresh"
|
||||
/>
|
||||
|
@ -119,7 +118,6 @@ import { formatDate } from '@/utils/formatTime'
|
|||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { setConfAndFields2 } from '@/utils/formCreate'
|
||||
import type { ApiAttrs } from '@form-create/element-ui/types/config'
|
||||
import * as DefinitionApi from '@/api/bpm/definition'
|
||||
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
|
||||
import * as TaskApi from '@/api/bpm/task'
|
||||
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue'
|
||||
|
@ -132,6 +130,7 @@ import { FieldPermissionType } from '@/components/SimpleProcessDesignerV2/src/co
|
|||
import audit1 from '@/assets/svgs/bpm/audit1.svg'
|
||||
import audit2 from '@/assets/svgs/bpm/audit2.svg'
|
||||
import audit3 from '@/assets/svgs/bpm/audit3.svg'
|
||||
import audit4 from '@/assets/svgs/bpm/audit4.svg'
|
||||
|
||||
defineOptions({ name: 'BpmProcessInstanceDetail' })
|
||||
const props = defineProps<{
|
||||
|
@ -142,16 +141,14 @@ const props = defineProps<{
|
|||
const message = useMessage() // 消息弹窗
|
||||
const processInstanceLoading = ref(false) // 流程实例的加载中
|
||||
const processInstance = ref<any>({}) // 流程实例
|
||||
let processDefinitionId = undefined // 流程定义 Id
|
||||
const operationButtonRef = ref()
|
||||
const timelineRef = ref()
|
||||
const bpmnXml = ref('') // BPMN XML
|
||||
const tasksLoad = ref(true) // 任务的加载中
|
||||
const tasks = ref<any[]>([]) // 任务列表
|
||||
const auditIcons = {
|
||||
1: audit1,
|
||||
2: audit2,
|
||||
3: audit3
|
||||
3: audit3,
|
||||
4: audit4
|
||||
}
|
||||
|
||||
// ========== 申请信息 ==========
|
||||
|
@ -220,9 +217,6 @@ const getProcessInstance = async () => {
|
|||
// 注意:data.processDefinition.formCustomViewPath 是组件的全路径,例如说:/crm/contract/detail/index.vue
|
||||
BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath)
|
||||
}
|
||||
processDefinitionId = processDefinition.id
|
||||
// 加载流程图
|
||||
// bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinition.id))?.bpmnXml
|
||||
} finally {
|
||||
processInstanceLoading.value = false
|
||||
}
|
||||
|
@ -272,7 +266,7 @@ const getTaskList = async () => {
|
|||
})
|
||||
|
||||
// 获得需要自己审批的任务
|
||||
operationButtonRef.value?.loadRunningTask(tasks.value)
|
||||
//operationButtonRef.value?.loadRunningTask(tasks.value)
|
||||
} finally {
|
||||
tasksLoad.value = false
|
||||
}
|
||||
|
@ -291,13 +285,6 @@ const refresh = () => {
|
|||
/** 当前的Tab */
|
||||
const activeTab = ref('form')
|
||||
|
||||
/** Tab 切换 加载流程图,直接加载显示不出来,不知道啥原因,所以切换以后在加载 */
|
||||
const onTabChange = async (tabName: string) => {
|
||||
if (tabName === 'diagram' && processDefinitionId && !bpmnXml.value) {
|
||||
//加载流程图
|
||||
bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinitionId))?.bpmnXml
|
||||
}
|
||||
}
|
||||
/** 初始化 */
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
onMounted(async () => {
|
||||
|
|
Loading…
Reference in New Issue