Commit 9a0b5563 by 高源

动作集更名为actions

parent bd64c77f
......@@ -172,7 +172,7 @@ export default {
actionAll: [{
name: '根目录',
Kvid: 123123,
children: []
actions: []
}],
actionConfigs: {}
......@@ -309,7 +309,7 @@ export default {
this.dynamicTagObj.actionName = '新建动作'
this.dynamicTagObj.actionType = this.actionType
this.dynamicTagObj.tagId = this.tagId++
this.Kvid = Math.floor(Math.random() * 100001);
this.Kvid = Math.floor(Math.random() * 100000001);
this.dynamicTagObj.actionConfigs = this.actionConfigs
this.dynamicTagObj.Kvid = this.Kvid
if (this.parentKvid != null) {
......@@ -343,31 +343,31 @@ export default {
this.isChildrenTree = true
console.log(activeItem)
let activeParentItem = this.findObjectByKvid(this.treeNode, activeItem.parentKvid);
activeItem.children = []
activeItem.actions = []
if (activeParentItem == null) {
console.log('已经有容器了')
// if (this.actionAll[0].children.length > 0) return
// if (this.actionAll[0].actions.length > 0) return
let obj = {}
obj.name = activeItem.actionName
obj.Kvid = activeItem.Kvid
obj.children = []
obj.actions = []
console.log(this.treeNode)
for (let i = 0; i < this.treeNode.length; i++) {
this.actionAll[0].children.push(this.treeNode[i])
this.actionAll[0].actions.push(this.treeNode[i])
}
this.actionAll.push(obj)
this.findOrPushObject(this.actionAll[0].children, obj)
this.findOrPushObject(this.actionAll[0].actions, obj)
} else {
// this.actionType = ''
// this.actionName = ''
let obj = {}
obj.name = activeItem.actionName
obj.Kvid = activeItem.Kvid
obj.children = []
for (let i = 0; i < activeItem.children.length; i++) {
obj.children.push(activeItem.children[i])
obj.actions = []
for (let i = 0; i < activeItem.actions.length; i++) {
obj.actions.push(activeItem.actions[i])
}
this.childrenTreeNode = obj.children
this.childrenTreeNode = obj.actions
this.findOrPushObject(this.actionAll, obj)
// console.log(this.actionAll)
}
......@@ -407,7 +407,7 @@ export default {
// console.log(this.treeNode)
} else {
this.childrenTreeNode = []
this.childrenTreeNode = activeItem.children
this.childrenTreeNode = activeItem.actions
this.isChildrenTree = true
this.parentKvid = item.Kvid
this.isShowAction = false
......@@ -426,12 +426,12 @@ export default {
let obj = {}
obj.name = item.actionName
obj.Kvid = item.Kvid
obj.children = []
obj.actions = []
for (let i = 0; i < _this.treeNode.length; i++) {
_this.actionAll[0].children.push(_this.treeNode[i])
_this.actionAll[0].actions.push(_this.treeNode[i])
}
_this.actionAll.push(obj)
_this.findOrPushObject(_this.actionAll[0].children, obj)
_this.findOrPushObject(_this.actionAll[0].actions, obj)
_this.childrenTreeNode = []
_this.isChildrenTree = true
} else {
......@@ -441,10 +441,10 @@ export default {
let obj = {}
obj.name = item.actionName
obj.Kvid = item.Kvid
obj.children = []
for (let i = 0; i < item.children.length; i++) {
obj.children.push(item.children[i])
_this.childrenTreeNode.push(item.children[i])
obj.actions = []
for (let i = 0; i < item.actions.length; i++) {
obj.actions.push(item.actions[i])
_this.childrenTreeNode.push(item.actions[i])
}
_this.findOrPushObject(_this.actionAll, obj)
_this.isChildrenTree = true
......@@ -455,10 +455,10 @@ export default {
_this.isShowAction = true
}
_this.Kvid = item.Kvid
if (item.children != undefined && item.children.length > 0) {
if (item.actions != undefined && item.actions.length > 0) {
_this.childrenTreeNode = []
for (let i = 0; i < item.children.length; i++) {
_this.childrenTreeNode.push(item.children[i])
for (let i = 0; i < item.actions.length; i++) {
_this.childrenTreeNode.push(item.actions[i])
}
_this.isChildrenTree = true
}
......@@ -475,11 +475,11 @@ export default {
for (let i = 0; i < filteredArray.length; i++) {
_this.childrenTreeNode.push(filteredArray[i])
}
let activeItem = _this.findObjectByKvid(_this.actionAll[0].children, tag.Kvid);
let activeItem = _this.findObjectByKvid(_this.actionAll[0].actions, tag.Kvid);
let activeParentItem = null
// 根目录下处理
if (activeItem !== null) {
activeParentItem = _this.findObjectByKvid(_this.actionAll[0].children, activeItem.parentKvid);
activeParentItem = _this.findObjectByKvid(_this.actionAll[0].actions, activeItem.parentKvid);
} else {
let filteredArray = _this.treeNode.filter(item => item.Kvid !== tag.Kvid);
_this.treeNode = []
......@@ -494,10 +494,10 @@ export default {
_this.childrenTreeNode.push(filteredArray[i])
}
} else {
let filteredArray = activeParentItem.children.filter(item => item.Kvid !== tag.Kvid);
activeParentItem.children = []
let filteredArray = activeParentItem.actions.filter(item => item.Kvid !== tag.Kvid);
activeParentItem.actions = []
for (let i = 0; i < filteredArray.length; i++) {
activeParentItem.children.push(filteredArray[i])
activeParentItem.actions.push(filteredArray[i])
}
}
} else if (_this.treeNode.length > 0 && _this.isChildrenTree == false) {
......@@ -533,21 +533,21 @@ export default {
_this.childrenTreeNode = []
// 递归函数,用于在树的每一级中查找合适的父节点并添加数据
function addToNode (node, parentKvid, newData, childTree) {
if (node.children == undefined) {
node.children = []
if (node.actions == undefined) {
node.actions = []
}
// 如果当前节点的 kvid 等于 parentKvid,将 newData 添加到当前节点的 children
// 如果当前节点的 kvid 等于 parentKvid,将 newData 添加到当前节点的 actions
if (node.Kvid === parentKvid) {
node.children.push(newData);
node.actions.push(newData);
// _this.isChildrenTree = childTree
for (let i = 0; i < node.children.length; i++) {
_this.childrenTreeNode.push(node.children[i])
for (let i = 0; i < node.actions.length; i++) {
_this.childrenTreeNode.push(node.actions[i])
}
return true; // 表示数据已添加成功
}
// 递归查找子节点
for (var i = 0; i < node.children.length; i++) {
if (addToNode(node.children[i], parentKvid, newData)) {
for (var i = 0; i < node.actions.length; i++) {
if (addToNode(node.actions[i], parentKvid, newData)) {
return true; // 如果子节点中添加成功,返回 true
}
}
......@@ -573,8 +573,8 @@ export default {
if (activeParentsItem == null) {
this.childrenTreeNode = this.treeNode
} else {
for (let i = 0; i < activeParentsItem.children.length; i++) {
this.childrenTreeNode.push(activeParentsItem.children[i])
for (let i = 0; i < activeParentsItem.actions.length; i++) {
this.childrenTreeNode.push(activeParentsItem.actions[i])
}
this.Kvid = activeParentItem.Kvid
}
......@@ -598,10 +598,10 @@ export default {
if (node.Kvid === parentKvid) {
return [node]; // 找到匹配的节点,返回包含该节点的数组
}
if (node.children && node.children.length > 0) {
var result = _this.findHierarchyByParentKvid(node.children, parentKvid);
if (node.actions && node.actions.length > 0) {
var result = _this.findHierarchyByParentKvid(node.actions, parentKvid);
if (result.length > 0) {
return node.children; // 将当前节点与子级层级连接起来
return node.actions; // 将当前节点与子级层级连接起来
}
}
}
......@@ -615,8 +615,8 @@ export default {
if (obj.Kvid === kvid) {
return obj; // 如果当前对象的 kvid 等于目标 kvid,返回当前对象
}
if (obj.children && obj.children.length > 0) {
var result = _this.findObjectByKvid(obj.children, kvid); // 递归查找子级数组中的对象
if (obj.actions && obj.actions.length > 0) {
var result = _this.findObjectByKvid(obj.actions, kvid); // 递归查找子级数组中的对象
if (result) {
return result; // 如果在子级数组中找到了目标对象,返回结果
}
......@@ -648,9 +648,9 @@ export default {
// console.log(this.childrenTreeNode)
let activeParentItem = this.findObjectByKvid(this.treeNode, this.childrenTreeNode[0].parentKvid);
if (activeParentItem != null) {
activeParentItem.children = []
activeParentItem.actions = []
for (let i = 0; i < this.childrenTreeNode.length; i++) {
activeParentItem.children.push(this.childrenTreeNode[i])
activeParentItem.actions.push(this.childrenTreeNode[i])
}
}
// 拖拽完最终结果
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment