🐛 修复回收站配置中文文案
This commit is contained in:
1 parent
37e0a068b3
commit
c1be1f275a
2 files changed
+16
-5
No files matched your search
@@ -780,6 +780,8 @@ export default {
|
|||||||
count: '按下载次数'
|
count: '按下载次数'
|
||||||
},
|
},
|
||||||
maxSaveTime: '文件最长保存时间',
|
maxSaveTime: '文件最长保存时间',
|
||||||
|
trashRetentionDays: '回收站默认保留期',
|
||||||
|
trashRetentionDaysNote: '修改后会重新计算当前回收站中有期限文件的清理时间;已设为永久或已清理的文件不受影响。',
|
||||||
s3AccessKeyId: 'Access Key ID',
|
s3AccessKeyId: 'Access Key ID',
|
||||||
s3SecretAccessKey: 'Secret Access Key',
|
s3SecretAccessKey: 'Secret Access Key',
|
||||||
s3BucketName: '存储桶名称',
|
s3BucketName: '存储桶名称',
|
||||||
|
|||||||
@@ -6,10 +6,16 @@
|
|||||||
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">回收站</h2>
|
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">回收站</h2>
|
||||||
<p class="mt-1 text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
|
<p class="mt-1 text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
|
||||||
</div>
|
</div>
|
||||||
<BaseButton variant="secondary" :loading="isLoading" @click="loadTrash">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
|
<BaseButton variant="secondary" @click="openRetentionSettings">
|
||||||
刷新回收站
|
<template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>
|
||||||
</BaseButton>
|
配置默认清理时间
|
||||||
|
</BaseButton>
|
||||||
|
<BaseButton variant="secondary" :loading="isLoading" @click="loadTrash">
|
||||||
|
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
|
||||||
|
刷新回收站
|
||||||
|
</BaseButton>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="mb-5 grid gap-3 sm:mb-6 sm:grid-cols-3">
|
<section class="mb-5 grid gap-3 sm:mb-6 sm:grid-cols-3">
|
||||||
@@ -62,7 +68,8 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { EraserIcon, FileX2Icon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
|
import { useRouter } from 'vue-router'
|
||||||
|
import { EraserIcon, FileX2Icon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
|
||||||
import BaseButton from '@/components/common/BaseButton.vue'
|
import BaseButton from '@/components/common/BaseButton.vue'
|
||||||
import DataPagination from '@/components/common/DataPagination.vue'
|
import DataPagination from '@/components/common/DataPagination.vue'
|
||||||
import { useAdminTrash, useInjectedDarkMode } from '@/composables'
|
import { useAdminTrash, useInjectedDarkMode } from '@/composables'
|
||||||
@@ -70,6 +77,7 @@ import type { TrashFileItem } from '@/types'
|
|||||||
import { formatFileSize, formatTimestamp } from '@/utils/common'
|
import { formatFileSize, formatTimestamp } from '@/utils/common'
|
||||||
|
|
||||||
const isDarkMode = useInjectedDarkMode()
|
const isDarkMode = useInjectedDarkMode()
|
||||||
|
const router = useRouter()
|
||||||
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention } = useAdminTrash()
|
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention } = useAdminTrash()
|
||||||
const items = ref<TrashFileItem[]>([])
|
const items = ref<TrashFileItem[]>([])
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
@@ -89,6 +97,7 @@ const purgedCount = computed(() => items.value.filter(item => item.isTrashPurged
|
|||||||
const fileName = (item: TrashFileItem) => item.name || `${item.prefix || ''}${item.suffix || ''}` || '未命名文件'
|
const fileName = (item: TrashFileItem) => item.name || `${item.prefix || ''}${item.suffix || ''}` || '未命名文件'
|
||||||
const stateLabel = (item: TrashFileItem) => item.isTrashPurged ? '仅审计记录' : item.isTrashPermanent ? '永久保留' : '可恢复'
|
const stateLabel = (item: TrashFileItem) => item.isTrashPurged ? '仅审计记录' : item.isTrashPermanent ? '永久保留' : '可恢复'
|
||||||
const expiryLabel = (item: TrashFileItem) => item.isTrashPurged ? `文件本体已于 ${formatTimestamp(item.trashPurgedAt || '')} 清理` : item.isTrashPermanent ? '不会自动清理文件本体' : `预计清理:${formatTimestamp(item.trashExpiresAt || '')}`
|
const expiryLabel = (item: TrashFileItem) => item.isTrashPurged ? `文件本体已于 ${formatTimestamp(item.trashPurgedAt || '')} 清理` : item.isTrashPermanent ? '不会自动清理文件本体' : `预计清理:${formatTimestamp(item.trashExpiresAt || '')}`
|
||||||
|
const openRetentionSettings = () => { void router.push({ path: '/admin/settings', hash: '#settings-upload' }) }
|
||||||
|
|
||||||
const loadTrash = async () => { isLoading.value = true; errorText.value = ''; try { const detail = await fetchTrash({ page: page.value, size: size.value }); items.value = detail?.data || []; total.value = Number(detail?.total || 0) } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '回收站加载失败,请稍后重试。' } finally { isLoading.value = false } }
|
const loadTrash = async () => { isLoading.value = true; errorText.value = ''; try { const detail = await fetchTrash({ page: page.value, size: size.value }); items.value = detail?.data || []; total.value = Number(detail?.total || 0) } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '回收站加载失败,请稍后重试。' } finally { isLoading.value = false } }
|
||||||
const run = async (item: TrashFileItem, action: string, operation: () => Promise<unknown>) => { busyId.value = item.id; busyAction.value = action; try { await operation(); await loadTrash() } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '操作未完成,请稍后重试。' } finally { busyId.value = null; busyAction.value = '' } }
|
const run = async (item: TrashFileItem, action: string, operation: () => Promise<unknown>) => { busyId.value = item.id; busyAction.value = action; try { await operation(); await loadTrash() } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '操作未完成,请稍后重试。' } finally { busyId.value = null; busyAction.value = '' } }
|
||||||
|
|||||||
Reference in new issue
Block a user