فهرست منبع

ETA指标库目录层级改成三级

cxmo 1 سال پیش
والد
کامیت
212202b2bc

+ 6 - 0
src/api/modules/chartApi.js

@@ -11,6 +11,9 @@ const dataBaseInterface = {
 	nodeAdd: params => {
 		return http.post('/datamanage/classify/add',params)
 	},
+    nodeAddV2: params => {
+		return http.post('/datamanage/classify/addv2',params)
+	},
 	/**
 	 * 删除分类接口
 	 * @param {ClassifyId} params 
@@ -54,6 +57,9 @@ const dataBaseInterface = {
 	menuListV2: params => {
 		return http.get('/datamanage/classify/items/v2',params)
 	},
+	menuListV3: params => {
+		return http.get('/datamanage/classify/items/v3',params)
+	},
 	/**
 	 * 通过分类查找指标列表数据
 	 * @param ClassifyId

+ 2 - 2
src/views/dataEntry_manage/adjustdata/adjustData.vue

@@ -350,9 +350,9 @@ export default {
 
     /* 获取目录结构 */
 		getMenu() {
-			dataBaseInterface.menuList().then((res) => {
+			dataBaseInterface.menuListV3().then((res) => {
 				if (res.Ret === 200) {
-					this.filterNodes(res.Data.AllNodes)
+					//this.filterNodes(res.Data.AllNodes)
 					this.classifyOptions = res.Data.AllNodes || [];
 				}
 			});

+ 2 - 2
src/views/dataEntry_manage/codecount/index.vue

@@ -347,9 +347,9 @@ export default {
 
 		/* 获取目录结构 */
 		getMenu() {
-			dataBaseInterface.menuList().then((res) => {
+			dataBaseInterface.menuListV3().then((res) => {
 				if (res.Ret !== 200) return
-					this.filterNodes(res.Data.AllNodes);
+					//this.filterNodes(res.Data.AllNodes);
 					this.menuOptions = res.Data.AllNodes || [];
 			});
 		},

+ 2 - 2
src/views/dataEntry_manage/databaseComponents/completeTargetDia.vue

@@ -124,9 +124,9 @@ export default {
 	methods: {
 		/* 获取目录结构 */
 		getMenu() {
-			dataBaseInterface.menuList().then(res => {
+			dataBaseInterface.menuListV3().then(res => {
 				if(res.Ret === 200) {
-					this.filterNodes(res.Data.AllNodes);
+					//this.filterNodes(res.Data.AllNodes);
 					this.options = res.Data.AllNodes || [];
 				}
 			})

+ 2 - 2
src/views/dataEntry_manage/databaseComponents/computedDialog.vue

@@ -258,9 +258,9 @@ export default {
 	methods: {
 		/* 获取目录结构 */
 		getMenu() {
-			dataBaseInterface.menuList().then((res) => {
+			dataBaseInterface.menuListV3().then((res) => {
 				if (res.Ret === 200) {
-					this.filterNodes(res.Data.AllNodes);
+					//this.filterNodes(res.Data.AllNodes);
 					this.options = res.Data.AllNodes || [];
 				}
 			});

+ 26 - 7
src/views/dataEntry_manage/databaseComponents/openDialog.vue

@@ -46,8 +46,25 @@
 							placeholder="必填项"></el-input>
 						</el-form-item>
 					</template>
+					<!-- 添加/编辑3级目录 -->
+					<template 
+					v-else-if="(title=='添加'&&formData.level === 2)
+					|| (title=='编辑'&&formData.level === 3)">
+						<el-form-item label="一级目录" prop="level_1">
+							<span>{{formData.level_1}}</span>
+						</el-form-item>
+						<el-form-item label="二级目录" prop="level_2">
+							<span>{{formData.level_2}}</span>
+						</el-form-item>
+						<el-form-item label="目录名称" prop="level_3">
+							<el-input
+							v-model="formData.level_3"
+							style="width: 80%"
+							placeholder="必填项"></el-input>
+						</el-form-item>
+					</template>
 					<!-- 编辑具体指标 -->
-					<template v-else-if="title=='编辑' && formData.level === 3">
+					<template v-else-if="title=='编辑' && formData.level === 4">
 						<el-form-item label="指标名称" prop="level_4">
 							<el-input
 							v-model="formData.level_4"
@@ -113,7 +130,7 @@ export default {
 	watch: {
 		'isOpenDialog': {
 			handler(newval) {
-				if(newval && this.formData.level === 3) {
+				if(newval && this.formData.level === 4) {
 					this.getMenu();
 				}
 				// console.log(this.formData);
@@ -174,7 +191,7 @@ export default {
 						Level: this.formData.level
 					})
 			}else if(this.title==='编辑') {
-				res = this.formData.level===3
+				res = this.formData.level===4
 					? await dataBaseInterface.targetEdit({
 							ClassifyId: this.formData.level_menu[this.formData.level_menu.length - 1],
 							EdbInfoId: this.formData.edbinfo_id,
@@ -187,6 +204,8 @@ export default {
 								? this.formData.level_1
 								: this.formData.level === 2
 								? this.formData.level_2
+								: this.formData.level === 3
+								?this.formData.level_3
 								:'',
 							ClassifyId:this.formData.classify_id || 0
 						})
@@ -195,8 +214,8 @@ export default {
 			this.$message.success(res.Msg);
 
 		 if(this.title==='添加') this.callbackHandle('add');
-		 else if(this.title==='编辑' && this.formData.level===3) this.callbackHandle('update');
-		 else if(this.title==='编辑' && this.formData.level!==3) this.callbackHandle();
+		 else if(this.title==='编辑' && this.formData.level===4) this.callbackHandle('update');
+		 else if(this.title==='编辑' && this.formData.level!==4) this.callbackHandle();
 
 				
 		},
@@ -213,9 +232,9 @@ export default {
 		
 		/* 获取目录结构 */
 		getMenu() {
-			dataBaseInterface.menuList().then(res => {
+			dataBaseInterface.menuListV3().then(res => {
 				if(res.Ret === 200) {
-					this.filterNodes(res.Data.AllNodes);
+					//this.filterNodes(res.Data.AllNodes);
 					this.options = res.Data.AllNodes || [];
 				}
 			})

+ 72 - 20
src/views/dataEntry_manage/databaseList.vue

@@ -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))