<el-tree
:data="treeData"
:props="defaultProps"
node-key="id"
v-model="pointRadio"
ref="treeForm"
:filter-node-method="filterNode"
:check-strictly="true"
@node-click="nodeClick"
:render-content="renderContent"
>
</el-tree>
computed: {
pointRadio: {
set(val) {
this.$emit('update:point-idx', this.pointsList.findIndex(item => item.id === +val));
},
get() {
this.pointsList.forEach((item,index) => {
item.label = item.addr;
let obj = this.treeData.findIndex(data => data.label && data.label === item.deptname);
if(obj !== -1){
this.treeData[obj].children.push(item);
}else{
let newData = {
id: String(this.treeData.length),
children: [{...item}],
label: item.deptname,
pointIdx: item.id
};
this.treeData.push(newData);
}
});
}
},
},
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…