function bindkey(element,bool=false,parent) {
element.forEach((el) => {
el.disabled = bool
el.parent = parent
if (el.children) {
bindkey(el.children,bool,el);
}
});
}
const getOrgTree = () => {
queryTree('3').then((res) => {
bindkey(res.data)
orgList.value = res.data;
});
};
function uncheck(element) {
element.forEach((el) => {
proxy.$refs['orgRef'].setChecked(el,false)
if (el.children) {
uncheck(el.children);
}
});
}
<el-tree :data="orgList" :props="orgTreeProp" show-checkbox check-strictly @check="check" ref="orgRef" node-key="orgCode"/>
function check(data, obj){
let checkedKeys = obj.checkedKeys
let bool = checkedKeys.indexOf(data.orgCode) > -1
if(data.children){
bindkey(data.children,bool)
uncheck(data.children)
}
}