diff --git a/src/App.vue b/src/App.vue index 8126e9b..eda1cd0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -329,7 +329,9 @@ td, th { page-break-inside: avoid; } - + .page-break { + page-break-before: always; + } .datatable { border-collapse: collapse; diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue index 571a648..99a118c 100644 --- a/src/components/Template/BaseInfoFormPackage.vue +++ b/src/components/Template/BaseInfoFormPackage.vue @@ -267,6 +267,7 @@ export default { .c-Item { // &:not(:last-child) { margin-bottom: 16px; + page-break-inside: avoid; // } } @@ -315,12 +316,10 @@ export default { } .flex1 { - page-break-inside: avoid; flex: 1; } .flex { - page-break-inside: avoid; display: flex; } diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue index 7343586..101c55d 100644 --- a/src/components/Template/Step.vue +++ b/src/components/Template/Step.vue @@ -495,7 +495,9 @@ export default { flex:1 } .step-list { + padding-top: 10px; .step-list-item { + page-break-inside: avoid; margin-top: 10px; border-radius: 6px; overflow: hidden; diff --git a/src/views/business/study/comp/jhbd/Xq.vue b/src/views/business/study/comp/jhbd/Xq.vue index dfd59fb..f2c7b19 100644 --- a/src/views/business/study/comp/jhbd/Xq.vue +++ b/src/views/business/study/comp/jhbd/Xq.vue @@ -268,7 +268,9 @@ export default { this.updateWatermark() this.$refs.jcgjExportList.init(this.jcgjExportList) setTimeout(() => { - this.$refs.html2Pdf.generatePdf() + this.$refs.html2Pdf.generatePdf({ + margin:[20,10,20,10] + }) }, 200); }) }, @@ -278,10 +280,9 @@ export default { const canvas = document.createElement('canvas') const ctx = canvas.getContext('2d') - // 获取内容区域尺寸 - const rect = this.$refs.contentArea.getBoundingClientRect() - canvas.width = rect.width - canvas.height = rect.height + // 设置canvas尺寸 + canvas.width = 300; + canvas.height = 300; // 绘制动态水印 ctx.fillStyle = `rgba(100, 100, 100, ${this.watermarkOpacity})` @@ -298,10 +299,11 @@ export default { ctx.translate(canvas.width / 2, canvas.height / 2) ctx.rotate(-Math.PI / 4) // 45度倾斜 + let time=moment().format("YYYY-MM-DD HH:mm:ss") for (let x = -canvas.width; x < canvas.width * 2; x += stepX) { for (let y = -canvas.height; y < canvas.height * 2; y += stepY) { // 动态水印内容 - const dynamicText = `${this.watermarkText} - ${this.getCurrentTime()}` + const dynamicText = `${this.watermarkText} - ${time}` ctx.fillText(dynamicText, x, y) } } @@ -322,10 +324,6 @@ export default { z-index: 9999; ` - // 插入水印 - this.$refs.contentArea.style.position = 'relative' - this.$refs.contentArea.appendChild(watermarkLayer) - // 等待渲染 setTimeout(() => resolve(), 100) }) diff --git a/src/views/business/study/comp/sqbd/Xq.vue b/src/views/business/study/comp/sqbd/Xq.vue index 2411f77..d170488 100644 --- a/src/views/business/study/comp/sqbd/Xq.vue +++ b/src/views/business/study/comp/sqbd/Xq.vue @@ -268,7 +268,9 @@ export default { this.updateWatermark() this.$refs.jcgjExportList.init(this.jcgjExportList) setTimeout(() => { - this.$refs.html2Pdf.generatePdf() + this.$refs.html2Pdf.generatePdf({ + margin:[20,10,20,10] + }) }, 200); }) }, @@ -278,10 +280,9 @@ export default { const canvas = document.createElement('canvas') const ctx = canvas.getContext('2d') - // 获取内容区域尺寸 - const rect = this.$refs.contentArea.getBoundingClientRect() - canvas.width = rect.width - canvas.height = rect.height + // 设置canvas尺寸 + canvas.width = 300; + canvas.height = 300; // 绘制动态水印 ctx.fillStyle = `rgba(100, 100, 100, ${this.watermarkOpacity})` @@ -298,10 +299,11 @@ export default { ctx.translate(canvas.width / 2, canvas.height / 2) ctx.rotate(-Math.PI / 4) // 45度倾斜 + let time=moment().format("YYYY-MM-DD HH:mm:ss") for (let x = -canvas.width; x < canvas.width * 2; x += stepX) { for (let y = -canvas.height; y < canvas.height * 2; y += stepY) { // 动态水印内容 - const dynamicText = `${this.watermarkText} - ${this.getCurrentTime()}` + const dynamicText = `${this.watermarkText} - ${time}` ctx.fillText(dynamicText, x, y) } } @@ -322,9 +324,6 @@ export default { z-index: 9999; ` - // 插入水印 - this.$refs.contentArea.style.position = 'relative' - this.$refs.contentArea.appendChild(watermarkLayer) // 等待渲染 setTimeout(() => resolve(), 100) diff --git a/src/views/business/study/comp/tbbd/Xq.vue b/src/views/business/study/comp/tbbd/Xq.vue index 7dbde1e..ca9902a 100644 --- a/src/views/business/study/comp/tbbd/Xq.vue +++ b/src/views/business/study/comp/tbbd/Xq.vue @@ -64,7 +64,7 @@ -
{ - this.$refs.html2Pdf.generatePdf() + this.$refs.html2Pdf.generatePdf({ + margin: { + top: 20, + right: 15, + bottom: 20, + left: 15 + }, + }) }, 200); }) }, @@ -278,10 +285,10 @@ export default { const canvas = document.createElement('canvas') const ctx = canvas.getContext('2d') - // 获取内容区域尺寸 - const rect = this.$refs.contentArea.getBoundingClientRect() - canvas.width = rect.width - canvas.height = rect.height + // 设置canvas尺寸 + canvas.width = 300; + canvas.height = 300; + // 绘制动态水印 ctx.fillStyle = `rgba(100, 100, 100, ${this.watermarkOpacity})` @@ -297,11 +304,11 @@ export default { ctx.save() ctx.translate(canvas.width / 2, canvas.height / 2) ctx.rotate(-Math.PI / 4) // 45度倾斜 - + let time=moment().format("YYYY-MM-DD HH:mm:ss") for (let x = -canvas.width; x < canvas.width * 2; x += stepX) { for (let y = -canvas.height; y < canvas.height * 2; y += stepY) { // 动态水印内容 - const dynamicText = `${this.watermarkText} - ${this.getCurrentTime()}` + const dynamicText = `${this.watermarkText} - ${time}` ctx.fillText(dynamicText, x, y) } } @@ -322,9 +329,6 @@ export default { z-index: 9999; ` - // 插入水印 - this.$refs.contentArea.style.position = 'relative' - this.$refs.contentArea.appendChild(watermarkLayer) // 等待渲染 setTimeout(() => resolve(), 100) @@ -445,8 +449,9 @@ export default { padding: 0px; font-family: Arial, sans-serif; - + } + #watermark-overlay { position: absolute; top: -80px;