feat(product): 新增产品管理模块与字典组件功能

- 新增产品管理相关路由和页面(dashboard、list、requirement、setting)
- 实现产品基础信息编辑弹窗组件(base-info-dialog.vue)
- 添加运行时字典功能(dict-select、dict-text、dict-tag组件)
- 集成字典管理store和API调用
- 规范ID类型定义为string避免精度丢失问题
- 完善国际化资源文件支持中英文对照
- 新增对象上下文业务域入口页导航实现说明
- 添加Vue DevTools浮动入口注释说明
- 统一权限控制支持全局和对象作用域区分
- 规范分页查询参数类型定义与使用方式
This commit is contained in:
2026-04-23 09:05:55 +08:00
parent c5911ea34b
commit 4122dfa50d
95 changed files with 9581 additions and 801 deletions

View File

@@ -1,12 +1,14 @@
type TreeNodeId = string | number;
type TreeNode = {
id: number;
parentId: number;
id: TreeNodeId;
parentId: TreeNodeId;
sort?: number | null;
children?: TreeNode[] | null;
};
export function buildMenuTree<T extends TreeNode>(list: T[]) {
const nodeMap = new Map<number, T>();
const nodeMap = new Map<TreeNodeId, T>();
const roots: T[] = [];
list.forEach(item => {
@@ -17,7 +19,7 @@ export function buildMenuTree<T extends TreeNode>(list: T[]) {
});
nodeMap.forEach(node => {
if (node.parentId === 0) {
if (isRootParentId(node.parentId)) {
roots.push(node);
return;
}
@@ -35,17 +37,17 @@ export function buildMenuTree<T extends TreeNode>(list: T[]) {
return sortMenuTree(roots);
}
export function collectDescendantIds<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], targetId: number) {
export function collectDescendantIds<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], targetId: T['id']) {
const target = findTreeNode(nodes, targetId);
if (!target?.children?.length) {
return [];
}
const ids: number[] = [];
const ids: T['id'][] = [];
walkTree(target.children, item => {
ids.push(item.id);
ids.push(item.id as T['id']);
});
return ids;
@@ -63,7 +65,7 @@ function sortMenuTree<T extends TreeNode>(nodes: T[]) {
return sortedNodes;
}
function findTreeNode<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], targetId: number): T | null {
function findTreeNode<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], targetId: T['id']): T | null {
for (const node of nodes) {
if (node.id === targetId) {
return node;
@@ -81,6 +83,10 @@ function findTreeNode<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], t
return null;
}
function isRootParentId(parentId: TreeNodeId) {
return parentId === 0 || parentId === '0';
}
function walkTree<T extends Pick<TreeNode, 'id' | 'children'>>(nodes: T[], callback: (node: T) => void) {
for (const node of nodes) {
callback(node);