|
@@ -1,7 +1,42 @@
|
|
|
<template>
|
|
|
- <div>user</div>
|
|
|
+ <hc-body split>
|
|
|
+ <template #left>
|
|
|
+ <hc-card scrollbar>
|
|
|
+ <template #header>
|
|
|
+ <el-input v-model="treeKeyFilter" placeholder="请输入关键字进行过滤" />
|
|
|
+ </template>
|
|
|
+ <hc-lazy-tree :h-props="treeProps" @load="treeLoadNode">
|
|
|
+ <template #default="{ node }">{{ node.label }}</template>
|
|
|
+ </hc-lazy-tree>
|
|
|
+ </hc-card>
|
|
|
+ </template>
|
|
|
+ <hc-card>
|
|
|
+ 其它内容
|
|
|
+ </hc-card>
|
|
|
+ </hc-body>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { getArrValue } from 'js-fast-way'
|
|
|
import { nextTick, onActivated, ref } from 'vue'
|
|
|
+import deptApi from '~api/system/dept'
|
|
|
+
|
|
|
+onActivated(()=> {
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+//数据格式
|
|
|
+const treeKeyFilter = ref('')
|
|
|
+const treeProps = {
|
|
|
+ label: 'title',
|
|
|
+ children: 'children',
|
|
|
+ isLeaf: (item) => {
|
|
|
+ return !item.hasChildren
|
|
|
+ },
|
|
|
+}
|
|
|
+const treeLoadNode = async ({ item, level }, resolve) => {
|
|
|
+ const parentId = level === 0 ? 0 : item.id
|
|
|
+ const { data } = await deptApi.getDeptLazyTree(parentId)
|
|
|
+ resolve(getArrValue(data))
|
|
|
+}
|
|
|
</script>
|