feat: 工作流审批页面timeline组件节点icon展示样式自定义特殊处理

pull/582/head
GoldenZqqq 2024-10-22 16:23:35 +08:00
parent dfa9cd5a3c
commit de073e82bc
6 changed files with 146 additions and 18 deletions

View File

@ -0,0 +1 @@
<svg t="1729561718271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8640" width="200" height="200"><path d="M908.5952 920.4224H164.7616a31.0784 31.0784 0 0 1-30.976-30.976c0-17.0496 13.9264-30.976 30.976-30.976h743.8336c17.0496 0 31.0272 13.9264 31.0272 30.976a31.0784 31.0784 0 0 1-31.0272 30.976z m0-123.9552H164.7616a31.0784 31.0784 0 0 1-30.976-30.976v-154.9824c0-51.1488 41.8304-92.9792 92.9792-92.9792h198.3488c-6.1952-37.1712-24.7808-72.8064-51.1488-103.8336a216.576 216.576 0 0 1-54.2208-144.128c0-58.88 23.2448-114.688 66.6112-156.4672C429.7728 71.168 485.5296 51.0976 545.9968 52.6848c111.5648 4.608 206.08 100.6592 207.616 212.2752 1.536 55.808-20.1216 110.0288-57.344 151.8592-26.3168 27.904-41.8304 61.952-48.0256 100.7104h198.3488c51.2 0 93.0304 41.8304 93.0304 92.9792v154.9824a31.0784 31.0784 0 0 1-31.0272 30.976z m-712.8064-61.952H877.568v-124.0064a31.0784 31.0784 0 0 0-31.0272-30.976h-232.448a31.0784 31.0784 0 0 1-30.976-31.0272c0-65.024 23.2448-127.0784 66.6624-173.568 27.8528-29.3888 41.8304-68.1472 41.8304-108.4416-1.536-80.5888-68.1984-148.7872-148.7872-151.8592a150.528 150.528 0 0 0-113.152 43.3664 153.6 153.6 0 0 0-48.0256 111.616c0 37.1712 13.9776 74.3424 38.7584 102.2464 44.9536 51.1488 69.7344 113.152 69.7344 176.64a31.0784 31.0784 0 0 1-30.976 31.0272h-232.448a31.0784 31.0784 0 0 0-30.976 30.976v123.9552z" fill="#fff" p-id="8641"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<svg t="1729585232424" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1602" width="200" height="200"><path d="M925.5 898.9H804.9c-19 0-34.5-15.4-34.5-34.4V761.3c0-19 15.4-34.4 34.5-34.4h34.5V572.2c0-19-15.4-34.4-34.5-34.4H529.2V727h34.5c19 0 34.5 15.4 34.5 34.4v103.2c0 19-15.4 34.4-34.5 34.4H443.1c-19 0-34.5-15.4-34.5-34.4V761.3c0-19 15.4-34.4 34.5-34.4h34.5V537.8H219.1c-19 0-34.5 15.4-34.5 34.4V727h34.5c19 0 34.5 15.4 34.5 34.4v103.2c0 19-15.4 34.4-34.5 34.4H98.5c-19 0-34.5-15.4-34.5-34.4V761.3c0-19 15.4-34.4 34.5-34.4H133V555c0-38 30.9-68.8 68.9-68.8h275.7V297.1h-34.5c-19 0-34.5-15.4-34.5-34.4V159.5c0-19 15.4-34.4 34.5-34.4h120.6c19 0 34.5 15.4 34.5 34.4v103.2c0 19-15.4 34.4-34.5 34.4h-34.5v189.2h292.9c38.1 0 68.9 30.8 68.9 68.8v172h34.5c19 0 34.5 15.4 34.5 34.4v103.2c0 18.8-15.4 34.2-34.5 34.2z m0 0" p-id="1603"></path></svg>

After

Width:  |  Height:  |  Size: 885 B

View File

