diff --git a/frontend/src/views/Upstreams.vue b/frontend/src/views/Upstreams.vue index 56367b5..92af907 100644 --- a/frontend/src/views/Upstreams.vue +++ b/frontend/src/views/Upstreams.vue @@ -402,12 +402,12 @@ @@ -518,10 +518,10 @@ @@ -1058,15 +1058,20 @@ function shrinkError(value: string) { } const keyStatusLabel = (row: GeneratedUpstreamKey) => { + // orphaned 先区分是否仍有关联账号;无关联显示未被使用,有关联再按归档原因细分 if (row.status === 'orphaned') { + if (!row.imported_account_id) return '未被使用' if (row.error?.startsWith('重复旧 Key')) return '重复旧 Key' if (row.error === '远端 Key 已不存在') return '远端缺失' if (row.error === '来源分组已不存在') return '来源分组缺失' return '已归档' } + // 有关联下游账号 → 已导入(优先于上游 Key 的原始状态) + if (row.imported_account_id) return '已导入' + // 无下游关联 → 按上游 Key 状态显示 return ({ created: '已创建', - exists: '已存在', + exists: '上游已存在', imported: '已导入', remote: '远端存在', replaced: '已替换', @@ -1076,23 +1081,36 @@ const keyStatusLabel = (row: GeneratedUpstreamKey) => { }[row.status] || '未知状态') } -const keyStatusTagType = (s: string) => { +const keyStatusTagType = (row: GeneratedUpstreamKey) => { + const s = row.status + // orphaned 按是否有下游关联区分颜色 + if (s === 'orphaned') return row.imported_account_id ? 'warning' : 'info' + // 有关联下游账号 → success + if (row.imported_account_id) return 'success' + // 按上游 Key 状态 if (s === 'created' || s === 'imported') return 'success' if (s === 'exists' || s === 'remote') return 'info' - if (s === 'orphaned' || s === 'replaced' || s === 'created_pending_key') return 'warning' + if (s === 'replaced' || s === 'created_pending_key') return 'warning' if (s === 'failed' || s === 'import_failed') return 'danger' return 'info' } -const orphanedKeyTooltip = (row: GeneratedUpstreamKey) => { +const keyRowTooltip = (row: GeneratedUpstreamKey) => { const parts: string[] = [] if (row.error) parts.push(row.error) + if (row.imported_account_id) { + parts.push(`已关联下游账号 ID: ${row.imported_account_id}`) + } if (row.status === 'orphaned' && row.imported_account_id) { parts.push('可到目标站「清理异常账号」中处理') } return parts.join('\n') } +const hasKeyTooltip = (row: GeneratedUpstreamKey) => { + return !!(row.error || row.imported_account_id) +} + async function loadList() { tableLoading.value = true try {