加入辅料备件

This commit is contained in:
2026-01-20 15:20:19 +08:00
parent 9eceebb637
commit 5efe8c730c
6 changed files with 208 additions and 8 deletions

View File

@@ -39,15 +39,15 @@
<el-col :xs="24" :md="6">
<div class="summary-card">
<div class="label">辅料成本</div>
<div class="value">¥ 0.00</div>
<div class="desc">暂不计</div>
<div class="value">¥ {{ formatNumber(materialSummary.auxCost, 2) }}</div>
<div class="desc">备件 ¥ {{ formatNumber(materialSummary.spareCost, 2) }}</div>
</div>
</el-col>
<el-col :xs="24" :md="6">
<div class="summary-card highlight">
<div class="label">总成本</div>
<div class="value">¥ {{ formatNumber(totalCost, 2) }}</div>
<div class="desc">能源 + 囤积 + 辅料</div>
<div class="desc">能源 + 囤积 + 辅料 + 备件</div>
</div>
</el-col>
</el-row>
@@ -65,6 +65,12 @@
<el-table-column prop="stockCost" label="囤积成本(当日)">
<template slot-scope="scope">¥ {{ formatNumber(scope.row.stockCost, 2) }}</template>
</el-table-column>
<el-table-column prop="auxCost" label="辅料成本">
<template slot-scope="scope">¥ {{ formatNumber(scope.row.auxCost, 2) }}</template>
</el-table-column>
<el-table-column prop="spareCost" label="备件成本">
<template slot-scope="scope">¥ {{ formatNumber(scope.row.spareCost, 2) }}</template>
</el-table-column>
<el-table-column prop="totalCost" label="总成本">
<template slot-scope="scope">¥ {{ formatNumber(scope.row.totalCost, 2) }}</template>
</el-table-column>
@@ -192,6 +198,10 @@ export default {
totalNetWeight: 0,
totalGrossWeight: 0
},
materialSummary: {
auxCost: 0,
spareCost: 0
},
energyLoading: false,
stockLoading: false,
detailVisible: false,
@@ -204,7 +214,9 @@ export default {
totalCost() {
const energy = Number(this.energySummary.totalEnergyCost) || 0
const stock = Number(this.stockSummary.todayCost ?? this.stockSummary.totalCost) || 0
return energy + stock
const aux = Number(this.materialSummary.auxCost) || 0
const spare = Number(this.materialSummary.spareCost) || 0
return energy + stock + aux + spare
}
},
mounted() {
@@ -246,6 +258,12 @@ export default {
fetchCoilTotalMerged(params).then(res => {
this.mergedRows = res.rows || []
this.mergedTotal = res.total || 0
const rows = this.mergedRows || []
this.materialSummary = {
auxCost: rows.reduce((sum, r) => sum + (Number(r.auxCost) || 0), 0),
spareCost: rows.reduce((sum, r) => sum + (Number(r.spareCost) || 0), 0)
}
})
},
loadEnergy() {