Commit 913d457f by 张超军

Merge branch 'zwxt_hn' of http://39.99.224.27:9022/changchao/founder_vue into zwxt_hn

parents f0d16cee c319ee15
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -92,6 +92,11 @@ import Loading from "./components/Loading.vue";
Vue.prototype.$store = store;
Vue.use(Loading);
const LoadingCons = Vue.extend(Nsloading);
// 打印
import htmlToPdf from './utils/htmlToPDF.js'
Vue.use(htmlToPdf)
// 常用工具函数
Vue.prototype.$util = Util;
window.util = Util;
......
// htmlToPdf.js
// 导出页面为PDF格式
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
export default {
install (Vue, options) {
Vue.prototype.getPdf = function () {
var title = this.htmlTitle //DPF标题
html2Canvas(document.querySelector('#pdfDom'), {
allowTaint: true,
taintTest: false,
useCORS: true,
y: 1, // 对Y轴进行裁切
// width:1200,
// height:5000,
// width: 1240,
// height: 3508,
dpi: window.devicePixelRatio * 4, //将分辨率提高到特定的DPI 提高四倍
scale: 4 //按比例增加分辨率
}).then(function (canvas) {
let contentWidth = canvas.width
let contentHeight = canvas.height
let pageHeight = contentWidth / 592.28 * 841.89
let leftHeight = contentHeight
let position = 0
let imgWidth = 595.28
let imgHeight = 592.28 / contentWidth * contentHeight
let pageData = canvas.toDataURL('image/jpeg', 1.0)
let PDF = new JsPDF('', 'pt', 'a4')
if (leftHeight < pageHeight) {
PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight)
} else {
while (leftHeight > 0) {
PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
leftHeight -= pageHeight
position -= 841.89
if (leftHeight > 0) {
PDF.addPage()
}
}
}
PDF.save(title + '.pdf')
})
}
}
}
......@@ -70,7 +70,7 @@
</div>
</div>
<div class="right">
<div v-if="FaceLoading">
<div v-if="FaceLoading" class="loadingImg">
<img src="@/assets/img/dy/zmjz.gif" alt="" />
</div>
<div v-if="FaceImg[0].img && FaceLoading == false" class="hasImg">
......@@ -78,7 +78,7 @@
</div>
<div v-if="!FaceImg[0].img && FaceLoading == false" class="noImg">
<img src="@/assets/img/dy/zwtp.png" alt="" />
<span>{{ $t('Daxxk.no_image') }}</span>
<span>暂无图像</span>
</div>
</div>
</div>
......@@ -310,9 +310,6 @@ export default {
// 获取人像
getFaceByBarcode () {
let self = this
if (self.FaceCount > 0) return
self.FaceCount++
this.FaceImgNum = 0
window.NetUtil.ryxxk.getFaceByBarcode({ barcode: this.htmlTitle })
.then((response) => {
if (response.code == 0) {
......@@ -320,7 +317,6 @@ export default {
self.FaceImg.forEach((item) => {
if (item.code == element.seq) {
item.img = element.image
this.FaceImgNum++
}
})
})
......@@ -367,7 +363,6 @@ export default {
window.NetUtil.ryxxk.getPlainByBarcode({ barcode: this.htmlTitle })
.then((response) => {
if (response.code == 0) {
this.PlainImgNum = response.ret.length
response.ret.forEach((element) => {
self.PlainImg.forEach((item) => {
if (item.code == element.seq) {
......@@ -393,7 +388,6 @@ export default {
if (response.code == 0) {
// 去掉加载状态
this.RollImgfingerLoading = false
this.RollImgNum = response.ret.length
response.ret.forEach((element) => {
this.RollImg.forEach((item) => {
if (item.code == element.seq) {
......@@ -553,6 +547,15 @@ export default {
border: 1px solid #ccc;
margin-top: 9px;
.loadingImg {
width: 100%;
height: 100%;
img {
width: 137px;
}
}
.hasImg {
width: 100%;
height: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment