yangdr 2 hónapja
szülő
commit
c007d854ba
4 módosított fájl, 85 hozzáadás és 17 törlés
  1. 21 1
      src/css/home.less
  2. 19 9
      src/css/knowledgeUpdate.less
  3. 43 5
      src/html/home.html
  4. 2 2
      src/js/graphMap.js

+ 21 - 1
src/css/home.less

@@ -476,6 +476,8 @@
           flex-wrap: nowrap;
           justify-content: space-between;
 
+
+
           .left {
 
             // .el-input__inner {
@@ -521,10 +523,28 @@
                 align-content: flex-start;
               }
 
+
               .el-input__icon {
                 line-height: 32px;
               }
             }
+
+            .select-entity-name {
+
+              // input:focus {
+              //   border: none !important;
+              //   outline: none;
+              //   box-shadow: none;
+              // }
+
+              .el-input__inner {
+                padding: 0px 10px;
+              }
+
+              .el-input__suffix {
+                display: none !important;
+              }
+            }
           }
 
           .right {
@@ -744,7 +764,7 @@
   width: auto !important;
   min-width: 150px;
   text-align: left;
-  
+
 }
 
 

+ 19 - 9
src/css/knowledgeUpdate.less

@@ -77,7 +77,7 @@
         min-width: 100%;
         // width: 100%;
         left: -1px;
-        z-index: 10;
+        z-index: 15;
         border: 1px solid #E7E7E7;
         // box-sizing: border-box;
 
@@ -182,10 +182,12 @@
 
 
   .content {
-    position: relative;
+    // position: relative;
     width: 100%;
-    left: 0;
-    flex-grow: 1;
+
+    // left: 0;
+    // flex: 1 1 auto;
+    height: calc(100% - 78px);
     // margin-left: -600px;
     cursor: default;
     white-space: nowrap;
@@ -206,6 +208,7 @@
     // width: calc(100% - 394px);
     box-sizing: border-box;
     flex-grow: 1;
+    position: relative;
 
     #main {
       // width: 796px;
@@ -227,7 +230,7 @@
       width: 34px;
       height: 24px;
       bottom: 0px;
-      right: 379px;
+      right: 10px;
       // left: 0;
       // border-top: 1px dotted black;
       /*background:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);*/
@@ -238,7 +241,7 @@
       width: 34px;
       height: 24px;
       bottom: 0px;
-      right: 413px;
+      right: 35px;
       color: #dd7172;
     }
 
@@ -289,6 +292,7 @@
           padding: 5px 0px;
           text-overflow: ellipsis;
           cursor: pointer;
+
           &:hover {
             color: #0071E7;
           }
@@ -354,8 +358,8 @@
         padding: 14px 8px;
         font-size: 16px;
         min-height: 100px;
-        max-height: 200px;
-        overflow-y: auto;
+        // max-height: 200px;
+        // overflow-y: auto;
         overflow-x: hidden;
         box-sizing: border-box;
 
@@ -368,7 +372,13 @@
             padding-bottom: 0px;
           }
 
-          .text-key {}
+          .text-key {
+            // max-width: 100px;
+            display: flex;
+            // display: inline-block;
+            // white-space: normal;
+            // text-overflow: ellipsis;
+          }
 
           .text-value {
             white-space: normal;

+ 43 - 5
src/html/home.html

@@ -49,7 +49,7 @@
 
 <body>
   <div id="app" v-cloak>
-    <el-container>
+    <el-container v-cloak>
       <el-header>
         <div class="logo" contenteditable="false">知识图谱系统</div>
         <div class="time">{{nowDate}}</div>
@@ -285,10 +285,20 @@
                   </el-option>
                 </el-select>
                 <span style="margin-left: 10px;">实体名称:</span>
-                <el-autocomplete v-model.trim="addPropertyDropdown.name"
+                <!-- <el-autocomplete v-model.trim="addPropertyDropdown.name"
                   :fetch-suggestions="((queryString,cb)=>{querySearchAsync(queryString,cb,addPropertyDropdown.label)})"
                   @select="handleSelect($event,addPropertyDropdown,'addProperty-dropdown')"
-                  placeholder=" 请输入实体名称"></el-autocomplete>
+                  placeholder="请输入实体名称"></el-autocomplete> -->
+
+                <el-select class="select-entity-name" v-model.trim="addPropertyDropdown.nodeId" filterable remote
+                  placeholder="请输入实体名称" @change="addPropertyDropdownValueChange"
+                  :remote-method="((query)=>addPropertyDropdownRemoteMethod(query,addPropertyDropdown.label))"
+                  :loading="false">
+                  <el-option v-for="item in addPropertyDropdownOptions" :key="item.nodeId" :label="item.name"
+                    :value="item.nodeId">
+                  </el-option>
+                </el-select>
+
               </div>
               <div class="right">
                 <span class="blue">导出模板</span>
@@ -600,10 +610,11 @@
         ],
         addPropertyDropdown: {
           "label": "疾病",
-          "nodeId": 0,
+          "nodeId": null,
           "name": "",
           "property": [{ key: "", value: "" }]
         },
+        addPropertyDropdownOptions: [],
         addProperty: { //右键属性新增的数据
           "label": "",
           "nodeId": -1,
@@ -714,6 +725,7 @@
       }
     },
     methods: {
+
       menuSelect: function (item) {
         this.currentPage = { ...item }
         const { id, title, url } = item
@@ -1060,7 +1072,33 @@
             this.dialogVisible = false
             this.sendChildWindowMessage("update-graph", "")
         }
-
+      },
+      addPropertyDropdownValueChange(value) {
+        for (let i = 0; i < this.addPropertyDropdownOptions.length; i++) {
+          const option = this.addPropertyDropdownOptions[i]
+          if (option.nodeId === value) {
+            this.addPropertyDropdown.name = option.name
+            break
+          }
+        }
+        // this.addPropertyDropdownOptions
+      },
+      addPropertyDropdownRemoteMethod(name, label) {
+        axios.post("/api" + api.getNode, {
+          "inputStr": name,
+          "labelName": label
+        }).then(res => {
+          const { msg, code, data } = res.data
+          if (code == '0') {
+            this.addPropertyDropdownOptions = data
+            // data.forEach((el, index) => {
+            //   this.addPropertyDropdownOptions.push(
+            //     { oldName: el.name, name: "", nodeId: el.nodeId, type: el.label })
+            // })
+          }
+        }).catch(err => {
+          console.log("addPropertyDropdownRemoteMethod的getNode接口出错了", err)
+        })
       },
       getNode() {
         axios.post("/api" + api.getNode, {

+ 2 - 2
src/js/graphMap.js

@@ -693,7 +693,7 @@ const rightMsgRender = function (data) {
     </div>
     <div class="text">
       <p class="text-key">名称:</p>
-      <p class="text-value">${data.properties.name}</p>
+      <p class="text-value">${data.properties.name || data.label}</p>
     </div>`
     let property_str = ""
     for (let i in data.properties) {
@@ -751,7 +751,7 @@ function rightEntityNode(data) {
         <div class="text" nodeIndex="${entityNode.name}" nodeId="${entityNode.nodeId}" label="${entityNode.type}">
             <p class='select-sign'><span class='icon-rect-select'></span>&nbsp;</p>
             <p class="text-key">${entityNode.type}:</p>
-            <p class="text-value">${entityNode.properties.name}</p>
+            <p class="text-value">${entityNode.properties.name || entityNode.label}</p>
         </div>`
     }
     $(".content .right .entity-node .box-content").html(entity_node_str)