Browse Source

feat: 本体实体增加数值时,新增value、unit标识

zhangzp 1 year ago
parent
commit
47f325edaa
1 changed files with 52 additions and 50 deletions
  1. 52 50
      src/components/d3graphTwo.vue

+ 52 - 50
src/components/d3graphTwo.vue

@@ -30,7 +30,7 @@
           <div class="radiokboxs">
             <el-radio-group v-model="radioNods">
               <el-radio
-              
+
                 :label="item.id"
                 v-for="(item, index) in nodesAll"
                 :key="index"
@@ -138,7 +138,7 @@
               v-model="num"
               :precision="2"
               :step="0.1"
-            
+
             ></el-input-number>
             <el-select
               filterable
@@ -450,7 +450,7 @@ export default {
   watch: {
     dialogVisibleDowDoubli:{
       handler(newValue, oldValue) {
-    
+
         if (!newValue) {
         setTimeout(() => {
            this.addNodesBool = false
@@ -474,7 +474,7 @@ export default {
               : "";
               if (!!url) {
                 this.postRequest(url, "get").then((res) => {
-                
+
                   if (res.data.code == 0) {
                     this.data.nodes = res.data.data.nodes;
                     this.data.links = res.data.data.links;
@@ -523,7 +523,7 @@ export default {
     },
     old: {
       handler(newValue, oldValue) {
-     
+
         this.oldname = newValue;
       },
       deep: true, //确认是否深入监听。(一般监听时是不能监听到对象属性值的变化的,数组的值变化可以听到。)
@@ -656,10 +656,12 @@ export default {
             this.checkLists.value === undefined
               ? this.num
               : this.num + this.checkLists.value,
+          value: this.num,
+          unit: this.checkLists.value,
           label: "数值",
           entityName: this.checkListsChange.entityName,
         };
-
+debugger
         if (this.discern === "本体图谱") {
           numPost.noumenonId = this.formLabelAligIdBACK;
         } else {
@@ -680,7 +682,7 @@ export default {
               message: "选择成功",
               type: "success",
             });
-            
+
             let nodesConts = JSON.parse(JSON.stringify(numPost));
             nodesConts.id = res.data.data;
             nodesConts.types = "Number";
@@ -688,18 +690,18 @@ export default {
             if (this.discern == "实体管理" ||this.discern == "新建实体" ) {
               let url = `entity/info/${this.formLabelAligIdBACK}`;
               this.postRequest(url, "get").then((res) => {
-        
+
                 if (res.data.code == 0) {
                   this.data.nodes = res.data.data.nodes;
                   this.data.links = res.data.data.links;
-        
+
                 }
               });
             }else{
               console.log(nodesConts);
                this.data.nodes.push(nodesConts);
             }
-       
+
             this.dialogVisibleDowDoubli = false;
             this.radioCreat = "";
             this.checkListsChange = {};
@@ -748,7 +750,7 @@ export default {
           this.checkListsChange.entityName == this.checkListsChange.name &&
           (this.radioCreat == "4" || this.radioCreat == "7")
         ) {
-   
+
           this.$message.error("不能添加自己");
           this.addNodesBool = false
           console.log(this.addNodesBool);
@@ -759,10 +761,10 @@ export default {
               ? "/noumenon/addNode"
               : "/entity/addNode";
           this.postRequest(url, this.checkListsChange, "post").then((res) => {
-       
+
             if (res.data.code == 0) {
               if (this.discern != "本体图谱") {
-            
+
                 this.checkListsChange.name = res.data.data.node.name;
                 this.checkListsChange.id = res.data.data.node.id;
 
@@ -770,11 +772,11 @@ export default {
                   message: "选择成功",
                   type: "success",
                 });
-  
-       
+
+
               // let url = `entity/info/${this.formLabelAligIdBACK}`;
               // this.postRequest(url, "get").then((res) => {
-        
+
               //   if (res.data.code == 0) {
                 this.data.nodes=this.data.nodes.concat(res.data.data.nodes);
               if (res.data.data.links.length>0) {
@@ -783,13 +785,13 @@ export default {
               }
               //   }
               // });
-            
+
                 // let nodesConts = JSON.parse(
                 //   JSON.stringify(this.checkListsChange)
                 // );
                 // this.data.nodes.push(nodesConts);
               } else if (this.discern == "本体图谱") {
-          
+
               this.data.nodes=this.data.nodes.concat(res.data.data.nodes);
               if (res.data.data.links.length>0) {
                 this.data.links=this.data.links.concat(res.data.data.links)
@@ -819,7 +821,7 @@ export default {
           type: 'warning'
         });
       }
-   
+
     },
     agreeChange(val) {
       this.selectaNumericBool = false;
@@ -923,7 +925,7 @@ export default {
       }
       let status=false
       !!this.data.links&&this.data.links.length&&this.data.links.forEach(rs=>{
-        
+
         if (rs.source.id==this.startNodes&&rs.target.id==this.radioNods&&rs.value==this.weisModel) {
           this.$message.error('已经存在该节点')
           status=true
@@ -1058,7 +1060,7 @@ export default {
                 this.data.links = res.data.data.links;
 
 
-              
+
 
               }
             });
@@ -1070,8 +1072,8 @@ export default {
             });
 
 
-        
- 
+
+
           // } else {
           //   this.$message.error(res.data.message);
           // }
@@ -1291,7 +1293,7 @@ export default {
 
       // 节点集
       this.nodeds = this.data.nodes;
-  
+
 
       // 设置一个颜色比例尺
       // 边集
@@ -1662,7 +1664,7 @@ export default {
     formateArr(val){
       let result=val.map(its=>its[its.length-1])
       return result
-    },  
+    },
     updateStatus(){
       this.updateObj={
         ... this.updateObj,
@@ -1680,7 +1682,7 @@ export default {
           }else{
             obj[res.key]=res.value2
           }
-          
+
         }
       })
       this.postRequest('/noumenon/node', {id:this.updateObj.id,...obj }, "put").then((res) => {
@@ -2527,7 +2529,7 @@ export default {
             this.endY < i.y + 40 &&
             this.sufu3
           ) {
-        
+
             this.innerVisible = true;
             // if (!isNaN(this.assoc)) {
             //   this.weiArr = [{ name: "设置" }];
@@ -2583,7 +2585,7 @@ export default {
           this.nodeds2 = res.data.data.nodes;
           this.edgeds2 = res.data.data.links;
           //
-        
+
           this.drawThumb1(d);
           $(`#thumbSvg1`)
             .detach()
@@ -2635,7 +2637,7 @@ export default {
       this.checkList = [];
       this.value = "";
       this.radioNods = "";
-      
+
       this.values = "";
       this.radioCreat = '';
       this.radio = "";
@@ -2951,14 +2953,14 @@ export default {
       } else {
         delname = this.oldname;
       }
-      // 
+      //
       let id=''
       if (typeof d.id === "object" && d.id !== null) {
         id= d.id.node.id;
         }else{
           id = d.id;
         }
-     
+
       let url =
         this.discern === "本体图谱" ? "/noumenon/delNode" : "/entity/delNode";
       this.postRequest(url, { id, name:delname }, "put").then(
@@ -2999,7 +3001,7 @@ export default {
     },
 
     handleClearLabel(d) {
-   
+
       if(d.label == '本体'){
         this.backName.push(d.id);
       }else if(d.label == '实体'){
@@ -3182,7 +3184,7 @@ export default {
           this.exitHighlightMenu(d);
         })
         .on("click", (d, i, nodes) => {
-     
+
           this.onMenuClick(d, pie_g, node, node_dx, node_dy, node_dradius);
         });
       /* .on('mousedown', (d, i, nodes) => {
@@ -3783,7 +3785,7 @@ export default {
         status:true,
         ...d
       }
-      
+
       this.postRequest(`/noumenon/detail/${d.id}`, "get").then(async (res) => {
         if (res.data.code == 0) {
           this.detailed = [{ name: "名称", value: res.data.data.n.name,
@@ -3859,9 +3861,9 @@ export default {
               res.data.data.n.typeIds,
                 this.temp_treeData
               )
-              
+
               this.detailed.push(
-               
+
                 {
                   name: "本体",
                   key:'ontologySts',
@@ -3906,7 +3908,7 @@ export default {
                 this.temp_treeData
               );
               this.detailed.push(
-             
+
                 {
                   name: "本体",
                   value2:res.data.data.n.ontologySts,
@@ -4010,7 +4012,7 @@ export default {
                 this.temp_treeData
               );
               this.detailed.push(
-                
+
                 {
                   name: "实体详情",
                   value2:res.data.data.n.introduction,
@@ -4040,9 +4042,9 @@ export default {
               res.data.data.n.typeIds,
                 this.temp_treeData
               );
-              
+
               this.detailed.push(
-             
+
                 {
                   name: "本体简介",
                   value2:res.data.data.n.introduction,
@@ -4124,7 +4126,7 @@ export default {
       return this.postRequest("/type/tree/"+val || this.requestType, "get").then((res) => {
         if (res.status == 200) {
           this.temp_treeData1 = this.getTreeDatas(JSON.parse(JSON.stringify(res.data.data)));
-          
+
           this.temp_treeData = res.data.data;
 
         } else {
@@ -4135,14 +4137,14 @@ export default {
     },
     getCascPath1(currentValue,source){
       const paths = [];
-  
+
   // 遍历currentValue数组中的每个元素
   for (const value of currentValue) {
     // 递归查找路径
     const path = this.findPath1(value, source);
     paths.push(path);
   }
-  
+
   // 输出路径
   console.log(paths);
   return paths
@@ -4155,7 +4157,7 @@ findPath1(value, source, path = []) {
     if (node.id === value) {
       return [...path, node.id];
     }
-    
+
     // 如果节点有子节点,递归查找路径
     if (node.children) {
       const childPath = this.findPath1(value, node.children, [...path, node.id]);
@@ -4164,7 +4166,7 @@ findPath1(value, source, path = []) {
       }
     }
   }
-  
+
   // 没有找到匹配的节点,返回空路径
   return [];
 },
@@ -4174,14 +4176,14 @@ findPath1(value, source, path = []) {
         return ""
       }
       const paths = [];
-  
+
   // 遍历currentValue数组中的每个元素
   for (const value of currentValue) {
     // 递归查找路径
     const path = this.findPath(value, source);
     paths.push(path);
   }
-  
+
   // 输出路径
   console.log(paths);
   return paths.join(',')
@@ -4194,7 +4196,7 @@ findPath(value, source, path = []) {
     if (node.id === value) {
       return node.name;
     }
-    
+
     // 如果节点有子节点,递归查找路径
     if (node.children) {
       const childPath = this.findPath(value, node.children, [...path, node.id]);
@@ -4203,7 +4205,7 @@ findPath(value, source, path = []) {
       }
     }
   }
-  
+
   // 没有找到匹配的节点,返回空路径
   return [];
 },
@@ -5639,4 +5641,4 @@ header {
   position: relative;
   top: 1px;
 }
-</style>
+</style>