|
|
@ -122,24 +122,27 @@ export default { |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
if (this.eventDetailCopy.parentCategoryId) { |
|
|
|
let pids = this.eventDetailCopy.parentCategoryId.split(','); |
|
|
|
pids.push(this.eventDetailCopy.categoryId) |
|
|
|
pids.forEach(id => { |
|
|
|
let node = this.buildTree(this.casOptions, toString(id)); |
|
|
|
this.selCategoryArray.push(node) |
|
|
|
}); |
|
|
|
let node = this.buildTree(this.casOptions, this.eventDetailCopy.categoryId); |
|
|
|
this.selCategoryArray.push(node); |
|
|
|
const pids = this.eventDetailCopy.parentCategoryId.split(','); |
|
|
|
pids.push(this.eventDetailCopy.categoryId); |
|
|
|
let nodes = this.casOptions; |
|
|
|
for (let i = 0; i < pids.length; i++) { |
|
|
|
nodes = this.buildNode(nodes,pids[i]) |
|
|
|
} |
|
|
|
if(nodes){ |
|
|
|
this.formData.categoryList.push(nodes) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
buildTree(nodes, treeId) { |
|
|
|
nodes.forEach(item => { |
|
|
|
if (treeId === item.id) { |
|
|
|
return item; |
|
|
|
} else { |
|
|
|
this.buildTree(item.children, treeId) |
|
|
|
buildNode(nodes, treeId) { |
|
|
|
for(let i = 0; i < nodes.length; i++){ |
|
|
|
if (nodes[i].id === treeId) { |
|
|
|
if(nodes[i].children){ |
|
|
|
return nodes[i].children |
|
|
|
}else { |
|
|
|
return nodes[i] |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleChangeCate(value) { |
|
|
|
if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) { |
|
|
@ -148,7 +151,7 @@ export default { |
|
|
|
} else { |
|
|
|
this.selCateObj = {} |
|
|
|
} |
|
|
|
if(!value) return |
|
|
|
if (!value) return |
|
|
|
this.selCategoryArray = value |
|
|
|
}, |
|
|
|
//重构树,去除网格 |
|
|
|