From b69bcd6099b0109b37543aaf322cb590d6ea654f Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Thu, 18 Aug 2022 17:13:27 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D/=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9/=E6=89=93=E5=8D=B0=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + public/webA/index.js | 8 +- public/webB/index.js | 11 +- public/webC/index.js | 11 +- public/webTotal/index.js | 12 +- src/assets/icons/svg/print.svg | 22 +++ .../archivesManage/archivesList/index.vue | 2 +- .../archivesList/module/packing/index.vue | 2 +- .../caseManage/caseList/index.vue | 129 +++++++++++++++++- src/views/components/SecurityDoor.vue | 2 +- src/views/home.vue | 3 +- 11 files changed, 186 insertions(+), 18 deletions(-) create mode 100644 src/assets/icons/svg/print.svg diff --git a/package.json b/package.json index b0c284d..35ef8ee 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "file-saver": "1.3.8", "fuse.js": "3.4.4", "highlight.js": "^11.5.1", + "html2canvas": "^1.4.1", "js-beautify": "^1.10.2", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", @@ -49,6 +50,7 @@ "normalize.css": "7.0.0", "nprogress": "0.2.0", "path-to-regexp": "2.4.0", + "print-js": "^1.6.0", "qs": "^6.10.1", "screenfull": "4.2.0", "sortablejs": "1.8.4", diff --git a/public/webA/index.js b/public/webA/index.js index 4580c70..6eea0c4 100644 --- a/public/webA/index.js +++ b/public/webA/index.js @@ -37,9 +37,11 @@ BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { this._loadingDiv.innerHTML = "
阅行客 提供技术支持!
"; + "'>"; + + //
阅行客 提供技术支持!
this._resizeLoadingUI(); window.addEventListener("resize", this._resizeLoadingUI); diff --git a/public/webB/index.js b/public/webB/index.js index fe4de2c..b980bfb 100644 --- a/public/webB/index.js +++ b/public/webB/index.js @@ -34,9 +34,14 @@ BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { this._loadingDiv.innerHTML = "
阅行客 提供技术支持!
"; + "'>"; + + // this._loadingDiv.innerHTML = + // "
阅行客 提供技术支持!
"; this._resizeLoadingUI(); window.addEventListener("resize", this._resizeLoadingUI); diff --git a/public/webC/index.js b/public/webC/index.js index 297ab3c..408aa3d 100644 --- a/public/webC/index.js +++ b/public/webC/index.js @@ -35,9 +35,14 @@ BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { this._loadingDiv.innerHTML = "
阅行客 提供技术支持!
"; + "'>"; + + // this._loadingDiv.innerHTML = + // "
阅行客 提供技术支持!
"; this._resizeLoadingUI(); window.addEventListener("resize", this._resizeLoadingUI); diff --git a/public/webTotal/index.js b/public/webTotal/index.js index 3512aeb..92c1fdf 100644 --- a/public/webTotal/index.js +++ b/public/webTotal/index.js @@ -26,9 +26,15 @@ BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { this._loadingDiv.innerHTML = "
阅行客 提供技术支持!
"; + "'>"; + + // this._loadingDiv.innerHTML = + // "
阅行客 提供技术支持!
"; + this._resizeLoadingUI(); window.addEventListener("resize", this._resizeLoadingUI); document.body.appendChild(this._loadingDiv); diff --git a/src/assets/icons/svg/print.svg b/src/assets/icons/svg/print.svg new file mode 100644 index 0000000..1fafd8c --- /dev/null +++ b/src/assets/icons/svg/print.svg @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/src/views/archivesManage/archivesList/index.vue b/src/views/archivesManage/archivesList/index.vue index ff7a34e..3015f87 100644 --- a/src/views/archivesManage/archivesList/index.vue +++ b/src/views/archivesManage/archivesList/index.vue @@ -26,7 +26,7 @@
- 隐藏固定状态栏 + 隐藏状态栏
搜索
-

数据来源:文件 2条数据

+

数据来源:文件 {{ caseData.selections.length }} 条数据

数据来源:案卷 {{ caseData.selections.length }} 条数据 卷内 {{ caseData.totalSumAll }} 条数据

diff --git a/src/views/archivesManage/caseManage/caseList/index.vue b/src/views/archivesManage/caseManage/caseList/index.vue index 52b1b44..4a67c79 100644 --- a/src/views/archivesManage/caseManage/caseList/index.vue +++ b/src/views/archivesManage/caseManage/caseList/index.vue @@ -17,6 +17,7 @@ @@ -104,6 +125,9 @@ import crudOperation from '@crud/CRUD.operation' import rrOperation from '@crud/RR.operation' import pagination from '@crud/Pagination' import detailDialog from './module/detailDialog.vue' + +import html2canvas from 'html2canvas' +import printJS from 'print-js' export default { name: 'CaseList', filters: { @@ -135,10 +159,13 @@ export default { group: false }, sort: ['create_time,desc'] + }) }, data() { return { + isHidden: false, + printData: [], permission: { add: ['admin', 'caseManage:add'], edit: ['admin', 'caseManage:edit'], @@ -187,8 +214,62 @@ export default { ] } }, - + mounted() { + }, methods: { + // 打印 + getPrintData() { + const params = { + caseId: this.crud.selections[0].id + } + this.crud.crudMethod.findInCase(params).then(res => { + if (res) { + this.printData = res.archives + } + this.isHidden = true + this.$nextTick(() => { + this.printFn() + this.isHidden = false + }) + }) + }, + printFn() { + const printContent = this.$refs.printId + // 获取dom 宽度 高度 + const width = printContent.clientWidth + const height = printContent.clientHeight + // 创建一个canvas节点 + const canvas = document.createElement('canvas') + + const scale = 4 // 定义任意放大倍数,支持小数;越大,图片清晰度越高,生成图片越慢。 + canvas.width = width * scale // 定义canvas 宽度 * 缩放 + canvas.height = height * scale // 定义canvas高度 *缩放 + canvas.style.width = width * scale + 'px' + canvas.style.height = height * scale + 'px' + canvas.getContext('2d').scale(scale, scale) // 获取context,设置scale + + const scrollTop = document.documentElement.scrollTop || document.body.scrollTop // 获取滚动轴滚动的长度 + const scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft // 获取水平滚动轴的长度 + + html2canvas(printContent, { + canvas, + backgroundColor: null, + useCORS: true, + windowHeight: document.body.scrollHeight, + scrollX: -scrollLeft, // 解决水平偏移问题,防止打印的内容不全 + scrollY: -scrollTop + }).then((canvas) => { + const url = canvas.toDataURL('image/png') + printJS({ + printable: url, + type: 'image', + documentTitle: '', // 标题 + style: '@page{size:auto;margin: 0cm 1cm 0cm 1cm;}' // 去除页眉页脚 + }) + }).catch(err => { + console.error(err) + }) + }, // 获取数据前的处理 [CRUD.HOOK.beforeRefresh]() { this.crud.query.storageType = null @@ -319,4 +400,50 @@ export default { .crud-opts{ display: flex; } +.intoExamine{ + position: fixed; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + // width: 980px; + background-color: #fff; + z-index: 99; + ::v-deep .el-table--group, .el-table--border{ + border: 1px solid #000; + border-bottom: none; + border-top: none; + } + ::v-deep .el-table__header{ + border-bottom: 1px solid #000;; + } + ::v-deep .el-table .el-table__header-wrapper th.el-table__cell, .el-table .el-table__header th.el-table__cell{ + color: #000; + background-color: #fff; + border-bottom: none; + &>.cell{ + color: #000; + } + } + ::v-deep .el-table .el-table__body-wrapper td.el-table__cell, .el-table .el-table__fixed-right td.el-table__cell{ + color: #000; + border-bottom: 1px solid #000; + padding: 0; + } + ::v-deep .el-table__body tr.el-table__row:hover>td.el-table__cell, .el-table__body tr.el-table__row:focus>td.el-table__cell, .el-table__body tr.current-row:hover>td.el-table__cell, .el-table__body tr.current-row:focus>td.el-table__cell{ + background-color: transparent; + } + ::v-deep .el-table--border .el-table__cell{ + border-right: 1px solid #000; + } +} +@media print { + /*最外层打印节点*/ + html,body{ + height: inherit; + } + .intoExamine{ + // height: 95%; + margin: 0 auto; + } +} diff --git a/src/views/components/SecurityDoor.vue b/src/views/components/SecurityDoor.vue index 142aeef..6d22dfe 100644 --- a/src/views/components/SecurityDoor.vue +++ b/src/views/components/SecurityDoor.vue @@ -7,7 +7,7 @@ 门禁记录

- +