结算导出修改

This commit is contained in:
syruan 2025-10-21 18:03:30 +08:00
parent d4cd5e7382
commit 1fccf4e792
8 changed files with 225 additions and 49 deletions

View File

@ -70,7 +70,7 @@
<div class="tabelAllTopFour">
<div class="costTopOne">说明</div>
<div class="costRightTwo">
{{ '本协议一式份,甲方一份,乙方一份,经双方签字后生效。' }}
{{ '本协议一式份,甲方一份,乙方一份,经双方签字后生效。' }}
</div>
</div>
<div class="tabelAllTopFour">

View File

@ -200,7 +200,7 @@
<td>{{ item.endTime }}</td>
<td v-if="item.leaseDays">{{ Number(item.leaseDays).toFixed(2) }}</td>
<td v-else></td>
<td>{{ item.costs ? item.costs.toFixed(3) : '0' }}</td>
<td>{{ item.costs ? item.costs.toFixed(2) : '0' }}</td>
</tr>
</table>
</div>
@ -214,8 +214,7 @@
style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;"
>
<tr>
<td style="text-align: center">费用小计</td>
<td colspan="9" style="text-align: center">{{ leaseCost }}</td>
<td style="text-align: center">费用小计 {{ leaseCost }}</td>
</tr>
</table>
</div>
@ -323,7 +322,7 @@
<td v-if="item.num">{{ item.num.toFixed(2) }}</td>
<td v-else></td>
<td>{{ item.partType }}</td>
<td v-if="item.costs">{{ item.costs.toFixed(3) }}</td>
<td v-if="item.costs">{{ item.costs.toFixed(2) }}</td>
<td v-else></td>
</tr>
</table>
@ -338,8 +337,7 @@
style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;"
>
<tr>
<td style="text-align: center">费用小计</td>
<td colspan="6" style="text-align: center">{{ repairCost }}</td>
<td style="text-align: center">费用小计 {{ repairCost }}</td>
</tr>
</table>
</div>
@ -403,16 +401,18 @@
<col style="width: 180px;">
<col style="width: 120px;">
<col style="width: 120px;">
<col style="width: 120px;">
<col style="width: 140px;">
</colgroup>
<tr>
<th colspan="6">丢失费用明细</th>
<th colspan="7">丢失费用明细</th>
</tr>
<tr>
<th>序号</th>
<th>设备名称</th>
<th>规格型号</th>
<th>计量单位</th>
<th>扣款单价</th>
<th>丢失数量</th>
<th>丢失费用</th>
</tr>
@ -421,13 +421,14 @@
<!-- 滚动数据区域 -->
<div class="table-body">
<table border="1" cellspacing="0" cellpadding="6" class="data-table">
<table border="1" cellspacing="0" cellpadding="7" class="data-table">
<colgroup>
<col style="width: 80px;">
<col style="width: 180px;">
<col style="width: 180px;">
<col style="width: 120px;">
<col style="width: 120px;">
<col style="width: 120px;">
<col style="width: 140px;">
</colgroup>
<tr v-for="(item, index) in loseList" :key="index">
@ -435,9 +436,11 @@
<td>{{ item.typeName }}</td>
<td>{{ item.modelName }}</td>
<td>{{ item.mtUnitName }}</td>
<td v-if="item.buyPrice">{{ item.buyPrice.toFixed(2) }}</td>
<td v-else></td>
<td v-if="item.num">{{ item.num.toFixed(2) }}</td>
<td v-else></td>
<td v-if="item.costs">{{ item.costs.toFixed(3) }}</td>
<td v-if="item.costs">{{ item.costs.toFixed(2) }}</td>
<td v-else></td>
</tr>
</table>
@ -452,8 +455,7 @@
style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;"
>
<tr>
<td style="text-align: center">费用小计</td>
<td colspan="5" style="text-align: center">{{ loseCost }}</td>
<td style="text-align: center">费用小计 {{ loseCost }}</td>
</tr>
</table>
</div>
@ -523,10 +525,11 @@
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 140px;">
</colgroup>
<tr>
<th colspan="7">报废费用明细</th>
<th colspan="8">报废费用明细</th>
</tr>
<tr>
<th>序号</th>
@ -534,6 +537,7 @@
<th>规格型号</th>
<th>计量单位</th>
<th>报废数量</th>
<th>扣款单价</th>
<th>是否收费</th>
<th>报废费用</th>
</tr>
@ -550,6 +554,7 @@
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 140px;">
</colgroup>
<tr v-for="(item, index) in scrapList" :key="index">
@ -559,6 +564,8 @@
<td>{{ item.mtUnitName }}</td>
<td v-if="item.num">{{ item.num.toFixed(2) }}</td>
<td v-else></td>
<td v-if="item.buyPrice">{{ item.buyPrice.toFixed(2) }}</td>
<td v-else></td>
<td>{{ item.partType }}</td>
<td v-if="item.costs">{{ item.costs.toFixed(3) }}</td>
<td v-else></td>
@ -575,8 +582,7 @@
style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;"
>
<tr>
<td style="text-align: center">费用小计</td>
<td colspan="6" style="text-align: center">{{ scrapCost }}</td>
<td style="text-align: center">费用小计 {{ scrapCost }}</td>
</tr>
</table>
</div>
@ -736,12 +742,10 @@
style="width: 100%; border-collapse: collapse; text-align: center; margin-top: -1px;"
>
<tr>
<td style="text-align: center">费用小计</td>
<td colspan="10" style="text-align: center">{{ reducCost }}</td>
<td style="text-align: center">费用小计 {{ reducCost }}</td>
</tr>
<tr>
<td style="text-align: center">合计</td>
<td colspan="10" style="text-align: center">{{ costAll.toFixed(2) }}</td>
<td style="text-align: center">合计 {{ costAll.toFixed(2) }}</td>
</tr>
</table>
</div>

