diff --git a/src/utils/list-to-treedata.js b/src/utils/list-to-treedata.js
new file mode 100644
index 0000000..a99bf6b
--- /dev/null
+++ b/src/utils/list-to-treedata.js
@@ -0,0 +1,16 @@
+export function listToTreeData(list, currentPid) {
+ const res = []
+ list.forEach(item => {
+ if (item.pid === currentPid) {
+ // 对于找出来的子节点, 都要再找它的下一级
+ // 把当前的item.id 作为下一层的 pid
+ const children = listToTreeData(list, item.id)
+ // 什么时候停止, 找不到下一级的时候停止
+ if (children.length > 0) {
+ item.children = children
+ }
+ res.push(item)
+ }
+ })
+ return res
+}
diff --git a/src/views/departments/index.vue b/src/views/departments/index.vue
index cea86d9..19a3ab4 100644
--- a/src/views/departments/index.vue
+++ b/src/views/departments/index.vue
@@ -18,6 +18,7 @@
-