mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-04 17:14:21 +00:00
feat: 添加多语言支持及资源文件更新
- 添加日语、中文、泰语等多语言支持文件 - 更新静态资源文件包括图片和样式表 - 重构菜单权限树组件,修复父子节点联动问题 - 优化在线用户管理功能,使用会话ID替代用户名 - 更新数据库配置,默认使用MySQL - 重构文档系统,将mkdocs迁移至backend目录 - 修复Redis哈希操作接口 - 更新前端工具函数,优化列表转树形结构逻辑 - 调整端口配置和环境变量 - 添加开发运维文档和部署脚本 本次提交主要实现了多语言支持、资源文件更新和多个功能优化,同时改进了系统文档结构和部署配置。
This commit is contained in:
+32
-11
@@ -105,19 +105,40 @@ export function save_token(access_token, refresh_token, expires_in) {
|
||||
storage.set("Refresh-Token", refresh_token);
|
||||
}
|
||||
|
||||
// export function listToTree(list) {
|
||||
// let resultList = list.filter((item) => {
|
||||
// let children = list.filter((child) => {
|
||||
// return item.id === child.parent_id;
|
||||
// });
|
||||
// if (children.length > 0) {
|
||||
// item.children = children;
|
||||
// }
|
||||
// return item.parent_id === null;
|
||||
// });
|
||||
// return cloneDeep(resultList);
|
||||
// }
|
||||
export function listToTree(list) {
|
||||
let resultList = list.filter((item) => {
|
||||
let children = list.filter((child) => {
|
||||
return item.id === child.parent_id;
|
||||
});
|
||||
if (children.length > 0) {
|
||||
item.children = children;
|
||||
}
|
||||
return item.parent_id === null;
|
||||
});
|
||||
return cloneDeep(resultList);
|
||||
}
|
||||
const map = {};
|
||||
// 创建映射表,保留每个节点的 parent_id 等原始字段
|
||||
list.forEach(item => map[item.id] = { ...item });
|
||||
|
||||
const tree = [];
|
||||
list.forEach(item => {
|
||||
const parentId = item.parent_id;
|
||||
if (parentId && map[parentId]) {
|
||||
// 将当前节点加入其父节点的 children 数组中
|
||||
if (!map[parentId].children) {
|
||||
map[parentId].children = [];
|
||||
}
|
||||
map[parentId].children.push(map[item.id]);
|
||||
} else if (parentId === null || parentId === undefined) {
|
||||
// 根节点
|
||||
tree.push(map[item.id]);
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
}
|
||||
export function cloneDeep(obj) {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user