简历批量下载更改
continuous-integration/drone/push Build is passing Details

main
caiyiling 2026-02-05 14:41:28 +08:00
parent 231a993f8b
commit 849142bd23
1 changed files with 54 additions and 5 deletions

View File

@ -712,11 +712,12 @@ export default {
this.model_cfg.visible = false
this.model_cfg.showClose = true
console.log(res.Result)
for (let i = 0; res.Result.length > i; i++) {
let item = res.Result[i]
console.log(item)
await this.handleBatchDown(item)
}
this.downloadAllInOneZip(res.Result)
// for (let i = 0; res.Result.length > i; i++) {
// let item = res.Result[i]
// console.log(item)
// await this.handleBatchDown(item)
// }
} catch (e) {
console.log(e)
}
@ -736,6 +737,54 @@ export default {
// this.model_cfg.showClose = true
// })
},
async downloadAllInOneZip(arr) {
if (!arr.length) {
return
}
const zip = new JSZip()
const allTasks = []
arr.forEach((reviewer) => {
if (!reviewer?.FileList?.length) return
reviewer.FileList.forEach((fileItem) => {
const fileUrl = this.OSSclientConfig.basePath + fileItem.Path
const zipPath = `${reviewer.Name}_${fileItem.FileName}`
const task = this.getFileData(fileUrl)
.then((response) => {
zip.file(zipPath, response.data, { binary: true })
})
.catch((err) => {
console.error(`文件下载失败 [${zipPath}]:`, err)
});
allTasks.push(task)
})
})
if (allTasks.length === 0) {
console.log('无可下载的文件')
return
}
try {
await Promise.all(allTasks)
// ZIP
const zipBlob = await zip.generateAsync({
type: 'blob',
compression: 'DEFLATE',
compressionOptions: { level: 9 },
})
//
saveAs(zipBlob, `CV_${new Date().getTime()}.zip`)
console.error('ZIP 生成成功')
} catch (err) {
console.error('ZIP 生成失败:', err)
} finally {
}
},
//
handleSelectSearch() {
this.searchData.PageIndex = 1