feat(报表): 重构报表模块并添加下载功能
Some checks failed
Close stale issues / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled

重构各报表页面,提取公共逻辑到useMonthReport和MonthReportView组件
添加报表下载功能,支持单月下载和全年下载
统一各报表的API调用方式和数据处理逻辑
优化代码结构,减少重复代码
This commit is contained in:
2026-01-22 18:29:53 +08:00
parent be5078ae0d
commit 5c39bd4113
12 changed files with 632 additions and 551 deletions

View File

@@ -55,10 +55,7 @@ export function downloadFileFromBase64({ fileName, source }: DownloadOptions) {
/**
* 通过图片 URL 下载图片文件
*/
export async function downloadFileFromImageUrl({
fileName,
source,
}: DownloadOptions) {
export async function downloadFileFromImageUrl({ fileName, source }: DownloadOptions) {
const base64 = await urlToBase64(source);
downloadFileFromBase64({ fileName, source: base64 });
}
@@ -87,9 +84,7 @@ export function downloadFileFromBlobPart({
}: DownloadOptions<BlobPart>): void {
// 如果 data 不是 Blob则转换为 Blob
const blob =
source instanceof Blob
? source
: new Blob([source], { type: 'application/octet-stream' });
source instanceof Blob ? source : new Blob([source], { type: 'application/octet-stream' });
// 创建对象 URL 并触发下载
const url = URL.createObjectURL(blob);