作业证导出调整
This commit is contained in:
parent
1bf3a44513
commit
9b6f1d0995
|
|
@ -128,7 +128,7 @@
|
||||||
<td class="tableTd">检测部位</td>
|
<td class="tableTd">检测部位</td>
|
||||||
<td class="tableTd">O₂(%)</td>
|
<td class="tableTd">O₂(%)</td>
|
||||||
<td class="tableTd">CO</td>
|
<td class="tableTd">CO</td>
|
||||||
<td class="tableTd">可燃气体(V%LEL)</td>
|
<td class="tableTd" style="line-height: 18px;">可燃气体<span style="12px;font-weight:500">(V%LEL)</span></td>
|
||||||
<td class="tableTd">检验结论</td>
|
<td class="tableTd">检验结论</td>
|
||||||
<td class="tableTd">检测人</td>
|
<td class="tableTd">检测人</td>
|
||||||
<td class="tableTd">检测时间</td>
|
<td class="tableTd">检测时间</td>
|
||||||
|
|
@ -171,7 +171,6 @@
|
||||||
<span v-if="item.participant_">{{item.participant_.name}}</span>
|
<span v-if="item.participant_">{{item.participant_.name}}</span>
|
||||||
<span v-if="item.participant_str">{{item.participant_str}}</span>
|
<span v-if="item.participant_str">{{item.participant_str}}</span>
|
||||||
</td>
|
</td>
|
||||||
<!-- <td class="tableTd">{{ item.electricName }}</td> -->
|
|
||||||
<td class="tableTd">{{ item.update_time }}</td>
|
<td class="tableTd">{{ item.update_time }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -259,7 +258,6 @@
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this;
|
let that = this;
|
||||||
console.log(1, that.id, 2, that.wfId)
|
|
||||||
that.oplId = that.id; //许可证ID
|
that.oplId = that.id; //许可证ID
|
||||||
that.operationId = that.wfId; //zuoyeID
|
that.operationId = that.wfId; //zuoyeID
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
|
|
@ -268,19 +266,21 @@
|
||||||
that.getgasList();
|
that.getgasList();
|
||||||
that.getOperation();
|
that.getOperation();
|
||||||
})
|
})
|
||||||
let exportDiv = document.getElementById('exportDiv') // 需要导出部分页面的id名
|
|
||||||
this.pdfDownLoader = new PdfLoader(exportDiv, '许可证', 'exportDiv') // fileName -->导出文件名, question-table -->防止被截断的class名
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// handleExport() {
|
handleExport() {
|
||||||
// this.pdfDownLoader.outPutPdfFn('许可证')
|
let exportDiv = document.getElementById('exportDiv') // 需要导出部分页面的id名
|
||||||
// },
|
this.pdfDownLoader = new PdfLoader(exportDiv, '作业许可证', 'exportDiv') // fileName -->导出文件名, question-table -->防止被截断的class名
|
||||||
handleExport(){
|
this.pdfDownLoader.outPutPdfFn('许可证');
|
||||||
let bdHtml = window.document.body.innerHTML;
|
exportDiv.style.width = "100%"
|
||||||
document.body.innerHTML = document.getElementById('exportDiv').innerHTML;
|
|
||||||
window.print();
|
|
||||||
location.reload();
|
|
||||||
},
|
},
|
||||||
|
// handleExport(){
|
||||||
|
// let bdHtml = window.document.body.innerHTML;
|
||||||
|
// document.body.innerHTML = document.getElementById('exportDiv').innerHTML;
|
||||||
|
// window.print();
|
||||||
|
// location.reload();
|
||||||
|
// },
|
||||||
//根据oplId,查许可证
|
//根据oplId,查许可证
|
||||||
getOplData() {
|
getOplData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
@ -374,7 +374,7 @@
|
||||||
}
|
}
|
||||||
.tableTh>td:first-child{
|
.tableTh>td:first-child{
|
||||||
flex-shrink:0;
|
flex-shrink:0;
|
||||||
width: 50px;
|
width: 70px;
|
||||||
}
|
}
|
||||||
.tableTr>td{
|
.tableTr>td{
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
|
|
@ -383,7 +383,7 @@
|
||||||
}
|
}
|
||||||
.tableTr>td:first-child{
|
.tableTr>td:first-child{
|
||||||
flex-shrink:0;
|
flex-shrink:0;
|
||||||
width: 50px;
|
width: 70px;
|
||||||
}
|
}
|
||||||
td{
|
td{
|
||||||
width: 25%;
|
width: 25%;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ class PdfLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPDF(resolve) {
|
async getPDF(resolve) {
|
||||||
const ele = this.ele
|
const ele = this.ele;
|
||||||
|
let eleme = this.ele;
|
||||||
|
eleme.style.width="750px";
|
||||||
const pdfFileName = this.pdfFileName
|
const pdfFileName = this.pdfFileName
|
||||||
const eleW = ele.offsetWidth// 获得该容器的宽
|
const eleW = ele.offsetWidth// 获得该容器的宽
|
||||||
const eleH = ele.scrollHeight// 获得该容器的高
|
const eleH = ele.scrollHeight// 获得该容器的高
|
||||||
|
|
@ -35,9 +37,9 @@ class PdfLoader {
|
||||||
canvas.width = eleW * 2// 将画布宽&&高放大两倍
|
canvas.width = eleW * 2// 将画布宽&&高放大两倍
|
||||||
canvas.height = eleH * 2
|
canvas.height = eleH * 2
|
||||||
const context = canvas.getContext('2d')
|
const context = canvas.getContext('2d')
|
||||||
context.scale(3, 3) // 增强图片清晰度
|
context.scale(2,2) // 增强图片清晰度
|
||||||
context.translate(-eleOffsetLeft , -eleOffsetTop)
|
context.translate(-eleOffsetLeft , -eleOffsetTop)
|
||||||
html2canvas(ele, {
|
html2canvas(eleme, {
|
||||||
useCORS: true// 允许canvas画布内可以跨域请求外部链接图片, 允许跨域请求。
|
useCORS: true// 允许canvas画布内可以跨域请求外部链接图片, 允许跨域请求。
|
||||||
}).then(async canvas => {
|
}).then(async canvas => {
|
||||||
const contentWidth = canvas.width
|
const contentWidth = canvas.width
|
||||||
|
|
@ -114,51 +116,5 @@ class PdfLoader {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// export default {
|
|
||||||
// install(Vue, options) {
|
|
||||||
// Vue.prototype.getPdf = function(title) {
|
|
||||||
// var element = document.getElementById("pdfContent")
|
|
||||||
// var title = title; //PDF文件标题
|
|
||||||
// var c = document.createElement("canvas");//创建照片
|
|
||||||
// var opts = {
|
|
||||||
// scale: 2,
|
|
||||||
// canvas: c,
|
|
||||||
// logging: true,
|
|
||||||
// width: element.clientWidth,
|
|
||||||
// height: element.clientHeight
|
|
||||||
// };
|
|
||||||
// //照片高度和宽度是页面元素的两倍
|
|
||||||
// c.width = element.clientWidth * 2
|
|
||||||
// c.height = element.clientHeight * 2
|
|
||||||
// c.getContext("2d").scale(2, 2);
|
|
||||||
// html2Canvas(element, opts)
|
|
||||||
// .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) {
|
|
||||||
// //第一个20是img和pdf页面的左边距,第二个20是img与pdf页面的上边距
|
|
||||||
// PDF.addImage(pageData, ‘JPEG‘, 20, 20, imgWidth, imgHeight)
|
|
||||||
// } else {
|
|
||||||
// while (leftHeight > 0) {
|
|
||||||
// PDF.addImage(pageData, ‘JPEG‘, 20, position, imgWidth, imgHeight)
|
|
||||||
// leftHeight -= pageHeight
|
|
||||||
// position -= 841.89
|
|
||||||
// if (leftHeight > 0) {
|
|
||||||
// PDF.addPage()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// PDF.save(title + ‘.pdf‘)
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
export default PdfLoader
|
export default PdfLoader
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export default (app) => {
|
||||||
el.disabled = true
|
el.disabled = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
el.disabled = false
|
el.disabled = false
|
||||||
}, binding.value || 2000)
|
}, binding.value || 3000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue