From 5f2b0662fa159240d6b984feaded9bf96d236aaf Mon Sep 17 00:00:00 2001 From: guoshuang Date: Thu, 15 Aug 2024 15:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=8D=95=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/prepare/index.vue | 89 +++++++++++++++------------------ 1 file changed, 40 insertions(+), 49 deletions(-) diff --git a/src/views/mes/prepare/index.vue b/src/views/mes/prepare/index.vue index 8246ba81..1e1727a7 100644 --- a/src/views/mes/prepare/index.vue +++ b/src/views/mes/prepare/index.vue @@ -248,10 +248,16 @@ 页次: 1/ 1 - + - + + + @@ -262,7 +268,10 @@ -
+
+ + + 发料人: @@ -295,6 +304,7 @@ export default { // components: {Detail}, data() { return { + fenyeNumber:14, shengchan:true, newWorkerLoading: false, refreshNewWorkerTable:true, @@ -413,23 +423,7 @@ export default { style: ` body {margin: 5mm;padding: 0;} - .my-print-table { - width: 100%; - } - .my-print-table tr { - page-break-inside: avoid; - page-break-after: auto; - } - .my-print-table thead { - display: table-header-group; /* 确保表头在每一页显示 */ - } - .my-print-table tbody { - display: table-row-group; - } - .my-print-table th, .my-print-table td { - word-wrap: break-word; - white-space: normal; - } + .fy{page-break-after: always;} `, ignoreElements: params.ignore || [], // ['no-print'] properties: params.properties || null @@ -455,7 +449,17 @@ export default { this.printData.factory = response.data.mesPrepareDetailList[0].factoryCode this.printData.productDate = response.data.mesPrepareDetailList[0].productDate this.printData.printDate = moment(new Date()).format('YYYY-MM-DD') - this.printData.workTable = response.data.mesPrepareDetailList + this.printData.workTable = response.data.mesPrepareDetailList; + let chunkedArray = []; + +// 遍历this.printData.workTable + for (let i = 0; i < this.printData.workTable.length; i += this.fenyeNumber) { + // 使用slice方法从当前索引i开始切割,切割长度为10(如果剩余元素少于10,则切割剩余所有元素) + let chunk = this.printData.workTable.slice(i, i + this.fenyeNumber); + // 将切割后的数组添加到chunkedArray中 + chunkedArray.push(chunk); + } + this.printData.workTable = chunkedArray; this.printData.prodLineCode = response.data.mesPrepare.prodLineCode this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格 this.newWorkerLoading = false // 设置加载状态为false,表示加载完成 @@ -487,6 +491,16 @@ export default { this.printData.productDate = moment(this.queryParams.productDate).format('YYYY-MM-DD') this.printData.printDate = moment(new Date()).format('YYYY-MM-DD') this.printData.workTable = response.data.mesPrepareDetailList + let chunkedArray = []; + +// 遍历this.printData.workTable + for (let i = 0; i < this.printData.workTable.length; i += this.fenyeNumber) { + // 使用slice方法从当前索引i开始切割,切割长度为10(如果剩余元素少于10,则切割剩余所有元素) + let chunk = this.printData.workTable.slice(i, i + this.fenyeNumber); + // 将切割后的数组添加到chunkedArray中 + chunkedArray.push(chunk); + } + this.printData.workTable = chunkedArray; this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格 this.newWorkerLoading = false // 设置加载状态为false,表示加载完成 }) @@ -631,6 +645,7 @@ export default { body { font-family: 'Arial', sans-serif; /* 设置字体为'Arial'或其他清晰的无衬线字体 */ font-size: 14px; /* 设置字体大小 */ + -webkit-print-color-adjust: exact; } table, th, td { border: 1px solid black; @@ -638,31 +653,7 @@ export default { font-size: 14px; /* 确保表格内字体大小一致 */ } } -/* @media print { - #printFrom{ - font-family: "SimSun", "宋体" !important; - color: #000 !important; - font-size: 14pt !important; - -webkit-print-color-adjust: exact; - } - - .my-print-table { - width: 100%; - page-break-inside: auto; - } - .my-print-table tr { - page-break-inside: avoid; - } - .my-print-table thead { - display: table-header-group; - } - .my-print-table th, .my-print-table td { - word-wrap: break-word; - white-space: normal; - } - @page { - size: A5 portrait; - margin: 5mm; - } -} */ +.fy{ + page-break-after: always; +}