Browse Source

add like search for graph

allen 2 năm trước cách đây
mục cha
commit
6eb0c3143b

+ 9 - 0
src/api/knowledge/search.js

@@ -9,6 +9,15 @@ export function getGraphByEntiry(query) {
   })
 }
 
+// 查询实体管理列表
+export function getRelationByLikeName(query) {
+  return request({
+    url: '/kg/getRelationByLikeName',
+    method: 'get',
+    params: query
+  })
+}
+
 export function question(text) {
   return request({
     url: '/kg/question',

+ 5 - 1
src/views/searchV2/breakdown/index.vue

@@ -10,14 +10,18 @@
           <el-tab-pane label="部件关联分析" name="third">
             <Sbreakdown name1="部件" name2 ="部件" :key="3"/>
           </el-tab-pane>
+          <el-tab-pane label="检索" name="forth">
+            <Like name="名称" :key="4"/>
+          </el-tab-pane>
       </el-tabs>
   </div>
 </template>
 <script>
 import Sbreakdown from '@/views/searchV2/breakdown/base'
+import Like from '@/views/searchV2/breakdown/like'
 export default {
   name: "SearchBreakdown",
-  components:{Sbreakdown},
+  components:{Sbreakdown, Like},
   data() {
     return {
       activeName: 'first'

+ 80 - 0
src/views/searchV2/breakdown/like.vue

@@ -0,0 +1,80 @@
+<template>
+    <div class="app-container">
+      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
+        <el-form-item :label="name" prop="name">
+          <el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery" />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+      <Graph ref="charts" :chartList="chartData" />
+    </div>
+  </template>
+    
+  <script>
+  import Graph from "@/components/Echarts/graph";
+  import { getRelationByLikeName } from "@/api/knowledge/search";
+  
+  export default {
+    name: "GranphSearch",
+    dicts: ["graph_search_length"],
+    components: { Graph },
+    props: {
+        name: {
+        type: String,
+        required: true
+      },
+    },
+    data() {
+      return {
+        queryParams: {
+            name: "",
+        },
+        chartData: {
+          seriesData: [],
+          linksData: [],
+        },
+      };
+    },
+    methods: {
+      handleQuery() {
+        if (!this.queryParams.name) {
+          this.$message.error('请输入一个关键字');
+          return
+        }
+        getRelationByLikeName(this.queryParams).then((resp) => {
+          let respData = resp.data
+          let seriesData = []
+          let linksData = []
+          for (let item of respData.data) {
+            seriesData.push(
+              { name: item.name }
+            )
+          }
+          for (let link of respData.links) {
+            linksData.push(
+              {
+                source: link.fromName,
+                target: link.toName,
+                label: {
+                  show: true, // 是否显示line的文字
+                  formatter: link.name // line的文字
+                },
+              }
+            )
+          }
+          this.chartData = {
+            seriesData,
+            linksData,
+          }
+        });
+      },
+      resetQuery() {
+        this.resetForm("queryForm");
+      },
+    },
+  };
+  </script>
+    

+ 1 - 1
src/views/upload/uploadManage/index.vue

@@ -164,7 +164,7 @@
         </el-form-item>
         <el-form-item label="文件地址" prop="filePath">
           <!-- <el-input v-model="form.filePath" placeholder="请输入文件地址" /> -->
-          <FileUpload ref="upload" v-model="form.filePath" :value="form.filePath" :limit=1 :fileSize=100 :fileType="uploadFileType" />
+          <FileUpload ref="upload" v-model="form.filePath" :value="form.filePath" :limit=1 :fileSize=0 :fileType="uploadFileType" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">