From 50ee6ac5bd88bbaa7827472a3e7a0f7c9da953f7 Mon Sep 17 00:00:00 2001 From: houhuan Date: Tue, 12 May 2026 21:23:28 +0800 Subject: [PATCH] refactor: add useFileUtils composable for shared file helpers --- web/frontend/src/composables/useFileUtils.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 web/frontend/src/composables/useFileUtils.ts diff --git a/web/frontend/src/composables/useFileUtils.ts b/web/frontend/src/composables/useFileUtils.ts new file mode 100644 index 0000000..476ff31 --- /dev/null +++ b/web/frontend/src/composables/useFileUtils.ts @@ -0,0 +1,20 @@ +export function statusType(status: string): string { + const map: Record = { + done: 'success', merged: 'success', excel_done: 'warning', + ocr_done: 'info', pending: 'info' + } + return map[status] || 'info' +} + +export function statusText(status: string): string { + const map: Record = { + done: '已完成', merged: '已合并', excel_done: '已处理', + ocr_done: '已OCR', pending: '待处理' + } + return map[status] || status +} + +export function fmtTime(t: string): string { + if (!t) return '--' + return t.replace('T', ' ').slice(0, 19) +}