<el-tree
empty-text="暂无组织"
:data="dptLists" #列表数据
node-key="dptId" #为查询出来的列表中的属性字段
:current-node-key="currentLivingId"
:default-expand-all="true"
:expand-on-click-node="false"
:props="defaultProps" #节点配置
@check-on-click-node="true"
:highlight-current="true" #高亮显示
ref="dptTree"
:default-checked-keys="[1]" #默认选中的节点
@node-click="selectEmployees" #点击节点触发的函数
></el-tree>
data(){
return{
currentLivingId: 0,
defaultProps: {
children: "childrenList",
label: "dptName"
},
}
}
getDptInfo() {
const wecomDpt = {
pDptId: 0
};
getDptList(wecomDpt)
.then(res => {
this.dptLists = res.meta.responseMap.dptList;
this.currentLivingId = this.dptId == "" ? res.meta.responseMap.dptList[0].dptId : this.dptId;
this.$nextTick(function () {
this.$refs["dptTree"].setCurrentKey(this.currentLivingId);
});
this.selectEmployee();
})
.catch(error => {
console.log(error);
});
},