提交 c63df3f7 authored 作者: lidongxu's avatar lidongxu

refactor(dept): 部门默认展开第一级

同上
上级 89f60d93
...@@ -295,5 +295,4 @@ getList() ...@@ -295,5 +295,4 @@ getList()
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
:data="deptList" :data="deptList"
row-key="deptId" row-key="deptId"
:default-expand-all="isExpandAll" :default-expand-all="isExpandAll"
:expand-row-keys="defaultExpandList"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column prop="deptName" <el-table-column prop="deptName"
label="部门名称" label="部门名称"
...@@ -202,8 +203,9 @@ ...@@ -202,8 +203,9 @@
const showSearch = ref(true); const showSearch = ref(true);
const title = ref(""); const title = ref("");
const deptOptions = ref([]); const deptOptions = ref([]);
const isExpandAll = ref(true); const isExpandAll = ref(false);
const refreshTable = ref(true); const refreshTable = ref(true);
const defaultExpandList = ref([1]) // 默认展开的节点 keys 集合
const data = reactive({ const data = reactive({
form: {}, form: {},
...@@ -228,6 +230,7 @@ ...@@ -228,6 +230,7 @@
listDept(queryParams.value).then(response => { listDept(queryParams.value).then(response => {
deptList.value = proxy.handleTree(response.data, "deptId"); deptList.value = proxy.handleTree(response.data, "deptId");
defaultExpandList.value.push(response.data[0].deptId + '')
loading.value = false; loading.value = false;
}); });
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论