md
This commit is contained in:
parent
c451f92772
commit
347d13c488
@ -1,13 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "xd-vue-pdf",
|
"name": "xd-vue-pdf",
|
||||||
"version": "1.0.1",
|
"version": "3.0.0",
|
||||||
"description": "vue.js pdf viewer",
|
"description": "vue.js pdf viewer",
|
||||||
"main": "src/vuePdfNoSss.vue",
|
"main": "src/vuePdfNoSss.vue",
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/FranckFreiburger/vue-pdf.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"vue.js",
|
"vue.js",
|
||||||
"pdf",
|
"pdf",
|
||||||
@ -15,16 +11,12 @@
|
|||||||
],
|
],
|
||||||
"author": "Franck FREIBURGER",
|
"author": "Franck FREIBURGER",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/FranckFreiburger/vue-pdf/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/FranckFreiburger/vue-pdf#readme",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||||
"loader-utils": "^1.4.0",
|
"loader-utils": "^1.4.0",
|
||||||
"raw-loader": "^4.0.1",
|
"raw-loader": "^4.0.1",
|
||||||
"worker-loader": "^2.0.0",
|
"worker-loader": "^2.0.0",
|
||||||
"pdfjs-dist": "^2.5.207",
|
"pdfjs-dist-sign": "^2.5.208",
|
||||||
"vue-resize-sensor": "^2.0.0"
|
"vue-resize-sensor": "^2.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {}
|
"peerDependencies": {}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { CMapCompressionType } from 'pdfjs-dist/es5/build/pdf.js'
|
import { CMapCompressionType } from 'pdfjs-dist-sign/es5/build/pdf.js'
|
||||||
|
|
||||||
// see https://github.com/mozilla/pdf.js/blob/628e70fbb5dea3b9066aa5c34cca70aaafef8db2/src/display/dom_utils.js#L64
|
// see https://github.com/mozilla/pdf.js/blob/628e70fbb5dea3b9066aa5c34cca70aaafef8db2/src/display/dom_utils.js#L64
|
||||||
|
|
||||||
@ -6,16 +6,13 @@ export default function() {
|
|||||||
|
|
||||||
this.fetch = function(query) {
|
this.fetch = function(query) {
|
||||||
|
|
||||||
return import('./buffer-loader!pdfjs-dist/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
|
return import('./buffer-loader!pdfjs-dist-sign/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
|
||||||
.then(function(bcmap) {
|
.then(function(bcmap) {
|
||||||
|
|
||||||
delete require.cache[require.resolve('./buffer-loader!pdfjs-dist-sign/cmaps/'+query.name+'.bcmap')];
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cMapData: bcmap.default,
|
cMapData: bcmap.default,
|
||||||
compressionType: CMapCompressionType.BINARY,
|
compressionType: CMapCompressionType.BINARY,
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { PDFLinkService } from 'pdfjs-dist/es5/web/pdf_viewer';
|
import { PDFLinkService } from 'pdfjs-dist-sign/es5/web/pdf_viewer';
|
||||||
|
|
||||||
var pendingOperation = Promise.resolve();
|
var pendingOperation = Promise.resolve();
|
||||||
|
|
||||||
@ -26,9 +26,6 @@ export default function(PDFJS) {
|
|||||||
// source.pdfBug = true;
|
// source.pdfBug = true;
|
||||||
// source.stopAtErrors = true;
|
// source.stopAtErrors = true;
|
||||||
|
|
||||||
if ( options && options.withCredentials )
|
|
||||||
source.withCredentials = options.withCredentials;
|
|
||||||
|
|
||||||
var loadingTask = PDFJS.getDocument(source);
|
var loadingTask = PDFJS.getDocument(source);
|
||||||
loadingTask.__PDFDocumentLoadingTask = true; // since PDFDocumentLoadingTask is not public
|
loadingTask.__PDFDocumentLoadingTask = true; // since PDFDocumentLoadingTask is not public
|
||||||
|
|
||||||
@ -84,29 +81,31 @@ export default function(PDFJS) {
|
|||||||
|
|
||||||
// 1in == 72pt
|
// 1in == 72pt
|
||||||
// 1in == 96px
|
// 1in == 96px
|
||||||
var PRINT_RESOLUTION = dpi === undefined ? 300 : dpi;
|
var PRINT_RESOLUTION = dpi === undefined ? 150 : 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;
|
||||||
|
|
||||||
var printContainerElement = document.createElement('div');
|
var iframeElt = document.createElement('iframe');
|
||||||
printContainerElement.setAttribute('id', 'print-container')
|
|
||||||
|
|
||||||
|
function removeIframe() {
|
||||||
|
|
||||||
function removePrintContainer() {
|
iframeElt.parentNode.removeChild(iframeElt);
|
||||||
printContainerElement.parentNode.removeChild(printContainerElement);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new Promise(function(resolve, reject) {
|
new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
printContainerElement.frameBorder = '0';
|
iframeElt.frameBorder = '0';
|
||||||
printContainerElement.scrolling = 'no';
|
iframeElt.scrolling = 'no';
|
||||||
printContainerElement.width = '0px;'
|
iframeElt.width = '0px;'
|
||||||
printContainerElement.height = '0px;'
|
iframeElt.height = '0px;'
|
||||||
printContainerElement.style.cssText = 'position: absolute; top: 0; left: 0';
|
iframeElt.style.cssText = 'position: absolute; top: 0; left: 0';
|
||||||
|
|
||||||
window.document.body.appendChild(printContainerElement);
|
iframeElt.onload = function() {
|
||||||
resolve(window)
|
|
||||||
|
resolve(this.contentWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.document.body.appendChild(iframeElt);
|
||||||
})
|
})
|
||||||
.then(function(win) {
|
.then(function(win) {
|
||||||
|
|
||||||
@ -116,21 +115,21 @@ export default function(PDFJS) {
|
|||||||
.then(function(page) {
|
.then(function(page) {
|
||||||
|
|
||||||
var viewport = page.getViewport({ scale: 1 });
|
var viewport = page.getViewport({ scale: 1 });
|
||||||
printContainerElement.appendChild(win.document.createElement('style')).textContent =
|
win.document.head.appendChild(win.document.createElement('style')).textContent =
|
||||||
'@supports ((size:A4) and (size:1pt 1pt)) {' +
|
'@supports ((size:A4) and (size:1pt 1pt)) {' +
|
||||||
'@page { margin: 1pt; size: ' + ((viewport.width * PRINT_UNITS) / CSS_UNITS) + 'pt ' + ((viewport.height * PRINT_UNITS) / CSS_UNITS) + 'pt; }' +
|
'@page { margin: 1pt; size: ' + ((viewport.width * PRINT_UNITS) / CSS_UNITS) + 'pt ' + ((viewport.height * PRINT_UNITS) / CSS_UNITS) + 'pt; }' +
|
||||||
'}' +
|
'}' +
|
||||||
'#print-canvas { display: none }' +
|
|
||||||
'@media print {' +
|
'@media print {' +
|
||||||
'body { margin: 0 }' +
|
'body { margin: 0 }' +
|
||||||
'#print-canvas { page-break-before: avoid; page-break-after: always; page-break-inside: avoid; display: block }' +
|
'canvas { page-break-before: avoid; page-break-after: always; page-break-inside: avoid }' +
|
||||||
'body > *:not(#print-container) { display: none; }' +
|
|
||||||
'}'+
|
'}'+
|
||||||
|
|
||||||
'@media screen {' +
|
'@media screen {' +
|
||||||
'body { margin: 0 }' +
|
'body { margin: 0 }' +
|
||||||
|
'}'+
|
||||||
|
|
||||||
'}'
|
''
|
||||||
return win;
|
return win;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -149,8 +148,7 @@ export default function(PDFJS) {
|
|||||||
|
|
||||||
var viewport = page.getViewport({ scale: 1 });
|
var viewport = page.getViewport({ scale: 1 });
|
||||||
|
|
||||||
var printCanvasElt = printContainerElement.appendChild(win.document.createElement('canvas'));
|
var printCanvasElt = win.document.body.appendChild(win.document.createElement('canvas'));
|
||||||
printCanvasElt.setAttribute('id', 'print-canvas')
|
|
||||||
printCanvasElt.width = (viewport.width * PRINT_UNITS);
|
printCanvasElt.width = (viewport.width * PRINT_UNITS);
|
||||||
printCanvasElt.height = (viewport.height * PRINT_UNITS);
|
printCanvasElt.height = (viewport.height * PRINT_UNITS);
|
||||||
|
|
||||||
@ -176,10 +174,11 @@ export default function(PDFJS) {
|
|||||||
} else {
|
} else {
|
||||||
win.print();
|
win.print();
|
||||||
}
|
}
|
||||||
removePrintContainer();
|
removeIframe();
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
removePrintContainer();
|
|
||||||
|
removeIframe();
|
||||||
emitEvent('error', err);
|
emitEvent('error', err);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,11 +6,11 @@
|
|||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
if ( process.env.VUE_ENV !== 'server' ) {
|
||||||
|
|
||||||
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
||||||
var PDFJS = require('pdfjs-dist/es5/build/pdf.js');
|
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
||||||
|
|
||||||
if ( typeof window !== 'undefined' && 'Worker' in window && navigator.appVersion.indexOf('MSIE 10') === -1 ) {
|
if ( typeof window !== 'undefined' && 'Worker' in window && navigator.appVersion.indexOf('MSIE 10') === -1 ) {
|
||||||
|
|
||||||
var PdfjsWorker = require('worker-loader!pdfjs-dist/es5/build/pdf.worker.js');
|
var PdfjsWorker = require('worker-loader!pdfjs-dist-sign/es5/build/pdf.worker.js');
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
if ( process.env.VUE_ENV !== 'server' ) {
|
||||||
|
|
||||||
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
||||||
var PDFJS = require('pdfjs-dist/es5/build/pdf.js');
|
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
||||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
var component = componentFactory(pdfjsWrapper(PDFJS));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,13 @@
|
|||||||
import componentFactory from './componentFactory'
|
import componentFactory from './componentFactory'
|
||||||
import pdfjsWrapper from './pdfjsWrapper'
|
import pdfjsWrapper from './pdfjsWrapper'
|
||||||
|
|
||||||
var PDFJS = require('pdfjs-dist/es5/build/pdf.js');
|
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
||||||
|
|
||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
if ( process.env.VUE_ENV !== 'server' ) {
|
||||||
|
|
||||||
if ( typeof window !== 'undefined' && 'Worker' in window ) {
|
if ( typeof window !== 'undefined' && 'Worker' in window ) {
|
||||||
|
|
||||||
var PdfjsWorker = require('worker-loader!pdfjs-dist/es5/build/pdf.worker.js');
|
var PdfjsWorker = require('worker-loader!pdfjs-dist-sign/es5/build/pdf.worker.js');
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<pdf
|
<pdf
|
||||||
v-for="i in numPages"
|
v-for="i in numPages"
|
||||||
:key="i"
|
:key="i"
|
||||||
:src="src"
|
:src="currentPdfUrl"
|
||||||
:page="i"
|
:page="i"
|
||||||
></pdf>
|
></pdf>
|
||||||
</div>
|
</div>
|
||||||
@ -27,11 +27,22 @@
|
|||||||
numPages: undefined,
|
numPages: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
currentPdfUrl() {
|
||||||
|
if (!this.pdfSrc) return ''
|
||||||
|
console.log("====>pdfSrc==>",this.pdfSrc)
|
||||||
|
return pdf.createLoadingTask({
|
||||||
|
url: this.pdfSrc
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadPDF(this.pdfSrc)
|
this.loadPDF(this.pdfSrc)
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
loadPDF(url){
|
loadPDF(url){
|
||||||
|
if (!url) return ''
|
||||||
|
|
||||||
this.src=pdf.createLoadingTask(url)
|
this.src=pdf.createLoadingTask(url)
|
||||||
this.src.promise.then(pdf => {
|
this.src.promise.then(pdf => {
|
||||||
this.numPages = pdf.numPages;//获取pdf页数
|
this.numPages = pdf.numPages;//获取pdf页数
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
:min="0"
|
:min="0"
|
||||||
:max="pageCount"
|
:max="pageCount"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@keyup.enter.native="gotoPage(currentPage)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="page-count">/ {{ pageCount }}</div>
|
<div class="page-count">/ {{ pageCount }}</div>
|
||||||
@ -61,7 +62,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
|
// npm i vue-pdf@4.2.0
|
||||||
import pdf from 'xd-vue-pdf'
|
// import pdf from 'xd-vue-pdf'
|
||||||
|
// import pdf from 'xd-vue-pdf'
|
||||||
|
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 },
|
||||||
@ -76,10 +79,6 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
isLoadComplete:{
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -113,11 +112,16 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
currentPdfUrl() {
|
currentPdfUrl() {
|
||||||
if (!this.loadPdfUrl) return ''
|
if (!this.loadPdfUrl) return ''
|
||||||
|
|
||||||
|
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
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -131,19 +135,28 @@ export default {
|
|||||||
this.showFirstFile();
|
this.showFirstFile();
|
||||||
},
|
},
|
||||||
thisPageCount(value) {
|
thisPageCount(value) {
|
||||||
|
console.log("===>thisPageCount==>",value);
|
||||||
|
|
||||||
if(this.isA4){
|
if(this.isA4){
|
||||||
this.doScale(75);
|
this.doScale(75);
|
||||||
}else{
|
}else{
|
||||||
this.doScale(25);
|
this.doScale(25);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isLoadComplete(newVal,oldVal){
|
// isLoadComplete(newVal,oldVal){
|
||||||
if(this.isA4){
|
// console.log("===isLoadComplete=>this.cacheFileList==>",isLoadComplete,this.cacheFileList)
|
||||||
this.showA4Page(1);
|
|
||||||
}else{
|
// if(this.isA4){
|
||||||
this.showSinglePage(1);
|
// 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();
|
||||||
@ -184,7 +197,7 @@ export default {
|
|||||||
this.cacheA4FileList.push(fileItem);
|
this.cacheA4FileList.push(fileItem);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showFirstFile(){
|
showFirstFile(page){
|
||||||
if(this.isA4){
|
if(this.isA4){
|
||||||
this.scale=75;
|
this.scale=75;
|
||||||
this.preScale=75;
|
this.preScale=75;
|
||||||
@ -194,7 +207,11 @@ export default {
|
|||||||
this.scale=25;
|
this.scale=25;
|
||||||
this.preScale=25;
|
this.preScale=25;
|
||||||
this.pageCount=this.cacheFileList.length;
|
this.pageCount=this.cacheFileList.length;
|
||||||
setTimeout( this.showSinglePage(1),2000);
|
setTimeout(
|
||||||
|
// this.showSinglePage(page?page:this.pageCount)
|
||||||
|
// this.gotoPage(page?page:this.pageCount)
|
||||||
|
this.gotoPage(1)
|
||||||
|
,2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resetCountKey++;
|
this.resetCountKey++;
|
||||||
@ -217,14 +234,15 @@ export default {
|
|||||||
|
|
||||||
onPageLoaded(currentPage){
|
onPageLoaded(currentPage){
|
||||||
|
|
||||||
|
console.log("====>onPageLoaded===>",currentPage)
|
||||||
|
|
||||||
if(this.isA4){
|
if(this.isA4){
|
||||||
// this.page = 1;
|
// this.page = 1;
|
||||||
// this.doScale(75);
|
this.doScale(75);
|
||||||
}else{
|
}else{
|
||||||
// this.currentPage=1;
|
// this.currentPage=1;
|
||||||
// this.page = 1;
|
// this.page = 1;
|
||||||
// this.doScale(20);
|
this.doScale(20);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -258,6 +276,13 @@ export default {
|
|||||||
this.doScale(this.scale );
|
this.doScale(this.scale );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
gotoPage(page) {
|
||||||
|
this.currentPage=page;
|
||||||
|
let fileNo = this.currentPage
|
||||||
|
if (fileNo < 1) return
|
||||||
|
this.currentPage = fileNo
|
||||||
|
this.showSinglePage(this.currentPage)
|
||||||
|
},
|
||||||
prePage() {
|
prePage() {
|
||||||
if(!this.isA4){
|
if(!this.isA4){
|
||||||
let fileNo = this.currentPage - 1
|
let fileNo = this.currentPage - 1
|
||||||
@ -372,7 +397,6 @@ export default {
|
|||||||
document.body.removeChild(tempLink)
|
document.body.removeChild(tempLink)
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// 打印
|
// 打印
|
||||||
printPDF() {
|
printPDF() {
|
||||||
|
|||||||
@ -118,11 +118,12 @@
|
|||||||
<div style="width:50%">
|
<div style="width:50%">
|
||||||
<div class="pagination-container"><slot name="statInfo" /></div>
|
<div class="pagination-container"><slot name="statInfo" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width:50%">
|
<div style="width:50%;overflow: hidden;">
|
||||||
|
<!-- :pagerCount="3" -->
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0 && showPagination"
|
v-show="total>0 && showPagination"
|
||||||
:total="total"
|
:total="total"
|
||||||
:pagerCount="3"
|
|
||||||
:page-sizes="[10,20,50,100,300,500,1000,2000,5000]"
|
:page-sizes="[10,20,50,100,300,500,1000,2000,5000]"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
|
|||||||
@ -307,7 +307,7 @@ class TanexPrinterSdk {
|
|||||||
"orderList":orderList.toString()
|
"orderList":orderList.toString()
|
||||||
}]
|
}]
|
||||||
printCmd['Data']=printData
|
printCmd['Data']=printData
|
||||||
console.log(JSON.stringify(printCmd));
|
// console.log(JSON.stringify(printCmd));
|
||||||
this.send(JSON.stringify(printCmd),null);
|
this.send(JSON.stringify(printCmd),null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -578,7 +578,7 @@ class TanexPrinterSdk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("===>this.recievePdfFileList.length==>",this.recievePdfFileList.length);
|
console.log("===>this.recievePdfFileList.length==>",this.recievePdfFileList.length);
|
||||||
console.log("===>this.sendPdfFileListCount==>",this.sendPdfFileListCount);
|
// console.log("===>this.sendPdfFileListCount==>",this.sendPdfFileListCount);
|
||||||
|
|
||||||
// 如果已相等则表示文件已接收完成
|
// 如果已相等则表示文件已接收完成
|
||||||
if(this.recievePdfFileList.length >= this.sendPdfFileListCount){
|
if(this.recievePdfFileList.length >= this.sendPdfFileListCount){
|
||||||
|
|||||||
@ -59,8 +59,8 @@
|
|||||||
|
|
||||||
<el-dialog :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :resizable="true" :visible.sync="openPdfView" width="90%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogDrag append-to-body @close="handleClose">
|
<el-dialog :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :resizable="true" :visible.sync="openPdfView" width="90%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogDrag append-to-body @close="handleClose">
|
||||||
<div style="height:100%;width:100%;overflow: auto;">
|
<div style="height:100%;width:100%;overflow: auto;">
|
||||||
<PdfViewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&!isInitA4" :pdfList="pdfList" :printOrderList="printOrderList" :isLoadComplete="isLoadComplete" @onPrint="onPdfViewPrint" ></PdfViewer>
|
<PdfViewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&!isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" @onPrint="onPdfViewPrint" ></PdfViewer>
|
||||||
<A4Viewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&isInitA4" :pdfList="pdfList" :printOrderList="printOrderList" :isLoadComplete="isLoadComplete" ></A4Viewer>
|
<A4Viewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" ></A4Viewer>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
pdfList:[],
|
pdfList:[],
|
||||||
pdfBase64List:[],
|
pdfBase64List:[],
|
||||||
isLoadComplete:false,
|
isLoadComplete:0,
|
||||||
|
|
||||||
tanexPrinter:null,
|
tanexPrinter:null,
|
||||||
printerDownUrl:null,
|
printerDownUrl:null,
|
||||||
@ -379,15 +379,13 @@
|
|||||||
}
|
}
|
||||||
else if(code == 800){
|
else if(code == 800){
|
||||||
// 全部获取完成
|
// 全部获取完成
|
||||||
console.log("===全部获取完成ADV====>");
|
// console.log("===全部获取完成ADV====>");
|
||||||
// let newTmpList = that.pdfList.sort((one, two) => {
|
let newTmpList = that.pdfList.sort((one, two) => {
|
||||||
// return one.seqNo - two.seqNo;
|
return one.seqNo - two.seqNo;
|
||||||
// });
|
});
|
||||||
// that.pdfList=newTmpList;
|
// console.log("===newTmpList====>",newTmpList);
|
||||||
// if(!that.openPdfView && that.showCounter==0){
|
that.pdfList=newTmpList;
|
||||||
// that.openPdfView = true;
|
that.refreshKey();
|
||||||
// }
|
|
||||||
that.isLoadComplete=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -423,8 +421,6 @@
|
|||||||
this.orderList=[...orderList]
|
this.orderList=[...orderList]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 打印子单
|
// 打印子单
|
||||||
if(this.selTplCode=="TAN-GC-130"){
|
if(this.selTplCode=="TAN-GC-130"){
|
||||||
for(let i=0;i<this.orderList.length;i++){
|
for(let i=0;i<this.orderList.length;i++){
|
||||||
@ -499,7 +495,13 @@
|
|||||||
else if(code == 800){
|
else if(code == 800){
|
||||||
// 全部获取完成
|
// 全部获取完成
|
||||||
console.log("===全部获取完成2====>");
|
console.log("===全部获取完成2====>");
|
||||||
that.isLoadComplete=true;
|
let newTmpList = that.pdfList.sort((one, two) => {
|
||||||
|
return one.seqNo - two.seqNo;
|
||||||
|
});
|
||||||
|
console.log("===newTmpList====>",newTmpList);
|
||||||
|
that.pdfList=newTmpList;
|
||||||
|
|
||||||
|
that.refreshKey();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<el-steps :active="active" align-center finish-status="finish">
|
<el-steps :active="active" align-center finish-status="finish">
|
||||||
<el-step >
|
<el-step >
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
收件(<span >{{billDetail.sender.countryName}}</span>)
|
收件(<span >{{billDetail?(billDetail.sender.countryName):''}}</span>)
|
||||||
</template>
|
</template>
|
||||||
<span class="icon iconfont" slot="icon"></span>
|
<span class="icon iconfont" slot="icon"></span>
|
||||||
</el-step>
|
</el-step>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</el-step>
|
</el-step>
|
||||||
<el-step >
|
<el-step >
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
签收(<span >{{billDetail.reciever.countryName}}</span>)
|
签收(<span >{{billDetail?(billDetail.reciever.countryName):''}}</span>)
|
||||||
</template>
|
</template>
|
||||||
<span class="icon iconfont" slot="icon"></span>
|
<span class="icon iconfont" slot="icon"></span>
|
||||||
</el-step>
|
</el-step>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<ImagePreview height="50px" v-for="pic in (billDetail.billPicDispatchRmk||'').split(',')" :key="pic" :src="pic" ></ImagePreview>
|
<ImagePreview height="50px" v-for="pic in (billDetail?billDetail.billPicDispatchRmk:'').split(',')" :key="pic" :src="pic" ></ImagePreview>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
签收底单
|
签收底单
|
||||||
|
|||||||
@ -1077,23 +1077,23 @@ methods: {
|
|||||||
|
|
||||||
let printDataList=[]
|
let printDataList=[]
|
||||||
// 打印主单,子单
|
// 打印主单,子单
|
||||||
let orderList=[];
|
// let orderList=[];
|
||||||
orderList.push(this.form.billCode);
|
// orderList.push(this.form.billCode);
|
||||||
// 客户联
|
// // 客户联
|
||||||
let customerItem ={
|
// let customerItem ={
|
||||||
"tplCode":"TAN-CM-130",
|
// "tplCode":"TAN-CM-130",
|
||||||
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
||||||
"orderList":orderList.toString()
|
// "orderList":orderList.toString()
|
||||||
}
|
// }
|
||||||
printDataList.push(customerItem);
|
// printDataList.push(customerItem);
|
||||||
|
|
||||||
// 主单
|
// 主单
|
||||||
let mainBillItem ={
|
// let mainBillItem ={
|
||||||
"tplCode":"TAN-GM-130",
|
// "tplCode":"TAN-GM-130",
|
||||||
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
||||||
"orderList":orderList.toString()
|
// "orderList":orderList.toString()
|
||||||
}
|
// }
|
||||||
printDataList.push(mainBillItem);
|
// printDataList.push(mainBillItem);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1162,12 +1162,12 @@ methods: {
|
|||||||
printDataList.push(customerItem);
|
printDataList.push(customerItem);
|
||||||
|
|
||||||
// 主单
|
// 主单
|
||||||
let mainBillItem ={
|
// let mainBillItem ={
|
||||||
"tplCode":"TAN-GM-130",
|
// "tplCode":"TAN-GM-130",
|
||||||
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
|
||||||
"orderList":orderList.toString()
|
// "orderList":orderList.toString()
|
||||||
}
|
// }
|
||||||
printDataList.push(mainBillItem);
|
// printDataList.push(mainBillItem);
|
||||||
|
|
||||||
|
|
||||||
// 打印子单
|
// 打印子单
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user