|
@@ -1833,9 +1833,13 @@
|
|
|
<!-- 详细费用 -->
|
|
|
<el-dialog :title="`${otherExpensesRow.projectName}支出明细(元)`" :visible.sync="otherExpensesVisable" width="800px" top="5.6vh" :before-close="handleClose">
|
|
|
<div>
|
|
|
- <el-table :data="otherExpensesRow.projectExpenseFeeList" height="50vh" border style="width: 100%">
|
|
|
+ <el-table :data="otherExpensesRow.projectExpenseFeeList" height="50vh" border style="width: 100%" show-summary :summary-method="expensesSummaries">
|
|
|
<el-table-column prop="typeName" align="center" label="名称"></el-table-column>
|
|
|
- <el-table-column prop="amount" align="center" label="费用(元)"></el-table-column>
|
|
|
+ <el-table-column prop="amount" align="center" label="费用(元)">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ (scope.row.amount || 0).toFixed(2) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -2198,6 +2202,29 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ expensesSummaries(param) {
|
|
|
+ const { columns, data } = param;
|
|
|
+ const sums = [];
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '总计';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = data.map(item => Number(item[column.property]));
|
|
|
+ if (!values.every(value => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index] = (sums[index]).toFixed(2)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
showOtherExpensesClick(row) {
|
|
|
console.log(row, '<====== showOtherExpensesClick')
|
|
|
this.otherExpensesRow = {
|