diff --git a/src/pages-bpm/processInstance/detail/components/time-line.vue b/src/pages-bpm/processInstance/detail/components/time-line.vue index 547c4f2..1d83e57 100644 --- a/src/pages-bpm/processInstance/detail/components/time-line.vue +++ b/src/pages-bpm/processInstance/detail/components/time-line.vue @@ -108,7 +108,7 @@ > - + {{ (task.assigneeUser?.nickname || task.ownerUser?.nickname)?.[0] || '?' }} @@ -159,12 +159,12 @@ 签名: diff --git a/src/pages-bpm/processInstance/detail/index.vue b/src/pages-bpm/processInstance/detail/index.vue index 05895bc..a6f775a 100644 --- a/src/pages-bpm/processInstance/detail/index.vue +++ b/src/pages-bpm/processInstance/detail/index.vue @@ -8,14 +8,18 @@ /> - + + + - - + + {{ processInstance?.name }} - - {{ getStatusText(processInstance?.status) }} - @@ -65,6 +69,7 @@ import { useToast } from 'wot-design-uni' import { getApprovalDetail } from '@/api/bpm/processInstance' import { getTaskListByProcessInstanceId } from '@/api/bpm/task' import { navigateBackPlus } from '@/utils' +import { BpmProcessInstanceStatus } from '@/utils/constants' import { formatDateTime } from '@/utils/date' import FormDetail from './components/form-detail.vue' import ProcessInstanceOperationButton from './components/operation-button.vue' @@ -96,74 +101,16 @@ function handleBack() { navigateBackPlus('/pages/bpm/index') } -/** 获取状态文本 */ -// TODO @jason:要有标签,和 vben 一样,盖章 -// TODO @jason:通过字典 -function getStatusText(status?: number) { - const map: Record = { - 0: '待审批', - 1: '审批中', - 2: '审批通过', - 3: '审批不通过', - 4: '已取消', - 5: '已退回', - 6: '委派中', - 7: '审批通过中', +/** 获取状态图标 */ +function getStatusIcon(status?: number): string { + // 状态映射: 1-审批中, 2-审批通过, 3-审批不通过, 4-已取消. -1 未开始不会出现 + const iconMap: Record = { + [BpmProcessInstanceStatus.RUNNING]: '/static/my-icons/bpm/bpm-running.svg', // 待审批 + [BpmProcessInstanceStatus.APPROVE]: '/static/my-icons/bpm/bpm-approve.svg', // 审批通过 + [BpmProcessInstanceStatus.REJECT]: '/static/my-icons/bpm/bpm-reject.svg', // 审批不通过 + [BpmProcessInstanceStatus.CANCEL]: '/static/my-icons/bpm/bpm-cancel.svg', // 已取消 } - return map[status ?? 0] || '待审批' -} - -/** 获取状态标签类型 */ -function getStatusType(status?: number): 'default' | 'primary' | 'success' | 'warning' | 'danger' { - if ([1, 6, 7].includes(status ?? 0)) { - return 'primary' - } - if (status === 2) { - return 'success' - } - if (status === 3) { - return 'danger' - } - if (status === 4 || status === 5) { - return 'warning' - } - return 'default' -} - -/** 获取任务圆点样式 */ -// TODO @jason:看看又要对齐 vben -function getTaskDotClass(task: Task) { - if ([1, 6, 7].includes(task.status)) { - return 'bg-[#1890ff]' - } - if (task.status === 2) { - return 'bg-[#52c41a]' - } - if (task.status === 3) { - return 'bg-[#ff4d4f]' - } - if (task.status === 5) { - return 'bg-[#faad14]' - } - return 'bg-[#d9d9d9]' -} - -/** 获取状态文本样式 */ -// TODO @jason:看看又要对齐 vben -function getStatusTextClass(status: number) { - if ([1, 6, 7].includes(status)) { - return 'text-[#1890ff]' - } - if (status === 2) { - return 'text-[#52c41a]' - } - if (status === 3) { - return 'text-[#ff4d4f]' - } - if (status === 5) { - return 'text-[#faad14]' - } - return 'text-[#999]' + return iconMap[status ?? 1] } /** 加载流程实例 */ diff --git a/src/static/my-icons/bpm/bpm-approve.svg b/src/static/my-icons/bpm/bpm-approve.svg new file mode 100644 index 0000000..06aa09d --- /dev/null +++ b/src/static/my-icons/bpm/bpm-approve.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/static/my-icons/bpm/bpm-cancel.svg b/src/static/my-icons/bpm/bpm-cancel.svg new file mode 100644 index 0000000..ab9b155 --- /dev/null +++ b/src/static/my-icons/bpm/bpm-cancel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/static/my-icons/bpm/bpm-reject.svg b/src/static/my-icons/bpm/bpm-reject.svg new file mode 100644 index 0000000..21fd5f6 --- /dev/null +++ b/src/static/my-icons/bpm/bpm-reject.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/static/my-icons/bpm/bpm-running.svg b/src/static/my-icons/bpm/bpm-running.svg new file mode 100644 index 0000000..5908c13 --- /dev/null +++ b/src/static/my-icons/bpm/bpm-running.svg @@ -0,0 +1 @@ + \ No newline at end of file