🐛 修复变更记录按提交批次汇总,临时额度-1显示为-

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 10:58:42 +08:00
parent cdd30b8211
commit 18aeb08c90
2 changed files with 55 additions and 18 deletions
@@ -636,6 +636,12 @@ export default {
}
const value = row[prop];
if (value === undefined || value === null || value === '') return '-';
if (
(prop === 'usedFundLimit' || prop === 'remainingFundLimit') &&
Number(value) === -1
) {
return '-';
}
return value;
},
applyDetail(detail) {
@@ -164,8 +164,8 @@
show-overflow-tooltip
/>
<el-table-column label="操作" width="120" fixed="right" align="center">
<template #default>
<el-link type="primary" @click="openChangeRecordsDialog">查看详情</el-link>
<template #default="{ row }">
<el-link type="primary" @click="openChangeRecordsDialog(row)">查看详情</el-link>
</template>
</el-table-column>
</el-table>
@@ -1049,6 +1049,7 @@ export default {
priceUnitLoading: false,
priceUnitRequest: null,
changeRows: [],
changeBatchRecords: [],
changePage: { current: 1, size: 10, total: 0 },
latestChangeRows: [],
latestChangeLoading: false,
@@ -2030,34 +2031,64 @@ export default {
this.latestChangeLoading = true;
this.latestChangeRows = [];
try {
const res = await api.getChangeRecords(1, 1, {
const res = await api.getChangeRecords(1, 1000, {
detailId: this.detailDialog.row.id,
});
const data = this.unwrapPage(res);
this.latestChangeRows = (data.records || []).slice(0, 1);
this.latestChangeRows = this.buildChangeRecordBatches(data.records || []);
} finally {
this.latestChangeLoading = false;
}
},
openChangeRecordsDialog() {
buildChangeRecordBatches(records = []) {
const batchMap = new Map();
records.forEach(record => {
const batchKey = record.adjustTime || '';
if (!batchMap.has(batchKey)) {
batchMap.set(batchKey, []);
}
batchMap.get(batchKey).push(record);
});
return Array.from(batchMap.entries()).map(([batchKey, batchRecords]) => {
const first = batchRecords[0] || {};
const lineNos = [
...new Set(batchRecords.map(item => item.lineNo).filter(value => value !== undefined && value !== null && value !== '')),
];
const cargoNames = [
...new Set(
batchRecords.map(item => item.cargoName).filter(value => value !== undefined && value !== null && value !== '')
),
];
const changeContents = batchRecords
.map(item => item.changeContent)
.filter(value => value !== undefined && value !== null && value !== '');
return {
...first,
lineNo: lineNos.join('、'),
cargoName: cargoNames.join('、'),
changeContent: changeContents.join(';'),
adjustUserName: first.adjustUserName,
adjustReason: first.adjustReason,
adjustTime: first.adjustTime || batchKey,
_batchKey: batchKey,
_batchRecords: batchRecords,
};
});
},
openChangeRecordsDialog(row) {
if (!this.detailDialog.row) return;
this.changeBatchRecords = Array.isArray(row?._batchRecords) ? row._batchRecords : [];
this.changeRecordsDialog.visible = true;
this.changePage.current = 1;
this.loadChangeRecords();
},
async loadChangeRecords() {
if (!this.detailDialog.row) return;
this.changeRecordsDialog.loading = true;
try {
const res = await api.getChangeRecords(this.changePage.current, this.changePage.size, {
detailId: this.detailDialog.row.id,
});
const data = this.unwrapPage(res);
this.changeRows = data.records || [];
this.changePage.total = data.total || 0;
} finally {
this.changeRecordsDialog.loading = false;
}
loadChangeRecords() {
const records = this.changeBatchRecords || [];
const size = Number(this.changePage.size) || 10;
const current = Number(this.changePage.current) || 1;
const fromIndex = Math.max(0, (current - 1) * size);
this.changeRows = records.slice(fromIndex, fromIndex + size);
this.changePage.total = records.length;
},
handleChangeSizeChange() {
this.changePage.current = 1;