|
|
|
@ -69,8 +69,9 @@ |
|
|
|
|
<template slot-scope="scope" v-if="scope.row.isSubject"> |
|
|
|
|
<p class="p">操作一致性规则:用户完成的功能操作与下方设置的操作点一致</p> |
|
|
|
|
<div class="tree-con"> |
|
|
|
|
<div class="block1"> |
|
|
|
|
<div class="block1" id="divTree"> |
|
|
|
|
<my-tree |
|
|
|
|
id="depTree" |
|
|
|
|
class="action" |
|
|
|
|
:ref="'tree-'+scope.$index" |
|
|
|
|
:data="treeData" |
|
|
|
@ -388,11 +389,52 @@ export default { |
|
|
|
|
this.anewPosttingData(judgmentRuleList) |
|
|
|
|
this.tableData.forEach(async (item, index) => { |
|
|
|
|
// 勾选树节点 |
|
|
|
|
console.log(item.operationIds) |
|
|
|
|
if (item.operationIds) { |
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs[`tree-${index}`].setCheckedKeys([item.operationIds]); |
|
|
|
|
// this.$refs.tree.setCurrentKey(item.operationIds) |
|
|
|
|
let currentNode = this.$refs[`tree-${index}`].getNode([item]); |
|
|
|
|
let parentLevel |
|
|
|
|
let nodeCount = 1//当前树展开节点的数量 |
|
|
|
|
let nodeIndex = 1//当前选中节点在当前树的位置 |
|
|
|
|
let dataIndex; //后台返回当前选中节点的父节点是当前的第几位 |
|
|
|
|
for ( let i=0; i<this.treeData.length; i++){ |
|
|
|
|
if(this.treeData[i].children !=null){//有子集节点的 |
|
|
|
|
if(this.treeData[i].children==this.treeData[i].children){ //this.orgListLine[i].orgCode默认选中的父节点的orgCode(一个),另外一个this.orgListLine[i].orgCode是一级节点所有的orgCode(多个) |
|
|
|
|
dataIndex =i |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(this.treeData[i].children==item.operationIds){ //只有一级节点的 |
|
|
|
|
dataIndex =i |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(dataIndex) |
|
|
|
|
let topHeight=dataIndex*20;//计算出选中节点到到顶部的高度 |
|
|
|
|
if(currentNode){ |
|
|
|
|
let currentNodeOrgCode= currentNode&¤tNode.children.operationIds; |
|
|
|
|
//计算nodeCount和nodeIndex |
|
|
|
|
do { |
|
|
|
|
currentNode = currentNode.parent |
|
|
|
|
parentLevel = currentNode.level |
|
|
|
|
let childNodes = currentNode.childNodes |
|
|
|
|
nodeCount += childNodes.length |
|
|
|
|
for (let i = 0; i < childNodes.length; i ++) { |
|
|
|
|
if (childNodes[i].data.children == currentNodeOrgCode) { |
|
|
|
|
nodeIndex += (i + 1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
currentNodeOrgCode = currentNode.children.operationIds |
|
|
|
|
} |
|
|
|
|
while ( parentLevel>0)//包含一级节点,因为一级节点有多个,如果是一级节点有一个,那这个判断就是while ( 1!=parentLevel) |
|
|
|
|
let dom = document.querySelector("#divTree") |
|
|
|
|
let dom1 = document.querySelector("#depTree") |
|
|
|
|
//一个节点的高度是26px,这个值能否从对象中获取,等我把这个功能做好再考虑吧 |
|
|
|
|
let nodeHight =26 |
|
|
|
|
dom1.style.height = (nodeCount * nodeHight) + "px" |
|
|
|
|
let contHeight=(nodeIndex * nodeHight)+topHeight-300//总高度,盒子高度的一半 |
|
|
|
|
dom.scrollTo(0, contHeight) |
|
|
|
|
} |
|
|
|
|
// this.scrollToDepTree(item.operationIds) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -401,13 +443,16 @@ export default { |
|
|
|
|
await this.getSubjectData(item.emptyOne, index); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.$message.warning(res.message); |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//计算此节点的距离思路1.计算出当前节点据顶部的高度+当前节点在树的位置的高度-盒子高度的一半 |
|
|
|
|
scrollToDepTree(deptCode){ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 重新封装数据 |
|
|
|
|
anewPosttingData(judgmentRuleList){ |
|
|
|
|