feat: 文件下载
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m54s

This commit is contained in:
sexygoat
2026-04-30 18:04:01 +08:00
parent 81155fd8e4
commit 950520635d
19 changed files with 438 additions and 44 deletions

View File

@@ -40,7 +40,7 @@
:total="pagination.total"
:marginTop="10"
:actions="getActions"
:actionsWidth="120"
:actionsWidth="180"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
@@ -614,9 +614,34 @@
}
}
const downloadTaskFile = async (row: DeviceImportTask) => {
const fileKey = row.file_name?.trim()
if (!fileKey) {
ElMessage.warning('当前任务没有可下载的原始文件')
return
}
try {
await StorageService.downloadFileByKey(fileKey)
ElMessage.success('原始文件下载已开始')
} catch (error) {
console.error('下载原始文件失败:', error)
ElMessage.error('下载原始文件失败')
}
}
// 获取操作按钮
const getActions = (row: DeviceImportTask) => {
const actions: any[] = []
const showDownloadFileAction = false
if (showDownloadFileAction && row.file_name?.trim() && hasAuth('device_task:download_file')) {
actions.push({
label: '下载文件',
handler: () => downloadTaskFile(row),
type: 'primary'
})
}
if (row.fail_count > 0 && hasAuth('device_task:download_fail_data')) {
actions.push({