feat: 重构前端项目结构并优化代码

refactor: 迁移前端资源文件至web目录
feat: 新增多种图标资源
style: 统一代码风格和格式化配置
docs: 更新README和文档说明
chore: 更新依赖和配置文件
fix: 修复部分类型定义和枚举
perf: 优化路由和组件加载逻辑
This commit is contained in:
zhangtao
2026-05-01 01:01:17 +08:00
parent 1355a09441
commit 80263e98e1
887 changed files with 116349 additions and 33825 deletions
+30
View File
@@ -0,0 +1,30 @@
/**
* 按分页拉取全量列表(用于 ExportModal 等「全量数据」场景)
*/
export async function fetchAllPages<T>(options: {
/** 每页条数,默认 1000 */
pageSize?: number;
/** 初始查询条件(会拷贝后写入 page_no / page_size) */
initialQuery: Record<string, unknown>;
/** 页码字段名,默认 page_no */
pageNoKey?: string;
/** 每页条数字段名,默认 page_size */
pageSizeKey?: string;
/** 拉取一页,返回 total 与 list */
fetchPage: (query: Record<string, unknown>) => Promise<{ total: number; list: T[] }>;
}): Promise<T[]> {
const pageSize = options.pageSize ?? 1000;
const pageNoKey = options.pageNoKey ?? 'page_no';
const pageSizeKey = options.pageSizeKey ?? 'page_size';
const query = { ...options.initialQuery };
query[pageNoKey] = 1;
query[pageSizeKey] = pageSize;
const all: T[] = [];
while (true) {
const { total, list } = await options.fetchPage(query);
all.push(...list);
if (all.length >= total || list.length === 0) break;
query[pageNoKey] = (query[pageNoKey] as number) + 1;
}
return all;
}