|
@@ -64,7 +64,7 @@
|
|
|
check-strictly
|
|
|
empty-text="暂无目录"
|
|
|
lazy
|
|
|
- :load="handleTreeLoad"
|
|
|
+ :load="getLazyTreeData"
|
|
|
@node-expand="handleNodeExpand"
|
|
|
@node-collapse="handleNodeCollapse"
|
|
|
@current-change="nodeChange"
|
|
@@ -219,12 +219,15 @@
|
|
|
type="text"
|
|
|
:disabled="!scope.row.Button.OpButton"
|
|
|
@click="editNode({
|
|
|
- level: 3,
|
|
|
+ level: 4,
|
|
|
parent: {
|
|
|
- data: { ClassifyId:edb_levels[1].ClassifyId },
|
|
|
+ data: { ClassifyId:edb_levels[2].ClassifyId },
|
|
|
parent:{
|
|
|
- data: { ClassifyId:edb_levels[1].ParentId },
|
|
|
- }
|
|
|
+ data: { ClassifyId:edb_levels[1].ClassifyId },
|
|
|
+ parent:{
|
|
|
+ data: { ClassifyId:edb_levels[0].ClassifyId },
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
},scope.row)"
|
|
|
>编辑</el-button>
|
|
@@ -712,7 +715,7 @@ export default {
|
|
|
/* 获取树分类数据 */
|
|
|
getTreeData(params) {
|
|
|
|
|
|
- dataBaseInterface.menuListV2().then(res=>{
|
|
|
+ dataBaseInterface.menuListV3().then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
const arr=res.Data.AllNodes || []
|
|
|
this.treeData=arr.map(item=>{
|
|
@@ -766,7 +769,7 @@ export default {
|
|
|
//将指标添加进标签列表中
|
|
|
const {EdbNameEn,EdbName,EdbInfoId,UniqueCode,ClassifyId}=res.Data.Item
|
|
|
this.addLabel({code:UniqueCode,id:EdbInfoId,classifyId:ClassifyId,EdbName,EdbNameEn})
|
|
|
- this.defaultShowNodes=this.findParentNodeForClassifyId(ClassifyId,UniqueCode)
|
|
|
+ this.defaultShowNodes=this.findParentNodeHandle(this.treeData,ClassifyId)
|
|
|
//设置tree高亮
|
|
|
this.$refs.menuTree.setCurrentKey(UniqueCode);
|
|
|
|
|
@@ -936,6 +939,7 @@ export default {
|
|
|
this.isComplete = false;
|
|
|
this.isAddTarget = false;
|
|
|
this.getTreeData(params);
|
|
|
+ this.changeTreeNode()
|
|
|
// this.getNewTargetList();
|
|
|
},
|
|
|
/* 取消新增回调 */
|
|
@@ -1046,7 +1050,7 @@ export default {
|
|
|
level: node.level,
|
|
|
level_4: res.Data.EdbName,
|
|
|
level_menu:[
|
|
|
- // node.parent.parent.parent.data.ClassifyId,
|
|
|
+ node.parent.parent.parent.data.ClassifyId,
|
|
|
node.parent.parent.data.ClassifyId,
|
|
|
node.parent.data.ClassifyId
|
|
|
],
|
|
@@ -1098,9 +1102,9 @@ export default {
|
|
|
:node.level === 2
|
|
|
? data.ClassifyName
|
|
|
: node.parent.data.ClassifyName,
|
|
|
- // level_3: node.level === 3
|
|
|
- // ? data.ClassifyName
|
|
|
- // : '',
|
|
|
+ level_3: node.level === 3
|
|
|
+ ? data.ClassifyName
|
|
|
+ : '',
|
|
|
classify_id: data.ClassifyId,
|
|
|
level: node.level
|
|
|
}
|
|
@@ -1119,7 +1123,7 @@ export default {
|
|
|
return item === code
|
|
|
});
|
|
|
// console.log(flag)
|
|
|
- !flag && this.defaultShowNodes.push(code);
|
|
|
+ !flag &&code&& this.defaultShowNodes.push(code);
|
|
|
sessionStorage.removeItem('expandCode');
|
|
|
}
|
|
|
},
|
|
@@ -1230,7 +1234,7 @@ export default {
|
|
|
canDropHandle(draggingNode, dropNode, type) {
|
|
|
let canDrop=false
|
|
|
// 移动的是一级目录
|
|
|
- if(draggingNode.level===1&&dropNode.level===1) {
|
|
|
+ if(draggingNode.level===1&&dropNode.level===1&&type!=='inner') {
|
|
|
canDrop=true
|
|
|
}
|
|
|
|
|
@@ -1241,29 +1245,35 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //三级指标层
|
|
|
+ //三级目录
|
|
|
if(draggingNode.level===3){
|
|
|
if((dropNode.level===2&&type==='inner')||(dropNode.level===3&&type!=='inner')){
|
|
|
canDrop=true
|
|
|
}
|
|
|
}
|
|
|
+ //四级指标
|
|
|
+ if(draggingNode.level===4){
|
|
|
+ if((dropNode.level===3&&type==='inner')||(dropNode.level===4&&type!=='inner')){
|
|
|
+ canDrop=true
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return canDrop
|
|
|
},
|
|
|
/* 拖拽完成 */
|
|
|
dropOverHandle(b,a,i,e) {
|
|
|
// 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
|
|
|
- if(b.level===1||b.level===2){
|
|
|
+ if(b.level===1||b.level===2||b.level===3){
|
|
|
this.handleMoveCatalogue(b,a,i,e)
|
|
|
}
|
|
|
|
|
|
// 指标层
|
|
|
- if(b.level===3){
|
|
|
+ if(b.level===4){
|
|
|
this.handleMoveEdb(b,a,i,e)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 移动的为一、二级目录
|
|
|
+ // 移动的为一、二、三级目录
|
|
|
handleMoveCatalogue(b,a,i,e){
|
|
|
let list=a.parent.childNodes,targetIndex=0,PrevClassifyId=0,NextClassifyId=0,ParentClassifyId=0;
|
|
|
|
|
@@ -1295,6 +1305,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(b.level===3){
|
|
|
+ if(i==='inner'){
|
|
|
+ ParentClassifyId=a.data.ClassifyId
|
|
|
+ PrevClassifyId=0
|
|
|
+ NextClassifyId=a.data.Children.length>1?a.data.Children[1].ClassifyId:0
|
|
|
+ }else{
|
|
|
+ ParentClassifyId=a.data.ParentId
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
dataBaseInterface.classifyMove({
|
|
|
ClassifyId:b.data.ClassifyId,
|
|
|
ParentClassifyId:ParentClassifyId,
|
|
@@ -1308,7 +1328,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- // 移动的为指标层 三级
|
|
|
+ // 移动的为指标层 四级
|
|
|
handleMoveEdb(b,a,i,e){
|
|
|
let PrevEdbInfoId=0,NextEdbInfoId=0,targetIndex=0,list=a.parent.childNodes.map(_ => _.data)
|
|
|
if(i==='inner'){
|
|
@@ -1412,7 +1432,7 @@ export default {
|
|
|
findParentNodeHandle(arr, id) {
|
|
|
// 遍历取父级code push数组
|
|
|
for (let i of arr) {
|
|
|
- if (i.UniqueCode === id) {
|
|
|
+ if (i.ClassifyId === id) {
|
|
|
return [i.UniqueCode];
|
|
|
}
|
|
|
if (i.Children) {
|
|
@@ -1568,6 +1588,7 @@ export default {
|
|
|
edb_id:res.EdbInfoDetail.EdbInfoId,
|
|
|
formula: res.EdbInfoDetail.CalculateFormula,
|
|
|
menu: [
|
|
|
+ node.parent.parent.parent.data.ClassifyId,
|
|
|
node.parent.parent.data.ClassifyId,
|
|
|
data.ClassifyId
|
|
|
],
|
|
@@ -1741,8 +1762,39 @@ export default {
|
|
|
this.dynamicNode = _node;
|
|
|
this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
|
|
|
})
|
|
|
+ },
|
|
|
+ //绑定el-tree的load属性
|
|
|
+ getLazyTreeData (node,resolve,maxLevel=3){
|
|
|
+ if(node.level===0){
|
|
|
+ resolve(this.treeData)
|
|
|
+ }
|
|
|
+ if(node.level>0&&node.level<=maxLevel){
|
|
|
+ //获取对应层级的Child
|
|
|
+ resolve(node.data.Children||[])
|
|
|
+ }
|
|
|
+ if(node.level===maxLevel){
|
|
|
+ //调接口获取该分类下指标的数据
|
|
|
+ dataBaseInterface.getEdbListForClassify({ClassifyId:node.data.ClassifyId}).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ let arr=res.Data.EdbInfoList||[]
|
|
|
+ arr=arr.map(item=>{
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isLeaf:true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ resolve(arr)
|
|
|
+ }else{
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
+ this.changeTreeNode()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(node.level>maxLevel){
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
+ },
|
|
|
//离开页面时保存标签
|
|
|
beforeRouteLeave(to,from,next){
|
|
|
sessionStorage.setItem('database',JSON.stringify(this.labelList))
|