This commit is contained in:
Zy
2026-09-10 16:12:22 +08:00
parent e8564269b0
commit 292ee1a6dd
68 changed files with 1397 additions and 757 deletions

View File

@@ -172,7 +172,10 @@
<template #header>
<div class="flex items-center justify-between">
<span>收费日报</span>
<el-button type="primary" @click="handleExport">导出</el-button>
<div>
<el-button type="primary" @click="handleExport">导出</el-button>
<el-button type="primary" @click="handleExportAll">导出所有</el-button>
</div>
</div>
</template>
<el-table v-loading="loading" :data="ArrearsDetailList" :row-class-name="handleRowClass" border>
@@ -483,7 +486,30 @@ const handleExport = () => {
proxy?.$modal.msgWarning('没有可导出的数据');
return;
}
handleExportDate(ArrearsDetailList.value);
};
/** 导出所有Excel */
const handleExportAll = () => {
let data = [];
const search = {
...queryParams.value
};
// 移除空字符串字段
Object.keys(search).forEach((key) => {
if (search[key] === '-1') {
search[key] = undefined;
}
});
getDailyFeeReportList(search)
.then((res) => {
data = [...(res.rows ?? [])];
handleExportDate(data);
})
.finally(() => {
loading.value = false;
});
};
const handleExportDate = (data: Datum[], title: string = '收费日报') => {
// 显示加载提示
loading.value = true;
// 使用 setTimeout 让出主线程,避免阻塞UI
@@ -548,7 +574,16 @@ const handleExport = () => {
// { label: '经办人', prop: 'inspectorName' },
// { label: '备注', prop: 'remark' }
];
exportToExcel(ArrearsDetailList.value, columns, `日报_${new Date().getTime()}`);
exportToExcel(data, columns, `${title}_${new Date().getTime()}`, undefined, ({ row }) => {
if (row.residentName === '当日合计') {
return {
fill: {
fgColor: { rgb: 'E2EFDA' },
patternType: 'solid'
}
};
}
});
} catch (error) {
proxy?.$modal.msgError('导出失败,请重试');
console.error('导出错误:', error);
@@ -557,6 +592,7 @@ const handleExport = () => {
}
}, 100);
};
onMounted(() => {
getList();
getHouseUseList();