refactor: 优化通用组件实现与工具类型

- src/components/DictSelect: 改用 defineModel 与 computed,修复选项加载时清空已选值与父子值分叉
- src/components/ThemeSwitcher: ThemeSwitch 改名,修正 theneList 拼写
- src/composables/useTableSelection: 显式判空,避免 id 为 0 的行被过滤
- src/utils/download: 收窄入参类型,headers 改为可选
- src/api/system/user: 导出与模板下载接口声明 Blob 响应类型
- src/views/system/dict: 标签类型选项排除空串,el-tag 去掉 as any
- src/views/system/user/components/UserImportDialog: 去掉响应类型的 any 标注
- src/layouts、src/views/login: 删除可自动导入组件的冗余 import
This commit is contained in:
Ray.Hao
2026-09-01 07:26:09 +08:00
parent cf5768dbf4
commit c9bd327fc0
12 changed files with 158 additions and 132 deletions

View File

@@ -34,7 +34,9 @@ export function useTableSelection<T extends { id?: string | number }>() {
* @param selection 选中的行数据列表
*/
function handleSelectionChange(selection: T[]): void {
selectedIds.value = selection.flatMap((item) => (item.id ? [item.id] : []));
selectedIds.value = selection.flatMap((item) =>
item.id === undefined || item.id === null ? [] : [item.id]
);
}
/**