From d78bdc7e3b96490a1728ab200626ddbac548c53f Mon Sep 17 00:00:00 2001 From: bonus <1203338439@qq.com> Date: Sat, 15 Nov 2025 15:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=A8=A1=E5=9D=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/cost/component/applyDetail.vue | 916 +++++------------- .../material/cost/component/examHome.vue | 149 ++- .../cost/component/applyHome.vue | 1 + .../cost/component/examHome.vue | 16 + 4 files changed, 325 insertions(+), 757 deletions(-) diff --git a/src/views/material/cost/component/applyDetail.vue b/src/views/material/cost/component/applyDetail.vue index 9aa050ee..41136be7 100644 --- a/src/views/material/cost/component/applyDetail.vue +++ b/src/views/material/cost/component/applyDetail.vue @@ -18,123 +18,27 @@ --> - - - -
- + - + - +
结算费用结算费用
结算单位{{ unitName }}{{ unitName }}
结算工程{{ projectName }}{{ projectName }}
@@ -144,19 +48,20 @@
- - - - - - - - - - + + + + + + + + + + + - + @@ -169,6 +74,7 @@ +
租赁费用明细租赁费用明细
序号归还日期 租赁天数 租赁费用(元)备注
@@ -177,16 +83,17 @@
- - - - - - - - - - + + + + + + + + + + + @@ -201,6 +108,7 @@ +
{{ index + 1 }}{{ Number(item.leaseDays).toFixed(2) }} {{ item.costs ? item.costs.toFixed(2) : '0' }}{{ item.unitName }}
@@ -211,7 +119,7 @@ border="1" cellspacing="0" cellpadding="6" - style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;" + style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px" > 费用小计: {{ leaseCost }} @@ -219,59 +127,6 @@
- -
@@ -279,16 +134,17 @@
- - - - - - - + + + + + + + + - + @@ -298,6 +154,7 @@ +
维修费用明细维修费用明细
序号维修数量 是否收费 维修费用(元)备注
@@ -306,13 +163,14 @@
- - - - - - - + + + + + + + + @@ -324,6 +182,7 @@ +
{{ index + 1 }}{{ item.partType }} {{ item.costs.toFixed(2) }} {{ item.unitName }}
@@ -334,7 +193,7 @@ border="1" cellspacing="0" cellpadding="6" - style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;" + style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px" > 费用小计: {{ repairCost }} @@ -342,53 +201,6 @@
- -
@@ -396,16 +208,17 @@
- - - - - - - + + + + + + + + - + @@ -415,6 +228,7 @@ +
丢失费用明细丢失费用明细
序号扣款单价 丢失数量 丢失费用(元)备注
@@ -423,13 +237,14 @@
- - - - - - - + + + + + + + + @@ -442,6 +257,7 @@ +
{{ index + 1 }} {{ item.costs.toFixed(2) }} {{ item.unitName }}
@@ -452,7 +268,7 @@ border="1" cellspacing="0" cellpadding="6" - style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;" + style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px" > 费用小计: {{ loseCost }} @@ -460,58 +276,6 @@
-
@@ -519,17 +283,18 @@
- - - - - - - - + + + + + + + + + - + @@ -540,6 +305,7 @@ +
报废费用明细报废费用明细
序号扣款单价 是否收费 报废费用(元)备注
@@ -548,14 +314,15 @@
- - - - - - - - + + + + + + + + + @@ -569,6 +336,7 @@ +
{{ index + 1 }}{{ item.partType }} {{ item.costs.toFixed(3) }} {{ item.unitName }}
@@ -579,7 +347,7 @@ border="1" cellspacing="0" cellpadding="6" - style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;" + style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px" > 费用小计: {{ scrapCost }} @@ -587,79 +355,6 @@
-
@@ -667,20 +362,21 @@
- - - - - - - - - - - + + + + + + + + + + + + - + @@ -694,6 +390,7 @@ +
减免费用明细减免费用明细
序号减免天数 减免原因 减免费用(元)备注
@@ -702,17 +399,18 @@
- - - - - - - - - - - + + + + + + + + + + + + @@ -729,6 +427,7 @@ +
{{ index + 1 }}{{ item.remark }} {{ item.leaseMoney.toFixed(3) }} {{ item.unitName }}
@@ -739,7 +438,7 @@ border="1" cellspacing="0" cellpadding="6" - style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;" + style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px" > 费用小计: {{ reducCost }} @@ -833,26 +532,38 @@ export default { } }, methods: { - handlePrint() { - // 移除滚动容器的样式,确保所有数据显示 - const tableBodies = document.querySelectorAll('.table-body'); + handlePrint(orientation = 'portrait') { + // 设置打印方向(通过动态样式注入) + const printStyle = document.createElement('style') + printStyle.setAttribute('type', 'text/css') + printStyle.innerHTML = ` + @page { size: A4 ${orientation}; margin: 10mm; } + ` + document.head.appendChild(printStyle) + + // 临时取消滚动限制 + const tableBodies = document.querySelectorAll('.table-body') tableBodies.forEach(body => { - body.style.maxHeight = 'none'; - body.style.overflow = 'visible'; - }); - - // 执行打印 + body.dataset.originalMaxHeight = body.style.maxHeight + body.style.maxHeight = 'none' + body.style.overflow = 'visible' + }) + this.$nextTick(() => { - this.$refs.remarksPrintRef.print(); - - // 打印完成后恢复样式 + // 调用 vue-easy-print 组件打印 + this.$refs.remarksPrintRef.print() + + // 打印后恢复样式 setTimeout(() => { - tableBodies.forEach(body => { - body.style.maxHeight = '400px'; - body.style.overflow = 'auto'; - }); - }, 100); - }); + tableBodies.forEach(body => { + body.style.maxHeight = body.dataset.originalMaxHeight || '300px' + body.style.overflowY = 'auto' + }) + + // 移除临时 @page 样式 + document.head.removeChild(printStyle) + }, 300) + }) }, // 初始化数据 - 统一处理数据解析和API调用 initData() { @@ -1040,7 +751,11 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportLease', { ...params }, `${this.projectName}_租赁费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportLease', + { ...params }, + `${this.projectName}_租赁费用明细_${currentTime}.xlsx` + ) }, //丢失 handleExport2() { @@ -1057,7 +772,11 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportLose', { ...params }, `${this.projectName}_丢失费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportLose', + { ...params }, + `${this.projectName}_丢失费用明细_${currentTime}.xlsx` + ) }, // 维修 handleExport3() { @@ -1074,7 +793,11 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportRepair', { ...params }, `${this.projectName}_维修费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportRepair', + { ...params }, + `${this.projectName}_维修费用明细_${currentTime}.xlsx` + ) }, //报废 handleExport4() { @@ -1091,7 +814,11 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportScrap', { ...params }, `${this.projectName}_报废费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportScrap', + { ...params }, + `${this.projectName}_报废费用明细_${currentTime}.xlsx` + ) // this.downloadJson( // 'material/slt_agreement_info/exportScrap', // JSON.stringify(this.rowData), @@ -1133,7 +860,11 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportAll', { ...params }, `${this.projectName}_全部费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportAll', + { ...params }, + `${this.projectName}_全部费用明细_${currentTime}.xlsx` + ) }, handleExportEach() { const formatTime = date => { @@ -1149,26 +880,26 @@ export default { const currentTime = formatTime(new Date()) let data = _.cloneDeep(this.rowData) const params = { params: JSON.stringify(data) } - this.download('material/slt_agreement_info/exportEach', { ...params }, `${this.projectName}_各费用明细_${currentTime}.xlsx`) + this.download( + 'material/slt_agreement_info/exportEach', + { ...params }, + `${this.projectName}_各费用明细_${currentTime}.xlsx` + ) } } } - diff --git a/src/views/material/cost/component/examHome.vue b/src/views/material/cost/component/examHome.vue index a2e9f02f..af790ab9 100644 --- a/src/views/material/cost/component/examHome.vue +++ b/src/views/material/cost/component/examHome.vue @@ -1,27 +1,11 @@