jwyu 1 year ago
parent
commit
7a28885d8c

+ 20 - 24
src/views/dataEntry_manage/databaseComponents/openDialog.vue

@@ -50,7 +50,7 @@
 					<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>
+      							<span class="parentStr">{{getParentName}}</span>
     						</el-tooltip>
 						</el-form-item>
 						<el-form-item label="目录名称" prop="levelVal">
@@ -136,11 +136,12 @@ export default {
 	},
 	computed:{
 		getParentName(){
-			let str=''
-			if(this.formData.parentArr){
-
-			}
-			return str
+			const arr=this.formData.parentArr||[]
+			let strArr=arr.reverse().map(item=>{
+				return item.classifyName
+			})
+			
+			return strArr.join('/')
 		}
 	},
 	data () {
@@ -186,33 +187,21 @@ export default {
 
 			if(this.title==='添加') {
 				res = await dataBaseInterface.nodeAdd({
-						ClassifyName: this.formData.level === 0 
-							? this.formData.level_1
-							: this.formData.level === 1
-							? this.formData.level_2
-							: this.formData.level === 2
-							? this.formData.level_3
-							:'',
+						ClassifyName: this.formData.levelVal||'',
 						ParentId:this.formData.parent_id || 0,
 						Level: this.formData.level
 					})
 			}else if(this.title==='编辑') {
-				res = this.formData.level===4
+				res = this.formData.isEDB
 					? await dataBaseInterface.targetEdit({
 							ClassifyId: this.formData.level_menu[this.formData.level_menu.length - 1],
 							EdbInfoId: this.formData.edbinfo_id,
-							EdbName: this.formData.level_4,
+							EdbName: this.formData.levelVal,
 							Frequency: this.formData.frequency,
 							Unit: this.formData.unit
 						})
 					: await dataBaseInterface.nodeEdit({
-							ClassifyName: this.formData.level === 1
-								? this.formData.level_1
-								: this.formData.level === 2
-								? this.formData.level_2
-								: this.formData.level === 3
-								?this.formData.level_3
-								:'',
+							ClassifyName: this.formData.levelVal||'',
 							ClassifyId:this.formData.classify_id || 0
 						})
 			}
@@ -220,8 +209,8 @@ export default {
 			this.$message.success(res.Msg);
 
 		 if(this.title==='添加') this.callbackHandle('add');
-		 else if(this.title==='编辑' && this.formData.level===4) this.callbackHandle('update');
-		 else if(this.title==='编辑' && this.formData.level!==4) this.callbackHandle();
+		 else if(this.title==='编辑' && this.formData.isEDB) this.callbackHandle('update');
+		 else if(this.title==='编辑' && !this.formData.isEDB) this.callbackHandle();
 
 				
 		},
@@ -261,6 +250,13 @@ export default {
 </script>
 <style lang='scss'>
 .Dialog-box {
+	.parentStr{
+		display: block;
+		width: 304px;
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
+	}
 	.dialog-main {
 		padding-left: 50px;
 	}

+ 17 - 23
src/views/dataEntry_manage/databaseList.vue

@@ -1156,21 +1156,23 @@ export default {
 			this.isOpenDialog = true;
 		},
 		// 递归节点
-		getNodeParentData(data){
+		getNodeParentData(data,arr){
 			if(data.level===0) return
-			this.getNodeParentData(data.parent)
-			return {classifyName:data.data.ClassifyName,classifyId:data.data.ClassifyId}
+			arr.push({classifyName:data.data.ClassifyName,classifyId:data.data.ClassifyId})
+			this.getNodeParentData(data.parent,arr)
+			return arr
 		},
 		/* 添加节点 */
 		addNode(node,data) {
 			// console.log(node);
 			this.dialog_title = '添加';
-			let a=this.getNodeParentData(node)
-			console.log(a);
+			let arr=[]
+			arr=this.getNodeParentData(node,arr)
+			// console.log(arr);
 			
 				/* 添加目录 */
 			this.dialogForm = {
-				parentArr:[],
+				parentArr:arr,
 				parent_id: data.ClassifyId,
 				level: node.level,
 				levelVal:'',
@@ -1185,14 +1187,13 @@ export default {
 			this.dialog_title = '编辑';
 			if(data.EdbCode) {
 				/* 编辑指标 */
-				
 				(data.EdbType===1 || [58,59,67,68].includes(data.Source)) && dataBaseInterface.targetDetail({
 					EdbInfoId: data.EdbInfoId
 				}).then(res => {
 					if(res.Ret === 200) {
 						this.dialogForm = {
 							level: node.level,
-							level_4: res.Data.EdbName,
+							levelVal: res.Data.EdbName,
 							level_menu:[
 								node.parent.parent.parent.data.ClassifyId,
 								node.parent.parent.data.ClassifyId,
@@ -1200,7 +1201,8 @@ export default {
 							],
 							edbinfo_id: res.Data.EdbInfoId,
 							frequency:res.Data.Frequency,
-							unit:res.Data.Unit
+							unit:res.Data.Unit,
+							isEDB:true
 						}
 						this.isOpenDialog = true;
 					}
@@ -1235,23 +1237,15 @@ export default {
 
 
 			}else {
+				let arr=[]
+				arr=this.getNodeParentData(node.parent,arr)
 				/* 编辑目录 */
 				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
-					: '',
+					isEDB:false,
+					parentArr:arr,
+					levelVal: data.ClassifyName||'',
 					classify_id: data.ClassifyId,
-					level: node.level
+					level: node.level-1
 				}
 				this.isOpenDialog = true;
 			}