|
|
@@ -218,12 +218,8 @@ export default {
|
|
|
document.removeEventListener('click', this.closeContentMenu)
|
|
|
}
|
|
|
},
|
|
|
- onAddRoot () {
|
|
|
- this.node = { parentId: '0', name: '', org: this.group.path }
|
|
|
- this.$refs.nodeDialog.show()
|
|
|
- },
|
|
|
onAddChildNode () {
|
|
|
- this.node = { parentId: this.selectedNode.id, name: '', org: this.group.path }
|
|
|
+ this.node = { parentId: this.selectedNode.root ? '0' : this.selectedNode.id, name: '', org: this.group.path }
|
|
|
this.$refs.nodeDialog.show()
|
|
|
this.closeContentMenu()
|
|
|
},
|
|
|
@@ -248,11 +244,7 @@ export default {
|
|
|
} else {
|
|
|
addTreeNode(this.node).then(({ data }) => {
|
|
|
done()
|
|
|
- if (this.node.parentId === '0') {
|
|
|
- this.$refs.treeRef.append({ id: data, childrenNode: [], ...this.node })
|
|
|
- } else {
|
|
|
- this.$refs.treeRef.append({ id: data, childrenNode: [], ...this.node }, this.selectedNode)
|
|
|
- }
|
|
|
+ this.$refs.treeRef.append({ id: data, childrenNode: [], ...this.node }, this.selectedNode)
|
|
|
if (!this.$selectedVNode.expanded) {
|
|
|
this.$selectedComponent.handleExpandIconClick()
|
|
|
}
|