当前位置: 首页 > news >正文

网站建设 全包 制作网站建设评审会的通知

网站建设 全包 制作,网站建设评审会的通知,最新电视剧免费观看网址,开发者结果#xff1a; 业务#xff1a;将页面右侧的table打印成想要的格式的pdf#xff0c;首先遇到的问题是table表上下左右都有滚轮而html2canvas相当于屏幕截图#xff0c;那滚动区域如何显示出来是个问题#xff1f; gif有点模糊#xff0c;但是大致功能可以看出 可复制… 结果 业务将页面右侧的table打印成想要的格式的pdf首先遇到的问题是table表上下左右都有滚轮而html2canvas相当于屏幕截图那滚动区域如何显示出来是个问题 gif有点模糊但是大致功能可以看出 可复制代码在最下面 参考文章主要思路就是table既然原始高度宽度不对那你在转pdf之前就把他的宽度高度还原成真实的高度宽度然后打印成pdf最后再转成原始高度宽度。值得注意的是画布的高度宽度也要设置和table一样就行 html代码 script代码 table表上有个“导出按钮”点击就会触发handleExport函数 全部代码 html divrefmyContaineridfatherDivclassdemo-form-inlinestyleheight: calc(100% - 120px)el-tablerefworkforceTable:datatableDataborderdrop.nativedrop($event)dragover.nativeallowDrop($event)stripe:span-methodobjectSpanMethod:cell-class-nametableCellClassNamemax-height100%height100%classdemo-form-inlineidfactTableel-table-columnproptimelabel时间width70aligncenterfixed/el-table-columnel-table-column:propitem.sectorCode:labelitem.sectorNamev-foritem in sectorList:keyitem.sectorCodealigncenterel-table-column:propseat.seatId:labelseat.seatNamev-forseat in item.seatList:keyseat.seatIdaligncentermin-width102pxtemplate slot-scopescopespan:defPropseat.seatId:defTimescope.row.time:defIndexscope.$index/spanspanclassel-tag el-tag--lightdefidscope.row[seat.seatId]v-ifscope.row[seat.seatId]!-- 姓名(班组名称) --!-- {{ scope.row[seat.seatId](scope.row[teamseat.seatId]) }} --!-- 姓名 --{{ scope.row[seat.seatId] }}iclassel-tag__close el-icon-closeclickonRemovePerson(scope.$index, seat.seatId)v-ifisManual/i/span/template/el-table-column/el-table-columnel-table-column:propseat.seatId:labelseat.seatNamev-forseat in seatList:keyseat.seatIdaligncentermin-width102pxtemplate slot-scopescopespan:defPropseat.seatId:defTimescope.row.time:defIndexscope.$index/spanspanclassel-tag el-tag--lightdefidscope.row[seat.seatId]v-ifscope.row[seat.seatId]!-- 姓名(班组名称) --!-- {{ scope.row[seat.seatId](scope.row[teamseat.seatId]) }} --!-- 姓名 --{{ scope.row[seat.seatId] }}iclassel-tag__close el-icon-closeclickonRemovePerson(scope.$index, seat.seatId)v-ifisManual/i/span/template/el-table-column/el-table/div script代码 handleExport() {this.$nextTick(() {let pdfName (this.deptRegion TWR? 塔台: this.deptRegion APP? 进近: 区域) 管制室 this.$common.parseTime(this.selectedMonth, {y}/{m}/{d}) 日排班表;document.getElementsByClassName(demo-form-inline)[0].classList.add(export-pdf-style);this.generatePDF(this.$refs.myContainer, pdfName);});},generatePDF(el, name) {let bodyWrapper document.querySelector(#factTable .el-table__body-wrapper);let headerNode document.querySelector(#factTable .el-table__header-wrapper);bodyWrapper.style.height ${bodyWrapper.scrollHeight}px;document.getElementById(fatherDiv).style.width ${bodyWrapper.scrollWidth}px;document.getElementById(fatherDiv).style.height ${bodyWrapper.scrollHeight headerNode.scrollHeight不}px;setTimeout(function () {html2canvas(el, {scale: 4,width: bodyWrapper.scrollWidth 60, // 为了使横向滚动条的内容全部展示这里必须指定height: bodyWrapper.scrollHeight headerNode.scrollHeight ,}).then((canvas) {let contentWidth canvas.width;let contentHeight canvas.height;let pageHeight (contentWidth / 592.28) * 841.89; //一页pdf显示html页面生成的canvas高度;let leftHeight contentHeight; //未生成pdf的html页面高度let position 0; //页面偏移let imgWidth 595.28; //a4纸的尺寸[595.28,841.89]html页面生成的canvas在pdf中图片的宽高let imgHeight (592.28 / contentWidth) * contentHeight;let pageData canvas.toDataURL(image/jpeg, 1.0);let pdf new jsPDF(, pt, a4);if (leftHeight pageHeight) { //有两个高度需要区分一个是html页面的实际高度和生成pdf的页面高度(841.89)pdf.addImage(pageData, JPEG, 5, 30, imgWidth, imgHeight); //当内容未超过pdf一页显示的范围无需分页} else {while (leftHeight 0) {pdf.addImage(pageData, JPEG, 5, position, imgWidth, imgHeight); //arg3--距离左边距;arg4--距离上边距;arg5--宽度;arg6--高度leftHeight - pageHeight;position - 841.89;if (leftHeight 0) { //避免添加空白页pdf.addPage(); //添加新页}}}pdf.save(${name}.pdf);document.getElementById(fatherDiv).style.width ${100}%;document.getElementById(fatherDiv).style.height calc(100% - 120px);document.getElementsByClassName(demo-form-inline)[0].classList.remove(export-pdf-style);});}, 200);}, css代码 .export-pdf-style .el-table , .export-pdf-style .el-tag{background: white !important;color: black !important; }.export-pdf-style .el-table th, .export-pdf-style .el-table .el-table__cell {color: black;border: 1px solid black;background: white !important; }
http://www.pierceye.com/news/30362/