View File

@ -125,7 +125,7 @@
@pagination="getList"
/>
<!-- 协议弹窗 -->
<!-- 协议弹窗 -->
<el-dialog :visible.sync="openPrint" width="1100px" append-to-body>
<div id="checkId">
<div style="height: 600px; overflow-y: scroll">
@ -200,7 +200,7 @@
<div class="tabelColumn">
<div class="columnLabel" style="width: 20%">说明</div>
<div class="columnContent" style="width: 80%">
本协议一式甲方一份乙方一份经双方签字后生效
本协议一式甲方一份乙方一份经双方签字后生效
</div>
</div>
<div class="tabelColumn" style="border: 1px solid #9c9c9c">
@ -235,6 +235,7 @@
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="print"> </el-button>
<el-button type="success" @click="handleExportAgreement"> </el-button>
<el-button @click="openPrint = false"> </el-button>
</div>
</el-dialog>
@ -322,6 +323,7 @@ import vueEasyPrint from 'vue-easy-print'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import printJS from 'print-js'
import ExcelJS from 'exceljs'
export default {
name: 'ApplyHome',
dicts: ['cost_status'],
@ -616,6 +618,176 @@ export default {
this.$refs.remarksPrintRef.print()
},
//
async handleExportAgreement() {
try {
const workbook = new ExcelJS.Workbook()
const worksheet = workbook.addWorksheet('协议书')
//
worksheet.columns = [
{ header: '', key: 'col1', width: 30 },
{ header: '', key: 'col2', width: 30 },
{ header: '', key: 'col3', width: 20 },
{ header: '', key: 'col4', width: 30 }
]
//
const borderStyle = {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
// -
const titleRow = worksheet.addRow(['机具设备有偿使用费结算协议书', '', '', ''])
titleRow.height = 30
//
worksheet.mergeCells('A1:D1')
//
const titleCell = worksheet.getCell('A1')
titleCell.value = '机具设备有偿使用费结算协议书'
titleCell.font = { bold: true, size: 16 }
titleCell.alignment = { horizontal: 'center', vertical: 'center' }
titleCell.border = borderStyle
//
titleRow.getCell(2).border = borderStyle
titleRow.getCell(3).border = borderStyle
titleRow.getCell(4).border = borderStyle
// -
const agreementCode = this.agreementContent.agreementCode || ''
const agreementRow = worksheet.addRow(['协议号:', agreementCode, '', ''])
agreementRow.getCell(1).alignment = { horizontal: 'right', vertical: 'center' }
agreementRow.getCell(2).alignment = { horizontal: 'left', vertical: 'center' }
agreementRow.getCell(3).alignment = { horizontal: 'center', vertical: 'center' }
agreementRow.getCell(4).alignment = { horizontal: 'center', vertical: 'center' }
agreementRow.height = 25
agreementRow.eachCell((cell) => {
cell.border = borderStyle
})
//
const projectName = this.agreementContent.projectName || ''
const projectRow = worksheet.addRow(['工程名称:', projectName, '', ''])
projectRow.getCell(1).alignment = { horizontal: 'right', vertical: 'center' }
projectRow.getCell(2).alignment = { horizontal: 'left', vertical: 'center' }
projectRow.height = 25
projectRow.eachCell((cell) => {
cell.border = borderStyle
})
worksheet.mergeCells('B3:D3')
worksheet.mergeCells('B4:D4')
//
const unitName = this.agreementContent.unitName || ''
const applyDate = this.agreementContent.applyTime || this.newData || ''
const unitRow = worksheet.addRow(['承租单位:', unitName, '日期:', applyDate])
unitRow.getCell(1).alignment = { horizontal: 'right', vertical: 'center' }
unitRow.getCell(2).alignment = { horizontal: 'left', vertical: 'center' }
unitRow.getCell(3).alignment = { horizontal: 'right', vertical: 'center' }
unitRow.getCell(4).alignment = { horizontal: 'left', vertical: 'center' }
unitRow.height = 25
unitRow.eachCell((cell) => {
cell.border = borderStyle
})
//
const headerRow = worksheet.addRow(['结算项目及金额(元)'])
headerRow.font = { bold: true }
headerRow.eachCell((cell) => {
cell.border = borderStyle
})
//
const leaseCost = this.agreementContent.leaseCost ? Number(this.agreementContent.leaseCost).toFixed(2) : '0.00'
const leaseRow = worksheet.addRow(['一、施工机具有偿使用费:', leaseCost, '', ''])
leaseRow.getCell(1).alignment = { horizontal: 'left' }
leaseRow.getCell(2).alignment = { horizontal: 'right' }
leaseRow.eachCell((cell) => {
cell.border = borderStyle
})
const repairCost = this.agreementContent.repairCost ? Number(this.agreementContent.repairCost).toFixed(2) : '0.00'
const repairRow = worksheet.addRow(['二、施工机具维修费:', repairCost, '', ''])
repairRow.getCell(1).alignment = { horizontal: 'left' }
repairRow.getCell(2).alignment = { horizontal: 'right' }
repairRow.eachCell((cell) => {
cell.border = borderStyle
})
const loseCost = this.agreementContent.loseCost ? Number(this.agreementContent.loseCost).toFixed(2) : '0.00'
const loseRow = worksheet.addRow(['三、施工机具丢失费:', loseCost, '', ''])
loseRow.getCell(1).alignment = { horizontal: 'left' }
loseRow.getCell(2).alignment = { horizontal: 'right' }
loseRow.eachCell((cell) => {
cell.border = borderStyle
})
const scrapCost = this.agreementContent.scrapCost ? Number(this.agreementContent.scrapCost).toFixed(2) : '0.00'
const scrapRow = worksheet.addRow(['四、施工机具损坏赔偿费:', scrapCost, '', ''])
scrapRow.getCell(1).alignment = { horizontal: 'left' }
scrapRow.getCell(2).alignment = { horizontal: 'right' }
scrapRow.eachCell((cell) => {
cell.border = borderStyle
})
const reductionCost = this.agreementContent.reductionCost ? Number(this.agreementContent.reductionCost).toFixed(2) : '0.00'
const reductionRow = worksheet.addRow(['五、施工机具租赁减免费:', reductionCost, '', ''])
reductionRow.getCell(1).alignment = { horizontal: 'left' }
reductionRow.getCell(2).alignment = { horizontal: 'right' }
reductionRow.eachCell((cell) => {
cell.border = borderStyle
})
//
const costAllUpper = this.agreementContent.costAllUpper || ''
const costAll = this.agreementContent.costAll ? Number(this.agreementContent.costAll).toFixed(2) : '0.00'
const totalRow = worksheet.addRow(['费用合计金额(大写):', costAllUpper, '¥', costAll])
totalRow.font = { bold: true }
totalRow.getCell(1).alignment = { horizontal: 'left' }
totalRow.getCell(2).alignment = { horizontal: 'left' }
totalRow.getCell(3).alignment = { horizontal: 'center' }
totalRow.getCell(4).alignment = { horizontal: 'right' }
totalRow.eachCell((cell) => {
cell.border = borderStyle
})
//
const remarkHeaderRow = worksheet.addRow(['说明: 本协议一式两份,甲方一份,乙方一份,经双方签字后生效。'])
remarkHeaderRow.font = { bold: true }
remarkHeaderRow.eachCell((cell) => {
cell.border = borderStyle
})
worksheet.mergeCells('A13:D13')
//
const noteHeaderRow = worksheet.addRow(['备注: 此费用仅为在机具设备分公司发生费用,未计从项目部领用机具费用。'])
noteHeaderRow.font = { bold: true }
noteHeaderRow.eachCell((cell) => {
cell.border = borderStyle
})
worksheet.mergeCells('A14:D14')
//
const buffer = await workbook.xlsx.writeBuffer()
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `协议书_${this.agreementContent.agreementCode}_${new Date().getTime()}.xlsx`
link.click()
window.URL.revokeObjectURL(url)
this.$message.success('导出成功')
} catch (error) {
console.error('导出失败:', error)
this.$message.error('导出失败')
}
},
/** 删除按钮操作 */
handleDelete(row) {
// const agreementId = row.agreementId;

View File

@ -168,32 +168,32 @@
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%;">施工机具有偿使用费</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.leaseCost }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.leaseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%;">施工机具维修费</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.repairCost }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.repairCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%;">施工机具丢失费</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.loseCost }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.loseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%;">施工机具损坏赔偿费</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.scrapCost }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.scrapCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%;">施工机具租赁减免费</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.reductionCost }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.reductionCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 20%;">费用合计金额大写</div>
<div class="columnContent" style="width: 40%;">{{ agreementContent.costAllUpper }}</div>
<div class="columnContent" style="width: 40%;"> {{ agreementContent.costAll }}</div>
<div class="columnContent" style="width: 40%;"> {{ Number(agreementContent.costAll).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 20%;">说明</div>
<div class="columnContent" style="width: 80%;">本协议一式甲方一份乙方一份经双方签字后生效</div>
<div class="columnContent" style="width: 80%;">本协议一式甲方一份乙方一份经双方签字后生效</div>
</div>
<div class="tabelColumn" style="border: 1px solid #9c9c9c;">
<div class="columnLabel" style="width: 20%;">备注</div>

View File

@ -419,8 +419,8 @@ export default {
{ header: '设备类型数', key: 'equipmentTypeCount', width: 12 },
{ header: '设备总数量', key: 'totalEquipmentCount', width: 12 },
{ header: '总租赁天数', key: 'totalLeaseDays', width: 12 },
{ header: '总租赁费用(元)', key: 'totalLeaseCost', width: 15 },
{ header: '日均租金(元)', key: 'avgDailyRent', width: 15 },
{ header: '总租赁费用(元)', key: 'totalLeaseCost', width: 18 },
{ header: '日均租金(元)', key: 'avgDailyRent', width: 18 },
{ header: '查询开始日期', key: 'queryStartDate', width: 15 },
{ header: '查询结束日期', key: 'queryEndDate', width: 15 },
{ header: '最早租赁时间', key: 'earliestLeaseTime', width: 15 },
@ -463,7 +463,7 @@ export default {
//
this.tableList.forEach((row, index) => {
const dataRow = {
index: index + 1,
index: String(index + 1), //
agreementCode: row.agreementCode || '',
unitName: row.unitName || '',
projectName: row.projectName || '',
@ -617,7 +617,7 @@ export default {
//
this.detailTableList.forEach((row, index) => {
const dataRow = {
index: index + 1,
index: String(index + 1), //
agreementCode: row.agreementCode || '',
typeName: row.typeName || '',
modelName: row.modelName || '',

View File

@ -1012,7 +1012,7 @@ export default {
const dataRows = this.pushReviewList.slice(0, -1);
dataRows.forEach((row, index) => {
const dataRow = {
index: index + 1,
index: String(index + 1), //
agreementCode: row.agreementCode || '',
unitName: row.unitName || '',
projectName: row.projectName || '',

View File

@ -60,7 +60,7 @@
placeholder="请选择班组"
clearable
filterable
multiple
multiple
style="width: 240px"
@change="changeTeamId"
>
@ -180,32 +180,32 @@
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具有偿使用费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.leaseCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.leaseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具维修费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.repairCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.repairCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具丢失费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.loseCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.loseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具损坏赔偿费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.scrapCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.scrapCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具租赁减免费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.reductionCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.reductionCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 20%">费用合计金额大写</div>
<div class="columnContent" style="width: 40%">{{ agreementContent.costAllUpper }}</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.costAll }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.costAll).toFixed(2) }}</div>
</div>
<div class="tabelColumn" style="border: 1px solid #9c9c9c;">
<div class="columnLabel" style="width: 20%">说明</div>
<div class="columnContent" style="width: 80%">本协议一式甲方一份乙方一份经双方签字后生效</div>
<div class="columnContent" style="width: 80%">本协议一式甲方一份乙方一份经双方签字后生效</div>
</div>
<div class="fillIn" style="margin-top: 20px; display: flex; justify-content: space-between">
@ -405,7 +405,7 @@ export default {
console.error('获取班组列表失败:', error)
this.$message.error('获取班组列表失败')
}
},
async changeTeamId() {

View File

@ -149,32 +149,32 @@
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具有偿使用费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.leaseCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.leaseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具维修费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.repairCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.repairCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具丢失费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.loseCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.loseCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具损坏赔偿费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.scrapCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.scrapCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 60%">施工机具租赁减免费</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.reductionCost }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.reductionCost).toFixed(2) }}</div>
</div>
<div class="tabelColumn">
<div class="columnLabel" style="width: 20%">费用合计金额大写</div>
<div class="columnContent" style="width: 40%">{{ agreementContent.costAllUpper }}</div>
<div class="columnContent" style="width: 40%"> {{ agreementContent.costAll }}</div>
<div class="columnContent" style="width: 40%"> {{ Number(agreementContent.costAll).toFixed(2) }}</div>
</div>
<div class="tabelColumn" style="border: 1px solid #9c9c9c;">
<div class="columnLabel" style="width: 20%">说明</div>
<div class="columnContent" style="width: 80%">本协议一式甲方一份乙方一份经双方签字后生效</div>
<div class="columnContent" style="width: 80%">本协议一式甲方一份乙方一份经双方签字后生效</div>
</div>
<div class="fillIn" style="margin-top: 20px; display: flex; justify-content: space-between">