Bläddra i källkod

修复无法正确选中右侧节点的bug

cxmo 1 år sedan
förälder
incheckning
efce92a62b
1 ändrade filer med 19 tillägg och 24 borttagningar
  1. 19 24
      src/views/dataEntry_manage/databaseList.vue

+ 19 - 24
src/views/dataEntry_manage/databaseList.vue

@@ -182,7 +182,7 @@
 							<span v-show="currentLang=='ch'">{{ item.EdbName }}</span> 
 							<span v-show="currentLang=='en'">{{ item.EdbNameEn || item.EdbName }}</span>
 						</div>
-						<div class="image" @click="selectCurrentNode({ code:item.UniqueCode, id:item.EdbInfoId, classifyId:item.ClassifyId })">
+						<div class="image" @click="detailShowHandle(item)">
 							<img :src="item.ChartImage" alt=""/>
 						</div>
 						<div class="info">
@@ -671,7 +671,7 @@ export default {
 			CanOpClassify: false,
 
 			select_classifyId:0,//指标分类id
-			PageSize:15,
+			PageSize:20,
 			CurrentIndex:1,
 			Total:0,
 			IsListEnd:false,//是不是到底了
@@ -821,7 +821,8 @@ export default {
 						//将指标添加进标签列表中
 						const {EdbNameEn,EdbName,EdbInfoId,UniqueCode,ClassifyId}=res.Data.Item
 						this.addLabel({code:UniqueCode,id:EdbInfoId,classifyId:ClassifyId,EdbName,EdbNameEn})
-						this.defaultShowNodes=this.findParentNodeHandle(this.treeData,ClassifyId)
+						let deep_arr = _.cloneDeep(this.treeData);
+						this.defaultShowNodes=this.findParentNodeHandle(deep_arr,ClassifyId).reverse()||[]
 						//设置tree高亮
 						this.$refs.menuTree.setCurrentKey(UniqueCode);
 
@@ -1036,18 +1037,14 @@ export default {
 		},
 		/* 节点变化时 */
 		nodeChange(data,node) {
-			this.dynamicNode = node;
 			this.search_txt = '';
-			this.showAssociateChart=false
-			this.showAssociateComputeData=false
-			// this.page_no = 1;
-			// this.$refs.valueUl.scrollTop = 0;
 			this.select_classifyId = !data.EdbInfoId?data.ClassifyId:0;
 			this.select_node = data.UniqueCode;
 			this.selected_edbid = data.EdbInfoId;
 			this.resetNodeStyle(node);
-			
-			
+			this.dynamicNode = node;
+			this.showAssociateChart=false
+			this.showAssociateComputeData=false
 		},
 		resetNodeStyle: _.debounce(function(node) {
 			const tree = $('.target_tree')[0];
@@ -1491,18 +1488,6 @@ export default {
 			//this.defaultShowNodes=this.findParentNodeForClassifyId(classifyId,code)
 			const containerDom = document.getElementById('detail-container')
 			containerDom&&(containerDom.scrollTop = 0)
-			 //滚动到高亮节点位置
-			this.$nextTick(()=>{
-				setTimeout(() => {
-					let node = document.getElementById(`node${this.select_node}`)||{}
-					let parent = document.getElementsByClassName('target_tree')[0];
-					if(node.offsetTop > parent.offsetHeight) {
-						parent.scrollTop =  node.offsetTop - parent.offsetHeight/2
-					}else{
-						parent.scrollTop = 0
-					}
-				},400)
-			})
 		},
 		// 查找树节点所有父节点
 		findParentNodeHandle(arr, id) {
@@ -1835,7 +1820,7 @@ export default {
 		changeTreeNode(){
 			this.$refs.menuTree.setCurrentKey(this.select_node);
 			this.$nextTick(()=>{
-				const _node = this.$refs.menuTree.getNode(this.select_node)
+				const _node = this.$refs.menuTree.getCurrentNode()
 				this.dynamicNode = _node;
 				this.dynamicNode&&this.resetNodeStyle(this.dynamicNode)
 			})
@@ -1890,7 +1875,17 @@ export default {
 			this.$nextTick(()=>{
 				this.$refs.createChart.getDataByPath()
 			})
-		}
+		},
+		/* 展开对应菜单 显示详情 */
+		detailShowHandle({ UniqueCode, EdbInfoId,ClassifyId}) {
+			let params = {
+				code: UniqueCode,
+				id: EdbInfoId,
+				classifyId:ClassifyId
+			};
+			this.selectCurrentNode(params);
+			this.select_classifyId = 0;
+		},
 	},
 	//离开页面时保存标签
 	beforeRouteLeave(to,from,next){