调整结算

This commit is contained in:
2026-09-05 00:04:46 +08:00
parent 96f2fa0eb5
commit 3bac9b6472
11 changed files with 688 additions and 352 deletions
@@ -82,7 +82,12 @@
添加费用
</el-button>
</template>
<el-table :data="summaryFees" border>
<el-table
:data="summaryFees"
border
show-summary
:summary-method="getSummarySums"
>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column
v-for="column in summaryColumns"
@@ -161,9 +166,6 @@
</template>
</el-table-column>
</el-table>
<div class="pre-settlement-editor__summary-total">
合计:{{ formatMoney(summaryTotal, form.currency) }}
</div>
</section-card>
<section-card title="结算明细">
@@ -298,12 +300,12 @@
</section-card>
<section-card title="附件">
<template #extra>
<el-button type="primary" :disabled="!attachments.length" @click="downloadAttachments">
批量下载
</el-button>
</template>
<div class="pre-settlement-editor__attachment">
<div class="pre-settlement-editor__attachment-actions">
<el-button type="primary" :disabled="!attachments.length" @click="downloadAttachments">
批量下载
</el-button>
</div>
<el-table :data="attachments" border @selection-change="handleAttachmentSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" />
@@ -846,6 +848,7 @@
</template>
<script>
import { h } from 'vue';
import { mapGetters } from 'vuex';
import { InfoFilled } from '@element-plus/icons-vue';
import {
@@ -1506,6 +1509,19 @@ export default {
if (Number(row.manualFlag) !== 1) return;
row.settlementAmount = Number(row.originalAmount || 0) + Number(row.adjustAmount || 0);
},
getSummarySums({ columns, data }) {
const sumProps = ['originalAmount', 'adjustAmount', 'settlementAmount'];
return columns.map((column, index) => {
if (index === 0) return '合计';
if (!sumProps.includes(column.property)) return '';
const total = data.reduce((sum, row) => sum + Number(row[column.property] || 0), 0);
const totalText = this.formatMoney(total, this.form.currency);
if (column.property === 'adjustAmount' && total < 0) {
return h('span', { style: { color: 'var(--el-color-danger)' } }, totalText);
}
return totalText;
});
},
buildSummaryFeesFromDetails() {
const summaryMap = new Map();
const defaultFreightItem =
@@ -1630,9 +1646,9 @@ export default {
this.details.push(this.normalizeSourceDetail(row));
}
});
this.buildSummaryFeesFromDetails();
this.candidateDialog.confirming = true;
if (this.deferSave) {
this.buildSummaryFeesFromDetails();
if (this.deferSave || (this.pageMode && !this.form.id)) {
this.candidateDialog.visible = false;
this.candidateDialog.confirming = false;
this.$message.success('结算明细添加成功,请点击保存提交');
@@ -1678,10 +1694,6 @@ export default {
const isPersistedDetail =
row.id && sourceDetailId && String(row.id) !== String(sourceDetailId);
if (isPersistedDetail) return row;
if (this.deferSave) {
this.$message.warning('请先保存预结算单后再调整结算明细');
return null;
}
await this.$refs.formRef?.validate();
this.loading = true;
@@ -2136,14 +2148,6 @@ export default {
}
}
&__attachment-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
margin-bottom: 12px;
}
&__attachment-upload {
display: flex;
justify-content: flex-start;
@@ -2158,12 +2162,6 @@ export default {
}
}
&__summary-total {
padding: 12px 16px 0;
text-align: right;
font-weight: 600;
}
&__negative-amount {
color: var(--el-color-danger);
}