@ -0,0 +1 @@
<svg t="1729584191390" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1449" width="200" height="200"><path d="M901.489435 536.822664v-0.931601l-1.001722-198.240726c-0.100172-19.162936-9.21584-37.474409-25.043042-50.246361-14.024104-11.349507-32.265456-17.60025-51.348255-17.610268l-618.062295-0.18031c-19.142902 0-37.424323 6.280795-51.478478 17.690405-15.827203 12.842072-24.902802 31.2437-24.892785 50.486775v196.798247A114.987635 114.987635 0 1 0 195.295664 536.922836V338.782282c1.15198-1.252152 4.808264-3.596181 10.768509-3.596181l276.725622 0.090155v199.753326a114.987635 114.987635 0 1 0 65.612772 1.412428V335.326342l275.693849 0.080138c6.01033 0 9.626546 2.344029 10.768508 3.596181l1.001722 195.70637a114.987635 114.987635 0 1 0 65.592737 2.113633zM214.979496 645.910158a56.437001 56.437001 0 1 1-56.437001-56.437001 56.507122 56.507122 0 0 1 56.437001 56.437001z m354.689623 0a56.437001 56.437001 0 1 1-56.437001-56.437001 56.507122 56.507122 0 0 1 56.437001 56.437001z m295.507904 56.437001a56.437001 56.437001 0 1 1 56.437001-56.437001 56.507122 56.507122 0 0 1-56.457035 56.437001z" p-id="1450"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg t="1729585239190" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1755" width="200" height="200"><path d="M901.489435 536.822664v-0.931601l-1.001722-198.240726c-0.100172-19.162936-9.21584-37.474409-25.043042-50.246361-14.024104-11.349507-32.265456-17.60025-51.348255-17.610268l-618.062295-0.18031c-19.142902 0-37.424323 6.280795-51.478478 17.690405-15.827203 12.842072-24.902802 31.2437-24.892785 50.486775v196.798247A114.987635 114.987635 0 1 0 195.295664 536.922836V338.782282c1.15198-1.252152 4.808264-3.596181 10.768509-3.596181l276.725622 0.090155v199.753326a114.987635 114.987635 0 1 0 65.612772 1.412428V335.326342l275.693849 0.080138c6.01033 0 9.626546 2.344029 10.768508 3.596181l1.001722 195.70637a114.987635 114.987635 0 1 0 65.592737 2.113633zM214.979496 645.910158a56.437001 56.437001 0 1 1-56.437001-56.437001 56.507122 56.507122 0 0 1 56.437001 56.437001z m354.689623 0a56.437001 56.437001 0 1 1-56.437001-56.437001 56.507122 56.507122 0 0 1 56.437001 56.437001z m295.507904 56.437001a56.437001 56.437001 0 1 1 56.437001-56.437001 56.507122 56.507122 0 0 1-56.457035 56.437001z" p-id="1756"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg t="1729561814171" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1359" width="200" height="200"><path d="M674.496 603.456c120.256 0 218.176 90.752 221.44 203.84l0.064 5.888v125.888c0 11.52-9.92 20.928-22.144 20.928h-44.352a21.568 21.568 0 0 1-22.144-20.928v-125.888c0-67.712-56.512-123.264-128-125.76l-4.928-0.064H349.568c-71.488 0-130.176 53.504-132.864 121.152l-0.064 4.672v125.888c0 11.52-9.92 20.928-22.144 20.928h-44.352A21.568 21.568 0 0 1 128 939.072v-125.888c0-113.92 95.872-206.528 215.36-209.664l6.208-0.064h324.928zM497.216 128c122.368 0 221.568 93.888 221.568 209.728s-99.2 209.792-221.568 209.792c-122.304 0-221.44-93.952-221.44-209.728C275.712 221.952 374.848 128 497.152 128z m0 83.904c-73.408 0-132.864 56.32-132.864 125.888 0 69.504 59.52 125.824 132.864 125.824 73.408 0 132.928-56.32 132.928-125.824 0-69.504-59.52-125.888-132.928-125.888z" fill="#fff" p-id="1360"></path></svg>

After

Width:  |  Height:  |  Size: 947 B

View File

