🐛 修复变更记录按提交批次汇总,临时额度-1显示为-
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -636,6 +636,12 @@ export default {
|
|||||||
}
|
}
|
||||||
const value = row[prop];
|
const value = row[prop];
|
||||||
if (value === undefined || value === null || value === '') return '-';
|
if (value === undefined || value === null || value === '') return '-';
|
||||||
|
if (
|
||||||
|
(prop === 'usedFundLimit' || prop === 'remainingFundLimit') &&
|
||||||
|
Number(value) === -1
|
||||||
|
) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
applyDetail(detail) {
|
applyDetail(detail) {
|
||||||
|
|||||||
@@ -164,8 +164,8 @@
|
|||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" width="120" fixed="right" align="center">
|
<el-table-column label="操作" width="120" fixed="right" align="center">
|
||||||
<template #default>
|
<template #default="{ row }">
|
||||||
<el-link type="primary" @click="openChangeRecordsDialog">查看详情</el-link>
|
<el-link type="primary" @click="openChangeRecordsDialog(row)">查看详情</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -1049,6 +1049,7 @@ export default {
|
|||||||
priceUnitLoading: false,
|
priceUnitLoading: false,
|
||||||
priceUnitRequest: null,
|
priceUnitRequest: null,
|
||||||
changeRows: [],
|
changeRows: [],
|
||||||
|
changeBatchRecords: [],
|
||||||
changePage: { current: 1, size: 10, total: 0 },
|
changePage: { current: 1, size: 10, total: 0 },
|
||||||
latestChangeRows: [],
|
latestChangeRows: [],
|
||||||
latestChangeLoading: false,
|
latestChangeLoading: false,
|
||||||
@@ -2030,34 +2031,64 @@ export default {
|
|||||||
this.latestChangeLoading = true;
|
this.latestChangeLoading = true;
|
||||||
this.latestChangeRows = [];
|
this.latestChangeRows = [];
|
||||||
try {
|
try {
|
||||||
const res = await api.getChangeRecords(1, 1, {
|
const res = await api.getChangeRecords(1, 1000, {
|
||||||
detailId: this.detailDialog.row.id,
|
detailId: this.detailDialog.row.id,
|
||||||
});
|
});
|
||||||
const data = this.unwrapPage(res);
|
const data = this.unwrapPage(res);
|
||||||
this.latestChangeRows = (data.records || []).slice(0, 1);
|
this.latestChangeRows = this.buildChangeRecordBatches(data.records || []);
|
||||||
} finally {
|
} finally {
|
||||||
this.latestChangeLoading = false;
|
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;
|
if (!this.detailDialog.row) return;
|
||||||
|
this.changeBatchRecords = Array.isArray(row?._batchRecords) ? row._batchRecords : [];
|
||||||
this.changeRecordsDialog.visible = true;
|
this.changeRecordsDialog.visible = true;
|
||||||
this.changePage.current = 1;
|
this.changePage.current = 1;
|
||||||
this.loadChangeRecords();
|
this.loadChangeRecords();
|
||||||
},
|
},
|
||||||
async loadChangeRecords() {
|
loadChangeRecords() {
|
||||||
if (!this.detailDialog.row) return;
|
const records = this.changeBatchRecords || [];
|
||||||
this.changeRecordsDialog.loading = true;
|
const size = Number(this.changePage.size) || 10;
|
||||||
try {
|
const current = Number(this.changePage.current) || 1;
|
||||||
const res = await api.getChangeRecords(this.changePage.current, this.changePage.size, {
|
const fromIndex = Math.max(0, (current - 1) * size);
|
||||||
detailId: this.detailDialog.row.id,
|
this.changeRows = records.slice(fromIndex, fromIndex + size);
|
||||||
});
|
this.changePage.total = records.length;
|
||||||
const data = this.unwrapPage(res);
|
|
||||||
this.changeRows = data.records || [];
|
|
||||||
this.changePage.total = data.total || 0;
|
|
||||||
} finally {
|
|
||||||
this.changeRecordsDialog.loading = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleChangeSizeChange() {
|
handleChangeSizeChange() {
|
||||||
this.changePage.current = 1;
|
this.changePage.current = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user