班费管理页面修复

This commit is contained in:
yaojian
2026-03-11 16:57:19 +08:00
parent 4af5660df2
commit cb2280406e

View File

@@ -140,6 +140,13 @@
</el-tag>
<span v-else>-</span>
</template>
<!-- 学期班费结余列特殊模板 -->
<template v-else-if="col.prop === 'termBalance'" #default="scope">
<el-tag v-if="scope.row.termBalance !== null && scope.row.termBalance !== undefined" :type="scope.row.termBalance >= 0 ? 'success' : 'danger'" size="small" effect="plain" round>
¥{{ scope.row.termBalance.toFixed(2) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- 附件列特殊模板 -->
<template v-else-if="col.prop === 'attachment'" #default="scope">
<el-button v-if="scope.row.attachment" icon="Document" link type="primary" size="small" @click="handleViewAttachment(scope.row)">
@@ -328,6 +335,7 @@ const tableColumns = [
{ prop: 'operatTime', label: '发生时间', icon: Calendar, width: 180 },
{ prop: 'type', label: '类型', icon: Collection },
{ prop: 'money', label: '金额', icon: Money },
{ prop: 'termBalance', label: '学期班费结余', icon: Money, width: 120 },
{ prop: 'operator', label: '经办人', icon: User },
{ prop: 'purpose', label: '用途', icon: Document, minWidth: 150 },
{ prop: 'attachment', label: '附件', width: 100 },
@@ -345,7 +353,41 @@ const state: BasicTableProps = reactive<BasicTableProps>({
classCode: '',
type: '',
},
pageList: fetchList,
pageList: async (params: any) => {
const res = await fetchList(params);
// 后端返回数据结构IPage<ClassFeeLogRelationVO>
// ClassFeeLogRelationVO 包含 moneyTotal 和 classFeeLogVOList
if (res.data && res.data.records) {
// 展开所有班级的班费记录
const allRecords: any[] = [];
let totalMoney: number = 0;
res.data.records.forEach((item: any) => {
if (item.classFeeLogVOList && Array.isArray(item.classFeeLogVOList)) {
item.classFeeLogVOList.forEach((log: any) => {
allRecords.push({
...log,
moneyTotal: item.moneyTotal // 添加班费结余到每条记录
});
});
}
// 记录总班费结余
if (item.moneyTotal !== undefined) {
totalMoney = item.moneyTotal;
}
});
return {
...res,
data: {
records: allRecords,
total: allRecords.length,
moneyTotal: totalMoney // 保留总结余
}
};
}
return res;
},
props: {
item: 'records',
totalCount: 'total',