This commit is contained in:
SunYF
2026-10-26 16:32:35 +08:00
parent 4b14f9540a
commit f86feb2271
99 changed files with 1652 additions and 521 deletions
+18 -4
View File
@@ -26,7 +26,7 @@
</el-select>
</el-form-item>
<el-form-item label="业务ID">
<el-input v-model="form.bizId" placeholder="如 工单号 / 图号 / SN" clearable style="width:190px"
<el-input v-model="form.bizId" placeholder="如 产品工号 / 图号 / SN" clearable style="width:190px"
@keyup.enter="search" />
</el-form-item>
<el-form-item label="文件名">
@@ -56,9 +56,9 @@
<el-tag size="small" type="info">{{ fileTypeText(row.fileType) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="相对路径" min-width="260" show-overflow-tooltip>
<el-table-column label="访问路径" min-width="260" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" :underline="false" @click="preview(row)">{{ row.filePath || '-' }}</el-link>
<el-link type="primary" :underline="false" @click="preview(row)">{{ fullUrl(row) }}</el-link>
</template>
</el-table-column>
<el-table-column label="大小" width="100" align="right">
@@ -119,6 +119,7 @@ const FILE_TYPES = {
PROCESS_CARD: '流程卡',
PACKAGE_PHOTO: '包装照片',
EXCEL_IMPORT: 'Excel导入',
IMAGE: '图片',
OTHER: '其他'
}
// 业务类型中文名
@@ -190,11 +191,24 @@ function resetFilters() {
search()
}
// 预览:走免鉴权直链(UUID 文件名不可枚举),PDF/图片浏览器内联打开
// 预览:图片(png/jpg/jpeg/gif/webp)与 PDF 浏览器内联打开;其余类型走下载(对齐 WMS 附件中心交互)
const INLINE_EXTS = ['png', 'jpg', 'jpeg', 'gif', 'webp']
function isInlinePreview(row) {
const ext = (row.fileExt || '').toLowerCase()
if (INLINE_EXTS.includes(ext) || ext === 'pdf') return true
// 文件类型枚举兜底(报告/图纸/流程卡多为 PDF)
return row.fileType === 'INSPECTION_PDF' || row.fileType === 'PROCESS_PDF' || row.fileType === 'DRAWING'
}
function preview(row) {
if (!isInlinePreview(row)) return download(row) // 非图片/PDF 直接下载
if (!row.previewUrl) return ElMessage.warning('无预览地址')
window.open(row.previewUrl, '_blank')
}
// 路径改完整 URL(绝对可访问地址,便于复制/对接)
function fullUrl(row) {
if (!row.url) return row.filePath || '-'
try { return location.origin + row.url } catch { return row.url }
}
// 下载:带鉴权走 id 路由,服务端给出中文文件名
async function download(row) {