Bläddra i källkod

🐛 fix(components): 修复地区树选择组件层级显示问题

- 修改树形数据格式化逻辑,支持三级地区层级显示
- 递归处理子节点数据,确保所有层级地区都能正确渲染
yourname 8 månader sedan
förälder
incheckning
677fff18f5
1 ändrade filer med 10 tillägg och 1 borttagningar
  1. 10 1
      src/client/admin/components/AreaTreeSelect.tsx

+ 10 - 1
src/client/admin/components/AreaTreeSelect.tsx

@@ -79,7 +79,16 @@ const AreaTreeSelect: React.FC<AreaTreeSelectProps> = ({
       title: child.name,
       value: child.id,
       key: child.id,
-      children: child.children?.length ? formattedTreeData : undefined
+      children: child.children?.map(subChild => ({
+        title: subChild.name,
+        value: subChild.id,
+        key: subChild.id,
+        children: subChild.children?.map(subSubChild => ({
+          title: subSubChild.name,
+          value: subSubChild.id,
+          key: subSubChild.id
+        }))
+      }))
     }))
   }));