feat(pl): add cert batch ZIP download on personnel lists.
Wire third-party and Shanxia escort/driver lists to personnel cert zip packing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6d8e5578c9
commit
2357c46e4d
1 file changed
+37
@@ -49,6 +49,15 @@
|
||||
filename="人员列表.xlsx"
|
||||
/>
|
||||
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length === 0"
|
||||
:loading="certZipLoading"
|
||||
@click="handleBatchDownloadCertZip"
|
||||
>
|
||||
<el-icon><Download /></el-icon>批量下载证书 ZIP
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -486,6 +495,7 @@ import {
|
||||
previewListPhoto,
|
||||
resolvePhotoDisplayUrl
|
||||
} from '@/utils/pl-photo'
|
||||
import { buildAndSavePersonnelCertZip } from '@/utils/pl-vehicle-cert-zip'
|
||||
|
||||
const handlePhotoPreview = (raw?: string | null) => previewListPhoto(raw)
|
||||
const handlePhotoDownload = (raw?: string | null) => downloadListPhoto(raw)
|
||||
@@ -582,6 +592,7 @@ tableEl: personnelTableWrapRef,
|
||||
})
|
||||
|
||||
const submitLoading = ref(false)
|
||||
const certZipLoading = ref(false)
|
||||
const personnelRows = ref<Personnel[]>([])
|
||||
const selectedRows = ref<Personnel[]>([])
|
||||
|
||||
@@ -840,6 +851,32 @@ function handleSelectionChange(rows: Personnel[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function handleBatchDownloadCertZip() {
|
||||
if (!selectedRows.value.length || certZipLoading.value) return
|
||||
certZipLoading.value = true
|
||||
try {
|
||||
const result = await buildAndSavePersonnelCertZip(selectedRows.value)
|
||||
if (!result.zipName && result.okCount === 0 && result.failCount === 0) {
|
||||
ElMessage.warning('无可下载附件')
|
||||
return
|
||||
}
|
||||
if (!result.zipName && result.failCount > 0) {
|
||||
ElMessage.error('下载失败,请稍后重试')
|
||||
return
|
||||
}
|
||||
if (result.failCount > 0) {
|
||||
ElMessage.warning(`已打包 ${result.okCount} 个文件,${result.failCount} 个失败`)
|
||||
return
|
||||
}
|
||||
ElMessage.success(`下载成功(${result.okCount} 个文件)`)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
ElMessage.error('下载失败,请稍后重试')
|
||||
} finally {
|
||||
certZipLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条人员记录')
|
||||
|
||||
Reference in new issue
Block a user