@ -9,8 +9,32 @@
:icon="getApprovalNodeIcon(activity.status, activity.nodeType)"
:color="getApprovalNodeColor(activity.status)"
>
<template #dot>
<div
class="position-absolute left--10px top--6px rounded-full border border-solid border-#dedede w-30px h-30px flex justify-center items-center bg-#3f73f7 p-5px"
>
<img class="w-full h-full" :src="getApprovalNodeImg(activity.nodeType)" alt="" />
<div
class="position-absolute top-17px left-17px bg-#fff rounded-full flex items-center p-2px"
>
<el-icon :size="12" :color="getApprovalNodeColor(activity.status)">
<component :is="getApprovalNodeIcon(activity.status, activity.nodeType)" />
</el-icon>
</div>
</div>
</template>
<div class="flex flex-col items-start">
<div class="font-bold"> {{ activity.name }}</div>
<!-- 第一行节点名称时间 -->
<div class="flex w-full">
<div class="font-bold"> {{ activity.name }}</div>
<!-- 信息时间 -->
<div
v-if="activity.status !== TaskStatusEnum.NOT_START"
class="text-#a5a5a5 text-13px mt-1 ml-auto"
>
{{ getApprovalNodeTime(activity) }}
</div>
</div>
<div class="flex items-center flex-wrap mt-1">
<!-- 情况一遍历每个审批节点下的进行中task 任务 -->
<div v-for="(task, idx) in activity.tasks" :key="idx" class="flex items-center">
@ -70,7 +94,7 @@
<div
v-for="(user, idx1) in activity.candidateUsers"
:key="idx1"
class="flex items-center"
class="flex items-center self-start"
>
<div class="flex items-center flex-col pr-2">
<div class="position-relative">
@ -99,13 +123,6 @@
</div>
</div>
</div>
<!-- 信息时间 -->
<div
v-if="activity.status !== TaskStatusEnum.NOT_START"
class="text-#a5a5a5 text-13px mt-1"
>
{{ getApprovalNodeTime(activity) }}
</div>
</div>
</el-timeline-item>
</el-timeline>
@ -117,16 +134,105 @@ 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'
import starterSvg from '@/assets/svgs/bpm/starter.svg'
import auditorSvg from '@/assets/svgs/bpm/auditor.svg'
import copySvg from '@/assets/svgs/bpm/copy.svg'
import conditionSvg from '@/assets/svgs/bpm/condition.svg'
import parallelSvg from '@/assets/svgs/bpm/parallel.svg'
defineOptions({ name: 'BpmProcessInstanceTimeline' })
defineProps<{
approveNodes: ProcessInstanceApi.ApprovalNodeInfo[] //
}>()
// defineProps<{
// approveNodes: ProcessInstanceApi.ApprovalNodeInfo[] //
// }>()
const approveNodes = [
{
id: 1,
name: '发起审批',
nodeType: NodeType.START_USER_NODE,
status: TaskStatusEnum.NOT_START,
startTime: new Date('2024-10-01 10:00:00'),
endTime: null,
candidateUsers: [],
tasks: []
},
{
id: 2,
name: '经理审批',
nodeType: NodeType.USER_TASK_NODE,
status: TaskStatusEnum.RUNNING, //
startTime: new Date('2024-10-02 11:00:00'),
endTime: null,
candidateUsers: [
{
nickname: '张经理',
avatar: 'https://picsum.photos/200?r=1'
},
{
nickname: '张经理',
avatar: 'https://picsum.photos/200?r=1'
},
{
nickname: '张经理',
avatar: 'https://picsum.photos/200?r=1'
},
{
nickname: '张经理',
avatar: 'https://picsum.photos/200?r=1'
}
],
tasks: [
{
assigneeUser: {
nickname: '李经理',
avatar: 'https://picsum.photos/200?r=1'
},
ownerUser: null,
status: TaskStatusEnum.RUNNING, //
reason: '同意'
}
]
},
{
id: 3,
name: '财务审批',
nodeType: NodeType.USER_TASK_NODE,
status: TaskStatusEnum.APPROVE, //
startTime: new Date('2024-10-03 14:00:00'),
endTime: new Date('2024-10-03 15:00:00'),
candidateUsers: [],
tasks: [
{
assigneeUser: {
nickname: '王财务',
avatar: 'https://picsum.photos/200?r=1'
},
ownerUser: null,
status: TaskStatusEnum.APPROVE, //
reason: '审批通过'
}
]
},
{
id: 4,
name: '总经理审批',
nodeType: NodeType.USER_TASK_NODE,
status: TaskStatusEnum.NOT_START, //
startTime: null,
endTime: null,
candidateUsers: [
{
nickname: '总经理',
avatar: 'https://picsum.photos/200?r=1'
}
],
tasks: []
}
]
//
const statusIconMap2 = {
//
'-1': { color: '#e5e7ec', icon: 'ep-clock' },
'-1': { color: '#909398', icon: 'ep-clock' },
//
'0': { color: '#e5e7ec', icon: 'ep:loading' },
//
@ -147,7 +253,7 @@ const statusIconMap2 = {
const statusIconMap = {
//
'-1': { color: '#e5e7ec', icon: Clock },
'-1': { color: '#909398', icon: Clock },
'0': { color: '#e5e7ec', icon: Clock },
//
'1': { color: '#448ef7', icon: Loading },
@ -165,6 +271,23 @@ const statusIconMap = {
'7': { color: '#00b32a', icon: Check }
}
const nodeTypeSvgMap = {
//
[NodeType.START_USER_NODE]: { color: '', svg: starterSvg },
//
[NodeType.USER_TASK_NODE]: { color: '', svg: auditorSvg },
//
[NodeType.COPY_TASK_NODE]: { color: '', svg: copySvg },
//
[NodeType.CONDITION_NODE]: { color: '', svg: conditionSvg },
//
[NodeType.PARALLEL_BRANCH_NODE]: { color: '', svg: parallelSvg }
}
const getApprovalNodeImg = (nodeType: NodeType) => {
return nodeTypeSvgMap[nodeType]?.svg
}
const getApprovalNodeIcon = (taskStatus: number, nodeType: NodeType) => {
if (taskStatus == TaskStatusEnum.NOT_START) {
return statusIconMap[taskStatus]?.icon
@ -181,13 +304,13 @@ const getApprovalNodeColor = (taskStatus: number) => {
const getApprovalNodeTime = (node: ProcessInstanceApi.ApprovalNodeInfo) => {
if (node.nodeType === NodeType.START_USER_NODE && node.startTime) {
return `发起时间:${formatDate(node.startTime)}`
return `${formatDate(node.startTime)}`
}
if (node.endTime) {
return `审批时间:${formatDate(node.endTime)}`
return `${formatDate(node.endTime)}`
}
if (node.startTime) {
return `创建时间:${formatDate(node.startTime)}`
return `${formatDate(node.startTime)}`
}
}
</script>