|
|
@@ -189,7 +189,16 @@
|
|
|
<el-button v-if="row.status===0" v-auth="'invoice.modify'" size="small" plain type="warning" @click="handleInvice(row)">开票</el-button>
|
|
|
<el-button v-if="row.status===0||row.status===3" v-auth="'invoice.modify'" size="small" plain type="danger" @click="handleCancelInvoice(row)">取消开票</el-button>
|
|
|
<el-button v-if="row.status===0||row.status===3" v-auth="'invoice.modify'" size="small" plain type="primary" @click="handleConfirmManual(row)">已手动开票</el-button>
|
|
|
- <el-button v-if="row.status===1" v-auth="'invoice.modify'" size="small" plain type="success" @click="previewInvoice(row)">下载</el-button>
|
|
|
+ <el-dropdown v-if="row.status===1" v-auth="'invoice.modify'" size="small" @command="(format: string) => downloadInvoice(row, format)">
|
|
|
+ <el-button size="small" plain type="success">下载</el-button>
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item command="invoiceUrl">PDF</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="ofdUrl">OFD</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="xmlUrl">XML</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
<el-button size="small" plain type="success" @click="handleInfo(row)">详情</el-button>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
@@ -366,20 +375,22 @@ const handleInfo = (row:any) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-const previewInvoice = (row: any) => {
|
|
|
+const downloadInvoice = (row: any, format: string) => {
|
|
|
$get(`/finance/downloadInvoice/${row.id}`).then((res: any) => {
|
|
|
- console.log(res)
|
|
|
- let {downloadUrl} = res;
|
|
|
- if (downloadUrl) {
|
|
|
- window.open(downloadUrl, "_blank")
|
|
|
-
|
|
|
- // doPriview(downloadUrl)
|
|
|
-
|
|
|
+ let url = res.data?.[format] || res[format];
|
|
|
+ if (url) {
|
|
|
+ window.open(url, "_blank");
|
|
|
+ } else {
|
|
|
+ Msg.error("下载地址不存在");
|
|
|
}
|
|
|
}).catch(e => {
|
|
|
console.error(e)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+const previewInvoice = (row: any) => {
|
|
|
+ downloadInvoice(row, 'invoiceUrl');
|
|
|
+}
|
|
|
/*
|
|
|
const doPriview=async (url:string) =>{
|
|
|
const canvas = pdfViewer.value;
|