// this.typeList // 源数据
// +this.currentItem.type 最后一个值
// this.initDeptArr(this.typeList, +this.currentItem.type)
this.formValidate.type = this.initDeptArr(this.typeList, node => node.value === +this.currentItem.type)
initDeptArr(tree, func, path = []) {
if (!tree) return []
for (const data of tree) {
path.push(data.value)
if (func(data)) return path
if (data.children) {
const findChildren = this.initDeptArr(data.children, func, path)
if (findChildren.length) return findChildren
}
path.pop()
}
return []
},
// initDeptArr(tree, currentValue) {
// tree.forEach(item => {
// if (item.value === currentValue) {
// this.formValidate.type = item.__value.split(',').map(Number)
// } else {
// if (item.children) {
// this.initDeptArr(item.children, +this.currentItem.type)
// }
// }
// })
// },
04-06
760