【修改】 监控管理的下载的文件名称为username命名

This commit is contained in:
dlaren
2025-08-20 15:26:52 +08:00
parent adf09b6ead
commit 45505faaa7

View File

@@ -206,7 +206,7 @@
<el-table-column label="操作" align="center" min-width="120px"> <el-table-column label="操作" align="center" min-width="120px">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="downloadFile(scope.row.temporaryId)"> <el-button link type="primary" @click="downloadFile(scope.row)">
下载 下载
</el-button> </el-button>
</template> </template>
@@ -378,8 +378,8 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
const downloadFile = async (temporaryId: string) => { const downloadFile = async (row: any) => {
const res = await MonitorApi.getMonitorStuFileUrl(temporaryId) const res = await MonitorApi.getMonitorStuFileUrl(row.temporaryId)
console.log(res) console.log(res)
const url = res const url = res
try { try {
@@ -391,7 +391,7 @@ const downloadFile = async (temporaryId: string) => {
const blobUrl = window.URL.createObjectURL(blob) const blobUrl = window.URL.createObjectURL(blob)
// 提取文件名 // 提取文件名
const filename = url.substring(url.lastIndexOf('/') + 1).split('?')[0] const filename = row.username
// 创建 a 标签并下载 // 创建 a 标签并下载
const a = document.createElement('a') const a = document.createElement('a')