feat: 付款记录付款凭证查看下载
This commit is contained in:
@@ -34,6 +34,15 @@ export const syncKingdeeBatch = ids =>
|
|||||||
// 回写任务按 paymentNo 分批远程查询 A103-2/A103-4,同样可能超过全局超时
|
// 回写任务按 paymentNo 分批远程查询 A103-2/A103-4,同样可能超过全局超时
|
||||||
export const syncKingdeeResult = () =>
|
export const syncKingdeeResult = () =>
|
||||||
request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post', timeout: APPROVE_TIMEOUT });
|
request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post', timeout: APPROVE_TIMEOUT });
|
||||||
|
// 付款记录付款凭证下载(后端代理 A801-2 流式回源),耗时较普通接口长,放宽到 120s
|
||||||
|
export const downloadRecordVoucher = recordId =>
|
||||||
|
request({
|
||||||
|
url: `${baseUrl}/record/download-voucher`,
|
||||||
|
method: 'get',
|
||||||
|
params: { recordId },
|
||||||
|
responseType: 'blob',
|
||||||
|
timeout: 120000,
|
||||||
|
});
|
||||||
|
|
||||||
export const paymentTypeOptions = [
|
export const paymentTypeOptions = [
|
||||||
{ label: '项目预付', value: 'project_advance' },
|
{ label: '项目预付', value: 'project_advance' },
|
||||||
|
|||||||
@@ -354,11 +354,23 @@
|
|||||||
><el-table-column prop="paidDate" label="付款日期" min-width="150" /><el-table-column
|
><el-table-column prop="paidDate" label="付款日期" min-width="150" /><el-table-column
|
||||||
prop="paymentNo"
|
prop="paymentNo"
|
||||||
label="付款单号"
|
label="付款单号"
|
||||||
min-width="160" /><el-table-column
|
min-width="160" /><el-table-column label="付款凭证" min-width="160"
|
||||||
prop="kingdeeBillNo"
|
><template #default="{ row }"
|
||||||
label="付款凭证"
|
><div v-if="row.voucherFileName" class="payment-form-page__invoice-actions"
|
||||||
min-width="160"
|
><el-link
|
||||||
/></el-table>
|
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>
|
||||||
<section-card>
|
<section-card>
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -736,8 +748,10 @@ import { formatContractOptionLabel } from '@/utils/contract';
|
|||||||
import { downloadFileByUrl } from '@/utils/util';
|
import { downloadFileByUrl } from '@/utils/util';
|
||||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||||
import {
|
import {
|
||||||
|
downloadKingdeeFile,
|
||||||
downloadKingdeeInvoiceFile,
|
downloadKingdeeInvoiceFile,
|
||||||
isKingdeePathAttachment,
|
isKingdeePathAttachment,
|
||||||
|
viewKingdeeFile,
|
||||||
viewKingdeeInvoiceFile,
|
viewKingdeeInvoiceFile,
|
||||||
} from '@/utils/kingdee-attachment';
|
} from '@/utils/kingdee-attachment';
|
||||||
import PdfPreview from '@/components/pdf-preview/main.vue';
|
import PdfPreview from '@/components/pdf-preview/main.vue';
|
||||||
@@ -1907,17 +1921,23 @@ export default {
|
|||||||
this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf`
|
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) {
|
async viewInvoiceAttachment(row) {
|
||||||
const attachment = this.invoiceAttachment(row);
|
const attachment = this.invoiceAttachment(row);
|
||||||
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件
|
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件
|
||||||
if (isKingdeePathAttachment(attachment)) {
|
if (isKingdeePathAttachment(attachment)) {
|
||||||
if (this.kingdeeAttachmentBusy) return;
|
await this.withKingdeeAttachmentBusy(() =>
|
||||||
this.kingdeeAttachmentBusy = true;
|
viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
|
||||||
try {
|
);
|
||||||
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
|
|
||||||
} finally {
|
|
||||||
this.kingdeeAttachmentBusy = false;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.attachmentFileUrl(attachment)) {
|
if (!this.attachmentFileUrl(attachment)) {
|
||||||
@@ -1933,13 +1953,9 @@ export default {
|
|||||||
const attachment = this.invoiceAttachment(row);
|
const attachment = this.invoiceAttachment(row);
|
||||||
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
|
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
|
||||||
if (isKingdeePathAttachment(attachment)) {
|
if (isKingdeePathAttachment(attachment)) {
|
||||||
if (this.kingdeeAttachmentBusy) return;
|
await this.withKingdeeAttachmentBusy(() =>
|
||||||
this.kingdeeAttachmentBusy = true;
|
downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
|
||||||
try {
|
);
|
||||||
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
|
|
||||||
} finally {
|
|
||||||
this.kingdeeAttachmentBusy = false;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = this.attachmentFileUrl(attachment);
|
const url = this.attachmentFileUrl(attachment);
|
||||||
@@ -1949,6 +1965,23 @@ export default {
|
|||||||
}
|
}
|
||||||
downloadFileByUrl(url, this.invoiceAttachmentName(row));
|
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) {
|
attachmentFileName(file) {
|
||||||
return String(file?.originalName || file?.name || file?.fileName || '').trim();
|
return String(file?.originalName || file?.name || file?.fileName || '').trim();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user