This commit is contained in:
linfso 2024-08-11 11:16:26 +08:00
parent aa267b2815
commit 36bc196756
4 changed files with 217 additions and 21 deletions

View File

@ -120,14 +120,23 @@
<el-table-column :label="$t('发票号')" align="center" prop="invoiceNo" width="100" :show-overflow-tooltip="true" />
<el-table-column :label="$t('发票文件')" align="center" prop="filePath" min-width="170" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button
<!-- <el-button
v-if="scope.row.openChStatus=='2'"
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleDownPDF(scope.row)"
>下载发票</el-button>
>下载发票</el-button> -->
<el-button
v-if="scope.row.invoiceStatus=='2'"
type="primary"
plain
icon="el-icon-document-copy"
size="mini"
@click="handleDownPDF(scope.row,$event)"
>复制发票地址</el-button>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('qr路径')" align="center" prop="qrPath" width="100" /> -->
@ -274,6 +283,42 @@ export default {
},
handleDownPDF(row) {
let downUrl=row.filePath;
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard 向剪贴板写文本
this.$modal.msgSuccess('复制成功')
return navigator.clipboard.writeText(downUrl)
} else {
// 创建text area
const textArea = document.createElement('textarea')
textArea.value = downUrl
// 使text area不在viewport,同时设置不可见
document.body.appendChild(textArea)
textArea.focus()
textArea.select()
this.$modal.msgSuccess('复制成功')
return new Promise((res, rej) => {
// 执行复制命令并移除文本框
document.execCommand('copy') ? res() : rej()
textArea.remove()
})
}
},
removeEndChar(str,char, type) {
if (char) {
if (type == 'left') {
return str.replace(new RegExp('^\\'+char+'+', 'g'), '');
} else if (type == 'right') {
return str.replace(new RegExp('\\'+char+'+$', 'g'), '');
}
return str.replace(new RegExp('^\\'+char+'+|\\'+char+'+$', 'g'), '');
}
return str.replace(/^\s+|\s+$/g, '');
},
handleDownPDFOld(row) {
let settleBillName=row.companyName;
let pdfUrl=row.filePath;
let fileName=settleBillName+"-"+row.invoiceNo+".pdf";

View File

@ -81,14 +81,22 @@
<el-table-column :label="$t('发票号')" align="center" prop="invoiceNo" width="100" :show-overflow-tooltip="true" />
<el-table-column :label="$t('发票文件')" align="center" prop="filePath" min-width="170" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button
<!-- <el-button
v-if="scope.row.openChStatus=='2'"
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleDownPDF(scope.row)"
>下载发票</el-button>
>下载发票</el-button> -->
<el-button
v-if="scope.row.invoiceStatus=='2'"
type="primary"
plain
icon="el-icon-document-copy"
size="mini"
@click="handleDownPDF(scope.row,$event)"
>复制发票地址</el-button>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('qr路径')" align="center" prop="qrPath" width="100" /> -->
@ -230,8 +238,44 @@ export default {
});
},
handleDownPDF(row) {
let downUrl=row.filePath;
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard 向剪贴板写文本
this.$modal.msgSuccess('复制成功')
return navigator.clipboard.writeText(downUrl)
} else {
// 创建text area
const textArea = document.createElement('textarea')
textArea.value = downUrl
// 使text area不在viewport,同时设置不可见
document.body.appendChild(textArea)
textArea.focus()
textArea.select()
this.$modal.msgSuccess('复制成功')
return new Promise((res, rej) => {
// 执行复制命令并移除文本框
document.execCommand('copy') ? res() : rej()
textArea.remove()
})
}
},
removeEndChar(str,char, type) {
if (char) {
if (type == 'left') {
return str.replace(new RegExp('^\\'+char+'+', 'g'), '');
} else if (type == 'right') {
return str.replace(new RegExp('\\'+char+'+$', 'g'), '');
}
return str.replace(new RegExp('^\\'+char+'+|\\'+char+'+$', 'g'), '');
}
return str.replace(/^\s+|\s+$/g, '');
},
handleDownPDFOld(row) {
let settleBillName=row.companyName;
let pdfUrl=row.filePath;
let fileName=settleBillName+"-"+row.invoiceNo+".pdf";

View File

@ -180,14 +180,22 @@
<el-table-column :label="$t('账单名称')" align="center" prop="settleBillName" min-width="100" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('发票文件')" align="center" prop="filePath" min-width="170" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button
<!-- <el-button
v-if="scope.row.invoiceStatus=='2'"
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleDownPDF(scope.row)"
>下载发票</el-button>
>下载发票</el-button> -->
<el-button
v-if="scope.row.invoiceStatus=='2'"
type="primary"
plain
icon="el-icon-document-copy"
size="mini"
@click="handleDownPDF(scope.row,$event)"
>复制发票地址</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('开票状态')" align="center" prop="invoiceStatus" width="100" >
@ -434,6 +442,57 @@ export default {
this.getList();
},
handleDownPDF(row) {
let qParam = {
pageNum:1,
pageSize:50,
applySeqNo: row.applySeqNo,
openChStatus:'2'
}
listEmisSettleInvoiceChRecord(qParam).then(response => {
let list = response.rows;
if(list&&list.length>0){
let downUrl="";
list.forEach(item=>{
downUrl=downUrl+item.filePath+",";
});
downUrl=this.removeEndChar(downUrl,',','');
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard 向剪贴板写文本
this.$modal.msgSuccess('复制成功')
return navigator.clipboard.writeText(downUrl)
} else {
// 创建text area
const textArea = document.createElement('textarea')
textArea.value = downUrl
// 使text area不在viewport,同时设置不可见
document.body.appendChild(textArea)
textArea.focus()
textArea.select()
this.$modal.msgSuccess('复制成功')
return new Promise((res, rej) => {
// 执行复制命令并移除文本框
document.execCommand('copy') ? res() : rej()
textArea.remove()
})
}
}
});
},
removeEndChar(str,char, type) {
if (char) {
if (type == 'left') {
return str.replace(new RegExp('^\\'+char+'+', 'g'), '');
} else if (type == 'right') {
return str.replace(new RegExp('\\'+char+'+$', 'g'), '');
}
return str.replace(new RegExp('^\\'+char+'+|\\'+char+'+$', 'g'), '');
}
return str.replace(/^\s+|\s+$/g, '');
},
handleDownPDFOld(row) {
let settleBillName=row.settleBillName;
let qParam = {

View File

@ -182,24 +182,17 @@
<el-table-column :label="$t('账单名称')" align="center" prop="settleBillName" min-width="100" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('发票文件')" align="center" prop="filePath" min-width="170" :show-overflow-tooltip="true">
<template slot-scope="scope">
<!-- <el-button
<el-button
v-if="scope.row.invoiceStatus=='2'"
type="primary"
plain
icon="el-icon-download"
icon="el-icon-document-copy"
size="mini"
@click="handleDownPDF(scope.row)"
>下载发票</el-button> -->
<el-link
v-if="scope.row.invoiceStatus=='2'"
type="primary" style="line-height: 28px;font-size:13px;color:blue" @click="handleDownPDF(scope.row)" >
下载发票
</el-link>
<el-link
v-if="scope.row.invoiceStatus=='2'"
type="primary" style="line-height: 28px;font-size:13px;color:blue" @click="handleDownPDF(scope.row)" >
复制发票地址
</el-link>
@click="handleDownPDF(scope.row,$event)"
>复制发票地址</el-button>
</template>
</el-table-column>
@ -284,6 +277,7 @@ import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisSettleInvoiceRecordForm from '@/views/emis/emisSettleInvoiceRecord/emisSettleInvoiceRecordForm';
import { listEmisSettleInvoiceChRecord } from "@/api/emis/emisSettleInvoiceChRecord";
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import clip from '@/utils/clipboard'
export default {
name: "emisSettleInvoiceRecord",
@ -439,7 +433,61 @@ export default {
this.openForm = true;
this.titleForm = "修改";
},
handleDownPDF(row) {
let qParam = {
pageNum:1,
pageSize:50,
applySeqNo: row.applySeqNo,
openChStatus:'2'
}
listEmisSettleInvoiceChRecord(qParam).then(response => {
let list = response.rows;
if(list&&list.length>0){
let downUrl="";
list.forEach(item=>{
// this.downPdfFile(item.filePath);
downUrl=downUrl+item.filePath+",";
});
downUrl=this.removeEndChar(downUrl,',','');
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard 向剪贴板写文本
this.$modal.msgSuccess('复制成功')
return navigator.clipboard.writeText(downUrl)
} else {
// 创建text area
const textArea = document.createElement('textarea')
textArea.value = downUrl
// 使text area不在viewport,同时设置不可见
document.body.appendChild(textArea)
textArea.focus()
textArea.select()
this.$modal.msgSuccess('复制成功')
return new Promise((res, rej) => {
// 执行复制命令并移除文本框
document.execCommand('copy') ? res() : rej()
textArea.remove()
})
}
}
});
},
removeEndChar(str,char, type) {
if (char) {
if (type == 'left') {
return str.replace(new RegExp('^\\'+char+'+', 'g'), '');
} else if (type == 'right') {
return str.replace(new RegExp('\\'+char+'+$', 'g'), '');
}
return str.replace(new RegExp('^\\'+char+'+|\\'+char+'+$', 'g'), '');
}
return str.replace(/^\s+|\s+$/g, '');
},
handleDownPDFOld(row) {
let settleBillName=row.settleBillName;