✨ feat: 重构管理后台并增强组件系统与回收站功能
* 新增自适应数值与窗口分析工具,提升交互体验 * 优化回收站模块逻辑,增加展示与选择功能 * 引入 Macaron 主题配置文件并更新 Tailwind 配置 * 精简基础组件代码,移除冗余样式与设置项 * 完善测试用例,覆盖 UI 系统与回收站工作流 * 更新多语言配置,支持功能变更后的文案需求
This commit is contained in:
1 parent
614b9a2104
commit
9b22534e2b
61 files changed
+1624
-832
No files matched your search
@@ -4,14 +4,14 @@
|
||||
>
|
||||
<div class="w-full max-w-md relative z-10">
|
||||
<div
|
||||
class="rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300"
|
||||
class="fcb-surface rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-gray-800 bg-opacity-50 backdrop-filter backdrop-blur-xl border-gray-700'
|
||||
: 'bg-white border-gray-200'
|
||||
]"
|
||||
>
|
||||
<div class="p-8">
|
||||
<div class="p-5 sm:p-8">
|
||||
<PageHeader :title="config.name" @title-click="toSend" />
|
||||
<RetrieveForm
|
||||
v-model="code"
|
||||
|
||||
+15
-18
@@ -4,16 +4,16 @@
|
||||
@paste.prevent="handlePaste"
|
||||
>
|
||||
<div
|
||||
class="rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
|
||||
class="fcb-surface rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl border-gray-700'
|
||||
: 'bg-[#f5f8f9] border-[#dce5e8] shadow-[12px_16px_34px_rgba(112,137,151,.16),-8px_-8px_20px_rgba(255,255,255,.8)]'
|
||||
]"
|
||||
>
|
||||
<div class="p-6 sm:p-8">
|
||||
<div class="p-5 sm:p-8">
|
||||
<PageHeader :title="config.name" @title-click="toRetrieve" />
|
||||
<form @submit.prevent="handleSubmit" class="space-y-8">
|
||||
<form @submit.prevent="handleSubmit" class="space-y-5 sm:space-y-8">
|
||||
<SendTypeSelector
|
||||
:selected-type="sendType"
|
||||
@update:selected-type="sendType = $event"
|
||||
@@ -49,12 +49,9 @@
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="isSubmitting"
|
||||
class="w-full bg-[#7198a6] text-white font-bold shadow-[0_10px_20px_rgba(113,152,166,.24)] py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
|
||||
class="fcb-action fcb-button-primary w-full bg-[#7198a6] text-white font-bold shadow-[0_10px_20px_rgba(113,152,166,.24)] py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
|
||||
>
|
||||
<span
|
||||
class="absolute top-0 left-0 w-full h-full bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"
|
||||
></span>
|
||||
<span class="relative z-10 flex items-center justify-center text-lg">
|
||||
<span class="relative z-10 flex items-center justify-center text-sm sm:text-lg">
|
||||
<svg
|
||||
v-if="isSubmitting"
|
||||
class="w-6 h-6 mr-2 animate-spin"
|
||||
@@ -82,7 +79,7 @@
|
||||
</button>
|
||||
</form>
|
||||
<div class="mt-6 text-center">
|
||||
<router-link to="/" class="inline-flex min-h-11 items-center rounded-lg px-2 text-sm text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#294047] sm:px-3 sm:text-base">
|
||||
<router-link to="/" class="fcb-action inline-flex min-h-11 items-center rounded-lg px-2 text-sm text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#333d49] sm:px-3 sm:text-base">
|
||||
{{ t('send.needRetrieveFile') }}
|
||||
</router-link>
|
||||
</div>
|
||||
@@ -102,7 +99,7 @@
|
||||
<button
|
||||
type="button"
|
||||
@click="toggleDrawer"
|
||||
class="flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-indigo-50 dark:hover:bg-gray-700"
|
||||
class="fcb-action flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-indigo-50 dark:hover:bg-gray-700"
|
||||
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
||||
>
|
||||
{{ t('send.sendRecords') }}
|
||||
@@ -220,20 +217,20 @@ select option {
|
||||
}
|
||||
|
||||
select option:checked {
|
||||
background: linear-gradient(to right, rgb(99 102 241 / 0.5), rgb(168 85 247 / 0.5)) !important;
|
||||
background: linear-gradient(to right, rgb(143 175 191 / 0.5), rgb(182 168 201 / 0.5)) !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.dark select option:checked {
|
||||
background: linear-gradient(to right, rgb(99 102 241 / 0.7), rgb(168 85 247 / 0.7)) !important;
|
||||
background: linear-gradient(to right, rgb(143 175 191 / 0.7), rgb(182 168 201 / 0.7)) !important;
|
||||
}
|
||||
|
||||
select option:hover {
|
||||
background-color: rgb(99 102 241 / 0.1);
|
||||
background-color: rgb(143 175 191 / 0.1);
|
||||
}
|
||||
|
||||
.dark select option:hover {
|
||||
background-color: rgb(99 102 241 / 0.2);
|
||||
background-color: rgb(143 175 191 / 0.2);
|
||||
}
|
||||
|
||||
/* 自定义滚动条样式 */
|
||||
@@ -254,14 +251,14 @@ select option:hover {
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, rgba(99, 102, 241, 0.6), rgba(168, 85, 247, 0.6));
|
||||
background: linear-gradient(135deg, rgba(143, 175, 191, 0.6), rgba(182, 168, 201, 0.6));
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(168, 85, 247, 0.8));
|
||||
background: linear-gradient(135deg, rgba(143, 175, 191, 0.8), rgba(182, 168, 201, 0.8));
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
@@ -279,11 +276,11 @@ select option:hover {
|
||||
}
|
||||
|
||||
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, rgba(99, 102, 241, 0.7), rgba(168, 85, 247, 0.7));
|
||||
background: linear-gradient(135deg, rgba(143, 175, 191, 0.7), rgba(182, 168, 201, 0.7));
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
|
||||
background: linear-gradient(135deg, rgba(143, 175, 191, 0.9), rgba(182, 168, 201, 0.9));
|
||||
}
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="p-4 sm:p-6">
|
||||
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">ADMIN AUDIT</p>
|
||||
<p class="hidden text-xs font-medium tracking-[0.16em] sm:block" :class="mutedTextClass">ADMIN AUDIT</p>
|
||||
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">操作记录</h2>
|
||||
<p class="mt-1 text-sm" :class="mutedTextClass">查看后台管理、回收站和配置变更的可追溯记录。</p>
|
||||
</div>
|
||||
@@ -12,12 +12,12 @@
|
||||
</BaseButton>
|
||||
</header>
|
||||
|
||||
<section class="theme-2026-card theme-2026-card-hover mb-5 rounded-[24px] border p-3 shadow-md sm:mb-6 sm:rounded-[30px] sm:p-4" :class="panelClass">
|
||||
<div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-[minmax(0,1fr)_220px_220px_auto]">
|
||||
<label class="min-w-0">
|
||||
<span class="sr-only">搜索操作、对象或文件名</span>
|
||||
<section class="theme-2026-card mb-5 rounded-[24px] border p-3 shadow-md sm:mb-6 sm:rounded-[30px] sm:p-4" :class="panelClass">
|
||||
<div class="fcb-filter-grid grid grid-cols-2 gap-3 xl:grid-cols-[minmax(0,1fr)_180px_180px_auto]">
|
||||
<label class="col-span-2 min-w-0 xl:col-span-1">
|
||||
<span class="mb-1 block text-xs font-medium" :class="mutedTextClass">关键词</span>
|
||||
<span class="relative block">
|
||||
<SearchIcon class="absolute left-3 top-3 h-4 w-4" :class="mutedTextClass" />
|
||||
<SearchIcon class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2" :class="mutedTextClass" />
|
||||
<input v-model="filters.keyword" class="min-h-11 w-full rounded-xl border py-2.5 pl-10 pr-3 text-sm outline-none focus:ring-2 focus:ring-[#8fb2bf]" :class="fieldClass" placeholder="搜索操作、对象或文件名" @keyup.enter="applyFilters" />
|
||||
</span>
|
||||
</label>
|
||||
@@ -35,9 +35,9 @@
|
||||
<option v-for="option in targetTypeOptions" :key="option.value" :value="option.value">{{ targetTypeLabel(option.label) }} · {{ option.count }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="flex items-end gap-2">
|
||||
<BaseButton class="flex-1" :loading="isLoading" @click="applyFilters">筛选</BaseButton>
|
||||
<button type="button" class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors" :class="actionClass" aria-label="重置筛选" title="重置筛选" @click="resetFilters">
|
||||
<div class="col-span-2 flex items-end justify-end gap-2 xl:col-span-1">
|
||||
<BaseButton class="min-w-20" :loading="isLoading" @click="applyFilters">筛选</BaseButton>
|
||||
<button type="button" class="fcb-action fcb-icon-action flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors" :class="actionClass" aria-label="重置筛选" title="重置筛选" @click="resetFilters">
|
||||
<RotateCcwIcon class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<h3 class="text-base font-semibold" :class="primaryTextClass">审计事件</h3>
|
||||
<p class="mt-0.5 text-xs" :class="mutedTextClass">筛选结果 {{ total }} 条 · 已保存 {{ storedTotal }} 条</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'">
|
||||
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#2c3440] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'">
|
||||
<ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" /> 审计留痕
|
||||
</span>
|
||||
</div>
|
||||
@@ -64,7 +64,7 @@
|
||||
v-for="activity in activities"
|
||||
:key="activity.id"
|
||||
class="fcb-interactive-row group grid gap-3 px-4 py-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-start sm:px-6"
|
||||
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
|
||||
:class="isDarkMode ? 'hover:bg-[#2c3440]/60' : 'hover:bg-[#f2f8f8]'"
|
||||
>
|
||||
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl" :class="activityToneClass(activity.action)">
|
||||
<component :is="activityIcon(activity.action)" class="h-5 w-5" aria-hidden="true" />
|
||||
@@ -109,19 +109,20 @@ const filters = ref({ page: 1, size: 20, keyword: '', action: '', targetType: ''
|
||||
|
||||
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
|
||||
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const fieldClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#253941] text-white placeholder:text-[#9fb2b7]' : 'border-[#c8d8dc] bg-white text-[#263f48] placeholder:text-[#84969a]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const actionClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#495765] bg-[#252b34]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const fieldClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#2c3440] text-white placeholder:text-[#9fb2b7]' : 'border-[#c8d8dc] bg-white text-[#263f48] placeholder:text-[#84969a]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#495765] border-[#495765]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const actionClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]')
|
||||
const badgeClass = computed(() => isDarkMode.value ? 'border-[#50666f] text-[#b8d6de]' : 'border-[#c8d8dc] text-[#4e6c75]')
|
||||
|
||||
const actionLabel = (action: string) => ({
|
||||
'file.delete': '移入回收站', 'files.batch_delete': '批量移入回收站', 'trash.restore': '从回收站恢复', 'trash.purge': '永久清理文件本体', 'file.update': '更新文件信息', 'files.batch_update': '批量更新文件', 'file.metadata_update': '更新文件备注', 'file.policy_action': '调整文件策略', 'files.batch_policy_action': '批量调整策略', 'config.update': '更新系统设置', 'local_file.delete': '删除本地文件', 'local_file.share': '分享本地文件'
|
||||
'file.delete': '移入回收站', 'files.batch_delete': '批量移入回收站', 'trash.restore': '从回收站恢复', 'trash.purge': '彻底删除文件', 'trash.retention': '设置清理时间', 'trash.batch_restore': '批量恢复', 'trash.batch_purge': '批量彻底删除', 'trash.batch_retention': '批量设置清理时间', 'file.update': '更新文件信息', 'files.batch_update': '批量更新文件', 'file.metadata_update': '更新文件备注', 'file.policy_action': '调整文件策略', 'files.batch_policy_action': '批量调整策略', 'config.update': '更新系统设置', 'local_file.delete': '删除本地文件', 'local_file.share': '分享本地文件'
|
||||
}[action] || action)
|
||||
const targetTypeLabel = (targetType: string) => ({ file: '文件', config: '系统配置', local_file: '本地文件', view_preset: '视图预设', system: '系统' }[targetType] || targetType || '系统')
|
||||
const activityIcon = (action: string): Component => action.includes('trash') || action.includes('delete') ? Trash2Icon : action.includes('config') ? CogIcon : action.includes('update') || action.includes('policy') ? FilePenLineIcon : action.includes('share') ? UploadIcon : ActivityIcon
|
||||
const activityIcon = (action: string): Component => action.includes('restore') ? RotateCcwIcon : action.includes('trash') || action.includes('delete') ? Trash2Icon : action.includes('config') ? CogIcon : action.includes('update') || action.includes('policy') ? FilePenLineIcon : action.includes('share') ? UploadIcon : ActivityIcon
|
||||
const activityToneClass = (action: string) => {
|
||||
if (action === 'trash.purge') return isDarkMode.value ? 'bg-red-950/50 text-red-300' : 'bg-red-50 text-red-600'
|
||||
if (action.includes('restore')) return isDarkMode.value ? 'bg-emerald-950/45 text-emerald-300' : 'bg-emerald-50 text-emerald-700'
|
||||
if (action === 'trash.purge' || action === 'trash.batch_purge') return isDarkMode.value ? 'bg-red-950/50 text-red-300' : 'bg-red-50 text-red-600'
|
||||
if (action.includes('trash') || action.includes('delete')) return isDarkMode.value ? 'bg-amber-950/45 text-amber-300' : 'bg-amber-50 text-amber-700'
|
||||
if (action.includes('restore') || action.includes('share')) return isDarkMode.value ? 'bg-emerald-950/45 text-emerald-300' : 'bg-emerald-50 text-emerald-700'
|
||||
return isDarkMode.value ? 'bg-[#263f48] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#397084]'
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
:loading="isDashboardRefreshing"
|
||||
:title="t('admin.dashboard.refresh')"
|
||||
:aria-label="t('admin.dashboard.refresh')"
|
||||
class="shrink-0 max-sm:h-11 max-sm:w-11 max-sm:!px-0"
|
||||
class="fcb-icon-action shrink-0 max-sm:h-11 max-sm:w-11 max-sm:!px-0"
|
||||
@click="refreshDashboardPage"
|
||||
>
|
||||
<template #icon>
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
<div v-if="dashboardData.hasExtendedStats" class="mt-6 grid grid-cols-1 gap-6 2xl:grid-cols-3">
|
||||
<section
|
||||
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5 2xl:col-span-2"
|
||||
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5 2xl:col-span-2"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="mb-4 flex items-center justify-between sm:mb-5">
|
||||
@@ -103,7 +103,7 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-3 sm:gap-4">
|
||||
<div class="fcb-metric-grid grid grid-cols-3 gap-2 sm:gap-4">
|
||||
<MetricProgress
|
||||
:label="t('admin.dashboard.activeFileRatio')"
|
||||
:value="dashboardData.activeRatio"
|
||||
@@ -187,7 +187,7 @@
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="mb-5">
|
||||
@@ -235,32 +235,28 @@
|
||||
|
||||
<div class="mt-6 grid grid-cols-1 gap-6 xl:grid-cols-2">
|
||||
<section
|
||||
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="mb-5 flex flex-col gap-4">
|
||||
<div class="flex min-w-0 flex-col gap-3 xl:flex-row xl:items-start xl:justify-between">
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">{{ t('admin.dashboard.trend.title') }}</h3>
|
||||
<p class="break-words text-sm leading-5" :class="[mutedTextClass]">
|
||||
{{ analyticsSummaryText }}
|
||||
</p>
|
||||
<p class="mt-1 text-xs leading-5" :class="mutedTextClass">{{ analyticsWindowText }}</p>
|
||||
<div class="mt-2 grid grid-cols-2 gap-3 text-xs sm:flex sm:flex-wrap" :class="mutedTextClass">
|
||||
<div><p>{{ t('admin.dashboard.trend.downloadTotal') }}</p><p class="mt-1 flex flex-wrap gap-x-2 gap-y-1 font-medium tabular-nums" :class="primaryTextClass"><span class="whitespace-nowrap">{{ t('admin.dashboard.trend.times', { count: analyticsWindowStats.downloads }) }}</span><span class="whitespace-nowrap">{{ analyticsDownloadTrafficText }}</span></p></div>
|
||||
<div><p>{{ t('admin.dashboard.trend.uploadTotal') }}</p><p class="mt-1 flex flex-wrap gap-x-2 gap-y-1 font-medium tabular-nums" :class="primaryTextClass"><span class="whitespace-nowrap">{{ t('admin.dashboard.trend.times', { count: analyticsWindowStats.uploads }) }}</span><span class="whitespace-nowrap">{{ analyticsUploadTrafficText }}</span></p></div>
|
||||
</div>
|
||||
<p class="mt-1 text-xs sm:hidden" :class="[mutedTextClass]">{{ t('admin.dashboard.trend.mobileHint') }}</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2 xl:flex-nowrap">
|
||||
<div class="analytics-date-range flex min-w-0 items-center justify-center gap-1.5 sm:gap-2">
|
||||
<div class="analytics-date-range grid w-full min-w-0 grid-cols-2 gap-2 sm:w-auto">
|
||||
<NativeDateSelect
|
||||
v-model="analyticsStart"
|
||||
:field-class="fieldClass"
|
||||
:aria-label="t('admin.dashboard.trend.startDate')"
|
||||
@change="fetchAnalyticsData"
|
||||
/>
|
||||
<span
|
||||
class="shrink-0 text-sm font-semibold"
|
||||
:class="[isDarkMode ? 'text-[#aabdc2]' : 'text-[#789096]']"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
<NativeDateSelect
|
||||
v-model="analyticsEnd"
|
||||
:field-class="fieldClass"
|
||||
@@ -313,11 +309,12 @@
|
||||
:rows="analyticsDailyRows"
|
||||
:is-dark-mode="isDarkMode"
|
||||
@window-change="analyticsWindowText = $event"
|
||||
@window-stats="analyticsWindowStats = $event"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="theme-2026-card theme-2026-card-hover rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
class="theme-2026-card rounded-[24px] p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-5"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="mb-5 flex items-center justify-between">
|
||||
@@ -408,7 +405,7 @@
|
||||
class="rounded-[30px] border px-2.5 py-0.5 font-medium shadow-sm"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'border-[#40545c] bg-[#263941]/80 text-[#d8e3e5]'
|
||||
? 'border-[#495765] bg-[#2c3440]/80 text-[#d8e3e5]'
|
||||
: 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66]'
|
||||
]"
|
||||
>
|
||||
@@ -446,6 +443,7 @@ import { ROUTES } from '@/constants'
|
||||
import { useConfigStore } from '@/stores/configStore'
|
||||
import { formatFileSize } from '@/utils/common'
|
||||
import type { AnalyticsData, AnalyticsFileRow, DashboardHealthAction } from '@/types'
|
||||
import type { AnalyticsWindowTotals } from '@/utils/analyticsWindow'
|
||||
|
||||
const isDarkMode = useInjectedDarkMode()
|
||||
const { t } = useI18n()
|
||||
@@ -463,22 +461,22 @@ const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'tex
|
||||
const versionText = computed(() => appVersion.value || t('admin.dashboard.versionPending'))
|
||||
const panelClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'bg-[#202f36]/90 border border-[#40545c]'
|
||||
? 'bg-[#252b34]/90 border border-[#495765]'
|
||||
: 'bg-[#f8fbfb] border border-[#d7e3e5]'
|
||||
)
|
||||
const fieldClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#50666f] bg-[#253941] text-white'
|
||||
? 'border-[#50666f] bg-[#2c3440] text-white'
|
||||
: 'border-[#c8d8dc] bg-[#fbfdfd] text-[#263f48]'
|
||||
)
|
||||
const subtlePanelClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#3d5159] bg-[#17252c]/50'
|
||||
? 'border-[#3d5159] bg-[#252b34]/50'
|
||||
: 'border-[#d4e0e3] bg-[linear-gradient(135deg,#f7faf9,#eaf3f4)]'
|
||||
)
|
||||
const cardHoverClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'hover:border-[#7199a8] hover:bg-[#263941] hover:shadow-black/25'
|
||||
? 'hover:border-[#7199a8] hover:bg-[#2c3440] hover:shadow-[#97aac8]/15'
|
||||
: 'hover:border-[#8fb2bf] hover:shadow-[#a9bdc2]/70'
|
||||
)
|
||||
const maxSaveTimeText = computed(() => {
|
||||
@@ -503,22 +501,19 @@ const analyticsData = ref<AnalyticsData | null>(null)
|
||||
const analyticsError = ref('')
|
||||
const isAnalyticsLoading = ref(false)
|
||||
const analyticsWindowText = ref(t('admin.dashboard.trend.noData'))
|
||||
const analyticsWindowStats = ref<AnalyticsWindowTotals>({
|
||||
downloads: 0,
|
||||
uploads: 0,
|
||||
downloadTraffic: 0,
|
||||
uploadTraffic: 0
|
||||
})
|
||||
const analyticsDailyRows = computed(() => analyticsData.value?.daily || [])
|
||||
const analyticsTopFiles = computed<AnalyticsFileRow[]>(() => analyticsData.value?.topFiles || [])
|
||||
const analyticsUploadTrafficText = computed(() =>
|
||||
formatBytes(analyticsData.value?.totals?.uploadTraffic || 0)
|
||||
formatBytes(analyticsWindowStats.value.uploadTraffic)
|
||||
)
|
||||
const analyticsDownloadTrafficText = computed(() =>
|
||||
formatBytes(analyticsData.value?.totals?.downloadTraffic || 0)
|
||||
)
|
||||
const analyticsSummaryText = computed(() =>
|
||||
t('admin.dashboard.trend.summary', {
|
||||
window: analyticsWindowText.value,
|
||||
downloads: analyticsData.value?.totals?.totalDownloads || 0,
|
||||
downloadTraffic: analyticsDownloadTrafficText.value,
|
||||
uploads: analyticsData.value?.totals?.totalUploads || 0,
|
||||
uploadTraffic: analyticsUploadTrafficText.value
|
||||
})
|
||||
formatBytes(analyticsWindowStats.value.downloadTraffic)
|
||||
)
|
||||
const formatBytes = (value: number | string | undefined) => formatFileSize(Number(value || 0), 1)
|
||||
|
||||
@@ -595,7 +590,7 @@ const getHealthActionClass = (tone: DashboardHealthAction['tone']) => {
|
||||
danger: 'border-[#7c5f64]/40 bg-[#5f383f]/24 text-[#f0d8dc] hover:border-[#b1878f]',
|
||||
warning: 'border-[#8b7a57]/40 bg-[#665733]/24 text-[#efe3c6] hover:border-[#b8a775]',
|
||||
success: 'border-[#58766d]/40 bg-[#31564f]/24 text-[#d2e7df] hover:border-[#7fa69a]',
|
||||
neutral: 'border-[#40545c] bg-[#17252c]/50 text-[#d8e3e5] hover:border-[#7199a8]'
|
||||
neutral: 'border-[#495765] bg-[#252b34]/50 text-[#d8e3e5] hover:border-[#7199a8]'
|
||||
}
|
||||
const lightClasses: Record<DashboardHealthAction['tone'], string> = {
|
||||
danger: 'border-[#ead8dc] bg-[#f7ecee] text-[#8b5962] hover:border-[#d8b8bf]',
|
||||
@@ -640,7 +635,7 @@ const MetricProgress = defineComponent({
|
||||
'div',
|
||||
{
|
||||
class:
|
||||
'theme-2026-card-hover rounded-[18px] border border-[#d4e0e3] bg-[#f6faf9] p-2.5 shadow-sm transition-all duration-200 hover:border-[#8fb2bf] hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md dark:border-[#40545c] dark:bg-[#17252c]/50 dark:hover:border-[#7199a8] dark:hover:bg-[#263941] dark:hover:shadow-black/25'
|
||||
'fcb-metric-card theme-2026-card-hover rounded-[18px] border border-[#d4e0e3] bg-[#f6faf9] p-2.5 shadow-sm transition-all duration-200 hover:border-[#8fb2bf] hover:shadow-md sm:rounded-[30px] sm:p-4 sm:shadow-md dark:border-[#495765] dark:bg-[#252b34]/50 dark:hover:border-[#7199a8] dark:hover:bg-[#2c3440] dark:hover:shadow-[#97aac8]/15'
|
||||
},
|
||||
[
|
||||
h('div', { class: 'mb-2 flex items-center justify-between gap-3 text-sm' }, [
|
||||
|
||||
@@ -21,15 +21,13 @@
|
||||
class="theme-2026-card theme-2026-card-hover group rounded-[24px] border p-3.5 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-4"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-xs sm:text-sm" :class="[mutedTextClass]">{{ card.label }}</p>
|
||||
<p class="mt-1.5 break-words text-xl font-semibold leading-tight tabular-nums sm:mt-2 sm:text-2xl" :title="String(card.value)" :class="[primaryTextClass]">
|
||||
{{ card.value }}
|
||||
</p>
|
||||
<div class="relative">
|
||||
<div class="min-w-0">
|
||||
<p class="pr-8 text-xs sm:text-sm" :class="[mutedTextClass]">{{ card.label }}</p>
|
||||
<AdaptiveValue :value="card.value" class="mt-3 font-semibold leading-tight sm:mt-3" :class="primaryTextClass" />
|
||||
</div>
|
||||
<div
|
||||
class="rounded-lg p-2 transition-transform duration-200 group-max-sm:p-1.5"
|
||||
class="absolute right-0 top-0 rounded-lg p-1.5 transition-transform duration-200"
|
||||
:class="[card.iconClass]"
|
||||
>
|
||||
<component :is="card.icon" class="h-5 w-5" />
|
||||
@@ -40,7 +38,7 @@
|
||||
|
||||
<section
|
||||
v-if="!hasSelectedFiles"
|
||||
class="theme-2026-card theme-2026-card-hover mb-4 rounded-[24px] border p-3 shadow-md transition-all duration-200 hover:shadow-lg sm:mb-6 sm:rounded-[30px] sm:p-4"
|
||||
class="theme-2026-card mb-4 rounded-[24px] border p-3 shadow-md transition-all duration-200 hover:shadow-lg sm:mb-6 sm:rounded-[30px] sm:p-4"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3 sm:flex-row">
|
||||
@@ -272,7 +270,7 @@
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border"
|
||||
class="fcb-action fcb-icon-action flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border"
|
||||
:class="detailActionClass"
|
||||
:disabled="isLoading"
|
||||
:aria-label="t('fileManage.refresh')"
|
||||
@@ -285,7 +283,7 @@
|
||||
<div
|
||||
v-if="tableData.length > 0"
|
||||
class="flex min-h-14 items-center justify-between gap-3 border-b px-4 py-2 md:hidden"
|
||||
:class="[isDarkMode ? 'border-gray-700 bg-[#20323a]/70' : 'border-[#d9e4e6] bg-[#f4f8f8]']"
|
||||
:class="[isDarkMode ? 'border-gray-700 bg-[#2c3440]/70' : 'border-[#d9e4e6] bg-[#f4f8f8]']"
|
||||
>
|
||||
<label class="flex min-h-11 min-w-0 cursor-pointer items-center gap-3 text-sm font-medium" :class="[primaryTextClass]">
|
||||
<span class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl">
|
||||
@@ -305,7 +303,7 @@
|
||||
<button
|
||||
v-if="hasSelectedFiles"
|
||||
type="button"
|
||||
class="min-h-11 shrink-0 rounded-xl px-3 text-sm font-medium"
|
||||
class="fcb-action min-h-11 shrink-0 rounded-xl px-3 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:disabled="isBatchActionRunning"
|
||||
@click="clearSelection"
|
||||
@@ -333,7 +331,7 @@
|
||||
v-for="file in tableData"
|
||||
:key="file.id"
|
||||
class="px-4 py-4"
|
||||
:class="selectedFileIds.has(file.id) ? (isDarkMode ? 'bg-[#294047]/50' : 'bg-[#e5eeee]') : ''"
|
||||
:class="selectedFileIds.has(file.id) ? (isDarkMode ? 'bg-[#333d49]/50' : 'bg-[#e5eeee]') : ''"
|
||||
>
|
||||
<div class="flex items-start gap-3">
|
||||
<label class="flex h-11 w-11 shrink-0 cursor-pointer items-start justify-center pt-1">
|
||||
@@ -346,7 +344,7 @@
|
||||
@change="toggleFileSelection(file.id)"
|
||||
/>
|
||||
</label>
|
||||
<button type="button" class="min-w-0 flex-1 text-left" @click="openFileDetail(file)">
|
||||
<button type="button" class="fcb-action fcb-content-action min-w-0 flex-1 text-left" @click="openFileDetail(file)">
|
||||
<p class="line-clamp-2 break-all text-sm font-semibold leading-5" :class="[primaryTextClass]">
|
||||
{{ file.displayName }}
|
||||
</p>
|
||||
@@ -388,7 +386,7 @@
|
||||
<aside
|
||||
v-if="hasSelectedFiles"
|
||||
class="pointer-events-auto fixed inset-x-0 bottom-0 z-[60] border-t px-3 pt-3 shadow-2xl backdrop-blur-xl md:hidden"
|
||||
:class="isDarkMode ? 'border-[#40545c] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
:class="isDarkMode ? 'border-[#495765] bg-[#252b34]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
:style="{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))', touchAction: 'manipulation' }"
|
||||
:aria-label="t('fileManage.mobileBatchActions')"
|
||||
>
|
||||
@@ -396,13 +394,13 @@
|
||||
<div
|
||||
v-if="showMobilePolicyActions"
|
||||
class="grid grid-cols-2 gap-2 rounded-2xl border p-2"
|
||||
:class="isDarkMode ? 'border-[#40545c] bg-[#20323a]' : 'border-[#c8d7da] bg-white'"
|
||||
:class="isDarkMode ? 'border-[#495765] bg-[#2c3440]' : 'border-[#c8d7da] bg-white'"
|
||||
>
|
||||
<button
|
||||
v-for="option in batchPolicyActionOptions"
|
||||
:key="option.action"
|
||||
type="button"
|
||||
class="min-h-11 rounded-xl border px-2 py-2 text-xs font-medium"
|
||||
class="fcb-action min-h-11 rounded-xl border px-2 py-2 text-xs font-medium"
|
||||
:class="detailActionClass"
|
||||
:title="option.description"
|
||||
:disabled="option.disabled || isBatchDeleting || isBatchUpdating || isBatchPolicyActionRunning"
|
||||
@@ -418,7 +416,7 @@
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="min-h-11 rounded-xl px-3 text-sm font-medium"
|
||||
class="fcb-action min-h-11 rounded-xl px-3 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:disabled="isBatchActionRunning"
|
||||
@click="clearSelection"
|
||||
@@ -430,7 +428,7 @@
|
||||
<div class="grid grid-cols-3 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
|
||||
class="fcb-action flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:disabled="isBatchDeleting || isBatchPolicyActionRunning"
|
||||
@click="openBatchEditModal"
|
||||
@@ -440,7 +438,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
|
||||
class="fcb-action flex min-h-12 items-center justify-center rounded-xl border px-2 text-sm font-medium"
|
||||
:class="detailActionClass"
|
||||
:aria-expanded="showMobilePolicyActions"
|
||||
:disabled="isBatchDeleting || isBatchUpdating"
|
||||
@@ -451,7 +449,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-12 items-center justify-center rounded-xl bg-red-600 px-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
|
||||
class="fcb-action flex min-h-12 items-center justify-center rounded-xl bg-red-600 px-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
|
||||
:disabled="isBatchUpdating || isBatchPolicyActionRunning || isBatchDeleting"
|
||||
@click="deleteSelectedFilesAndRefreshHistory"
|
||||
>
|
||||
@@ -701,10 +699,10 @@
|
||||
<button
|
||||
type="button"
|
||||
:title="t('fileManage.detail')"
|
||||
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-[#294047]/70 text-[#b8d4dc] hover:bg-[#34515a]'
|
||||
? 'bg-[#333d49]/70 text-[#b8d4dc] hover:bg-[#34515a]'
|
||||
: 'bg-[#dcebed] text-[#3f6a77] hover:bg-[#cfe1e4]'
|
||||
]"
|
||||
@click="openFileDetail(file)"
|
||||
@@ -716,10 +714,10 @@
|
||||
v-if="file.canPreviewText"
|
||||
type="button"
|
||||
:title="t('fileManage.viewText')"
|
||||
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]'
|
||||
? 'bg-[#2c3440] text-[#d8e3e5] hover:bg-[#384452]'
|
||||
: 'bg-[#edf4f5] text-[#506972] hover:bg-[#e2ecee]'
|
||||
]"
|
||||
@click="openTextPreview(file)"
|
||||
@@ -733,7 +731,7 @@
|
||||
file.isTextFile ? t('fileManage.exportText') : t('fileManage.downloadFile')
|
||||
"
|
||||
:disabled="Boolean(downloadingFileId)"
|
||||
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
|
||||
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-[#31564f]/70 text-[#c4dfd5] hover:bg-[#3c675e]'
|
||||
@@ -750,7 +748,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-[#2d4851]/70 text-[#bfd9df] hover:bg-[#365862]'
|
||||
@@ -763,11 +761,9 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
class="fcb-action inline-flex items-center rounded-[30px] px-3 py-1.5 shadow-sm transition-all duration-200 hover:shadow-md"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'bg-[#dc2626] text-white shadow-[#7f1d1d]/35 hover:bg-[#b91c1c]'
|
||||
: 'bg-[#dc2626] text-white shadow-[#f87171]/35 hover:bg-[#b91c1c]'
|
||||
'fcb-button-danger'
|
||||
]"
|
||||
@click="deleteFileAndRefreshHistory(file.id)"
|
||||
>
|
||||
@@ -793,7 +789,7 @@
|
||||
</div>
|
||||
|
||||
<section
|
||||
class="theme-2026-card theme-2026-card-hover mt-6 rounded-[30px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg"
|
||||
class="theme-2026-card mt-6 rounded-[30px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg"
|
||||
:class="[panelClass, cardHoverClass]"
|
||||
>
|
||||
<div class="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
@@ -801,7 +797,7 @@
|
||||
<h3 class="text-lg font-semibold" :class="[primaryTextClass]">历史文件</h3>
|
||||
<p class="text-sm" :class="[mutedTextClass]">包含已删除、已过期和现存文件的下载统计</p>
|
||||
</div>
|
||||
<BaseButton class="fcb-refresh-button fcb-secondary-card" variant="secondary" :loading="isHistoryLoading" @click="loadHistoryFiles">
|
||||
<BaseButton class="fcb-refresh-button" variant="secondary" :loading="isHistoryLoading" @click="loadHistoryFiles">
|
||||
<template #icon>
|
||||
<RefreshCwIcon class="mr-2 h-4 w-4" />
|
||||
</template>
|
||||
@@ -1045,7 +1041,7 @@
|
||||
<div class="grid grid-cols-2 gap-2.5 xl:grid-cols-4">
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
|
||||
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:class="detailActionClass"
|
||||
@click="openDetailEditModal"
|
||||
>
|
||||
@@ -1055,7 +1051,7 @@
|
||||
<button
|
||||
v-if="selectedFileDetail.canPreviewText"
|
||||
type="button"
|
||||
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors"
|
||||
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors"
|
||||
:class="detailActionClass"
|
||||
@click="openDetailTextPreview"
|
||||
>
|
||||
@@ -1064,7 +1060,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
|
||||
class="fcb-action flex min-h-11 items-center justify-center rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:class="detailActionClass"
|
||||
:disabled="!selectedFileDetail.canDownloadFile || Boolean(downloadingFileId)"
|
||||
@click="downloadFile(selectedFileDetail)"
|
||||
@@ -1082,7 +1078,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-11 items-center justify-center rounded-lg bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-red-700"
|
||||
class="fcb-action flex min-h-11 items-center justify-center rounded-lg bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-red-700"
|
||||
@click="deleteDetailFileAndRefreshHistory"
|
||||
>
|
||||
<TrashIcon class="mr-2 h-4 w-4" aria-hidden="true" />
|
||||
@@ -1091,7 +1087,7 @@
|
||||
</div>
|
||||
|
||||
<section
|
||||
class="theme-2026-card-hover rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
|
||||
class="theme-2026-card rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
|
||||
:class="getInsightPanelClass(selectedFileDetail.statusInsightSeverity)"
|
||||
>
|
||||
<div class="flex flex-col gap-2.5 md:flex-row md:items-start md:justify-between">
|
||||
@@ -1206,7 +1202,7 @@
|
||||
<button
|
||||
v-if="detailTimelineRows.length > 3"
|
||||
type="button"
|
||||
class="inline-flex min-h-10 items-center self-start rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors sm:min-h-0 sm:self-auto"
|
||||
class="fcb-action inline-flex min-h-10 items-center self-start rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors sm:min-h-0 sm:self-auto"
|
||||
:class="detailActionClass"
|
||||
@click="isLifecycleExpanded = !isLifecycleExpanded"
|
||||
>
|
||||
@@ -1265,7 +1261,7 @@
|
||||
<div v-if="item.key === 'retrieved' && retrievalTimelineCount > 0" class="mt-2.5 border-t pt-2.5" :class="isDarkMode ? 'border-gray-700' : 'border-gray-200'">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex min-h-9 items-center rounded-[30px] border px-3 py-1.5 text-sm font-medium transition-colors"
|
||||
class="fcb-action inline-flex min-h-9 items-center rounded-[30px] border px-3 py-1.5 text-sm font-medium transition-colors"
|
||||
:class="detailActionClass"
|
||||
@click="isRetrievalHistoryExpanded = !isRetrievalHistoryExpanded"
|
||||
>
|
||||
@@ -1310,7 +1306,7 @@
|
||||
</section>
|
||||
|
||||
<section
|
||||
class="theme-2026-card-hover space-y-2.5 rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
|
||||
class="theme-2026-card space-y-2.5 rounded-[24px] border px-3 py-3 shadow-md transition-all duration-200 hover:shadow-lg sm:px-4 sm:py-4"
|
||||
:class="[subtleSectionClass, cardHoverClass]"
|
||||
>
|
||||
<div class="flex flex-col gap-2.5 sm:flex-row sm:items-start sm:justify-between">
|
||||
@@ -1531,7 +1527,7 @@
|
||||
v-for="option in batchEditModeOptions"
|
||||
:key="option.value"
|
||||
type="button"
|
||||
class="flex min-h-12 items-center justify-center rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors"
|
||||
class="fcb-action flex min-h-12 items-center justify-center rounded-[30px] border px-3 py-2 text-sm font-medium transition-colors"
|
||||
:class="getBatchEditModeClass(option.value)"
|
||||
:disabled="isBatchUpdating"
|
||||
@click="batchEditForm.mode = option.value"
|
||||
@@ -1751,6 +1747,7 @@ import FileEditField from '@/components/common/FileEditField.vue'
|
||||
import NativeDateSelect from '@/components/common/NativeDateSelect.vue'
|
||||
import BaseModal from '@/components/common/BaseModal.vue'
|
||||
import BaseButton from '@/components/common/BaseButton.vue'
|
||||
import AdaptiveValue from '@/components/common/AdaptiveValue.vue'
|
||||
import { useAdminFiles, useInjectedDarkMode, useTransferAnalytics } from '@/composables'
|
||||
import { formatFileSize, formatTimestamp } from '@/utils/common'
|
||||
import { createDetailMotion } from '@/utils/detailMotion'
|
||||
@@ -2071,31 +2068,31 @@ const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text
|
||||
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'text-gray-500'))
|
||||
const panelClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#40545c] bg-[#202f36]/90'
|
||||
? 'border-[#495765] bg-[#252b34]/90'
|
||||
: 'border-[#d7e3e5] bg-[#f8fbfb]'
|
||||
)
|
||||
const fieldClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#50666f] bg-[#253941] text-white'
|
||||
? 'border-[#50666f] bg-[#2c3440] text-white'
|
||||
: 'border-[#c8d8dc] bg-[#fbfdfd] text-[#263f48]'
|
||||
)
|
||||
const detailActionClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#3f535c] bg-[#263941]/70 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#2d4751]'
|
||||
? 'border-[#3f535c] bg-[#2c3440]/70 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#384452]'
|
||||
: 'border-[#c9d9dd] bg-[#fbfdfd] text-[#36515b] hover:border-[#8fb2bf] hover:bg-[#edf5f6]'
|
||||
)
|
||||
const cardHoverClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'hover:border-[#7199a8] hover:bg-[#263941] hover:shadow-black/25'
|
||||
? 'hover:border-[#7199a8] hover:bg-[#2c3440] hover:shadow-[#97aac8]/15'
|
||||
: 'hover:border-[#8fb2bf] hover:shadow-[#a9bdc2]/70'
|
||||
)
|
||||
const detailPolicyActionClass = computed(() =>
|
||||
isDarkMode.value
|
||||
? 'border-[#40545c] bg-[#203039]/80 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#263941]'
|
||||
? 'border-[#495765] bg-[#2c3440]/80 text-[#d8e3e5] hover:border-[#7199a8] hover:bg-[#2c3440]'
|
||||
: 'border-[#c9d9dd] bg-[#fbfdfd] text-[#36515b] hover:border-[#8fb2bf] hover:bg-[#edf5f6]'
|
||||
)
|
||||
const subtleSectionClass = computed(() =>
|
||||
isDarkMode.value ? 'border-[#40545c] bg-[#17252c]/50' : 'border-[#d7e3e5] bg-[#f3f8f8]'
|
||||
isDarkMode.value ? 'border-[#495765] bg-[#252b34]/50' : 'border-[#d7e3e5] bg-[#f3f8f8]'
|
||||
)
|
||||
|
||||
type DetailInfoItem = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div
|
||||
:class="[
|
||||
'min-h-[100dvh] flex items-center justify-center px-4 pb-6 pt-24 sm:px-6 sm:py-12 lg:px-8 transition-colors duration-200 relative overflow-x-hidden overflow-y-auto',
|
||||
isDarkMode ? 'bg-[#10191e]' : 'bg-[#dfe9eb]'
|
||||
isDarkMode ? 'bg-[#252b34]' : 'bg-[#dfe9eb]'
|
||||
]"
|
||||
>
|
||||
<div class="absolute inset-0 z-0">
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div
|
||||
class="max-w-md w-full space-y-8 backdrop-blur-lg p-8 rounded-[30px] border shadow-xl"
|
||||
:class="[isDarkMode ? 'bg-[#1a2930]/82 border-[#31454d]' : 'bg-[#f2f6f5]/82 border-[#c8d7da]']"
|
||||
:class="[isDarkMode ? 'bg-[#2c3440]/82 border-[#495765]' : 'bg-[#f2f6f5]/82 border-[#c8d7da]']"
|
||||
>
|
||||
<div>
|
||||
<div class="mx-auto h-16 w-16 relative">
|
||||
@@ -24,7 +24,7 @@
|
||||
<div
|
||||
:class="[
|
||||
'absolute inset-1 rounded-full flex items-center justify-center',
|
||||
isDarkMode ? 'bg-[#1a2930]' : 'bg-[#f2f6f5]'
|
||||
isDarkMode ? 'bg-[#2c3440]' : 'bg-[#f2f6f5]'
|
||||
]"
|
||||
>
|
||||
<BoxIcon :class="['h-8 w-8', isDarkMode ? 'text-[#a5c8d0]' : 'text-[#5f8796]']" />
|
||||
@@ -68,29 +68,30 @@
|
||||
:class="[
|
||||
'appearance-none rounded-[30px] relative block w-full py-3 pl-4 pr-14 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-[#8fb2bf] focus:border-[#8fb2bf] focus:z-10 sm:text-sm backdrop-blur-sm',
|
||||
isDarkMode
|
||||
? 'bg-[#263941]/60 border-[#40545c] text-white placeholder-gray-400 hover:border-[#7199a8]'
|
||||
? 'bg-[#2c3440]/60 border-[#495765] text-white placeholder-gray-400 hover:border-[#7199a8]'
|
||||
: 'bg-[#edf4f5]/70 border-[#c8d8dc] text-[#2d4650] hover:border-[#9db6bd]'
|
||||
]"
|
||||
:placeholder="t('manage.login.passwordPlaceholder')"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-1 z-20 flex w-11 items-center justify-center rounded-full"
|
||||
class="fcb-action fcb-input-action absolute inset-y-0 right-1 z-20 flex w-11 items-center justify-center rounded-full"
|
||||
:aria-label="showPassword ? t('common.hidePassword') : t('common.showPassword')"
|
||||
:title="showPassword ? t('common.hidePassword') : t('common.showPassword')"
|
||||
:aria-pressed="showPassword"
|
||||
@click="showPassword = !showPassword"
|
||||
>
|
||||
<EyeOffIcon v-if="showPassword" class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeIcon v-else class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeIcon v-if="showPassword" class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeOffIcon v-else class="h-5 w-5" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
<button class="fcb-action"
|
||||
type="submit"
|
||||
:class="[
|
||||
'group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-[30px] text-white transition-all duration-300 transform focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#8fb2bf] shadow-lg',
|
||||
'fcb-button-primary group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-[30px] text-white transition-all duration-300 transform focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#8fb2bf] shadow-lg',
|
||||
isDarkMode
|
||||
? 'bg-gradient-to-r from-[#5f8796] to-[#6f9688] hover:from-[#527887] hover:to-[#5f8377] hover:shadow-[#6f98a6]/35'
|
||||
: 'bg-gradient-to-r from-[#5f8796] to-[#6f9688] hover:from-[#527887] hover:to-[#5f8377] hover:shadow-[#9fb8bf]/45',
|
||||
|
||||
@@ -96,11 +96,11 @@ onMounted(() => {
|
||||
]"
|
||||
:key="section[0]"
|
||||
type="button"
|
||||
class="inline-flex min-h-11 shrink-0 items-center justify-center rounded-full border px-3 text-center text-sm font-medium sm:px-4"
|
||||
class="fcb-action inline-flex min-h-11 shrink-0 items-center justify-center rounded-full border px-3 text-center text-sm font-medium sm:px-4"
|
||||
:class="activeSection === section[0]
|
||||
? 'border-[#5f8796] bg-[#5f8796] text-white'
|
||||
: isDarkMode
|
||||
? 'border-[#40545c] bg-[#263941] text-[#d8e3e5]'
|
||||
? 'border-[#495765] bg-[#2c3440] text-[#d8e3e5]'
|
||||
: 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66]'"
|
||||
:aria-current="activeSection === section[0] ? 'true' : undefined"
|
||||
@click="scrollToSection(section[0])"
|
||||
@@ -110,10 +110,10 @@ onMounted(() => {
|
||||
</nav>
|
||||
|
||||
<div
|
||||
class="theme-2026-card theme-2026-card-hover mx-auto max-w-6xl space-y-8 rounded-[24px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-6"
|
||||
class="theme-2026-card fcb-static-container mx-auto max-w-6xl space-y-8 rounded-[24px] border p-4 shadow-md transition-all duration-200 hover:shadow-lg sm:rounded-[30px] sm:p-6"
|
||||
:class="[
|
||||
isDarkMode
|
||||
? 'border-[#40545c] bg-[#202f36]/90 hover:border-[#7199a8] hover:bg-[#263941] hover:shadow-black/25'
|
||||
? 'border-[#495765] bg-[#252b34]/90 hover:border-[#7199a8] hover:bg-[#2c3440] hover:shadow-[#97aac8]/15'
|
||||
: 'border-[#d7e3e5] bg-[#f8fbfb] hover:border-[#8fb2bf] hover:shadow-[#a9bdc2]/70'
|
||||
]"
|
||||
>
|
||||
@@ -193,13 +193,14 @@ onMounted(() => {
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-1 flex w-11 items-center justify-center rounded-lg"
|
||||
class="fcb-action fcb-input-action absolute inset-y-0 right-1 flex w-11 items-center justify-center rounded-lg"
|
||||
:aria-label="showAdminPassword ? t('common.hidePassword') : t('common.showPassword')"
|
||||
:title="showAdminPassword ? t('common.hidePassword') : t('common.showPassword')"
|
||||
:aria-pressed="showAdminPassword"
|
||||
@click="showAdminPassword = !showAdminPassword"
|
||||
>
|
||||
<EyeOffIcon v-if="showAdminPassword" class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeIcon v-else class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeIcon v-if="showAdminPassword" class="h-5 w-5" aria-hidden="true" />
|
||||
<EyeOffIcon v-else class="h-5 w-5" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
<p id="settings-admin-password-note" class="text-xs" :class="isDarkMode ? 'text-gray-300' : 'text-gray-600'">
|
||||
@@ -685,7 +686,7 @@ onMounted(() => {
|
||||
<label
|
||||
v-for="style in ['day', 'hour', 'minute', 'forever', 'count']"
|
||||
:key="style"
|
||||
class="relative inline-flex items-center group cursor-pointer"
|
||||
class="fcb-choice relative inline-flex items-center group cursor-pointer"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -694,16 +695,8 @@ onMounted(() => {
|
||||
class="peer sr-only"
|
||||
/>
|
||||
<div
|
||||
class="px-4 py-2 rounded-full border-2 transition-all duration-200 select-none"
|
||||
:class="[
|
||||
config.expireStyle.includes(style)
|
||||
? isDarkMode
|
||||
? 'bg-indigo-600 border-indigo-600 text-white'
|
||||
: 'bg-indigo-600 border-indigo-600 text-white'
|
||||
: isDarkMode
|
||||
? 'bg-gray-700 border-gray-600 text-gray-300 hover:border-indigo-500'
|
||||
: 'bg-white border-gray-300 text-gray-700 hover:border-indigo-500'
|
||||
]"
|
||||
class="fcb-action fcb-choice-face inline-flex min-h-11 items-center justify-center px-4 py-2 rounded-full border transition-all duration-200 select-none"
|
||||
:class="config.expireStyle.includes(style) ? 'fcb-button-primary' : 'fcb-button-secondary'"
|
||||
>
|
||||
{{ t(`manage.settings.expiration.${style}`) }}
|
||||
</div>
|
||||
@@ -797,7 +790,7 @@ onMounted(() => {
|
||||
|
||||
<div
|
||||
class="fixed inset-x-0 bottom-0 z-40 border-t px-4 pt-3 backdrop-blur-xl lg:left-64"
|
||||
:class="isDarkMode ? 'border-[#31454d] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
:class="isDarkMode ? 'border-[#495765] bg-[#252b34]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
|
||||
+171
-68
@@ -2,105 +2,208 @@
|
||||
<div class="p-4 sm:p-6">
|
||||
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">RECYCLE BIN</p>
|
||||
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">回收站</h2>
|
||||
<p class="mt-1 text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
|
||||
<p class="hidden text-xs font-medium tracking-[0.16em] sm:block" :class="mutedTextClass">RECYCLE BIN</p>
|
||||
<h2 class="mt-1 text-xl font-bold sm:text-2xl" :class="primaryTextClass">回收站</h2>
|
||||
<p class="mt-1 text-xs leading-5 sm:text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<BaseButton variant="secondary" @click="openRetentionSettings">
|
||||
<template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>
|
||||
配置默认清理时间
|
||||
</BaseButton>
|
||||
<BaseButton class="fcb-refresh-button" variant="secondary" :loading="isLoading" @click="loadTrash">
|
||||
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
|
||||
刷新回收站
|
||||
</BaseButton>
|
||||
<div class="grid grid-cols-2 items-center gap-2 sm:flex">
|
||||
<BaseButton variant="secondary" :disabled="busy" @click="openRetentionSettings"><template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>清理设置</BaseButton>
|
||||
<BaseButton variant="secondary" :loading="isLoading" :disabled="busy" @click="loadTrash"><template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>刷新回收站</BaseButton>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="mb-5 grid gap-3 sm:mb-6 sm:grid-cols-3">
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">回收站记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ total }}</strong>
|
||||
</div>
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">可恢复</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ recoverableCount }}</strong>
|
||||
</div>
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">仅审计记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ purgedCount }}</strong>
|
||||
<section class="fcb-summary-grid mb-5 grid grid-cols-3 gap-2 sm:mb-6 sm:gap-3">
|
||||
<div v-for="stat in stats" :key="stat.label" class="theme-2026-card theme-2026-card-hover fcb-secondary-card min-w-0 rounded-[20px] border p-2.5 shadow-sm sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">{{ stat.label }}</p><strong class="mt-1 block text-xl sm:text-2xl" :class="primaryTextClass">{{ stat.value }}</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="theme-2026-card overflow-hidden rounded-[24px] border shadow-md sm:rounded-[30px]" :class="panelClass">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6 sm:py-4" :class="dividerClass">
|
||||
<div><h3 class="text-base font-semibold" :class="primaryTextClass">已删除文件</h3><p class="mt-0.5 text-xs" :class="mutedTextClass">物理清理只释放文件本体,文件记录和取件历史会持续保留。</p></div>
|
||||
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'"><ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" />审计保留</span>
|
||||
<section class="theme-2026-card mb-5 rounded-[24px] border p-3 sm:p-4" :class="panelClass" aria-label="回收站筛选">
|
||||
<form class="fcb-filter-grid grid grid-cols-2 gap-3 xl:grid-cols-[minmax(0,1fr)_180px_180px_auto]" @submit.prevent="applyFilters">
|
||||
<label class="col-span-2 min-w-0 xl:col-span-1"><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">关键词</span><input v-model="draft.keyword" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3" placeholder="搜索文件名或原取件码" /></label>
|
||||
<label><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">记录状态</span><select v-model="draft.state" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3"><option value="all">全部状态</option><option value="recoverable">可恢复</option><option value="scheduled">定时清理</option><option value="permanent">永久保留</option><option value="purged">仅审计记录</option></select></label>
|
||||
<label><span class="mb-1 block text-xs font-medium" :class="mutedTextClass">移入原因</span><select v-model="draft.reason" :disabled="busy || !supportsFilters" class="w-full rounded-xl border px-3"><option value="">全部原因</option><option value="manual">手动删除</option><option value="batch_delete">批量删除</option><option value="expired_time">保存到期</option><option value="expired_count">次数用尽</option><option value="expired_both">到期且次数用尽</option><option value="expired">历史自动回收</option></select></label>
|
||||
<div class="col-span-2 flex justify-end gap-2 xl:col-span-1"><BaseButton type="submit" :disabled="busy || !supportsFilters" :loading="isLoading">筛选</BaseButton><BaseButton variant="secondary" :disabled="busy || !supportsFilters" @click="resetFilters">重置</BaseButton></div>
|
||||
</form>
|
||||
<p v-if="!isLoading && !supportsFilters" class="mt-3 text-xs" :class="mutedTextClass">当前服务尚未支持回收站筛选和批量操作,更新服务后即可使用。</p>
|
||||
</section>
|
||||
|
||||
<div v-if="resultText" role="status" class="mb-4 rounded-2xl border p-3 text-sm" :class="panelClass">
|
||||
<p>{{ resultText }}</p>
|
||||
<ul v-if="operationResult" class="mt-2 max-h-36 overflow-auto text-xs leading-6">
|
||||
<li v-for="failure in operationResult.failed" :key="failure.id">#{{ failure.id }}:{{ failure.reason }}</li>
|
||||
<li v-for="entry in restoredEntries" :key="entry.id">#{{ entry.id }} 新取件码:<code class="font-semibold">{{ entry.code }}</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p v-if="errorText" role="alert" class="mb-4 rounded-2xl border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-200">{{ errorText }}</p>
|
||||
|
||||
<section class="theme-2026-card overflow-hidden rounded-[24px] border sm:rounded-[30px]" :class="panelClass">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6" :class="dividerClass">
|
||||
<div><h3 class="text-base font-semibold" :class="primaryTextClass">文件记录</h3><p class="mt-0.5 text-xs" :class="mutedTextClass">{{ supportsFilters ? `筛选结果 ${total} 条 · ` : '' }}恢复文件,或调整保留期限。</p></div>
|
||||
<span class="inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs" :class="isDarkMode ? 'bg-[#303946] text-[#dbe9ee]' : 'bg-[#e5f0f1] text-[#365a66]'"><ShieldCheckIcon class="h-3.5 w-3.5" />历史保留</span>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex min-h-64 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载回收站…</div>
|
||||
<div v-else-if="errorText" class="px-4 py-12 text-center sm:px-6"><p class="text-sm font-medium text-red-600">{{ errorText }}</p><BaseButton class="fcb-refresh-button mt-3" variant="secondary" @click="loadTrash">重新加载</BaseButton></div>
|
||||
<div v-else-if="items.length === 0" class="px-4 py-14 text-center sm:px-6"><Trash2Icon class="mx-auto h-9 w-9" :class="mutedTextClass" /><p class="mt-3 text-sm" :class="mutedTextClass">回收站目前为空</p></div>
|
||||
|
||||
<div v-if="supportsBatch && items.length" class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6" :class="dividerClass">
|
||||
<label class="flex min-h-9 cursor-pointer items-center gap-2 text-sm"><input type="checkbox" :checked="allSelected" :indeterminate="partiallySelected" :disabled="busy || isLoading || !eligibleIds.length" @change="toggleAll" />{{ selectedIds.length ? `已选择 ${selectedIds.length} 项` : '选择当前页可操作记录' }}</label>
|
||||
<div v-if="selectedIds.length" class="grid w-full grid-cols-2 gap-2 sm:flex sm:w-auto sm:flex-wrap">
|
||||
<BaseButton size="sm" variant="success" :disabled="busy || isLoading" @click="executeBatch('restore', selectedIds)">批量恢复</BaseButton>
|
||||
<BaseButton size="sm" variant="outline" :disabled="busy || isLoading" @click="openRetention(selectedIds)">设置清理时间</BaseButton>
|
||||
<BaseButton size="sm" variant="outline" :disabled="busy || isLoading" @click="executeBatch('retention', selectedIds, { retentionDays: 0 })">永久保留</BaseButton>
|
||||
<BaseButton size="sm" variant="danger" :disabled="busy || isLoading" @click="askPurge(selectedIds)">批量清理</BaseButton>
|
||||
<BaseButton size="sm" variant="secondary" :disabled="busy" @click="selectedIds = []">清空选择</BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isLoading" class="flex min-h-40 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载回收站…</div>
|
||||
<div v-else-if="!items.length" class="px-4 py-12 text-center" :class="mutedTextClass"><Trash2Icon class="mx-auto h-9 w-9" /><p class="mt-3 text-sm">{{ hasFilters ? '没有匹配的回收站记录' : '回收站目前为空' }}</p></div>
|
||||
<div v-else class="divide-y" :class="dividerClass">
|
||||
<article
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
class="fcb-interactive-row group grid gap-3 px-4 py-4 xl:grid-cols-[minmax(0,1fr)_auto] sm:items-center sm:px-6"
|
||||
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
|
||||
>
|
||||
<TrashItemInfo :item="item" :is-dark-mode="isDarkMode" :now="now" />
|
||||
<div class="flex flex-wrap items-center gap-2 sm:pl-14 xl:justify-end xl:pl-0">
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="success" :loading="busyId === item.id && busyAction === 'restore'" @click="restore(item)"><template #icon><RotateCcwIcon class="mr-2 h-4 w-4" /></template>恢复</BaseButton>
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="outline" :loading="busyId === item.id && busyAction === 'retention'" @click="makePermanent(item)"><template #icon><InfinityIcon class="mr-2 h-4 w-4" /></template>永久保留</BaseButton>
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="danger" :loading="busyId === item.id && busyAction === 'purge'" @click="purge(item)"><template #icon><EraserIcon class="mr-2 h-4 w-4" /></template>物理清理</BaseButton>
|
||||
</div>
|
||||
<article v-for="item in items" :key="item.id" class="fcb-interactive-row grid grid-cols-[auto_minmax(0,1fr)] gap-3 px-3 py-4 sm:px-6" :class="{ 'trash-row-selected': selectedIds.includes(item.id) }">
|
||||
<label v-if="supportsBatch" class="flex h-11 items-center" :title="item.isTrashPurged ? '已清理记录不能操作' : ''"><input type="checkbox" v-model="selectedIds" :value="item.id" :aria-label="`选择 ${fileName(item)}`" :disabled="busy || item.isTrashPurged" /></label>
|
||||
<TrashItemInfo :item="item" :is-dark-mode="isDarkMode" :now="now" :class="!supportsBatch ? 'col-span-2' : ''">
|
||||
<template v-if="!item.isTrashPurged" #actions>
|
||||
<BaseButton size="sm" variant="success" :disabled="busy" @click="restore(item)"><template #icon><RotateCcwIcon class="mr-1 h-4 w-4" /></template>恢复</BaseButton>
|
||||
<BaseButton size="sm" variant="outline" :disabled="busy || !supportsCustomRetention" @click="openRetention([item.id])"><template #icon><CalendarClockIcon class="mr-1 h-4 w-4" /></template>清理时间</BaseButton>
|
||||
<BaseButton size="sm" variant="outline" :disabled="busy || item.isTrashPermanent" @click="makePermanent(item)"><template #icon><InfinityIcon class="mr-1 h-4 w-4" /></template>永久保留</BaseButton>
|
||||
<BaseButton size="sm" variant="danger" :disabled="busy" @click="askPurge([item.id])"><template #icon><EraserIcon class="mr-1 h-4 w-4" /></template>彻底删除</BaseButton>
|
||||
</template>
|
||||
</TrashItemInfo>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<DataPagination v-if="total > 0" :current-page="page" :page-size="size" :total="total" @page-change="changePage" @page-size-change="changePageSize" />
|
||||
</section>
|
||||
|
||||
<BaseModal :show="retentionOpen" title="设置自动清理时间" :closable="!busy" @close="retentionOpen = false">
|
||||
<p class="mb-4 text-sm" :class="mutedTextClass">为 {{ retentionIds.length }} 条记录设置相同的回收站保留期限。</p>
|
||||
<label class="mb-4 flex cursor-pointer items-center gap-2 text-sm"><input v-model="retainForever" type="checkbox" :disabled="busy" />永久保留,不自动清理</label>
|
||||
<NativeDateSelect v-if="!retainForever" v-model="cleanupTime" aria-label="自动清理时间" include-time />
|
||||
<p class="mt-3 text-xs" :class="mutedTextClass">可选择未来 365 天内的时间。</p>
|
||||
<p v-if="dialogError" role="alert" class="mt-3 text-sm text-red-700 dark:text-red-200">{{ dialogError }}</p>
|
||||
<template #footer><BaseButton variant="secondary" :disabled="busy" @click="retentionOpen = false">取消</BaseButton><BaseButton :loading="busy" @click="saveRetention">保存时间</BaseButton></template>
|
||||
</BaseModal>
|
||||
<BaseModal :show="purgeOpen" title="确认彻底删除" :closable="!busy" @close="purgeOpen = false">
|
||||
<p class="text-sm leading-6">将永久清理所选 <strong>{{ purgeIds.length }}</strong> 条记录的文件本体。此操作不可恢复,审计记录和取件历史仍保留。</p>
|
||||
<template #footer><BaseButton variant="secondary" :disabled="busy" @click="purgeOpen = false">取消</BaseButton><BaseButton variant="danger" :loading="busy" @click="confirmPurge">确认清理 {{ purgeIds.length }} 项</BaseButton></template>
|
||||
</BaseModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { EraserIcon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
|
||||
import { CalendarClockIcon, EraserIcon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
|
||||
import BaseButton from '@/components/common/BaseButton.vue'
|
||||
import BaseModal from '@/components/common/BaseModal.vue'
|
||||
import NativeDateSelect from '@/components/common/NativeDateSelect.vue'
|
||||
import TrashItemInfo from '@/components/manage/TrashItemInfo.vue'
|
||||
import DataPagination from '@/components/common/DataPagination.vue'
|
||||
import { useAdminTrash, useInjectedDarkMode } from '@/composables'
|
||||
import type { TrashFileItem } from '@/types'
|
||||
import type { TrashFileItem, TrashListParams, TrashListResponse, TrashBatchRequest, TrashBatchResult, TrashRetentionRequest } from '@/types'
|
||||
import { getErrorMessage } from '@/utils/common'
|
||||
import { selectableTrashIds, buildTrashRetention, summarizeTrashBatch } from '@/utils/trashSelection'
|
||||
|
||||
const isDarkMode = useInjectedDarkMode()
|
||||
const router = useRouter()
|
||||
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention } = useAdminTrash()
|
||||
const items = ref<TrashFileItem[]>([])
|
||||
const page = ref(1)
|
||||
const size = ref(20)
|
||||
const total = ref(0)
|
||||
const isLoading = ref(false)
|
||||
const errorText = ref('')
|
||||
const busyId = ref<number | null>(null)
|
||||
const busyAction = ref('')
|
||||
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention, batchTrash } = useAdminTrash()
|
||||
const items = ref<TrashFileItem[]>([]), page = ref(1), size = ref(20), total = ref(0)
|
||||
const summary = ref<TrashListResponse['summary']>()
|
||||
const capabilities = ref<TrashListResponse['capabilities']>()
|
||||
const supportsFilters = computed(() => capabilities.value?.filters === true)
|
||||
const supportsBatch = computed(() => capabilities.value?.batch === true)
|
||||
const supportsCustomRetention = computed(() => capabilities.value?.customRetention === true)
|
||||
const blankFilters = () => ({ keyword: '', state: 'all' as NonNullable<TrashListParams['state']>, reason: '' as NonNullable<TrashListParams['reason']> })
|
||||
const draft = ref(blankFilters()), applied = ref(blankFilters())
|
||||
const hasFilters = computed(() => Boolean(applied.value.keyword || applied.value.reason || applied.value.state !== 'all'))
|
||||
const isLoading = ref(false), busy = ref(false), errorText = ref(''), resultText = ref('')
|
||||
const operationResult = ref<TrashBatchResult | null>(null)
|
||||
const restoredEntries = computed(() => operationResult.value?.succeeded.filter(entry => entry.code) || [])
|
||||
const selectedIds = ref<number[]>([])
|
||||
const eligibleIds = computed(() => selectableTrashIds(items.value))
|
||||
const allSelected = computed(() => eligibleIds.value.length > 0 && eligibleIds.value.every(id => selectedIds.value.includes(id)))
|
||||
const partiallySelected = computed(() => selectedIds.value.length > 0 && !allSelected.value)
|
||||
const toggleAll = () => { selectedIds.value = allSelected.value ? [] : [...eligibleIds.value] }
|
||||
const now = ref(Date.now())
|
||||
let clockTimer: ReturnType<typeof setInterval> | undefined
|
||||
onMounted(() => { clockTimer = setInterval(() => { now.value = Date.now() }, 60_000) })
|
||||
onUnmounted(() => { clearInterval(clockTimer) })
|
||||
onUnmounted(() => { clearInterval(clockTimer); loadVersion++ })
|
||||
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
|
||||
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const recoverableCount = computed(() => items.value.filter(item => !item.isTrashPurged).length)
|
||||
const purgedCount = computed(() => items.value.filter(item => item.isTrashPurged).length)
|
||||
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#adbec6]' : 'text-[#617980]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#495765] bg-[#252b34]' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#495765] border-[#495765]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const stats = computed(() => [
|
||||
{ label: '回收站记录', value: summary.value?.total ?? total.value },
|
||||
{ label: '可恢复', value: summary.value?.recoverable ?? (total.value <= size.value ? items.value.filter(item => !item.isTrashPurged).length : '—') },
|
||||
{ label: '仅审计记录', value: summary.value?.purged ?? (total.value <= size.value ? items.value.filter(item => item.isTrashPurged).length : '—') }
|
||||
])
|
||||
const fileName = (item: TrashFileItem) => item.name || `${item.prefix || ''}${item.suffix || ''}` || '未命名文件'
|
||||
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 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 restore = (item: TrashFileItem) => run(item, 'restore', () => restoreTrashItem(item.id))
|
||||
const makePermanent = (item: TrashFileItem) => run(item, 'retention', () => updateTrashRetention(item.id, 0))
|
||||
const purge = (item: TrashFileItem) => { if (!window.confirm(`确定物理清理“${fileName(item)}”吗?文件本体不可恢复,但审计记录会永久保留。`)) return; void run(item, 'purge', () => purgeTrashItem(item.id)) }
|
||||
const changePage = (nextPage: number) => { page.value = nextPage; void loadTrash() }
|
||||
const changePageSize = (nextSize: number) => { size.value = nextSize; page.value = 1; void loadTrash() }
|
||||
let loadVersion = 0
|
||||
const loadTrash = async () => {
|
||||
const version = ++loadVersion
|
||||
isLoading.value = true; errorText.value = ''
|
||||
try {
|
||||
let detail = await fetchTrash({ page: page.value, size: size.value, ...applied.value })
|
||||
if (version !== loadVersion) return
|
||||
const lastPage = Math.max(1, Math.ceil((detail?.total || 0) / size.value))
|
||||
if (page.value > lastPage) { page.value = lastPage; detail = await fetchTrash({ page: page.value, size: size.value, ...applied.value }) }
|
||||
if (version !== loadVersion) return
|
||||
items.value = detail?.data || []; total.value = Number(detail?.total || 0)
|
||||
summary.value = detail?.summary; capabilities.value = detail?.capabilities
|
||||
selectedIds.value = selectedIds.value.filter(id => eligibleIds.value.includes(id))
|
||||
} catch (error) { if (version === loadVersion) errorText.value = getErrorMessage(error, '回收站加载失败,请重试') }
|
||||
finally { if (version === loadVersion) isLoading.value = false }
|
||||
}
|
||||
const applyFilters = () => { if (!supportsFilters.value || busy.value) return; applied.value = { ...draft.value, keyword: draft.value.keyword.trim() }; selectedIds.value = []; page.value = 1; void loadTrash() }
|
||||
const resetFilters = () => { draft.value = blankFilters(); applyFilters() }
|
||||
const changePage = (value: number) => { if (busy.value) return; page.value = value; selectedIds.value = []; void loadTrash() }
|
||||
const changePageSize = (value: number) => { if (busy.value) return; size.value = value; page.value = 1; selectedIds.value = []; void loadTrash() }
|
||||
const runSingle = async (operation: () => Promise<unknown>, message: string) => {
|
||||
if (busy.value) return false
|
||||
busy.value = true; errorText.value = ''; resultText.value = ''; operationResult.value = null
|
||||
try { await operation(); resultText.value = message; await loadTrash(); return true }
|
||||
catch (error) { errorText.value = getErrorMessage(error, '操作失败,请重试'); return false }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
const executeBatch = async (action: TrashBatchRequest['action'], ids: number[], retention: TrashRetentionRequest = {}) => {
|
||||
if (busy.value || !ids.length || !supportsBatch.value) return false
|
||||
busy.value = true; errorText.value = ''; resultText.value = ''; operationResult.value = null
|
||||
try {
|
||||
const response = await batchTrash({ action, ids: [...ids], ...retention })
|
||||
if (!response.detail) throw new Error('未收到操作结果,请刷新后核对')
|
||||
operationResult.value = response.detail; resultText.value = summarizeTrashBatch(response.detail)
|
||||
selectedIds.value = response.detail.failed.map(entry => entry.id)
|
||||
await loadTrash()
|
||||
return response.detail.failed.length === 0
|
||||
} catch (error) { errorText.value = getErrorMessage(error, '操作失败,请重试'); return false }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
const restore = (item: TrashFileItem) => supportsBatch.value ? executeBatch('restore', [item.id]) : runSingle(() => restoreTrashItem(item.id), '已恢复,请到文件管理查看新取件码')
|
||||
const makePermanent = (item: TrashFileItem) => supportsBatch.value ? executeBatch('retention', [item.id], { retentionDays: 0 }) : runSingle(() => updateTrashRetention(item.id, { retentionDays: 0 }), '已设为永久保留')
|
||||
const retentionOpen = ref(false), retentionIds = ref<number[]>([]), retainForever = ref(false), cleanupTime = ref(''), dialogError = ref('')
|
||||
const localDateTime = (date: Date) => `${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,'0')}-${String(date.getDate()).padStart(2,'0')}T${String(date.getHours()).padStart(2,'0')}:${String(date.getMinutes()).padStart(2,'0')}`
|
||||
const openRetention = (ids: number[]) => {
|
||||
retentionIds.value = [...ids]; dialogError.value = ''
|
||||
const item = ids.length === 1 ? items.value.find(item => item.id === ids[0]) : undefined
|
||||
const current = new Date(item?.trashExpiresAt || '').getTime()
|
||||
retainForever.value = item?.isTrashPermanent === true
|
||||
cleanupTime.value = localDateTime(new Date(Number.isFinite(current) && current > Date.now() ? current : Date.now()+30*86400000))
|
||||
retentionOpen.value = true
|
||||
}
|
||||
const saveRetention = async () => {
|
||||
try {
|
||||
dialogError.value = ''
|
||||
const payload = buildTrashRetention(retainForever.value, cleanupTime.value, Date.now())
|
||||
const ok = await executeBatch('retention', retentionIds.value, payload)
|
||||
if (ok) retentionOpen.value = false
|
||||
else dialogError.value = errorText.value || resultText.value || '操作未完成,请重试'
|
||||
} catch (error) { dialogError.value = getErrorMessage(error, '请选择有效的清理时间') }
|
||||
}
|
||||
const purgeOpen = ref(false), purgeIds = ref<number[]>([])
|
||||
const askPurge = (ids: number[]) => { purgeIds.value = [...ids]; purgeOpen.value = true }
|
||||
const confirmPurge = async () => {
|
||||
const ok = supportsBatch.value ? await executeBatch('purge', purgeIds.value) : await runSingle(() => purgeTrashItem(purgeIds.value[0]), '文件本体已清理,审计记录已保留')
|
||||
if (ok || operationResult.value) purgeOpen.value = false
|
||||
}
|
||||
void loadTrash()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.trash-row-selected { background: var(--fcb-row-hover); }
|
||||
</style>
|
||||
Reference in new issue
Block a user