2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 审批详情的右侧:审批流 -->
|
2024-09-02 11:34:03 +08:00
|
|
|
|
<template>
|
|
|
|
|
<el-timeline class="pt-20px">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 遍历每个审批节点 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<el-timeline-item
|
|
|
|
|
v-for="(activity, index) in approveNodes"
|
|
|
|
|
:key="index"
|
|
|
|
|
size="large"
|
|
|
|
|
:icon="getApprovalNodeIcon(activity.status, activity.nodeType)"
|
|
|
|
|
:color="getApprovalNodeColor(activity.status)"
|
|
|
|
|
>
|
2024-09-02 11:34:03 +08:00
|
|
|
|
<div class="flex flex-col items-start">
|
|
|
|
|
<div class="font-bold"> {{ activity.name }}</div>
|
2024-10-19 19:01:38 +08:00
|
|
|
|
<div class="flex items-center flex-wrap mt-1">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 情况一:遍历每个审批节点下的【进行中】task 任务 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div v-for="(task, idx) in activity.tasks" :key="idx" class="flex items-center">
|
2024-10-08 12:42:38 +08:00
|
|
|
|
<div class="flex flex-col pr-2">
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div class="position-relative" v-if="task.assigneeUser || task.ownerUser">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:头像 -->
|
2024-10-19 19:01:38 +08:00
|
|
|
|
<el-tooltip
|
|
|
|
|
:content="task.reason"
|
|
|
|
|
placement="bottom"
|
|
|
|
|
v-if="task.assigneeUser && task.assigneeUser.avatar"
|
|
|
|
|
effect="light"
|
|
|
|
|
>
|
|
|
|
|
<el-avatar :size="36" :src="task.assigneeUser.avatar" />
|
2024-10-17 10:01:02 +08:00
|
|
|
|
</el-tooltip>
|
2024-10-19 19:01:38 +08:00
|
|
|
|
<el-tooltip
|
|
|
|
|
:content="task.reason"
|
|
|
|
|
placement="bottom"
|
|
|
|
|
v-else-if="task.assigneeUser && task.assigneeUser.nickname"
|
|
|
|
|
effect="light"
|
|
|
|
|
>
|
|
|
|
|
<el-avatar>
|
2024-10-17 10:01:02 +08:00
|
|
|
|
{{ task.assigneeUser.nickname.substring(0, 1) }}
|
|
|
|
|
</el-avatar>
|
|
|
|
|
</el-tooltip>
|
2024-10-19 19:01:38 +08:00
|
|
|
|
<el-tooltip
|
|
|
|
|
:content="task.reason"
|
|
|
|
|
placement="bottom"
|
|
|
|
|
v-else-if="task.ownerUser && task.ownerUser.avatar"
|
|
|
|
|
effect="light"
|
|
|
|
|
>
|
|
|
|
|
<el-avatar :src="task.ownerUser.avatar" />
|
2024-10-17 10:01:02 +08:00
|
|
|
|
</el-tooltip>
|
2024-10-19 19:01:38 +08:00
|
|
|
|
<el-tooltip
|
|
|
|
|
:content="task.reason"
|
|
|
|
|
placement="bottom"
|
|
|
|
|
v-else-if="task.ownerUser && task.ownerUser.nickname"
|
|
|
|
|
effect="light"
|
|
|
|
|
>
|
|
|
|
|
<el-avatar>
|
2024-10-17 10:01:02 +08:00
|
|
|
|
{{ task.ownerUser.nickname.substring(0, 1) }}
|
|
|
|
|
</el-avatar>
|
|
|
|
|
</el-tooltip>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:任务 ICON -->
|
|
|
|
|
<div
|
2024-10-01 23:35:11 +08:00
|
|
|
|
class="position-absolute top-26px left-26px bg-#fff rounded-full flex items-center p-2px"
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
|
|
|
|
:size="12"
|
|
|
|
|
:icon="statusIconMap2[task.status]?.icon"
|
|
|
|
|
:color="statusIconMap2[task.status]?.color"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex flex-col mt-1">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:昵称 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div
|
|
|
|
|
v-if="task.assigneeUser && task.assigneeUser.nickname"
|
2024-10-08 12:42:38 +08:00
|
|
|
|
class="text-12px text-align-center"
|
2024-10-01 23:35:11 +08:00
|
|
|
|
>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
{{ task.assigneeUser.nickname }}
|
|
|
|
|
</div>
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div
|
|
|
|
|
v-else-if="task.ownerUser && task.ownerUser.nickname"
|
|
|
|
|
class="text-10px text-align-center"
|
|
|
|
|
>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
{{ task.ownerUser.nickname }}
|
|
|
|
|
</div>
|
2024-10-17 10:01:02 +08:00
|
|
|
|
<!--
|
2024-10-08 12:42:38 +08:00
|
|
|
|
<div v-if="task.reason" class="text-#a5a5a5 my-4px text-12px flex items-center w-100%">
|
|
|
|
|
<div
|
|
|
|
|
:title="task.reason"
|
|
|
|
|
class="text-truncate w-200px border-1px border-#a5a5a5 border-dashed rounded py-5px px-15px text-#2d2d2d"
|
|
|
|
|
>
|
|
|
|
|
{{ task.reason }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-10-17 10:01:02 +08:00
|
|
|
|
-->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 情况二:遍历每个审批节点下的【候选的】task 任务。例如说,1)依次审批,2)未来的审批任务等 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div
|
2024-10-08 12:42:38 +08:00
|
|
|
|
v-for="(user, idx1) in activity.candidateUsers"
|
2024-10-01 23:35:11 +08:00
|
|
|
|
:key="idx1"
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
>
|
|
|
|
|
<div class="flex items-center flex-col pr-2">
|
|
|
|
|
<div class="position-relative">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:头像 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<el-avatar :size="36" v-if="user.avatar" :src="user.avatar" />
|
|
|
|
|
<el-avatar v-else-if="user.nickname && user.nickname">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
{{ user.nickname.substring(0, 1) }}
|
|
|
|
|
</el-avatar>
|
|
|
|
|
<!-- 信息:任务 ICON -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<div
|
|
|
|
|
class="position-absolute top-26px left-26px bg-#fff rounded-full flex items-center p-2px"
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
|
|
|
|
:size="12"
|
|
|
|
|
:icon="statusIconMap2['-1']?.icon"
|
|
|
|
|
:color="statusIconMap2['-1']?.color"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex flex-col mt-1">
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:昵称 -->
|
|
|
|
|
<div v-if="user.nickname" class="text-10px text-align-center">
|
|
|
|
|
{{ user.nickname }}
|
|
|
|
|
</div>
|
2024-10-01 23:35:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
<!-- 信息:时间 -->
|
|
|
|
|
<div
|
|
|
|
|
v-if="activity.status !== TaskStatusEnum.NOT_START"
|
|
|
|
|
class="text-#a5a5a5 text-13px mt-1"
|
|
|
|
|
>
|
2024-10-01 23:35:11 +08:00
|
|
|
|
{{ getApprovalNodeTime(activity) }}
|
|
|
|
|
</div>
|
2024-10-04 16:16:33 +08:00
|
|
|
|
|
|
|
|
|
<!-- TODO @jason:审批意见,要展示哈。 -->
|
2024-10-01 23:35:11 +08:00
|
|
|
|
<!-- <div class="color-#a1a6ae text-12px mb-10px"> {{ activity.assigneeUser.nickname }}</div>
|
2024-09-02 11:34:03 +08:00
|
|
|
|
<div v-if="activity.opinion" class="text-#a5a5a5 text-12px w-100%">
|
|
|
|
|
<div class="mb-5px">审批意见:</div>
|
|
|
|
|
<div
|
|
|
|
|
class="w-100% border-1px border-#a5a5a5 border-dashed rounded py-5px px-15px text-#2d2d2d"
|
|
|
|
|
>
|
|
|
|
|
{{ activity.opinion }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="activity.createTime" class="text-#a5a5a5 text-13px">
|
|
|
|
|
{{ formatDate(activity.createTime) }}
|
2024-10-01 23:35:11 +08:00
|
|
|
|
</div> -->
|
2024-09-02 11:34:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-timeline-item>
|
|
|
|
|
</el-timeline>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { formatDate } from '@/utils/formatTime'
|
2024-10-01 23:35:11 +08:00
|
|
|
|
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
|
|
|
|
|
import { TaskStatusEnum } from '@/api/bpm/task'
|
|
|
|
|
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
|
|
|
|
|
import { Check, Close, Loading, Clock, Minus, Delete } from '@element-plus/icons-vue'
|
2024-09-02 11:34:03 +08:00
|
|
|
|
defineOptions({ name: 'BpmProcessInstanceTimeline' })
|
2024-10-16 22:31:20 +08:00
|
|
|
|
defineProps<{
|
|
|
|
|
approveNodes: ProcessInstanceApi.ApprovalNodeInfo[] // 审批节点信息
|
|
|
|
|
}>()
|
2024-09-02 11:34:03 +08:00
|
|
|
|
|
2024-10-01 23:35:11 +08:00
|
|
|
|
// 审批节点
|
2024-10-16 22:31:20 +08:00
|
|
|
|
|
2024-10-01 23:35:11 +08:00
|
|
|
|
const statusIconMap2 = {
|
|
|
|
|
// 未开始
|
|
|
|
|
'-1': { color: '#e5e7ec', icon: 'ep-clock' },
|
|
|
|
|
// 待审批
|
|
|
|
|
'0': { color: '#e5e7ec', icon: 'ep:loading' },
|
2024-09-02 11:34:03 +08:00
|
|
|
|
// 审批中
|
2024-10-04 16:16:33 +08:00
|
|
|
|
'1': { color: '#448ef7', icon: 'ep:loading' },
|
2024-09-02 11:34:03 +08:00
|
|
|
|
// 审批通过
|
2024-10-01 23:35:11 +08:00
|
|
|
|
'2': { color: '#00b32a', icon: 'ep:circle-check-filled' },
|
2024-09-02 11:34:03 +08:00
|
|
|
|
// 审批不通过
|
2024-10-01 23:35:11 +08:00
|
|
|
|
'3': { color: '#f46b6c', icon: 'fa-solid:times-circle' },
|
|
|
|
|
// 取消
|
|
|
|
|
'4': { color: '#cccccc', icon: 'ep:delete-filled' },
|
2024-10-19 19:01:38 +08:00
|
|
|
|
// 退回
|
2024-10-01 23:35:11 +08:00
|
|
|
|
'5': { color: '#f46b6c', icon: 'ep:remove-filled' },
|
|
|
|
|
// 委派中
|
|
|
|
|
'6': { color: '#448ef7', icon: 'ep:loading' },
|
|
|
|
|
// 审批通过中
|
2024-10-04 16:16:33 +08:00
|
|
|
|
'7': { color: '#00b32a', icon: 'ep:circle-check-filled' }
|
2024-10-01 23:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const statusIconMap = {
|
|
|
|
|
// 审批未开始
|
|
|
|
|
'-1': { color: '#e5e7ec', icon: Clock },
|
|
|
|
|
'0': { color: '#e5e7ec', icon: Clock },
|
|
|
|
|
// 审批中
|
|
|
|
|
'1': { color: '#448ef7', icon: Loading },
|
|
|
|
|
// 审批通过
|
|
|
|
|
'2': { color: '#00b32a', icon: Check },
|
|
|
|
|
// 审批不通过
|
|
|
|
|
'3': { color: '#f46b6c', icon: Close },
|
|
|
|
|
// 已取消
|
|
|
|
|
'4': { color: '#cccccc', icon: Delete },
|
2024-10-19 19:01:38 +08:00
|
|
|
|
// 退回
|
2024-10-04 16:16:33 +08:00
|
|
|
|
'5': { color: '#f46b6c', icon: Minus },
|
2024-10-01 23:35:11 +08:00
|
|
|
|
// 委派中
|
|
|
|
|
'6': { color: '#448ef7', icon: Loading },
|
|
|
|
|
// 审批通过中
|
2024-10-04 16:16:33 +08:00
|
|
|
|
'7': { color: '#00b32a', icon: Check }
|
2024-10-01 23:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-04 16:16:33 +08:00
|
|
|
|
const getApprovalNodeIcon = (taskStatus: number, nodeType: NodeType) => {
|
|
|
|
|
if (taskStatus == TaskStatusEnum.NOT_START) {
|
2024-10-01 23:35:11 +08:00
|
|
|
|
return statusIconMap[taskStatus]?.icon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nodeType === NodeType.START_USER_NODE || nodeType === NodeType.USER_TASK_NODE) {
|
|
|
|
|
return statusIconMap[taskStatus]?.icon
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getApprovalNodeColor = (taskStatus: number) => {
|
|
|
|
|
return statusIconMap[taskStatus]?.color
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getApprovalNodeTime = (node: ProcessInstanceApi.ApprovalNodeInfo) => {
|
2024-10-04 16:16:33 +08:00
|
|
|
|
if (node.endTime) {
|
2024-10-01 23:35:11 +08:00
|
|
|
|
return `结束时间:${formatDate(node.endTime)}`
|
|
|
|
|
}
|
2024-10-04 16:16:33 +08:00
|
|
|
|
if (node.startTime) {
|
2024-10-01 23:35:11 +08:00
|
|
|
|
return `创建时间:${formatDate(node.startTime)}`
|
|
|
|
|
}
|
2024-09-02 11:34:03 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|