✨ feat: 完善文件状态、取件记录与表格交互
* 支持当前页下载状态的手动和定时检测,仅显示标签与检测时间 * 区分查件时间和下载点击时间,保留重复查件前的取件时间 * 将查件事件按时间并入现有取件记录,共用展开与收起 * 统一表头居中,支持拖拽和键盘调整列宽并限制最小宽度 * 修复筛选面板收起结束时顶部间距突然消失的顿挫 * 补充单元、集成与浏览器验证,覆盖查询下载、列宽和动画行为
This commit is contained in:
1 parent
272741ee49
commit
4fefcd0f0a
29 files changed
+765
-41
No files matched your search
@@ -0,0 +1,3 @@
|
||||
export function resizeColumn(widths: number[], index: number, delta: number, minimum: number): number[] {
|
||||
return widths.map((width, column) => column === index ? Math.max(minimum, width + delta) : width)
|
||||
}
|
||||
@@ -7,16 +7,18 @@ const unsafeFilenamePattern = new RegExp(
|
||||
'g'
|
||||
)
|
||||
|
||||
export function downloadReceivedRecord(record: ReceivedFileRecord): void {
|
||||
export function downloadReceivedRecord(record: ReceivedFileRecord): boolean {
|
||||
if (record.downloadUrl) {
|
||||
window.open(buildDownloadUrl(record.downloadUrl), '_blank')
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
if (record.content) {
|
||||
if (typeof record.content === 'string') {
|
||||
const blob = new Blob([record.content], { type: 'text/plain;charset=utf-8' })
|
||||
saveAs(blob, `${record.filename}.txt`)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export const getSafeFilename = (name: string) =>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { ReceivedFileRecord } from '../types/file'
|
||||
|
||||
/** Legacy date was written on lookup, never on download. */
|
||||
export function queriedAt(record: ReceivedFileRecord): string {
|
||||
return record.queriedAt || record.date
|
||||
}
|
||||
|
||||
export function formatRecordTime(value?: string | null): string {
|
||||
if (!value) return ''
|
||||
// Old records contain locale-formatted dates; retain them without guessing.
|
||||
if (!/^\d{4}-\d{2}-\d{2}T/.test(value)) return value
|
||||
const time = new Date(value)
|
||||
return Number.isNaN(time.getTime()) ? value : time.toLocaleString()
|
||||
}
|
||||
|
||||
export function markRecordRetrieved(record: ReceivedFileRecord, at = new Date()): void {
|
||||
record.retrievedAt = at.toISOString()
|
||||
}
|
||||
Reference in new issue
Block a user