This commit is contained in:
zlwu committed 2026-07-21 15:23:59 +08:00
1 parent 417d6c9c51
commit c8fe0cdc20
102 files changed
+19847 -12224

No files matched your search

@@ -8,10 +8,7 @@
<div v-if="!items.length" class="oa-flow-preview__empty">暂无任务记录</div>
<div v-for="(item, idx) in items" :key="item.key" class="oa-flow-step">
<div class="oa-flow-rail">
<div
class="oa-flow-dot"
:class="dotClass(item)"
/>
<div class="oa-flow-dot" :class="dotClass(item)" />
<div v-if="idx < items.length - 1" class="oa-flow-line" />
</div>
<div class="oa-flow-card">
@@ -20,7 +17,11 @@
<span v-if="statusBadge(item)" class="oa-flow-badge" :class="statusBadge(item)">
{{ statusText(item.status) }}
</span>
<span v-if="item.taskType === 'cc'" class="oa-flow-badge cc">抄送</span>
<span v-if="signBadge(item)" class="oa-flow-badge" :class="signBadge(item)">
{{ signBadgeText(item) }}
</span>
<span v-else-if="item.taskType === 'cc'" class="oa-flow-badge cc">抄送</span>
<span v-else-if="item.taskType === 'end'" class="oa-flow-badge mute">结束</span>
<template v-if="item.timestamp">
<span class="oa-flow-card__sep">·</span>
<span class="oa-flow-card__meta" :title="item.timestamp">{{ item.timestamp }}</span>
@@ -32,12 +33,21 @@
</span>
</template>
<span
v-if="item.assignee && item.kind !== 'pending_node' && item.kind !== 'terminal'"
v-if="displayPeople(item).length && item.kind !== 'terminal'"
class="oa-flow-card__people"
>
<span class="oa-person-chip">
<span class="oa-person-chip__dot">{{ avatarChar(item.assignee) }}</span>
{{ item.assignee }}
<span
v-for="p in displayPeople(item)"
:key="p.id || p.nickName"
class="oa-person-chip"
:class="personChipClass(p.status)"
:title="personTitle(p)"
>
<span class="oa-person-chip__dot">{{ avatarChar(p.nickName) }}</span>
{{ p.nickName }}
<span v-if="personStatusHint(p.status)" class="oa-person-chip__st">
{{ personStatusHint(p.status) }}
</span>
</span>
</span>
</div>
@@ -53,6 +63,15 @@
<script setup lang="ts">
defineOptions({ name: 'OaProgressChain' })
export type OaProgressPerson = {
id?: string
nickName?: string
status?: string
timestamp?: string
commentText?: string
taskId?: string
}
export type OaProgressChainItem = {
key: string
title: string
@@ -63,6 +82,8 @@
commentText?: string
taskType?: string
kind?: string
signMode?: string
people?: OaProgressPerson[]
}
withDefaults(
@@ -100,6 +121,59 @@
return ''
}
function signBadge(item: OaProgressChainItem) {
if (item.taskType === 'cc' || item.signMode === 'cc') return 'cc'
if (item.signMode === 'and') return 'and'
if (item.signMode === 'or') return 'or'
return ''
}
function signBadgeText(item: OaProgressChainItem) {
const k = signBadge(item)
if (k === 'cc') return '抄送'
if (k === 'and') return '会签'
if (k === 'or') return '或签'
return ''
}
function displayPeople(item: OaProgressChainItem): OaProgressPerson[] {
const list = Array.isArray(item.people) ? item.people.filter((p) => p?.nickName || p?.id) : []
if (list.length) {
return list.map((p) => ({
...p,
nickName: (p.nickName || p.id || '').trim()
}))
}
const name = (item.assignee || '').trim()
if (!name) return []
return [{ nickName: name, status: item.status }]
}
function personChipClass(status?: string) {
const s = status || ''
if (s === 'approved' || s === 'completed') return 'is-ok'
if (s === 'pending' || s === 'running') return 'is-pending'
if (s === 'rejected' || s === 'returned' || s === 'cancelled') return 'is-danger'
if (s === 'done' || s === 'not_reached') return 'is-mute'
return ''
}
function personStatusHint(status?: string) {
const s = status || ''
if (s === 'approved') return '已同意'
if (s === 'rejected') return '已拒绝'
if (s === 'returned') return '已打回'
if (s === 'pending' || s === 'running') return '待处理'
if (s === 'done') return '无需处理'
if (s === 'not_reached') return '未到达'
return ''
}
function personTitle(p: OaProgressPerson) {
const parts = [p.nickName || '', statusText(p.status || ''), p.timestamp || ''].filter(Boolean)
return parts.join(' · ')
}
function dotClass(item: OaProgressChainItem) {
const s = item.status || ''
if (s === 'approved' || s === 'completed' || s === 'done' || s === 'submitted') return 'ok'
@@ -275,6 +349,42 @@
white-space: nowrap;
background: #f1f5f9;
border-radius: 999px;
&.is-ok {
color: #059669;
background: #ecfdf5;
.oa-person-chip__dot {
background: var(--primary, #10b981);
}
}
&.is-pending {
color: #d97706;
background: #fff7ed;
.oa-person-chip__dot {
background: #d97706;
}
}
&.is-danger {
color: #dc2626;
background: #fef2f2;
.oa-person-chip__dot {
background: #ef4444;
}
}
&.is-mute {
color: #94a3b8;
background: #f8fafc;
.oa-person-chip__dot {
background: #94a3b8;
}
}
}
.oa-person-chip__dot {
@@ -289,6 +399,12 @@
border-radius: 50%;
}
.oa-person-chip__st {
margin-left: 2px;
font-size: 10px;
opacity: 0.85;
}
.oa-flow-badge {
flex-shrink: 0;
padding: 0 5px;
@@ -308,6 +424,11 @@
background: #fff7ed;
}
&.and {
color: #2563eb;
background: #eff6ff;
}
&.danger {
color: #dc2626;
background: #fef2f2;