✨ feat: 完善文件状态、取件记录与表格交互

* 支持当前页下载状态的手动和定时检测,仅显示标签与检测时间
* 区分查件时间和下载点击时间,保留重复查件前的取件时间
* 将查件事件按时间并入现有取件记录,共用展开与收起
* 统一表头居中,支持拖拽和键盘调整列宽并限制最小宽度
* 修复筛选面板收起结束时顶部间距突然消失的顿挫
* 补充单元、集成与浏览器验证,覆盖查询下载、列宽和动画行为
This commit is contained in:
orion committed 2026-09-19 00:35:55 +08:00
1 parent 272741ee49
commit 4fefcd0f0a
29 files changed
+765 -41

No files matched your search

+48 -12
View File
@@ -14,6 +14,22 @@
</div>
</div>
<div class="mb-4 flex flex-wrap items-center gap-3 text-sm" :class="mutedTextClass">
<label class="flex items-center gap-2">
下载状态刷新
<select :value="downloadCheckInterval" :disabled="savingCheckInterval" class="min-h-11 rounded-lg border px-3" :class="fieldClass" @change="handleCheckIntervalChange">
<option :value="0">仅手动刷新</option>
<option :value="30">每 30 秒</option>
<option :value="60">每分钟</option>
<option :value="300">每 5 分钟</option>
<option :value="600">每 10 分钟</option>
<option :value="1800">每 30 分钟</option>
</select>
</label>
<span class="text-xs">仅检测当前页;刷新列表会重新检测,不消耗取件次数。</span>
<span v-if="checkIntervalError" role="alert" class="text-red-500">{{ checkIntervalError }}</span>
</div>
<div v-if="!hasSelectedFiles" class="mb-5 grid grid-cols-2 gap-3 sm:mb-6 sm:gap-4 xl:grid-cols-4">
<div
v-for="card in summaryCards"
@@ -70,7 +86,8 @@
</div>
<Transition :css="false" @before-enter="beforeExpandPanelEnter" @enter="enterExpandPanel" @after-enter="afterExpandPanelEnter" @before-leave="beforeExpandPanelLeave" @leave="leaveExpandPanel">
<div id="file-filter-panel" v-show="filterBodyVisible" class="fcb-expand-content mt-4 grid gap-4">
<div id="file-filter-panel" v-show="filterBodyVisible" class="fcb-expand-content">
<div class="grid gap-4 pt-4">
<div class="flex flex-col gap-3 lg:flex-row lg:items-center">
<label class="min-w-0 flex-1">
<span class="sr-only">{{ t('fileManage.searchPlaceholder') }}</span>
@@ -256,6 +273,7 @@
</BaseButton>
</div>
</div>
</div>
</Transition>
</section>
@@ -362,6 +380,7 @@
{{ file.displayHealthState }}
</span>
</div>
<DownloadCheckStatus class="mt-2" :result="downloadStatusFor(file.id)" :dark="isDarkMode" />
<div class="mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-xs" :class="[mutedTextClass]">
<span>{{ file.code }} · {{ file.displaySize }}</span>
<span class="text-right">{{ file.displayUsage }}</span>
@@ -694,6 +713,9 @@
{{ file.isExpiredFile ? t('fileManage.expired') : t('fileManage.active') }}
</span>
</td>
<td class="px-6 py-4" :class="primaryTextClass">
<DownloadCheckStatus :result="downloadStatusFor(file.id)" :dark="isDarkMode" />
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<div class="flex items-center justify-end gap-2">
<button
@@ -806,55 +828,56 @@
</div>
<div class="overflow-x-auto" tabindex="0" role="region" :aria-label="t('fileManage.history.title')">
<table
v-resizable-columns
class="min-w-full divide-y"
:class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-200']"
>
<thead>
<tr>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
文件
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
大小
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
取件码
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
上传时间
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
过期时间
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
下载
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
流量
</th>
<th
class="px-4 py-3 text-left text-xs font-semibold uppercase"
class="px-4 py-3 text-center text-xs font-semibold uppercase"
:class="[mutedTextClass]"
>
状态
@@ -1704,6 +1727,8 @@
</template>
<script setup lang="ts">
import { vResizableColumns } from '@/directives/resizable-columns'
import DownloadCheckStatus from '@/components/manage/DownloadCheckStatus.vue'
import { getHistoryStatusLabel } from '@/utils/history-status'
import { computed, nextTick, onMounted, onUnmounted, ref, watch, type Component } from 'vue'
import { useI18n } from 'vue-i18n'
@@ -1749,7 +1774,7 @@ 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 { useAdminFiles, useInjectedDarkMode, useTransferAnalytics, useDownloadChecks } from '@/composables'
import { formatFileSize, formatTimestamp } from '@/utils/common'
import { createDetailMotion } from '@/utils/detailMotion'
@@ -1768,6 +1793,7 @@ const fileTableHeaders = computed(() => [
t('fileManage.headers.usage'),
t('fileManage.headers.expiration'),
t('fileManage.headers.status'),
'可下载状态',
t('fileManage.headers.actions')
])
@@ -1852,6 +1878,15 @@ const {
toggleFileSelection
} = useAdminFiles()
const {
interval: downloadCheckInterval, saving: savingCheckInterval, error: checkIntervalError,
statusFor: downloadStatusFor, loadInterval: loadCheckInterval, saveInterval: saveCheckInterval
} = useDownloadChecks(tableData)
const handleCheckIntervalChange = (event: Event) => {
void saveCheckInterval(Number((event.target as HTMLSelectElement).value))
}
const isFilterPanelOpen = ref(false)
const showMobilePolicyActions = ref(false)
const mobileMediaQuery = window.matchMedia('(max-width: 767px)')
@@ -1864,12 +1899,12 @@ const lifecycleViewportRef = ref<HTMLElement | null>(null)
let lifecycleHeightRevision = 0
const isRetrievalHistoryExpanded = ref(false)
const retrievalTimelineEvents = computed(() =>
(selectedFileDetail.value?.detailTimeline || []).filter((item) => item.key === 'retrieved_event')
(selectedFileDetail.value?.detailTimeline || []).filter((item) => item.key === 'retrieved_event' || item.key === 'queried_event')
)
const retrievalTimelineCount = computed(() => retrievalTimelineEvents.value.length)
const detailTimelineRows = computed(() => {
const timeline = selectedFileDetail.value?.detailTimeline || []
return timeline.filter((item) => item.key !== 'retrieved_event')
return timeline.filter((item) => item.key !== 'retrieved_event' && item.key !== 'queried_event')
})
const visibleDetailTimeline = computed(() =>
isLifecycleExpanded.value ? detailTimelineRows.value : detailTimelineRows.value.slice(0, 3)
@@ -2509,6 +2544,7 @@ watch(
onMounted(() => {
mobileMediaQuery.addEventListener('change', syncMobileViewport)
params.value.health = getRouteHealthFilter()
void loadCheckInterval()
void loadViewPresets()
void loadFiles()
void loadHistoryFiles()