From 40e3ce44ade3b82e3fcdb03365b0f845b5a8c94b Mon Sep 17 00:00:00 2001 From: chenjianan Date: Fri, 4 Jan 2019 16:52:47 +0800 Subject: [PATCH] exportpdfshowstyle --- src/views/PurchasingCenter/OfflineContract/index.vue | 3 ++- src/views/PurchasingCenter/PurchaseContractSearch/index.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/PurchasingCenter/OfflineContract/index.vue b/src/views/PurchasingCenter/OfflineContract/index.vue index f5d29a13..14632376 100644 --- a/src/views/PurchasingCenter/OfflineContract/index.vue +++ b/src/views/PurchasingCenter/OfflineContract/index.vue @@ -969,11 +969,12 @@ export default { this.useqrcode(row.离线合同流水号) // 显示二维码 }).then(() => { const htmlNode = $('#offlineContract').html() - const body = $('body') + const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;') body.children().hide() const printNode = $(htmlNode) body.append(printNode) window.print() + body.removeAttr('style') body.children().not('script').show() body.children().not('#app').hide() printNode.remove() diff --git a/src/views/PurchasingCenter/PurchaseContractSearch/index.vue b/src/views/PurchasingCenter/PurchaseContractSearch/index.vue index d3f6f5f9..7fd4a266 100644 --- a/src/views/PurchasingCenter/PurchaseContractSearch/index.vue +++ b/src/views/PurchasingCenter/PurchaseContractSearch/index.vue @@ -249,11 +249,12 @@ export default { if (this.contractValue) { // exportExcelMethod('print', '采购合同', '采购合同sheet1') const htmlNode = $('#print').html() - const body = $('body') + const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;') body.children().hide() const printNode = $(htmlNode) body.append(printNode) window.print() + body.removeAttr('style') body.children().not('script').show() body.children().not('#app').hide() printNode.remove()