fix: 发票信息查看下载优先走金蝶票池版式文件
This commit is contained in:
@@ -745,14 +745,12 @@ import {
|
||||
} from '@/api/vehicle/customer-archive';
|
||||
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
|
||||
import { formatContractOptionLabel } from '@/utils/contract';
|
||||
import { downloadFileByUrl } from '@/utils/util';
|
||||
import { downloadFile, downloadFileByUrl } from '@/utils/util';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import {
|
||||
downloadKingdeeFile,
|
||||
downloadKingdeeInvoiceFile,
|
||||
isKingdeePathAttachment,
|
||||
requestKingdeeFile,
|
||||
viewKingdeeFile,
|
||||
viewKingdeeInvoiceFile,
|
||||
} from '@/utils/kingdee-attachment';
|
||||
import PdfPreview from '@/components/pdf-preview/main.vue';
|
||||
|
||||
@@ -1913,9 +1911,6 @@ export default {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
invoiceAttachmentUrl(row) {
|
||||
return this.attachmentFileUrl(this.invoiceAttachment(row));
|
||||
},
|
||||
invoiceAttachmentName(row) {
|
||||
return (
|
||||
this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf`
|
||||
@@ -1932,38 +1927,47 @@ export default {
|
||||
}
|
||||
},
|
||||
async viewInvoiceAttachment(row) {
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件
|
||||
if (isKingdeePathAttachment(attachment)) {
|
||||
await this.withKingdeeAttachmentBusy(() =>
|
||||
viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
|
||||
await this.withKingdeeAttachmentBusy(async () => {
|
||||
// 发票版式文件按票号走金蝶票池(A801-2 镜像优先/实时回源),登记扫描件仅在票池无此票时兜底
|
||||
try {
|
||||
const blob = await requestKingdeeFile(row.invoiceNo);
|
||||
const url = URL.createObjectURL(blob);
|
||||
window.open(url, '_blank');
|
||||
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||
return;
|
||||
} catch (error) {
|
||||
// 网络级失败(silent,拦截器已提示)不再回退;票池无此票回退登记附件
|
||||
if (error?.silent) return;
|
||||
}
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
if (!this.attachmentFileUrl(attachment)) {
|
||||
this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
|
||||
return;
|
||||
}
|
||||
this.previewAttachment(
|
||||
{ ...attachment, name: this.invoiceAttachmentName(row) },
|
||||
[attachment]
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!this.attachmentFileUrl(attachment)) {
|
||||
this.$message.warning('当前发票暂无可查看附件');
|
||||
return;
|
||||
}
|
||||
this.previewAttachment(
|
||||
{ ...attachment, name: this.invoiceAttachmentName(row) },
|
||||
[attachment]
|
||||
);
|
||||
});
|
||||
},
|
||||
async downloadInvoiceAttachment(row) {
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
|
||||
if (isKingdeePathAttachment(attachment)) {
|
||||
await this.withKingdeeAttachmentBusy(() =>
|
||||
downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row))
|
||||
);
|
||||
return;
|
||||
}
|
||||
const url = this.attachmentFileUrl(attachment);
|
||||
if (!url) {
|
||||
this.$message.warning('当前发票暂无可下载附件');
|
||||
return;
|
||||
}
|
||||
downloadFileByUrl(url, this.invoiceAttachmentName(row));
|
||||
await this.withKingdeeAttachmentBusy(async () => {
|
||||
try {
|
||||
const blob = await requestKingdeeFile(row.invoiceNo);
|
||||
downloadFile(blob, this.invoiceAttachmentName(row));
|
||||
return;
|
||||
} catch (error) {
|
||||
if (error?.silent) return;
|
||||
}
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
const url = this.attachmentFileUrl(attachment);
|
||||
if (!url) {
|
||||
this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
|
||||
return;
|
||||
}
|
||||
downloadFileByUrl(url, this.invoiceAttachmentName(row));
|
||||
});
|
||||
},
|
||||
/** 付款记录付款凭证(金蝶电子回单,A801-2 代理):查看=新窗口预览,下载=保存文件 */
|
||||
viewRecordVoucher(row) {
|
||||
|
||||
@@ -1133,12 +1133,8 @@ import {
|
||||
settlementRecordTypeName,
|
||||
settlementStatusName,
|
||||
} from '@/utils/settlementStatus';
|
||||
import { downloadFileByUrl } from '@/utils/util';
|
||||
import {
|
||||
downloadKingdeeInvoiceFile,
|
||||
isKingdeePathAttachment,
|
||||
viewKingdeeInvoiceFile,
|
||||
} from '@/utils/kingdee-attachment';
|
||||
import { downloadFile, downloadFileByUrl } from '@/utils/util';
|
||||
import { requestKingdeeFile } from '@/utils/kingdee-attachment';
|
||||
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
|
||||
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
|
||||
import ProjectAdvanceWriteOff from './project-advance-write-off.vue';
|
||||
@@ -2918,38 +2914,45 @@ export default {
|
||||
return attachment.originalName || attachment.name || `${row.invoiceNo || '发票'}.pdf`;
|
||||
},
|
||||
async viewInvoiceAttachment(row) {
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持 window.open
|
||||
if (isKingdeePathAttachment(attachment)) {
|
||||
if (this.kingdeeAttachmentBusy) return;
|
||||
this.kingdeeAttachmentBusy = true;
|
||||
if (this.kingdeeAttachmentBusy) return;
|
||||
this.kingdeeAttachmentBusy = true;
|
||||
try {
|
||||
// 发票版式文件按票号走金蝶票池(A801-2 镜像优先/实时回源),登记扫描件仅在票池无此票时兜底
|
||||
try {
|
||||
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
|
||||
} finally {
|
||||
this.kingdeeAttachmentBusy = false;
|
||||
const blob = await requestKingdeeFile(row.invoiceNo);
|
||||
const url = URL.createObjectURL(blob);
|
||||
window.open(url, '_blank');
|
||||
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||
return;
|
||||
} catch (error) {
|
||||
// 网络级失败(silent,拦截器已提示)不再回退;票池无此票回退登记附件
|
||||
if (error?.silent) return;
|
||||
}
|
||||
return;
|
||||
const url = this.invoiceAttachmentUrl(row);
|
||||
if (!url) return this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
|
||||
window.open(url, '_blank');
|
||||
} finally {
|
||||
this.kingdeeAttachmentBusy = false;
|
||||
}
|
||||
const url = this.invoiceAttachmentUrl(row);
|
||||
if (!url) return this.$message.warning('当前发票暂无可查看附件');
|
||||
window.open(url, '_blank');
|
||||
},
|
||||
async downloadInvoiceAttachment(row) {
|
||||
const attachment = this.invoiceAttachment(row);
|
||||
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
|
||||
if (isKingdeePathAttachment(attachment)) {
|
||||
if (this.kingdeeAttachmentBusy) return;
|
||||
this.kingdeeAttachmentBusy = true;
|
||||
if (this.kingdeeAttachmentBusy) return;
|
||||
this.kingdeeAttachmentBusy = true;
|
||||
try {
|
||||
try {
|
||||
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
|
||||
} finally {
|
||||
this.kingdeeAttachmentBusy = false;
|
||||
const blob = await requestKingdeeFile(row.invoiceNo);
|
||||
downloadFile(blob, this.invoiceAttachmentName(row));
|
||||
return;
|
||||
} catch (error) {
|
||||
if (error?.silent) return;
|
||||
}
|
||||
return;
|
||||
const url = this.invoiceAttachmentUrl(row);
|
||||
if (!url) return this.$message.warning('当前发票没有金蝶版式文件,也没有登记附件');
|
||||
downloadFileByUrl(url, this.invoiceAttachmentName(row));
|
||||
} finally {
|
||||
this.kingdeeAttachmentBusy = false;
|
||||
}
|
||||
const url = this.invoiceAttachmentUrl(row);
|
||||
if (!url) return this.$message.warning('当前发票暂无可下载附件');
|
||||
downloadFileByUrl(url, this.invoiceAttachmentName(row));
|
||||
},
|
||||
// 开票发票预览地址:数电PDF优先(OFD浏览器无法预览),退预览图、板式文件
|
||||
issuedInvoicePreviewUrl(row) {
|
||||
|
||||
Reference in New Issue
Block a user