通讯录-默认组织架构-默认打开一级

main
ysn 7 days ago
parent de98c91a68
commit 7c7a6b5904
  1. 15
      src/views/contacts/index.vue

@ -16,7 +16,7 @@
ref="orgTree" ref="orgTree"
:data="treeData" :data="treeData"
:props="treeProps" :props="treeProps"
default-expand-all :default-expanded-keys="defaultExpandedKeys"
highlight-current highlight-current
node-key="id" node-key="id"
@node-click="handleNodeClick" @node-click="handleNodeClick"
@ -143,6 +143,7 @@ export default {
return { return {
treeData: [], treeData: [],
treeProps: { label: "name", children: "child" }, treeProps: { label: "name", children: "child" },
defaultExpandedKeys: [],
currentGroupId: null, currentGroupId: null,
currentStructureName: "", currentStructureName: "",
memberList: [], memberList: [],
@ -200,7 +201,9 @@ export default {
async fetchOrgTree() { async fetchOrgTree() {
try { try {
const { data } = await getGroupsList(); const { data } = await getGroupsList();
this.treeData =data.list this.treeData = data.list;
//
this.defaultExpandedKeys = this.treeData.map((node) => node.id);
if (!this.userGroupId) return; if (!this.userGroupId) return;
const parentKeys = this.findParentKeys(this.treeData, this.userGroupId); const parentKeys = this.findParentKeys(this.treeData, this.userGroupId);
this.$nextTick(() => { this.$nextTick(() => {
@ -447,6 +450,14 @@ export default {
flex-shrink: 0; flex-shrink: 0;
} }
} }
.load-more {
padding: 12px;
text-align: center;
.loading-text {
font-size: 12px;
color: #909399;
}
}
} }
} }
// //

Loading…
Cancel
Save