9/10
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user