refactor: 优化用户导入和字典数据路由跳转逻辑

移除用户导入接口的deptId参数
使用downloadFile工具函数简化模板下载代码
增加字典数据路由跳转的错误处理
This commit is contained in:
Ray.Hao
2026-03-03 15:16:18 +08:00
parent cee65ba58d
commit 0fd1ff197e
3 changed files with 18 additions and 25 deletions

View File

@@ -288,10 +288,20 @@ function handleDelete(id?: number) {
// 打开字典数据
function handleOpenDictData(row: DictTypeItem) {
router.push({
name: "DictItem",
query: { dictCode: row.dictCode, title: `${row.name}】字典数据` },
});
try {
const route = router.resolve({
name: "DictItem",
query: { dictCode: row.dictCode, title: `${row.name}】字典数据` },
});
if (route.matched.length === 0) {
ElMessage.error("路由未注册,请刷新页面后重试");
return;
}
router.push(route);
} catch (error) {
console.error("路由跳转失败:", error);
ElMessage.error("页面跳转失败,请刷新页面后重试");
}
}
onMounted(() => {