jquery;导出pdf

This commit is contained in:
chenjianan
2018-12-19 11:47:33 +08:00
parent 2324522f30
commit 9315c7ec6c
2 changed files with 13 additions and 3 deletions

View File

@@ -142,7 +142,7 @@
<b>二维码</b><br>
<img id="img">
</div>
<div id="print" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<div id="print" class="print" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<el-card v-show="searchView">
<!--将新一般处理页添加至通讯服务器-->
<div>附件图</div>
@@ -155,7 +155,8 @@
import { initContract, initBuyer, searchTable1, searchTable2 } from '@/api/PurchasingCenter/PurchaseContractSearch'
import { searchFile } from '@/api/PurchasingCenter/CreateContract'
import QRCode from 'qrcode'
import { exportExcelMethod } from './exportExcel'
import $ from 'jquery'
// import { exportExcelMethod } from './exportExcel'
export default {
data() {
@@ -213,7 +214,15 @@ export default {
methods: {
download() {
if (this.contractValue) {
exportExcelMethod('print', '采购合同', '采购合同sheet1')
// exportExcelMethod('print', '采购合同', '采购合同sheet1')
const htmlNode = $('#print').html()
const body = $('body')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.children().show()
printNode.remove()
} else {
this.$message.error('请选择合同')
}