2025-05-08 16:52:46 +08:00
|
|
|
|
<!-- 审批详情的右侧:审批流 -->
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance';
|
|
|
|
|
|
|
2025-05-12 00:53:48 +08:00
|
|
|
|
import { ref } from 'vue';
|
2025-05-08 16:52:46 +08:00
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
|
|
2025-07-09 08:54:10 +08:00
|
|
|
|
import { useVbenModal } from '@vben/common-ui';
|
2025-05-12 00:53:48 +08:00
|
|
|
|
import {
|
|
|
|
|
|
BpmCandidateStrategyEnum,
|
|
|
|
|
|
BpmNodeTypeEnum,
|
|
|
|
|
|
BpmTaskStatusEnum,
|
2025-09-04 18:19:49 +08:00
|
|
|
|
} from '@vben/constants';
|
|
|
|
|
|
import { IconifyIcon } from '@vben/icons';
|
|
|
|
|
|
import { formatDateTime, isEmpty } from '@vben/utils';
|
2025-09-03 16:08:40 +08:00
|
|
|
|
|
|
|
|
|
|
import { Avatar, Button, Image, Timeline, Tooltip } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
|
|
import { UserSelectModal } from '#/components/select-modal';
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'BpmProcessInstanceTimeline' });
|
|
|
|
|
|
|
2025-07-10 14:05:44 +08:00
|
|
|
|
const props = withDefaults(
|
2025-05-08 16:52:46 +08:00
|
|
|
|
defineProps<{
|
|
|
|
|
|
activityNodes: BpmProcessInstanceApi.ApprovalNodeInfo[]; // 审批节点信息
|
2025-08-02 22:25:30 +08:00
|
|
|
|
enableApproveUserSelect?: boolean; // 是否开启审批人自选功能
|
2025-05-08 16:52:46 +08:00
|
|
|
|
showStatusIcon?: boolean; // 是否显示头像右下角状态图标
|
|
|
|
|
|
}>(),
|
|
|
|
|
|
{
|
|
|
|
|
|
showStatusIcon: true, // 默认值为 true
|
2025-08-02 22:25:30 +08:00
|
|
|
|
enableApproveUserSelect: false, // 默认值为 false
|
2025-05-08 16:52:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2025-05-12 00:53:48 +08:00
|
|
|
|
selectUserConfirm: [activityId: string, userList: any[]];
|
2025-05-08 16:52:46 +08:00
|
|
|
|
}>();
|
|
|
|
|
|
|
2025-10-21 20:56:53 +08:00
|
|
|
|
const { push } = useRouter();
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
|
|
|
|
|
const statusIconMap: Record<
|
|
|
|
|
|
string,
|
|
|
|
|
|
{ animation?: string; color: string; icon: string }
|
|
|
|
|
|
> = {
|
2025-10-24 00:01:38 +08:00
|
|
|
|
'-2': { color: '#909398', icon: 'mdi:skip-forward-outline' }, // 跳过
|
|
|
|
|
|
'-1': { color: '#909398', icon: 'mdi:clock-outline' }, // 审批未开始
|
|
|
|
|
|
'0': { color: '#ff943e', icon: 'mdi:loading', animation: 'animate-spin' }, // 待审批
|
|
|
|
|
|
'1': { color: '#448ef7', icon: 'mdi:loading', animation: 'animate-spin' }, // 审批中
|
|
|
|
|
|
'2': { color: '#00b32a', icon: 'mdi:check' }, // 审批通过
|
|
|
|
|
|
'3': { color: '#f46b6c', icon: 'mdi:close' }, // 审批不通过
|
|
|
|
|
|
'4': { color: '#cccccc', icon: 'mdi:trash-can-outline' }, // 已取消
|
|
|
|
|
|
'5': { color: '#f46b6c', icon: 'mdi:arrow-left' }, // 退回
|
|
|
|
|
|
'6': { color: '#448ef7', icon: 'mdi:clock-outline' }, // 委派中
|
|
|
|
|
|
'7': { color: '#00b32a', icon: 'mdi:check' }, // 审批通过中
|
|
|
|
|
|
}; // 状态图标映射
|
2025-05-08 16:52:46 +08:00
|
|
|
|
const nodeTypeSvgMap = {
|
|
|
|
|
|
// 结束节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.END_EVENT_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#909398',
|
|
|
|
|
|
icon: 'mdi:power',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 开始节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.START_USER_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#909398',
|
|
|
|
|
|
icon: 'mdi:account-outline',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 用户任务节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.USER_TASK_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#ff943e',
|
|
|
|
|
|
icon: 'tdesign:seal',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 事务节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.TRANSACTOR_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#ff943e',
|
|
|
|
|
|
icon: 'mdi:file-edit-outline',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 复制任务节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.COPY_TASK_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#3296fb',
|
|
|
|
|
|
icon: 'mdi:content-copy',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 条件分支节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.CONDITION_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#14bb83',
|
|
|
|
|
|
icon: 'carbon:flow',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 并行分支节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.PARALLEL_BRANCH_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#14bb83',
|
|
|
|
|
|
icon: 'si:flow-parallel-line',
|
|
|
|
|
|
},
|
|
|
|
|
|
// 子流程节点
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.CHILD_PROCESS_NODE]: {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
color: '#14bb83',
|
|
|
|
|
|
icon: 'icon-park-outline:tree-diagram',
|
|
|
|
|
|
},
|
2025-10-24 00:01:38 +08:00
|
|
|
|
} as Record<BpmNodeTypeEnum, { color: string; icon: string }>; // 节点类型图标映射
|
|
|
|
|
|
const onlyStatusIconShow = [-1, 0, 1]; // 只有状态是 -1、0、1 才展示头像右小角状态小 icon
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 获取审批节点类型图标 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function getApprovalNodeTypeIcon(nodeType: BpmNodeTypeEnum) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return nodeTypeSvgMap[nodeType]?.icon;
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 获取审批节点图标 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function getApprovalNodeIcon(taskStatus: number, nodeType: BpmNodeTypeEnum) {
|
2025-05-12 00:53:48 +08:00
|
|
|
|
if (taskStatus === BpmTaskStatusEnum.NOT_START) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return statusIconMap[taskStatus]?.icon || 'mdi:clock-outline';
|
|
|
|
|
|
}
|
|
|
|
|
|
if (
|
2025-10-24 00:01:38 +08:00
|
|
|
|
[
|
|
|
|
|
|
BpmNodeTypeEnum.CHILD_PROCESS_NODE,
|
|
|
|
|
|
BpmNodeTypeEnum.END_EVENT_NODE,
|
2025-11-04 17:47:29 +08:00
|
|
|
|
BpmNodeTypeEnum.START_USER_NODE,
|
|
|
|
|
|
BpmNodeTypeEnum.TRANSACTOR_NODE,
|
|
|
|
|
|
BpmNodeTypeEnum.USER_TASK_NODE,
|
2025-10-24 00:01:38 +08:00
|
|
|
|
].includes(nodeType)
|
2025-05-08 16:52:46 +08:00
|
|
|
|
) {
|
|
|
|
|
|
return statusIconMap[taskStatus]?.icon || 'mdi:clock-outline';
|
|
|
|
|
|
}
|
|
|
|
|
|
return 'mdi:clock-outline';
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 获取审批节点颜色 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function getApprovalNodeColor(taskStatus: number) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return statusIconMap[taskStatus]?.color;
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 获取审批节点时间 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function getApprovalNodeTime(node: BpmProcessInstanceApi.ApprovalNodeInfo) {
|
2025-05-12 00:53:48 +08:00
|
|
|
|
if (node.nodeType === BpmNodeTypeEnum.START_USER_NODE && node.startTime) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return formatDateTime(node.startTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (node.endTime) {
|
|
|
|
|
|
return formatDateTime(node.endTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (node.startTime) {
|
|
|
|
|
|
return formatDateTime(node.startTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-07-09 08:54:10 +08:00
|
|
|
|
const [UserSelectModalComp, userSelectModalApi] = useVbenModal({
|
|
|
|
|
|
connectedComponent: UserSelectModal,
|
|
|
|
|
|
destroyOnClose: true,
|
|
|
|
|
|
});
|
2025-05-12 00:53:48 +08:00
|
|
|
|
const selectedActivityNodeId = ref<string>();
|
2025-05-08 16:52:46 +08:00
|
|
|
|
const customApproveUsers = ref<Record<string, any[]>>({}); // key:activityId,value:用户列表
|
|
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 打开选择用户弹窗 */
|
2025-05-08 16:52:46 +08:00
|
|
|
|
const handleSelectUser = (activityId: string, selectedList: any[]) => {
|
2025-05-12 00:53:48 +08:00
|
|
|
|
selectedActivityNodeId.value = activityId;
|
2025-07-09 08:54:10 +08:00
|
|
|
|
userSelectModalApi
|
|
|
|
|
|
.setData({ userIds: selectedList.map((item) => item.id) })
|
|
|
|
|
|
.open();
|
2025-05-08 16:52:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 选择用户完成 */
|
2025-05-08 18:29:28 +08:00
|
|
|
|
const selectedUsers = ref<number[]>([]);
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function handleUserSelectConfirm(userList: any[]) {
|
2025-07-09 08:54:10 +08:00
|
|
|
|
if (!selectedActivityNodeId.value) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-05-12 00:53:48 +08:00
|
|
|
|
customApproveUsers.value[selectedActivityNodeId.value] = userList || [];
|
|
|
|
|
|
|
|
|
|
|
|
emit('selectUserConfirm', selectedActivityNodeId.value, userList);
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
|
|
|
|
|
/** 跳转子流程 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function handleChildProcess(activity: any) {
|
2025-07-22 19:31:40 +08:00
|
|
|
|
if (!activity.processInstanceId) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
push({
|
|
|
|
|
|
name: 'BpmProcessInstanceDetail',
|
|
|
|
|
|
query: {
|
|
|
|
|
|
id: activity.processInstanceId,
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 判断是否需要显示自定义选择审批人 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function shouldShowCustomUserSelect(
|
2025-05-08 16:52:46 +08:00
|
|
|
|
activity: BpmProcessInstanceApi.ApprovalNodeInfo,
|
2025-06-06 20:45:45 +08:00
|
|
|
|
) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return (
|
|
|
|
|
|
isEmpty(activity.tasks) &&
|
2025-08-02 22:25:30 +08:00
|
|
|
|
((BpmCandidateStrategyEnum.START_USER_SELECT ===
|
|
|
|
|
|
activity.candidateStrategy &&
|
|
|
|
|
|
isEmpty(activity.candidateUsers)) ||
|
|
|
|
|
|
(props.enableApproveUserSelect &&
|
|
|
|
|
|
BpmCandidateStrategyEnum.APPROVE_USER_SELECT ===
|
|
|
|
|
|
activity.candidateStrategy))
|
2025-05-08 16:52:46 +08:00
|
|
|
|
);
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 判断是否需要显示审批意见 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function shouldShowApprovalReason(task: any, nodeType: BpmNodeTypeEnum) {
|
2025-05-08 16:52:46 +08:00
|
|
|
|
return (
|
|
|
|
|
|
task.reason &&
|
2025-05-12 00:53:48 +08:00
|
|
|
|
[BpmNodeTypeEnum.END_EVENT_NODE, BpmNodeTypeEnum.USER_TASK_NODE].includes(
|
2025-05-08 16:52:46 +08:00
|
|
|
|
nodeType,
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-09 20:23:19 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 用户选择弹窗关闭 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function handleUserSelectClosed() {
|
2025-05-09 20:23:19 +08:00
|
|
|
|
selectedUsers.value = [];
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-05-09 20:23:19 +08:00
|
|
|
|
|
2025-10-24 00:01:38 +08:00
|
|
|
|
/** 用户选择弹窗取消 */
|
2025-06-06 20:45:45 +08:00
|
|
|
|
function handleUserSelectCancel() {
|
2025-05-09 20:23:19 +08:00
|
|
|
|
selectedUsers.value = [];
|
2025-06-06 20:45:45 +08:00
|
|
|
|
}
|
2025-08-02 22:25:30 +08:00
|
|
|
|
|
|
|
|
|
|
/** 设置自定义审批人 */
|
|
|
|
|
|
const setCustomApproveUsers = (activityId: string, users: any[]) => {
|
|
|
|
|
|
customApproveUsers.value[activityId] = users || [];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 批量设置多个节点的自定义审批人 */
|
|
|
|
|
|
const batchSetCustomApproveUsers = (data: Record<string, any[]>) => {
|
|
|
|
|
|
Object.keys(data).forEach((activityId) => {
|
|
|
|
|
|
customApproveUsers.value[activityId] = data[activityId] || [];
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ setCustomApproveUsers, batchSetCustomApproveUsers });
|
2025-05-08 16:52:46 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<div>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<Timeline class="pt-5">
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 遍历每个审批节点 -->
|
2025-05-13 19:54:11 +08:00
|
|
|
|
<Timeline.Item
|
2025-05-12 00:53:48 +08:00
|
|
|
|
v-for="(activity, index) in activityNodes"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
:color="getApprovalNodeColor(activity.status)"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<template #dot>
|
|
|
|
|
|
<div class="relative">
|
|
|
|
|
|
<div
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="position-absolute left--2.5 top--1.5 flex h-8 w-8 items-center justify-center rounded-full border border-solid border-gray-200 bg-blue-500 p-1.5"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
>
|
|
|
|
|
|
<IconifyIcon
|
|
|
|
|
|
:icon="getApprovalNodeTypeIcon(activity.nodeType)"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="size-6 text-white"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="showStatusIcon"
|
2025-10-24 00:01:38 +08:00
|
|
|
|
class="absolute left-4 top-4 flex size-4 items-center rounded-full border-2 border-solid border-white p-0.5"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:style="{
|
|
|
|
|
|
backgroundColor: getApprovalNodeColor(activity.status),
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
|
|
|
|
|
<IconifyIcon
|
|
|
|
|
|
:icon="getApprovalNodeIcon(activity.status, activity.nodeType)"
|
|
|
|
|
|
class="text-white"
|
|
|
|
|
|
:class="[statusIconMap[activity.status]?.animation]"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
|
|
|
|
|
<div
|
2025-05-12 00:53:48 +08:00
|
|
|
|
class="ml-2 flex flex-col items-start gap-2"
|
|
|
|
|
|
:id="`activity-task-${activity.id}-${index}`"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 第一行:节点名称、时间 -->
|
|
|
|
|
|
<div class="flex w-full">
|
2025-08-05 22:58:11 +08:00
|
|
|
|
<div class="font-bold">
|
|
|
|
|
|
{{ activity.name }}
|
|
|
|
|
|
<span v-if="activity.status === BpmTaskStatusEnum.SKIP">
|
|
|
|
|
|
【跳过】
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 信息:时间 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="activity.status !== BpmTaskStatusEnum.NOT_START"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="ml-auto mt-1 text-sm text-gray-500"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
>
|
|
|
|
|
|
{{ getApprovalNodeTime(activity) }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 子流程节点 -->
|
|
|
|
|
|
<div v-if="activity.nodeType === BpmNodeTypeEnum.CHILD_PROCESS_NODE">
|
2025-05-08 16:52:46 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
ghost
|
2025-05-12 00:53:48 +08:00
|
|
|
|
size="small"
|
|
|
|
|
|
@click="handleChildProcess(activity)"
|
2025-07-22 19:31:40 +08:00
|
|
|
|
:disabled="!activity.processInstanceId"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
查看子流程
|
2025-05-08 16:52:46 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 需要自定义选择审批人 -->
|
2025-05-08 16:52:46 +08:00
|
|
|
|
<div
|
2025-05-12 00:53:48 +08:00
|
|
|
|
v-if="shouldShowCustomUserSelect(activity)"
|
|
|
|
|
|
class="flex flex-wrap items-center gap-2"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<Tooltip title="添加用户" placement="left">
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
size="middle"
|
|
|
|
|
|
ghost
|
2025-07-09 08:54:10 +08:00
|
|
|
|
class="flex items-center justify-center"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
@click="
|
2025-07-09 08:54:10 +08:00
|
|
|
|
handleSelectUser(
|
|
|
|
|
|
activity.id,
|
|
|
|
|
|
customApproveUsers[activity.id] ?? [],
|
|
|
|
|
|
)
|
2025-05-12 00:53:48 +08:00
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #icon>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<IconifyIcon icon="lucide:user-plus" class="size-4" />
|
2025-05-12 00:53:48 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(user, userIndex) in customApproveUsers[activity.id]"
|
|
|
|
|
|
:key="user.id || userIndex"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="relative flex h-9 items-center gap-2 rounded-3xl bg-gray-100 pr-2 dark:bg-gray-600"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
>
|
|
|
|
|
|
<Avatar
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="!m-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:size="28"
|
|
|
|
|
|
v-if="user.avatar"
|
|
|
|
|
|
:src="user.avatar"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<Avatar class="!m-1" :size="28" v-else>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<span>{{ user.nickname.substring(0, 1) }}</span>
|
|
|
|
|
|
</Avatar>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<span class="text-sm">{{ user.nickname }}</span>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else class="mt-1 flex flex-wrap items-center gap-2">
|
|
|
|
|
|
<!-- 情况一:遍历每个审批节点下的【进行中】task 任务 -->
|
2025-05-08 16:52:46 +08:00
|
|
|
|
<div
|
2025-05-12 00:53:48 +08:00
|
|
|
|
v-for="(task, idx) in activity.tasks"
|
|
|
|
|
|
:key="idx"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="flex flex-col gap-2 pr-2"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
|
|
|
|
|
<div
|
2025-05-12 00:53:48 +08:00
|
|
|
|
class="relative flex flex-wrap gap-2"
|
|
|
|
|
|
v-if="task.assigneeUser || task.ownerUser"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 信息:头像昵称 -->
|
2025-06-28 00:24:52 +08:00
|
|
|
|
<div class="relative flex h-8 items-center rounded-3xl pr-2">
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<template
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
task.assigneeUser?.avatar || task.assigneeUser?.nickname
|
|
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Avatar
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="!m-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:size="28"
|
|
|
|
|
|
v-if="task.assigneeUser?.avatar"
|
|
|
|
|
|
:src="task.assigneeUser?.avatar"
|
|
|
|
|
|
/>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<Avatar class="!m-1" :size="28" v-else>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
{{ task.assigneeUser?.nickname.substring(0, 1) }}
|
|
|
|
|
|
</Avatar>
|
|
|
|
|
|
{{ task.assigneeUser?.nickname }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template
|
|
|
|
|
|
v-else-if="
|
|
|
|
|
|
task.ownerUser?.avatar || task.ownerUser?.nickname
|
|
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Avatar
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="!m-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:size="28"
|
|
|
|
|
|
v-if="task.ownerUser?.avatar"
|
|
|
|
|
|
:src="task.ownerUser?.avatar"
|
|
|
|
|
|
/>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<Avatar class="!m-1" :size="28" v-else>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
{{ task.ownerUser?.nickname.substring(0, 1) }}
|
|
|
|
|
|
</Avatar>
|
|
|
|
|
|
{{ task.ownerUser?.nickname }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 信息:任务状态图标 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
showStatusIcon && onlyStatusIconShow.includes(task.status)
|
|
|
|
|
|
"
|
2025-10-24 00:01:38 +08:00
|
|
|
|
class="absolute left-5 top-5 flex items-center rounded-full border-2 border-solid border-white p-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:style="{
|
|
|
|
|
|
backgroundColor: statusIconMap[task.status]?.color,
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
|
|
|
|
|
<IconifyIcon
|
2025-06-17 20:22:24 +08:00
|
|
|
|
:icon="statusIconMap[task.status]?.icon || 'lucide:clock'"
|
2025-10-24 00:01:38 +08:00
|
|
|
|
class="size-1.5 text-white"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:class="[statusIconMap[task.status]?.animation]"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-05-08 16:52:46 +08:00
|
|
|
|
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 审批意见和签名 -->
|
|
|
|
|
|
<teleport defer :to="`#activity-task-${activity.id}-${index}`">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="shouldShowApprovalReason(task, activity.nodeType)"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="mt-1 w-full rounded-md bg-gray-100 p-2 text-sm text-gray-500"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
>
|
|
|
|
|
|
审批意见:{{ task.reason }}
|
|
|
|
|
|
</div>
|
2025-05-08 16:52:46 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="
|
2025-05-12 00:53:48 +08:00
|
|
|
|
task.signPicUrl &&
|
|
|
|
|
|
activity.nodeType === BpmNodeTypeEnum.USER_TASK_NODE
|
2025-05-08 16:52:46 +08:00
|
|
|
|
"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="mt-1 w-full rounded-md bg-gray-100 p-2 text-sm text-gray-500"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
签名:
|
|
|
|
|
|
<Image
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="ml-1 h-10 w-24"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:src="task.signPicUrl"
|
|
|
|
|
|
:preview="{ src: task.signPicUrl }"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
</teleport>
|
2025-05-08 16:52:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<!-- 情况二:遍历每个审批节点下的【候选的】task 任务 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="(user, userIndex) in activity.candidateUsers"
|
|
|
|
|
|
:key="userIndex"
|
2025-06-28 00:24:52 +08:00
|
|
|
|
class="relative flex h-8 items-center rounded-3xl pr-2"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
>
|
|
|
|
|
|
<Avatar
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="!m-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:size="28"
|
|
|
|
|
|
v-if="user.avatar"
|
|
|
|
|
|
:src="user.avatar"
|
|
|
|
|
|
/>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<Avatar class="!m-1" :size="28" v-else>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
{{ user.nickname.substring(0, 1) }}
|
|
|
|
|
|
</Avatar>
|
2025-06-17 20:22:24 +08:00
|
|
|
|
<span class="text-sm">
|
2025-05-12 00:53:48 +08:00
|
|
|
|
{{ user.nickname }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 候选任务状态图标 -->
|
2025-05-08 16:52:46 +08:00
|
|
|
|
<div
|
2025-05-12 00:53:48 +08:00
|
|
|
|
v-if="showStatusIcon"
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="absolute left-6 top-5 flex items-center rounded-full border-2 border-solid border-white p-1"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
:style="{ backgroundColor: statusIconMap['-1']?.color }"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
<IconifyIcon
|
2025-06-17 20:22:24 +08:00
|
|
|
|
class="text-xs text-white"
|
|
|
|
|
|
:icon="statusIconMap['-1']?.icon || 'lucide:clock'"
|
2025-05-08 16:52:46 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-05-13 19:54:11 +08:00
|
|
|
|
</Timeline.Item>
|
|
|
|
|
|
</Timeline>
|
2025-05-12 00:53:48 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 用户选择弹窗 -->
|
2025-07-09 08:54:10 +08:00
|
|
|
|
<UserSelectModalComp
|
2025-07-10 14:05:44 +08:00
|
|
|
|
class="w-3/5"
|
2025-05-12 00:53:48 +08:00
|
|
|
|
v-model:value="selectedUsers"
|
|
|
|
|
|
:multiple="true"
|
|
|
|
|
|
title="选择用户"
|
|
|
|
|
|
@confirm="handleUserSelectConfirm"
|
|
|
|
|
|
@closed="handleUserSelectClosed"
|
|
|
|
|
|
@cancel="handleUserSelectCancel"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-05-08 16:52:46 +08:00
|
|
|
|
</template>
|