|
|
@@ -24,6 +24,7 @@
|
|
|
:key=item.id
|
|
|
:groupNode="item"
|
|
|
:level="1"
|
|
|
+ @addGroup="onRequestForAddGroupLevel2"
|
|
|
@renameScene="onRenameScene"
|
|
|
@deleteScene="onDeleteScene"
|
|
|
@renameGroup="onRenameGroup"
|
|
|
@@ -219,6 +220,7 @@ export default {
|
|
|
|
|
|
addGroupLevel: 0, // 0: 没有在新增分组;1:在新增一级分组;2:在新增二级分组
|
|
|
newGroupName: '',
|
|
|
+ parentGroupId: '',
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -308,10 +310,27 @@ export default {
|
|
|
newGroupLevel2Id,
|
|
|
name: '默认二级分组',
|
|
|
})
|
|
|
+ } else if (this.addGroupLevel === 2) {
|
|
|
+ let id = 'c_' + this.$randomWord(true, 8, 8)
|
|
|
+ let parent = this.info.catalogRoot.find((item) => {
|
|
|
+ return item.id === this.parentGroupId
|
|
|
+ })
|
|
|
+ parent.children.push(id);
|
|
|
+ const newGroupLevel2 = {
|
|
|
+ id,
|
|
|
+ name: this.newGroupName,
|
|
|
+ }
|
|
|
+ this.info.catalogs.push(newGroupLevel2);
|
|
|
}
|
|
|
this.$msg.success("操作成功")
|
|
|
+ this.newGroupName = ''
|
|
|
+ this.parentGroupId = ''
|
|
|
this.addGroupLevel = 0
|
|
|
},
|
|
|
+ onRequestForAddGroupLevel2(parentGroupId) {
|
|
|
+ this.addGroupLevel = 2
|
|
|
+ this.parentGroupId = parentGroupId
|
|
|
+ },
|
|
|
onRenameScene(sceneId, newName) {
|
|
|
const renameTarget = this.info.scenes.find((item) => {
|
|
|
return item.id === sceneId
|