|
@@ -7,6 +7,9 @@ class TreeNodeDTO:
|
|
id: int
|
|
id: int
|
|
name: str
|
|
name: str
|
|
pId: int
|
|
pId: int
|
|
|
|
+ icon: str = ""
|
|
|
|
+ iconOpen: str = ""
|
|
|
|
+ iconClose: str = ""
|
|
|
|
|
|
@dataclass
|
|
@dataclass
|
|
class TreeDTO:
|
|
class TreeDTO:
|
|
@@ -64,12 +67,20 @@ def add_tree(nodes: List[TreeNodeDTO], tree_obj: Dict, path_id_map: Dict[str, in
|
|
|
|
|
|
# 判断是否为叶子节点
|
|
# 判断是否为叶子节点
|
|
is_leaf = not tree_obj.get('sNode', [])
|
|
is_leaf = not tree_obj.get('sNode', [])
|
|
|
|
+
|
|
|
|
+ # 设置图标
|
|
|
|
+ icon = "/images/node.png" if is_leaf else "/images/icon.png"
|
|
|
|
+ icon_open = "" if is_leaf else "/images/iconOpen.png"
|
|
|
|
+ icon_close = "" if is_leaf else "/images/iconClose.png"
|
|
|
|
|
|
# 创建树节点
|
|
# 创建树节点
|
|
node = TreeNodeDTO(
|
|
node = TreeNodeDTO(
|
|
id=current_id,
|
|
id=current_id,
|
|
name=tree_obj['name'],
|
|
name=tree_obj['name'],
|
|
- pId=parent_id
|
|
|
|
|
|
+ pId=parent_id,
|
|
|
|
+ icon=icon,
|
|
|
|
+ iconOpen=icon_open,
|
|
|
|
+ iconClose=icon_close
|
|
)
|
|
)
|
|
nodes.append(node)
|
|
nodes.append(node)
|
|
|
|
|