增加导入附件的查看记录

This commit is contained in:
wuweihua
2026-10-15 15:02:23 +08:00
parent c704021f2f
commit 41ce05a08a
14 changed files with 585 additions and 13 deletions
@@ -0,0 +1,70 @@
<template>
<el-drawer v-model="visible" size="860px" :title="drawerTitle" append-to-body destroy-on-close>
<basic-table
v-if="visible"
:columns="columns"
:search-columns="searchColumns"
:query="queryList"
row-key="attachmentId"
:page-size="10"
:selection="false"
:show-add="false"
>
<template #col-fileSize="{ row }">
{{ formatSize(row.fileSize) }}
</template>
<template #col-action="{ row }">
<el-button link type="primary" :disabled="!row.filePath" @click="handleDownload(row)">下载</el-button>
</template>
</basic-table>
</el-drawer>
</template>
<script setup>
import { listChargeWeightImportAttachments } from '@/api/price/billing'
const { proxy } = getCurrentInstance()
const visible = ref(false)
const drawerTitle = '批量修改计费重导入记录'
const searchColumns = [
{ label: '文件名', prop: 'fileName', component: 'input', placeholder: '文件名', width: '200px' },
{ label: '上传人', prop: 'createBy', component: 'input', placeholder: '上传人', width: '140px' }
]
const columns = [
{ label: '文件名称', prop: 'fileName', minWidth: 220, showOverflowTooltip: true },
{ label: '任务ID', prop: 'bizId', minWidth: 180, showOverflowTooltip: true },
{ label: '大小', prop: 'fileSize', width: 100, align: 'right', slot: 'fileSize' },
{ label: '上传人', prop: 'createBy', width: 110, align: 'center', showOverflowTooltip: true },
{ label: '上传时间', prop: 'createTime', width: 170, align: 'center' },
{ label: '操作', prop: 'action', width: 90, align: 'center', fixed: 'right', slot: 'action', showInToolbar: false }
]
function queryList(params) {
return listChargeWeightImportAttachments(params)
}
function formatSize(bytes) {
const n = Number(bytes)
if (!n || n < 0) return '-'
if (n < 1024) return n + ' B'
if (n < 1024 * 1024) return (n / 1024).toFixed(1) + ' KB'
return (n / (1024 * 1024)).toFixed(2) + ' MB'
}
function handleDownload(row) {
if (!row || !row.filePath) {
proxy.$modal.msgWarning('文件路径不存在')
return
}
proxy.$download.resource(row.filePath)
}
function open() {
visible.value = true
}
defineExpose({ open })
</script>