✨ feat(frontend): 新增上传中断并联动历史回收状态

This commit is contained in:
orion committed 2026-09-18 16:53:40 +08:00
1 parent a962f7aec7
commit e7918e9317
20 files changed
+275 -71

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
import type { AnalyticsFileRow } from '@/types'
import { getTrashReasonLabel } from './trashPresentation.ts'
export function getHistoryStatusLabel(file: AnalyticsFileRow): string {
if (file.status === 'purged' || file.is_purged) return '已清理'
if (file.status === 'trashed' || file.is_trashed) return file.trash_reason ? getTrashReasonLabel(file.trash_reason) : '回收站中'
if (file.current || file.status === 'active' || file.status === 'expired') return file.was_restored ? '现存,已从回收站恢复' : '现存'
if (file.deleted) return '已删除'
return '历史'
}
+6 -5
View File
@@ -19,11 +19,7 @@ export function formatTrashTime(value?: string | null, now?: number): string {
}
export function getTrashPresentation(item: TrashFileItem, now: number) {
const reasons: Record<string, string> = {
manual: '手动删除', batch_delete: '批量删除', expired_time: '保存到期',
expired_count: '次数用尽', expired_both: '到期且次数用尽', expired: '历史自动回收'
}
const reason = item.trashReason ? reasons[item.trashReason] || '其他原因' : '未记录'
const reason = getTrashReasonLabel(item.trashReason)
if (item.isTrashPurged) return {
state: '已清理', tone: 'muted', reason, reminder: '',
@@ -45,3 +41,8 @@ export function getTrashPresentation(item: TrashFileItem, now: number) {
note: valid && remainingMs <= 0 ? '已到清理时间,等待后台处理。' : ''
}
}
export function getTrashReasonLabel(reason?: string | null): string {
const labels: Record<string,string> = {manual:'手动删除',batch_delete:'批量删除',expired_time:'保存到期',expired_count:'次数用尽',expired_both:'到期且次数用尽',expired:'历史自动回收'}
return reason ? labels[reason] || '其他原因' : '未记录'
}