文件下载名称调优
This commit is contained in:
1 parent
cd5aa624db
commit
0e02d446ba
19 files changed
+116
-37
No files matched your search
@@ -3,6 +3,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Download, Plus, Promotion, Refresh, Search, Upload } from '@element-plus/icons-vue'
|
||||
import http, { apiErrorMessage } from '../api/http'
|
||||
import { downloadApiFile } from '../api/excel'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
|
||||
type ResultRow = { studentNumber: string; studentName?: string; collegeName?: string; className?: string; attemptNumber?: number; score: number | null; level: string; isPassed: boolean | null; notes: string }
|
||||
@@ -97,8 +98,7 @@ async function createBatch() {
|
||||
}
|
||||
async function downloadTemplate() {
|
||||
try {
|
||||
const response = await http.get(`/other-exams/batches/${selected.value.id}/template`, { responseType: 'blob' })
|
||||
const url = URL.createObjectURL(response.data); const link = document.createElement('a'); link.href = url; link.download = `其他考试成绩导入模板-${selected.value.examCode || selected.value.name}.xlsx`; link.click(); URL.revokeObjectURL(url)
|
||||
await downloadApiFile(`/other-exams/batches/${selected.value.id}/template`, '其他考试成绩-导入模板.xlsx')
|
||||
} catch (error) { ElMessage.error(apiErrorMessage(error)) }
|
||||
}
|
||||
async function importExcel(event: Event) {
|
||||
|
||||
Reference in new issue
Block a user