未结算报表增加费用减免列

This commit is contained in:
syruan 2025-08-24 15:41:06 +08:00
parent b406c7ddca
commit e472d8042e
1 changed files with 137 additions and 19 deletions

View File

@ -92,18 +92,26 @@
{{ scope.row.scrapCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="减免费用" align="center" prop="reductionCost" width="80">
<template slot-scope="scope">
<el-button
type="text"
@click="showCostDetail(scope.row, 'reduction')"
:style="{color: scope.row.reductionCost > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.reductionCost > 0)">
{{ scope.row.reductionCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="合计费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button
type="text"
@click="showCostDetail(scope.row, 'total')"
:style="{color: scope.row.costs > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.costs > 0)">
<span v-if="scope.row.costs != null && scope.row.costs != ''">
{{ scope.row.costs.toFixed(2) }}
</span>
<span v-else>{{ 0.00 }}</span>
:style="{color: calculateTotalCost(scope.row) > 0 ? '#409EFF' : '#606266'}"
:disabled="!(calculateTotalCost(scope.row) > 0)">
{{ calculateTotalCost(scope.row).toFixed(2) }}
</el-button>
</template>
</el-table-column>
@ -163,6 +171,13 @@
<el-table-column label="规格型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="维修数量" align="center" prop="repairQuantity" width="100" />
<el-table-column label="是否收费" align="center" prop="partType" width="100">
<template slot-scope="scope">
<span v-if="scope.row.partType === '收费'">收费</span>
<span v-else-if="scope.row.partType === '不收费'">不收费</span>
<span v-else>{{ scope.row.partType || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修费用(元)" align="center" prop="cost" width="120">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
@ -210,6 +225,26 @@
</el-table-column>
</el-table>
<!-- 减免费用详情表格 -->
<el-table
v-if="costDetailType === 'reduction'"
v-loading="costDetailLoading"
:data="costDetailList"
border
stripe
height="500">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="机具名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="机具规格" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="减免数量" align="center" prop="reductionQuantity" width="100" />
<el-table-column label="减免费用(元)" align="center" prop="cost" width="120">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
</template>
</el-table-column>
</el-table>
<!-- 合计费用详情表格 -->
<el-table
v-if="costDetailType === 'total'"
@ -222,12 +257,46 @@
<el-table-column label="名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="单价(元)" align="center" prop="unitPrice" width="100" />
<el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" />
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" />
<el-table-column label="退还日期" align="center" prop="returnDate" width="120" />
<el-table-column label="天数" align="center" prop="days" width="80" />
<el-table-column label="单价(元)" align="center" prop="unitPrice" width="100">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.unitPrice || 0 }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="80">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.quantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'repair'">{{ scope.row.repairQuantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'lose'">{{ scope.row.loseQuantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'scrap'">{{ scope.row.scrapQuantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'reduction'">{{ scope.row.reductionQuantity || 0 }}</span>
<span v-else>{{ scope.row.quantity || 0 }}</span>
</template>
</el-table-column>
<el-table-column label="归还数量" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.returnQuantity || 0 }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="租赁日期" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.leaseDate || '-' }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="退还日期" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.returnDate || '-' }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="天数" align="center" width="80">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.days || 0 }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
@ -239,6 +308,7 @@
<el-tag v-else-if="scope.row.costType === 'repair'" type="warning">维修费用</el-tag>
<el-tag v-else-if="scope.row.costType === 'lose'" type="danger">丢失费用</el-tag>
<el-tag v-else-if="scope.row.costType === 'scrap'" type="info">报废费用</el-tag>
<el-tag v-else-if="scope.row.costType === 'reduction'" type="success">减免费用</el-tag>
<el-tag v-else>未知</el-tag>
</template>
</el-table-column>
@ -495,7 +565,7 @@ export default {
scrapCost: row.scrapCost || 0,
reductionCost: row.reductionCost || 0
};
this.agreementContent.costAll = Number(this.agreementContent.leaseCost) + Number(this.agreementContent.repairCost) + Number(this.agreementContent.scrapCost) + Number(this.agreementContent.loseCost) - Number(this.agreementContent.reductionCost)
this.agreementContent.costAll = this.calculateTotalCost(row)
// costAllUpper
this.agreementContent.costAllUpper = toChineseAmount(this.agreementContent.costAll.toFixed(2))
} catch (error) {
@ -514,6 +584,7 @@ export default {
'repair': '维修费用',
'lose': '丢失费用',
'scrap': '报废费用',
'reduction': '减免费用',
'total': '合计费用'
};
@ -540,13 +611,17 @@ export default {
case 'scrap':
sourceList = row.scrapList || [];
break;
case 'reduction':
sourceList = row.reductionList || [];
break;
case 'total':
//
const allLists = [
...(row.leaseList || []).map(item => ({...item, costType: 'lease'})),
...(row.repairList || []).map(item => ({...item, costType: 'repair'})),
...(row.loseList || []).map(item => ({...item, costType: 'lose'})),
...(row.scrapList || []).map(item => ({...item, costType: 'scrap'}))
...(row.scrapList || []).map(item => ({...item, costType: 'scrap'})),
...(row.reductionList || []).map(item => ({...item, costType: 'reduction'}))
];
sourceList = allLists;
break;
@ -578,7 +653,8 @@ export default {
} else if (costType === 'repair' || (costType === 'total' && item.costType === 'repair')) {
return {
...baseData,
repairQuantity: item.num || 0
repairQuantity: item.num || 0,
partType: item.partType
};
} else if (costType === 'lose' || (costType === 'total' && item.costType === 'lose')) {
return {
@ -590,6 +666,11 @@ export default {
...baseData,
scrapQuantity: item.num || 0
};
} else if (costType === 'reduction' || (costType === 'total' && item.costType === 'reduction')) {
return {
...baseData,
reductionQuantity: item.num || 0
};
}
return baseData;
@ -615,6 +696,7 @@ export default {
{ key: 'repairCost', title: '维修费用' },
{ key: 'loseCost', title: '丢失费用' },
{ key: 'scrapCost', title: '报废费用' },
{ key: 'reductionCost', title: '减免费用' },
{ key: 'costs', title: '合计费用(元)' }
];
@ -636,9 +718,9 @@ export default {
if (row.settlementType === 2) return '安全工器具';
return '总费用';
} else if (col.key === 'costs') {
//
return row.costs != null && row.costs !== '' ? parseFloat(row.costs.toFixed(2)) : 0.00;
} else if (col.key === 'leaseCost' || col.key === 'repairCost' || col.key === 'loseCost' || col.key === 'scrapCost') {
// -
return parseFloat(this.calculateTotalCost(row).toFixed(2));
} else if (col.key === 'leaseCost' || col.key === 'repairCost' || col.key === 'loseCost' || col.key === 'scrapCost' || col.key === 'reductionCost') {
//
return row[col.key] || 0;
} else {
@ -663,6 +745,7 @@ export default {
{ wch: 12 }, //
{ wch: 12 }, //
{ wch: 12 }, //
{ wch: 12 }, //
{ wch: 15 } //
];
worksheet['!cols'] = columnWidths;
@ -733,6 +816,7 @@ export default {
{ key: 'model', title: '规格型号' },
{ key: 'unit', title: '单位' },
{ key: 'repairQuantity', title: '维修数量' },
{ key: 'partType', title: '是否收费' },
{ key: 'cost', title: '维修费用(元)' }
];
fileName = '维修费用详情';
@ -760,6 +844,17 @@ export default {
fileName = '报废费用详情';
sheetName = '报废费用';
break;
case 'reduction':
columns = [
{ key: 'name', title: '机具名称' },
{ key: 'model', title: '机具规格' },
{ key: 'unit', title: '单位' },
{ key: 'reductionQuantity', title: '减免数量' },
{ key: 'cost', title: '减免费用(元)' }
];
fileName = '减免费用详情';
sheetName = '减免费用';
break;
case 'total':
columns = [
{ key: 'name', title: '名称' },
@ -800,11 +895,23 @@ export default {
'lease': '租赁费用',
'repair': '维修费用',
'lose': '丢失费用',
'scrap': '报废费用'
'scrap': '报废费用',
'reduction': '减免费用'
};
value = typeMap[value] || value;
}
//
if (col.key === 'partType') {
if (value === '收费') {
value = '收费';
} else if (value === '不收费') {
value = '不收费';
} else {
value = value || '-';
}
}
//
if (col.key === 'cost' || col.key === 'unitPrice') {
value = typeof value === 'number' ? parseFloat(value.toFixed(2)) : value;
@ -858,6 +965,17 @@ export default {
}
},
//
calculateTotalCost(row) {
const leaseCost = Number(row.leaseCost) || 0;
const repairCost = Number(row.repairCost) || 0;
const loseCost = Number(row.loseCost) || 0;
const scrapCost = Number(row.scrapCost) || 0;
const reductionCost = Number(row.reductionCost) || 0;
return leaseCost + repairCost + loseCost + scrapCost - reductionCost;
},
},
}
</script>