jwyu 1 year ago
parent
commit
167a028ed8

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

@@ -2,6 +2,13 @@ import http from "@/api/http.js"
 
 /* 数据库管理模块  */
 const dataBaseInterface = {
+	/**
+	 * 指标库目录
+	 */
+	targetCatalog:params=>{
+		return http.get('/datamanage/classify/simple',params)
+	},
+
 	/**
 	 * 新增分类
 	 * @param {ClassifyName} params 

+ 2 - 2
src/views/dataEntry_manage/components/targetTree.vue

@@ -377,13 +377,13 @@ export default {
     },
     // 获取一级目录
     getTreeData(params) {
-      dataBaseInterface.menuListV3().then((res) => {
+      dataBaseInterface.targetCatalog({ParentId:0}).then((res) => {
         if (res.Ret === 200) {
           const arr = res.Data.AllNodes || [];
           this.treeData = arr.map((item) => {
             return {
               ...item,
-              isLeaf: item.Children.length ? false : true,
+              // isLeaf: item.Children.length ? false : true,
             };
           });
           // this.CanOpClassify = res.Data.CanOpClassify;

+ 36 - 30
src/views/dataEntry_manage/databaseComponents/openDialog.vue

@@ -1,4 +1,4 @@
-<template>
+ <template>
 	<div class="Dialog-box">
 		<el-dialog
 		:visible.sync="isOpenDialog"
@@ -22,7 +22,7 @@
 				:model="formData"
 				:rules="formRules">
 					<!-- 添加/编辑1级目录 -->
-					<template 
+					<!-- <template 
 					v-if="(title=='添加'&&formData.level === 0)
 					|| (title=='编辑'&&formData.level === 1)">
 						<el-form-item label="目录名称" prop="level_1">
@@ -31,9 +31,9 @@
 							style="width: 80%"
 							placeholder="必填项"></el-input>
 						</el-form-item>
-					</template>
+					</template> -->
 					<!-- 添加/编辑2级目录 -->
-					<template 
+					<!-- <template 
 					v-else-if="(title=='添加'&&formData.level === 1)
 					|| (title=='编辑'&&formData.level === 2)">
 						<el-form-item label="一级目录" prop="level_1">
@@ -45,29 +45,26 @@
 							style="width: 80%"
 							placeholder="必填项"></el-input>
 						</el-form-item>
-					</template>
+					</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>
+					<template v-if="!formData.isEDB">
+						<el-form-item label="上级目录" v-if="formData.level>0">
+							<el-tooltip class="item" effect="dark" :content="getParentName" placement="top">
+      							<span>{{getParentName}}</span>
+    						</el-tooltip>
 						</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-form-item label="目录名称" prop="levelVal">
 							<el-input
-							v-model="formData.level_3"
+							v-model="formData.levelVal"
 							style="width: 80%"
 							placeholder="必填项"></el-input>
 						</el-form-item>
 					</template>
 					<!-- 编辑具体指标 -->
-					<template v-else-if="title=='编辑' && formData.level === 4">
-						<el-form-item label="指标名称" prop="level_4">
+					<template v-if="title=='编辑' && formData.isEDB">
+						<el-form-item label="指标名称" prop="levelVal">
 							<el-input
-							v-model="formData.level_4"
+							v-model="formData.levelVal"
 							style="width: 80%"
 							placeholder="指标名称"></el-input>
 						</el-form-item>
@@ -124,34 +121,43 @@ export default {
 			default: '添加'
 		},
 		formData: {
-			type: Object,
+			type: Object,//{parentArr父级数据,isEDB:true 是否为指标}
 		}
 	},
 	watch: {
 		'isOpenDialog': {
 			handler(newval) {
-				if(newval && this.formData.level === 4) {
+				if(newval && this.formData.isEDB) {
 					this.getMenu();
 				}
 				// console.log(this.formData);
 			}
 		}
 	},
+	computed:{
+		getParentName(){
+			let str=''
+			if(this.formData.parentArr){
+
+			}
+			return str
+		}
+	},
 	data () {
 		return {
 			formRules: {
-				level_1:[
-					{ required: true, message: '目录名称不能为空', trigger: 'blur' },
-				],
-				level_2:[
+				levelVal:[
 					{ required: true, message: '目录名称不能为空', trigger: 'blur' },
 				],
-				level_3:[
-					{ required: true, message: '目录名称不能为空', trigger: 'blur' },
-				],
-				level_4:[
-					{ required: true, message: '指标名称不能为空', trigger: 'blur' },
-				],
+				// level_2:[
+				// 	{ required: true, message: '目录名称不能为空', trigger: 'blur' },
+				// ],
+				// level_3:[
+				// 	{ required: true, message: '目录名称不能为空', trigger: 'blur' },
+				// ],
+				// level_4:[
+				// 	{ required: true, message: '指标名称不能为空', trigger: 'blur' },
+				// ],
 				level_menu:[
 					{ required: true, message: '所属目录不能为空', trigger: 'blur' },
 				],

+ 42 - 89
src/views/dataEntry_manage/databaseList.vue

@@ -54,8 +54,8 @@
 				/>
 		</div>
 		<div class="database_main box" id="box" v-if="showData">
-			<target-tree />
-			<!-- <div class="main-left left" id="left">
+			<!-- <target-tree /> -->
+			<div class="main-left left" id="left">
 				<div class="tree-cont">
 					<el-tree
 						ref="menuTree"
@@ -113,7 +113,7 @@
 									style="width: 14px; height: 14px; margin-right: 8px"
 									v-if="data.Button.MoveButton"
 								/>
-								添加子项
+								<!-- 添加子项 -->
 								<img
 									src="~@/assets/img/set_m/add.png"
 									alt=""
@@ -121,7 +121,7 @@
 									@click.stop="addNode(node,data)"
 									v-if="data.Button.AddButton&&isEdbBtnShow('editCatalog')"
 								/>
-								编辑节点 如果是分类,判断data.Button.OpButton不变;如果是指标,不显示(ETA1.0.3)
+								<!-- 编辑节点 如果是分类,判断data.Button.OpButton不变;如果是指标,不显示(ETA1.0.3) -->
 								<img
 									src="~@/assets/img/set_m/edit.png"
 									alt=""
@@ -129,7 +129,7 @@
 									@click.stop="editNode(node,data)"
 									v-if="!data.EdbCode&&(data.Button.OpButton)&&isEdbBtnShow('editCatalog')"
 								/>
-								删除节点 如果是分类,判断data.Button.DeleteButton不变;如果是指标,不显示(ETA1.0.3)
+								<!-- 删除节点 如果是分类,判断data.Button.DeleteButton不变;如果是指标,不显示(ETA1.0.3) -->
 								<img
 									slot="reference"
 									src="~@/assets/img/set_m/del.png"
@@ -138,11 +138,11 @@
 									@click.stop="removeNode(node,data)"
 									v-if="!data.EdbCode&&(data.Button.DeleteButton)&&isEdbBtnShow('deleteCatalog')"
 								/>
-								查看计算指标
+								<!-- 查看计算指标 -->
 								<i class="el-icon-view" 
 									v-if="data.EdbType===2&&![58,59,67,68].includes(data.Source)&&isEdbBtnShow('checkCalcChart')" 
 									@click.stop="viewNode(node,data)"></i>
-								查看关联图表
+								<!-- 查看关联图表 -->
 								<img 
 									v-if="data.Button.ShowChartRelation&&isEdbBtnShow('checkRelatedChart')" 
 									@click.stop="showAssociateChart=true,showAssociateComputeData=false"
@@ -150,7 +150,7 @@
 									style="width: 14px; height: 14px;margin-left: 8px"
 									alt=""
 								/>
-								查看关联指标
+								<!-- 查看关联指标 -->
 								<img 
 									v-if="data.Button.ShowEdbRelation&&isEdbBtnShow('checkRelatedEdb')" 
 									@click.stop="showAssociateComputeData=true,showAssociateChart=false"
@@ -172,7 +172,7 @@
 				</div>
 				<span class="move-btn resize" v-drag id="resize" @mousemove="dynamicNode&&resetNodeStyle(dynamicNode)">
 				</span>
-			</div> -->
+			</div>
 			<!-- 指标关联图模块 -->
 			<div class="main-right right" id="right" style="background:transparent;border:none;box-shadow:none" v-if="showAssociateChart">
 				<dataAssociateChart :edbInfoId="selected_edbid"></dataAssociateChart>
@@ -811,13 +811,13 @@ export default {
 		/* 获取树分类数据 */
 		getTreeData(params) {
 			
-			dataBaseInterface.menuListV3().then(res=>{
+			dataBaseInterface.targetCatalog({ParentId:0}).then(res=>{
 				if(res.Ret===200){
 					const arr=res.Data.AllNodes || []
 					this.treeData=arr.map(item=>{
 						return {
 							...item,
-							isLeaf:item.Children.length?false:true
+							// isLeaf:item.Children.length?false:true
 						}
 					})
 					this.CanOpClassify = res.Data.CanOpClassify;
@@ -866,8 +866,9 @@ export default {
 						//将指标添加进标签列表中
 						const {EdbNameEn,EdbName,EdbInfoId,UniqueCode,ClassifyId}=res.Data.Item
 						this.addLabel({code:UniqueCode,id:EdbInfoId,classifyId:ClassifyId,EdbName,EdbNameEn})
-						let deep_arr = _.cloneDeep(this.treeData);
-						this.defaultShowNodes=this.findParentNodeHandle(deep_arr,ClassifyId).reverse()||[]
+						this.defaultShowNodes=["82b85be0c8273579d9f3fb7f6e49335f","bda0a4909f21a54c418a9e5b541a0c16","f373231b9ac9fc5b077acabdd7bce2ea"]
+						// let deep_arr = _.cloneDeep(this.treeData);
+						// this.defaultShowNodes=this.findParentNodeHandle(deep_arr,ClassifyId).reverse()||[]
 						//设置tree高亮
 						this.$refs.menuTree.setCurrentKey(UniqueCode);
 
@@ -1154,27 +1155,26 @@ export default {
 			}
 			this.isOpenDialog = true;
 		},
+		// 递归节点
+		getNodeParentData(data){
+			if(data.level===0) return
+			this.getNodeParentData(data.parent)
+			return {classifyName:data.data.ClassifyName,classifyId:data.data.ClassifyId}
+		},
 		/* 添加节点 */
 		addNode(node,data) {
-			// console.log(node,data);
+			// console.log(node);
 			this.dialog_title = '添加';
+			let a=this.getNodeParentData(node)
+			console.log(a);
+			
 				/* 添加目录 */
 			this.dialogForm = {
-				level_1: node.level === 1 
-				? data.ClassifyName
-				:node.level === 2
-				? node.parent.data.ClassifyName
-				: node.parent.parent.data.ClassifyName,
-				level_2: node.level === 1 
-				? ''
-				:node.level === 2
-				? data.ClassifyName
-				: node.parent.data.ClassifyName,
-				// level_3: node.level === 3
-				// ? data.ClassifyName
-				// : '',
+				parentArr:[],
 				parent_id: data.ClassifyId,
-				level: node.level
+				level: node.level,
+				levelVal:'',
+				isEDB:false
 			}
 			//存储当前要新增子级的目录code
 			sessionStorage.setItem('expandCode', data.UniqueCode);
@@ -1589,41 +1589,6 @@ export default {
 			})
 			return [...arr,code]
 		},
-		// 懒加载tree
-		handleTreeLoad(node,resolve){
-			if(node.level===0){
-				resolve(this.treeData)
-			}
-			if(node.level===1){
-				let arr=[]
-				this.treeData.forEach(item=>{
-					if(item.UniqueCode===node.data.UniqueCode){
-						arr=item.Children
-					}
-				})
-				resolve(arr)
-			}
-			if(node.level===2){
-				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>2){
-				resolve([])
-			}
-		},
 		/* 添加计算指标 */
 		addComputedHandler() {
 			this.computedTit = '计算指标';
@@ -1919,34 +1884,22 @@ export default {
 			})
 		},
 		//绑定el-tree的load属性
-		getLazyTreeData (node,resolve,maxLevel=3){
+		async getLazyTreeData (node,resolve){
 			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([])
+			}else{
+				let arr=[]
+				const res=await dataBaseInterface.targetCatalog({ParentId:node.data.ClassifyId})
+				if (res.Ret === 200) {
+					const temarr = res.Data.AllNodes || [];
+					arr=temarr.map(item=>{
+						return {
+							...item,
+							isLeaf:item.EdbInfoId?true:false
+						}
+					})
+				}
+				resolve(arr)
 			}
 		},
 		//保存指标上下限