data(){
return{
treeBudgetSelect:[],
budgetIds:[3,4]
}
}
methods:{
this.setDisabled(this.treeBudgetSelect, this.budgetIds)
// 已经选择的不能编辑
setDisabled(treeData, key) {
key.forEach(k => {
const loop = (data) => {
for (const item of data) {
if (item.treedataid === k) {
item.disabled = true
break
}
if (item.childList && item.childList.length) {
loop(item.childList)
},
}
}
loop(treeData)
})
},
}