feat: 付款记录付款凭证查看下载

This commit is contained in:
刘泉佳
2026-11-06 17:39:34 +08:00
parent eb74466c30
commit b218fc2345
2 changed files with 61 additions and 19 deletions
+52 -19
View File
@@ -354,11 +354,23 @@
><el-table-column prop="paidDate" label="付款日期" min-width="150" /><el-table-column
prop="paymentNo"
label="付款单号"
min-width="160" /><el-table-column
prop="kingdeeBillNo"
label="付款凭证"
min-width="160"
/></el-table>
min-width="160" /><el-table-column label="付款凭证" min-width="160"
><template #default="{ row }"
><div v-if="row.voucherFileName" class="payment-form-page__invoice-actions"
><el-link
type="primary"
:disabled="kingdeeAttachmentBusy"
@click="viewRecordVoucher(row)"
>查看</el-link
><el-link
type="primary"
:disabled="kingdeeAttachmentBusy"
@click="downloadRecordVoucher(row)"
>下载</el-link
></div
><span v-else>-</span></template
></el-table-column
></el-table>
</section-card>
<section-card>
<template #title>
@@ -736,8 +748,10 @@ import { formatContractOptionLabel } from '@/utils/contract';
import { downloadFileByUrl } from '@/utils/util';
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
import {
downloadKingdeeFile,
downloadKingdeeInvoiceFile,
isKingdeePathAttachment,
viewKingdeeFile,
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
import PdfPreview from '@/components/pdf-preview/main.vue';
@@ -1907,17 +1921,23 @@ export default {
this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf`
);
},
/** 金蝶附件查看/下载互斥闸门(A801-2 拉流较慢,进行中忽略重复点击,结束自动释放) */
async withKingdeeAttachmentBusy(action) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await action();
} finally {
this.kingdeeAttachmentBusy = false;
}
},
async viewInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
await this.withKingdeeAttachmentBusy(() =>
viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
);
return;
}
if (!this.attachmentFileUrl(attachment)) {
@@ -1933,13 +1953,9 @@ export default {
const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
await this.withKingdeeAttachmentBusy(() =>
downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
);
return;
}
const url = this.attachmentFileUrl(attachment);
@@ -1949,6 +1965,23 @@ export default {
}
downloadFileByUrl(url, this.invoiceAttachmentName(row));
},
/** 付款记录付款凭证(金蝶电子回单,A801-2 代理):查看=新窗口预览,下载=保存文件 */
viewRecordVoucher(row) {
return this.withKingdeeAttachmentBusy(() =>
viewKingdeeFile(
() => api.downloadRecordVoucher(row.id),
`${row.paymentNo || '付款记录'}-付款凭证.pdf`
)
);
},
downloadRecordVoucher(row) {
return this.withKingdeeAttachmentBusy(() =>
downloadKingdeeFile(
() => api.downloadRecordVoucher(row.id),
`${row.paymentNo || '付款记录'}-付款凭证.pdf`
)
);
},
attachmentFileName(file) {
return String(file?.originalName || file?.name || file?.fileName || '').trim();
},