【功能修改】 新审批页面增加减签

pull/582/head
jason 2024-10-13 20:07:42 +08:00
parent 6b06f320b9
commit 842fe09e8b
6 changed files with 203 additions and 163 deletions

View File

@ -9,10 +9,10 @@ export enum TaskStatusEnum {
*/ */
NOT_START = -1, NOT_START = -1,
/** /**
* *
*/ */
WAIT = 0, WAIT = 0,
/** /**
* *
*/ */
@ -26,7 +26,7 @@ export enum TaskStatusEnum {
* *
*/ */
REJECT = 3, REJECT = 3,
/** /**
* *
*/ */
@ -42,8 +42,7 @@ export enum TaskStatusEnum {
/** /**
* *
*/ */
APPROVING = 7, APPROVING = 7
} }
export type TaskVO = { export type TaskVO = {
@ -111,6 +110,11 @@ export const copyTask = async (data: any) => {
return await request.put({ url: '/bpm/task/copy', data }) 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) => { export const getChildrenTaskList = async (id: string) => {
return await request.get({ url: '/bpm/task/list-by-parent-task-id?parentTaskId=' + id }) 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

View File

@ -292,8 +292,8 @@ const remainingRouter: AppRouteRecordRaw[] = [
}, },
{ {
path: 'process-instance/detail', path: 'process-instance/detail',
// component: () => import('@/views/bpm/processInstance/detail/index_new.vue'), component: () => import('@/views/bpm/processInstance/detail/index_new.vue'),
component: () => import('@/views/bpm/processInstance/detail/index.vue'), //component: () => import('@/views/bpm/processInstance/detail/index.vue'),
name: 'BpmProcessInstanceDetail', name: 'BpmProcessInstanceDetail',
meta: { meta: {
noCache: true, noCache: true,

View File

@ -1,7 +1,7 @@
<template> <template>
<div <div
class="h-50px bottom-10 text-14px flex items-center color-#32373c dark:color-#fff font-bold btn-container" 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 <el-popover
@ -9,7 +9,7 @@
placement="top-end" placement="top-end"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.APPROVE)" v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.APPROVE)"
> >
<template #reference> <template #reference>
<el-button plain type="success" @click="openPopover('approve')"> <el-button plain type="success" @click="openPopover('approve')">
@ -38,7 +38,12 @@
/> />
</el-card> </el-card>
<el-form-item label="审批意见" prop="reason"> <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-form-item> <el-form-item>
<el-button :disabled="formLoading" type="success" @click="handleAudit(true)"> <el-button :disabled="formLoading" type="success" @click="handleAudit(true)">
@ -56,7 +61,7 @@
placement="top-end" placement="top-end"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.REJECT)" v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.REJECT)"
> >
<template #reference> <template #reference>
<el-button class="mr-20px" plain type="danger" @click="openPopover('reject')"> <el-button class="mr-20px" plain type="danger" @click="openPopover('reject')">
@ -85,7 +90,12 @@
/> />
</el-card> </el-card>
<el-form-item label="审批意见" prop="reason"> <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-form-item> <el-form-item>
<el-button :disabled="formLoading" type="danger" @click="handleAudit(false)"> <el-button :disabled="formLoading" type="danger" @click="handleAudit(false)">
@ -103,10 +113,10 @@
placement="top-start" placement="top-start"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.COPY)" v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.COPY)"
> >
<template #reference> <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" />&nbsp; <Icon :size="14" icon="svg-icon:send" />&nbsp;
{{ getButtonDisplayName(OperationButtonType.COPY) }} {{ getButtonDisplayName(OperationButtonType.COPY) }}
</div> </div>
@ -120,9 +130,14 @@
:rules="genericRule" :rules="genericRule"
label-width="100px" label-width="100px"
> >
<el-form-item label="抄送人" prop="copyUserIds"> <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 <el-option
v-for="item in userOptions" v-for="item in userOptions"
:key="item.id" :key="item.id"
@ -132,7 +147,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="抄送意见" prop="copyReason"> <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>
<el-form-item> <el-form-item>
@ -151,10 +172,10 @@
placement="top-start" placement="top-start"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.TRANSFER)" v-if=" isHandleTaskStatus() && isShowButton(OperationButtonType.TRANSFER)"
> >
<template #reference> <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" />&nbsp; <Icon :size="14" icon="fa:share-square-o" />&nbsp;
{{ getButtonDisplayName(OperationButtonType.TRANSFER) }} {{ getButtonDisplayName(OperationButtonType.TRANSFER) }}
</div> </div>
@ -168,7 +189,6 @@
:rules="genericRule" :rules="genericRule"
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="genericForm.assigneeUserId" clearable style="width: 100%">
<el-option <el-option
@ -180,12 +200,17 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="审批意见" prop="reason"> <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-form-item> <el-form-item>
<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="popOverVisible.transfer = false"> 取消 </el-button>
@ -193,22 +218,22 @@
</el-form> </el-form>
</div> </div>
</el-popover> </el-popover>
<!-- 委派按钮 --> <!-- 委派按钮 -->
<el-popover <el-popover
:visible="popOverVisible.delegate" :visible="popOverVisible.delegate"
placement="top-start" placement="top-start"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.DELEGATE)" v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.DELEGATE)"
> >
<template #reference> <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" />&nbsp; <Icon :size="14" icon="ep:position" />&nbsp;
{{ getButtonDisplayName(OperationButtonType.DELEGATE) }} {{ getButtonDisplayName(OperationButtonType.DELEGATE) }}
</div> </div>
</template> </template>
<div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading"> <div class="flex flex-col flex-1 pt-20px px-20px" v-loading="formLoading">
<el-form <el-form
label-position="top" label-position="top"
@ -228,9 +253,15 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="审批意见" prop="reason"> <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-form-item> <el-form-item>
@ -241,7 +272,6 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-popover> </el-popover>
<!-- 加签按钮 当前任务审批人为A向前加签选了一个C则需要C先审批然后再是A审批向后加签BA审批完需要B再审批完才算完成这个任务节点 --> <!-- 加签按钮 当前任务审批人为A向前加签选了一个C则需要C先审批然后再是A审批向后加签BA审批完需要B再审批完才算完成这个任务节点 -->
@ -250,10 +280,10 @@
placement="top-start" placement="top-start"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.ADD_SIGN)" v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.ADD_SIGN)"
> >
<template #reference> <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" />&nbsp; <Icon :size="14" icon="ep:plus" />&nbsp;
{{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }} {{ getButtonDisplayName(OperationButtonType.ADD_SIGN) }}
</div> </div>
@ -278,9 +308,15 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="审批意见" prop="reason"> <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-form-item> <el-form-item>
<el-button :disabled="formLoading" type="primary" @click="handlerAddSign('before')"> <el-button :disabled="formLoading" type="primary" @click="handlerAddSign('before')">
@ -295,17 +331,25 @@
</div> </div>
</el-popover> </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" />&nbsp; 减签
</div>
<!-- 退回按钮 --> <!-- 退回按钮 -->
<el-popover <el-popover
:visible="popOverVisible.return" :visible="popOverVisible.return"
placement="top-start" placement="top-start"
:width="420" :width="420"
trigger="click" trigger="click"
v-if="isShowButton(OperationButtonType.RETURN)" v-if="isHandleTaskStatus() && isShowButton(OperationButtonType.RETURN)"
> >
<template #reference> <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" />&nbsp; <Icon :size="14" icon="fa:mail-reply" />&nbsp;
{{ getButtonDisplayName(OperationButtonType.RETURN) }} {{ getButtonDisplayName(OperationButtonType.RETURN) }}
</div> </div>
@ -320,20 +364,26 @@
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="genericForm.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"
:label="item.name" :label="item.name"
:value="item.taskDefinitionKey" :value="item.taskDefinitionKey"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="退回理由" prop="returnReason"> <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-form-item> <el-form-item>
<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="popOverVisible.return = false"> 取消 </el-button>
@ -341,29 +391,29 @@
</el-form> </el-form>
</div> </div>
</el-popover> </el-popover>
<!-- 弹窗子任务 -->
<TaskSignList ref="taskSignListRef" @success="reload" />
<!--TODO @jason撤回 --> <!--TODO @jason撤回 -->
<!--TODO @jason再次发起 --> <!--TODO @jason再次发起 -->
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import TaskSignList from './dialog/TaskSignList.vue'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
import { useUserStore } from '@/store/modules/user'
import * as TaskApi from '@/api/bpm/task' import * as TaskApi from '@/api/bpm/task'
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import { isEmpty } from '@/utils/is'
import { import {
OperationButtonType, OperationButtonType,
OPERATION_BUTTON_NAME OPERATION_BUTTON_NAME
} from '@/components/SimpleProcessDesignerV2/src/consts' } from '@/components/SimpleProcessDesignerV2/src/consts'
defineOptions({ name: 'ProcessInstanceBtnConatiner' }) defineOptions({ name: 'ProcessInstanceBtnConatiner' })
const userId = useUserStore().getUser.id //
const message = useMessage() // const message = useMessage() //
const { proxy } = getCurrentInstance() as any const { proxy } = getCurrentInstance() as any
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
defineProps({ const props = defineProps({
processInstance: propTypes.any, // processInstanceId: propTypes.string, //
userOptions: propTypes.any userOptions: propTypes.any
}) })
const formLoading = ref(false) // const formLoading = ref(false) //
@ -374,7 +424,7 @@ const popOverVisible = ref({
transfer: false, transfer: false,
delegate: false, delegate: false,
addSign: false, addSign: false,
return : false, return: false,
copy: false copy: false
}) })
/** 退回节点 */ /** 退回节点 */
@ -390,7 +440,7 @@ const genericRule = reactive({
reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }], reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
returnReason: [{ required: true, message: '退回理由不能为空', trigger: 'blur' }], returnReason: [{ required: true, message: '退回理由不能为空', trigger: 'blur' }],
copyUserIds: [{ required: true, message: '抄送人不能为空', trigger: 'change' }], copyUserIds: [{ required: true, message: '抄送人不能为空', trigger: 'change' }],
assigneeUserId:[{ required: true, message: '新审批人不能为空', trigger: 'change' }], assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }], delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
addSignUserIds: [{ required: true, message: '加签处理人不能为空', trigger: 'change' }] addSignUserIds: [{ required: true, message: '加签处理人不能为空', trigger: 'change' }]
}) })
@ -407,43 +457,25 @@ watch(
} }
) )
// TODO @jaosn /** 弹出退回气泡卡 */
/** const openReturnPopover = async () => {
* 设置 runningTasks 中的任务 returnList.value = await TaskApi.getTaskListByReturn(runningTask.value.id)
*/ if (returnList.value.length === 0) {
const loadRunningTask = (tasks: any[]) => { message.warning('当前没有可退回的节点')
runningTask.value = {} return
genericForm.value = {} }
approveForm.value = {} openPopover('return')
approveFormFApi.value = {} }
tasks.forEach((task: any) => { /** 弹出气泡卡 */
if (!isEmpty(task.children)) { const openPopover = (type: string) => {
loadRunningTask(task.children) Object.keys(popOverVisible.value).forEach((item) => {
} if (item === type) {
// 2.1 popOverVisible.value[item] = true
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
} else { } else {
approveForm.value = {} // popOverVisible.value[item] = false
} }
}) })
formRef.value.resetFields()
} }
/** 处理审批通过和不通过的操作 */ /** 处理审批通过和不通过的操作 */
@ -479,7 +511,7 @@ const handleAudit = async (pass: boolean) => {
message.success('审批不通过成功') message.success('审批不通过成功')
} }
// 2.2 // 2.2
getDetail() reload()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -511,7 +543,6 @@ const handleCopy = async () => {
/** 处理转交 */ /** 处理转交 */
const handleTransfer = async () => { const handleTransfer = async () => {
formLoading.value = true formLoading.value = true
try { try {
const transferFormRef = proxy.$refs['formRef'] const transferFormRef = proxy.$refs['formRef']
@ -526,12 +557,12 @@ const handleTransfer = async () => {
reason: genericForm.value.reason, reason: genericForm.value.reason,
assigneeUserId: genericForm.value.assigneeUserId assigneeUserId: genericForm.value.assigneeUserId
} }
await TaskApi.transferTask(data) await TaskApi.transferTask(data)
popOverVisible.value.transfer = false popOverVisible.value.transfer = false
message.success('操作成功') message.success('操作成功')
// 2. // 2.
getDetail() reload()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -539,30 +570,30 @@ const handleTransfer = async () => {
/** 处理委派 */ /** 处理委派 */
const handleDelegate = async () => { const handleDelegate = async () => {
formLoading.value = true formLoading.value = true
try { try {
const deletegateFormRef = proxy.$refs['formRef'] const deletegateFormRef = proxy.$refs['formRef']
// 1.1 // 1.1
const elForm = unref(deletegateFormRef) const elForm = unref(deletegateFormRef)
if (!elForm) return if (!elForm) return
const valid = await elForm.validate() const valid = await elForm.validate()
if (!valid) return if (!valid) return
// 1.2 // 1.2
const data = { const data = {
id: runningTask.value.id, id: runningTask.value.id,
reason: genericForm.value.reason, reason: genericForm.value.reason,
delegateUserId: genericForm.value.delegateUserId delegateUserId: genericForm.value.delegateUserId
} }
await TaskApi.delegateTask(data) await TaskApi.delegateTask(data)
popOverVisible.value.delegate = false popOverVisible.value.delegate = false
message.success('操作成功') message.success('操作成功')
// 2. // 2.
getDetail() reload()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} }
/** 处理加签 */ /** 处理加签 */
const handlerAddSign = async (type: string) => { const handlerAddSign = async (type: string) => {
@ -585,7 +616,7 @@ const handlerAddSign = async (type: string) => {
message.success('操作成功') message.success('操作成功')
popOverVisible.value.addSign = false popOverVisible.value.addSign = false
// 2 // 2
getDetail() reload()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -607,43 +638,41 @@ const handleReturn = async () => {
reason: genericForm.value.returnReason, reason: genericForm.value.returnReason,
targetTaskDefinitionKey: genericForm.value.targetTaskDefinitionKey targetTaskDefinitionKey: genericForm.value.targetTaskDefinitionKey
} }
await TaskApi.returnTask(data) await TaskApi.returnTask(data)
popOverVisible.value.return = false popOverVisible.value.return = false
message.success('操作成功') message.success('操作成功')
// 2 // 2
getDetail() reload()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} }
/** 弹出退回气泡卡 */ /** 子任务 */
const openReturnPopover = async () => { const taskSignListRef = ref()
returnList.value = await TaskApi.getTaskListByReturn(runningTask.value.id) const openChildrenTask = () => {
if (returnList.value.length === 0) { taskSignListRef.value.open(runningTask.value)
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 getDetail = () => { const reload = () => {
getMyTodoTask()
emit('success') 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 => { const isShowButton = (btnType: OperationButtonType): boolean => {
let isShow = true let isShow = true
@ -662,7 +691,26 @@ const getButtonDisplayName = (btnType: OperationButtonType) => {
return displayName 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -2,7 +2,7 @@
<el-drawer v-model="drawerVisible" title="子任务" size="880px"> <el-drawer v-model="drawerVisible" title="子任务" size="880px">
<!-- 当前任务 --> <!-- 当前任务 -->
<template #header> <template #header>
<h4>{{ parentTask.name }} 审批人{{ parentTask?.assigneeUser?.nickname }}</h4> <h4>{{ parentTask.name }} 审批人{{ parentTask?.ownerUser?.nickname }}</h4>
<el-button <el-button
style="margin-left: 5px" style="margin-left: 5px"
v-if="isSignDeleteButtonVisible(parentTask)" v-if="isSignDeleteButtonVisible(parentTask)"

View File

@ -37,7 +37,7 @@
<div class="text-#878c93"> {{ formatDate(processInstance.startTime) }} 提交 </div> <div class="text-#878c93"> {{ formatDate(processInstance.startTime) }} 提交 </div>
</div> </div>
<el-tabs v-model="activeTab" @tab-change="onTabChange"> <el-tabs v-model="activeTab">
<!-- 表单信息 --> <!-- 表单信息 -->
<el-tab-pane label="审批详情" name="form"> <el-tab-pane label="审批详情" name="form">
<div class="form-scroll-area"> <div class="form-scroll-area">
@ -104,8 +104,7 @@
<div class="b-t-solid border-t-1px border-[var(--el-border-color)]"> <div class="b-t-solid border-t-1px border-[var(--el-border-color)]">
<!-- 操作栏按钮 --> <!-- 操作栏按钮 -->
<ProcessInstanceOperationButton <ProcessInstanceOperationButton
ref="operationButtonRef" :process-instance-id="id"
:processInstance="processInstance"
:userOptions="userOptions" :userOptions="userOptions"
@success="refresh" @success="refresh"
/> />
@ -119,7 +118,6 @@ import { formatDate } from '@/utils/formatTime'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
import type { ApiAttrs } from '@form-create/element-ui/types/config' 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 ProcessInstanceApi from '@/api/bpm/processInstance'
import * as TaskApi from '@/api/bpm/task' import * as TaskApi from '@/api/bpm/task'
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue' 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 audit1 from '@/assets/svgs/bpm/audit1.svg'
import audit2 from '@/assets/svgs/bpm/audit2.svg' import audit2 from '@/assets/svgs/bpm/audit2.svg'
import audit3 from '@/assets/svgs/bpm/audit3.svg' import audit3 from '@/assets/svgs/bpm/audit3.svg'
import audit4 from '@/assets/svgs/bpm/audit4.svg'
defineOptions({ name: 'BpmProcessInstanceDetail' }) defineOptions({ name: 'BpmProcessInstanceDetail' })
const props = defineProps<{ const props = defineProps<{
@ -142,16 +141,14 @@ const props = defineProps<{
const message = useMessage() // const message = useMessage() //
const processInstanceLoading = ref(false) // const processInstanceLoading = ref(false) //
const processInstance = ref<any>({}) // const processInstance = ref<any>({}) //
let processDefinitionId = undefined // Id
const operationButtonRef = ref()
const timelineRef = ref() const timelineRef = ref()
const bpmnXml = ref('') // BPMN XML
const tasksLoad = ref(true) // const tasksLoad = ref(true) //
const tasks = ref<any[]>([]) // const tasks = ref<any[]>([]) //
const auditIcons = { const auditIcons = {
1: audit1, 1: audit1,
2: audit2, 2: audit2,
3: audit3 3: audit3,
4: audit4
} }
// ========== ========== // ========== ==========
@ -220,9 +217,6 @@ const getProcessInstance = async () => {
// data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue // data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue
BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath) BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath)
} }
processDefinitionId = processDefinition.id
//
// bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinition.id))?.bpmnXml
} finally { } finally {
processInstanceLoading.value = false processInstanceLoading.value = false
} }
@ -272,7 +266,7 @@ const getTaskList = async () => {
}) })
// //
operationButtonRef.value?.loadRunningTask(tasks.value) //operationButtonRef.value?.loadRunningTask(tasks.value)
} finally { } finally {
tasksLoad.value = false tasksLoad.value = false
} }
@ -291,13 +285,6 @@ const refresh = () => {
/** 当前的Tab */ /** 当前的Tab */
const activeTab = ref('form') 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[]>([]) // const userOptions = ref<UserApi.UserVO[]>([]) //
onMounted(async () => { onMounted(async () => {