This commit is contained in:
linfso 2024-08-18 10:38:31 +08:00
parent 0a9d0b6a62
commit b270022893
5 changed files with 58 additions and 92 deletions

View File

@ -38,6 +38,8 @@
<!-- <el-button title="" type="primary" v-else @click="showA4Page(1)">切换A4</el-button> --> <!-- <el-button title="" type="primary" v-else @click="showA4Page(1)">切换A4</el-button> -->
<el-button title="" type="primary" icon="el-icon-download" size="mini" style="padding: 5px 10px;" @click="downPDF">下载</el-button> <el-button title="" type="primary" icon="el-icon-download" size="mini" style="padding: 5px 10px;" @click="downPDF">下载</el-button>
<el-button title="" type="primary" icon="el-icon-printer" size="mini" style="padding: 5px 10px;" @click="printPDF">打印</el-button> <el-button title="" type="primary" icon="el-icon-printer" size="mini" style="padding: 5px 10px;" @click="printPDF">打印</el-button>
<el-button title="" type="primary" size="mini" style="padding: 5px 10px;" @click="copyImage">复制图片</el-button>
<!-- <el-button title="" type="primary" size="mini" style="padding: 5px 10px;" @click="closeDialog">关闭</el-button> --> <!-- <el-button title="" type="primary" size="mini" style="padding: 5px 10px;" @click="closeDialog">关闭</el-button> -->
</div> </div>
@ -46,7 +48,7 @@
<div style="min-height:700px;margin: 0 auto;overflow: auto;"> <div style="min-height:700px;margin: 0 auto;overflow: auto;">
<!-- <el-scrollbar> <!-- <el-scrollbar>
<div style="min-height:600px;margin: 0 auto;overflow: auto;"> --> <div style="min-height:600px;margin: 0 auto;overflow: auto;"> -->
<div class="pdf-wrapper"> <div ref="XdPdfWrapper" class="pdf-wrapper">
<pdf <pdf
:src="currentPdfUrl" :src="currentPdfUrl"
:page="page" :page="page"
@ -65,11 +67,9 @@
import printJS from 'print-js' import printJS from 'print-js'
// npm i pdfjs-dist@2.5.207 // npm i pdfjs-dist@2.5.207
// npm i vue-pdf@4.2.0
// import pdf from 'xd-vue-pdf'
// import pdf from 'xd-vue-pdf'
import pdf from "./xdpdf/vuePdfNoSss.vue" import pdf from "./xdpdf/vuePdfNoSss.vue"
import PdfUtils from '@/utils/pdfUtils.js'; import PdfUtils from '@/utils/pdfUtils.js';
export default { export default {
components: { pdf }, components: { pdf },
props: { props: {
@ -117,29 +117,33 @@ export default {
currentPdfUrl() { currentPdfUrl() {
if (!this.loadPdfUrl) return '' if (!this.loadPdfUrl) return ''
console.log("====>currentPdfUrl==>",this.loadPdfUrl) // console.log("====>currentPdfUrl==>",this.loadPdfUrl)
const publicPath ='/static/' const publicPath ='/static/'
// return pdf.createLoadingTask({
// url: this.loadPdfUrl,
// cMapUrl: `${publicPath}cmaps/`,
// cMapPacked: true
// })
return pdf.createLoadingTask({ return pdf.createLoadingTask({
url: this.loadPdfUrl url: this.loadPdfUrl,
cMapUrl: `${publicPath}cmaps/`,
cMapPacked: true
}) })
// return pdf.createLoadingTask({
// url: this.loadPdfUrl
// })
} }
}, },
watch: { watch: {
pdfList(){ "pdfList": {
handler (newValue, oldValue) {
console.log("===>watch pdfList==>",this.pdfList);
// 按照给定的数据排序 // 按照给定的数据排序
this.cacheFileList=this.pdfList; this.cacheFileList=this.pdfList;
this.initA4List(); this.initA4List();
this.showFirstFile(); this.showFirstFile();
}, },
deep: true
},
thisPageCount(value) { thisPageCount(value) {
console.log("===>thisPageCount==>",value); // console.log("===>thisPageCount==>",value);
if(this.isA4){ if(this.isA4){
this.doScale(75); this.doScale(75);
@ -147,32 +151,30 @@ export default {
this.doScale(25); this.doScale(25);
} }
}, },
// isLoadComplete(newVal,oldVal){
// console.log("===isLoadComplete=>this.cacheFileList==>",isLoadComplete,this.cacheFileList)
// if(this.isA4){
// this.showA4Page(1);
// }else{
// let newTmpList = this.cacheFileList.sort((one, two) => {
// return one.seqNo - two.seqNo;
// });
// this.cacheFileList=newTmpList;
// this.showFirstFile(1);
// // this.showSinglePage(1);
// }
// }
}, },
mounted() { mounted() {
this.initA4List(); this.initA4List();
this.showFirstFile(); this.showFirstFile();
window.addEventListener('mousewheel', this.handleScroll, { passive: false }) window.addEventListener('mousewheel', this.handleScroll, { passive: false })
}, },
methods: { methods: {
closeDialog(){ closeDialog(){
this.$emit("close"); this.$emit("close");
}, },
async copyImage() {
const canvas=this.$refs.pdf.$refs.canvas;
let dataURL = canvas.toDataURL({ pixelRatio: 1 });
const data = await fetch(dataURL);
const blob = await data.blob();
let ClipboardItem = window.ClipboardItem;
await navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob,
}),
]);
this.$modal.msgSuccess('复制成功')
},
initA4List(){ initA4List(){
this.cacheA4FileList=[]; this.cacheA4FileList=[];
const newList = Object.assign([], this.pdfList); const newList = Object.assign([], this.pdfList);
@ -482,7 +484,7 @@ export default {
height: 200px; height: 200px;
// background-image: radial-gradient(circle, rgb(165, 165, 165) 1px, #fff 1px); // background-image: radial-gradient(circle, rgb(165, 165, 165) 1px, #fff 1px);
background-image: radial-gradient(circle, #9b9b9b 1px, #f0f0f0 1px); background-image: radial-gradient(circle, #9b9b9b 1px, #f0f0f0 1px);
background-size: 30px 30px; background-size: 50px 50px;
background-position: center center; background-position: center center;
} }

View File

@ -10,14 +10,17 @@ export default function(pdfjsWrapper) {
render: function(h) { render: function(h) {
return h('span', { return h('span', {
attrs: { attrs: {
style: 'position: relative; display: block' style: 'position: relative; display: block;'
} }
}, [ }, [
h('canvas', { h('canvas', {
attrs: { attrs: {
style: 'display: inline-block; width: 100%; height: 100%; vertical-align: top', style: 'display: inline-block; width: 100%; height: 100%; vertical-align: top;-webkit-box-shadow:0 15px 15px rgb(0 0 0 / 37%);box-shadow: 0 15px 15px rgb(0 0 0 / 37%);',
}, },
ref:'canvas' ref:'canvas',
on:{
click:this.handleClick,
}
}), }),
h('span', { h('span', {
style: 'display: inline-block; width: 100%; height: 100%', style: 'display: inline-block; width: 100%; height: 100%',
@ -61,6 +64,9 @@ export default function(pdfjsWrapper) {
}, },
}, },
methods: { methods: {
handleClick:function() {
console.log("==pdf=handleClick=>");
},
resize: function(size) { resize: function(size) {
// check if the element is attached to the dom tree || resizeSensor being destroyed // check if the element is attached to the dom tree || resizeSensor being destroyed

View File

@ -84,10 +84,16 @@ export default function(PDFJS) {
// 1in == 72pt // 1in == 72pt
// 1in == 96px // 1in == 96px
// var PRINT_RESOLUTION = dpi === undefined ? 300 : dpi;
// var PRINT_UNITS = PRINT_RESOLUTION / 72.0;
// var CSS_UNITS = 96.0 / 72.0;
var PRINT_RESOLUTION = dpi === undefined ? 300 : dpi; var PRINT_RESOLUTION = dpi === undefined ? 300 : dpi;
var PRINT_UNITS = PRINT_RESOLUTION / 72.0; var PRINT_UNITS = PRINT_RESOLUTION / 72.0;
var CSS_UNITS = 96.0 / 72.0; var CSS_UNITS = 96.0 / 72.0;
console.log("==>printPage==>PRINT_RESOLUTION=",PRINT_RESOLUTION)
var printContainerElement = document.createElement('div'); var printContainerElement = document.createElement('div');
printContainerElement.setAttribute('id', 'print-container') printContainerElement.setAttribute('id', 'print-container')

View File

@ -21,8 +21,8 @@ class TanexPrinterSdk {
VERSION="1.0.0" VERSION="1.0.0"
MAX_SENT_RETRY_COUNT = 9; MAX_SENT_RETRY_COUNT = 9;
WS_URL = 'ws://'+process.env.VUE_APP_PRINTER_HOST+'/ws'; // WS_URL = 'ws://'+process.env.VUE_APP_PRINTER_HOST+'/ws';
// WS_URL = "ws://192.168.88.189:17080/ws"; WS_URL = "ws://192.168.88.189:17080/ws";
HTTP_GET_PDF = 'http://'+process.env.VUE_APP_PRINTER_HOST+'/api/downPdfFile'; HTTP_GET_PDF = 'http://'+process.env.VUE_APP_PRINTER_HOST+'/api/downPdfFile';

View File

@ -76,23 +76,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="" prop="invoiceNo">
<el-input
v-model="queryParams.invoiceNo"
:placeholder="$t('发票号')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<!-- <el-form-item label="" prop="blAudit">
<el-input
v-model="queryParams.blAudit"
:placeholder="$t('审核状态')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
</SearchForm> </SearchForm>
@ -102,7 +86,7 @@
:height="(slotProps.contentHeight)+'px'" :height="(slotProps.contentHeight)+'px'"
v-loading="loading" v-loading="loading"
border stripe border
size="mini" size="mini"
storageName="emisSettleInvoiceRecordList_deal_main" storageName="emisSettleInvoiceRecordList_deal_main"
@ -139,29 +123,6 @@
v-hasPermi="['emis:emisSettleInvoiceRecord:refuse']" v-hasPermi="['emis:emisSettleInvoiceRecord:refuse']"
>开票拒绝</el-button> >开票拒绝</el-button>
</el-col> </el-col>
<!--
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['emis:emisSettleInvoiceRecord:edit']"
>修改</el-button>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['emis:emisSettleInvoiceRecord:remove']"
>删除</el-button>
</el-col> -->
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -180,14 +141,6 @@
<el-table-column :label="$t('账单名称')" align="center" prop="settleBillName" min-width="100" :show-overflow-tooltip="true"/> <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"> <el-table-column :label="$t('发票文件')" align="center" prop="filePath" min-width="170" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <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'" v-if="scope.row.invoiceStatus=='2'"
type="primary" type="primary"
@ -268,7 +221,6 @@
<script> <script>
import { auditCenterNoPass,listEmisSettleInvoiceRecord, getEmisSettleInvoiceRecord, delEmisSettleInvoiceRecord, addEmisSettleInvoiceRecord, updateEmisSettleInvoiceRecord } from "@/api/emis/emisSettleInvoiceRecord"; import { auditCenterNoPass,listEmisSettleInvoiceRecord, getEmisSettleInvoiceRecord, delEmisSettleInvoiceRecord, addEmisSettleInvoiceRecord, updateEmisSettleInvoiceRecord } from "@/api/emis/emisSettleInvoiceRecord";
// import emisSettleInvoiceRecordView from '@/views/emis/emisSettleInvoiceRecord/emisSettleInvoiceRecordView';
import OpenBillForm from '@/views/emis/emisSettleInvoiceRecord/OpenBillForm'; import OpenBillForm from '@/views/emis/emisSettleInvoiceRecord/OpenBillForm';
import { listEmisSettleInvoiceChRecord } from "@/api/emis/emisSettleInvoiceChRecord"; import { listEmisSettleInvoiceChRecord } from "@/api/emis/emisSettleInvoiceChRecord";
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker'; import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';