相关文章:

  • 有没有永久免费的进销存软件seo顾问咨询
  • 音乐网站开发需求全网黄页网站
  • 免费公司主页网站wordpress列表页调用图片
  • 厦门网站建设价格xm37网站建设冫首先金手指十五
  • 网站产品怎么改顺序巧更妙改wordpress语言_wordpress英文变中文
  • 地方网站发展做一个微商城要多少钱
  • 广东省网站备案要多久网站设计模板图
  • 网站运营 解决方案凡科网站建站教程
  • 网站可以增加关键词吗电白网站开发公司
  • 做婚庆网站的想法百度竞价广告
  • 考试类网站如何做网站开发一定得用html吗
  • 电子工程设计网站中山网站建设找阿 n 2
  • 发帖子的网站wordpress 主题调试
  • 建设网站公司东莞徐州app制作
  • 江油市建设局网站襄阳建设网站
  • 做网站前端多少钱怎么做网站跳转链接
  • 网站建设推广选哪家如何制作一个单页网站
  • 服务器出租网站c2c网站 多钱
  • 做招聘网站需要资质吗网站不想被收录
  • 济南天桥区做网站的当阳网站建设
  • 做网站空间 阿里云外贸衣服是什么意思呢
  • 专门做美剧的网站企业门户网站什么意思
  • 地方网站方案制作网站建设规划书
  • html5动态效果的网站是怎么做的wordpress本地上云
  • 网站设计字体最好用玉田做网站
  • 衡水做网站报价cms快速建站
  • 公司网站不续费做电商网站就业岗位晋升
  • 网站开发分销系统北京响应式网站
  • 网站的页面由什么组成山西seo优化
  • 红色网站主题用php做网站需要什么