Browse Source

Merge branch 'master' of http://173.18.12.196:3000/front/self-constructing_graph

cynthia-qin 2 days ago
parent
commit
546f089f58

+ 14 - 11
index.html

@@ -1,13 +1,16 @@
 <!DOCTYPE html>
 <html lang="">
-  <head>
-    <meta charset="UTF-8">
-    <link rel="icon" href="/favicon.ico">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>知识图谱自动化构建平台</title>
-  </head>
-  <body>
-    <div id="app"></div>
-    <script type="module" src="/src/main.ts"></script>
-  </body>
-</html>
+
+<head>
+  <meta charset="UTF-8">
+  <link rel="icon" href="/favicon.ico">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>知识图谱自动化构建平台</title>
+</head>
+
+<body>
+  <div id="app"></div>
+  <script type="module" src="/src/main.ts"></script>
+</body>
+
+</html>

+ 2 - 1
src/components/CreateKBFileDialog.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="add-kb-file-dialog">
-    <el-dialog v-model="dialogVisible" title="知识库" width="1200px" align-center :show-close="false">
+    <el-dialog v-model="dialogVisible" title="知识库" width="1200px" align-center :show-close="false"
+      @closed="() => { emit('update:modelValue', false) }">
       <el-form ref="formRef" style="max-width: 100%" :model="formData" label-width="auto" class="demo-dynamic">
         <el-form-item prop="name" label="知识库名称:">
           {{ formData.name }}

+ 2 - 1
src/components/EditKBDialog.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="edit-kb-dialog">
-    <el-dialog v-model="dialogVisible" title="知识库设置" width="500" align-center>
+    <el-dialog v-model="dialogVisible" title="知识库设置" width="500" align-center
+      @closed="emit('update:modelValue', false)">
       <el-form ref="formRef" style="max-width: 600px" :model="formData" label-width="auto" class="demo-dynamic">
         <label for="">知识库名称</label>
         <el-form-item prop="name" label="">

+ 18 - 10
src/dialogs/OCRDialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" v-model="dialogFormVisible">
+  <el-dialog :title="title" v-model="dialogFormVisible" @closed="handleClosed">
     <el-form :model="form">
       <el-form-item label="任务名称" :label-width="formLabelWidth">
         <el-input v-model="form.name" autocomplete="off"></el-input>
@@ -57,8 +57,9 @@
                 <el-input v-model="knowledgeBase.querySearch" size="large" placeholder="搜索"
                   @keydown.enter="debounceGetKBfileList" :prefix-icon="Search" />
               </span>
-              <span class="add-file" @click="true && handleImportFiles(toRaw(knowledgeBase.filesList))"><span
-                  class="text">全部导入</span></span>
+              <span class="add-file" @click="handleImportFiles(toRaw(knowledgeBase.filesList))">
+                <span class="text">全部导入</span>
+              </span>
             </div>
             <el-scrollbar class="management-content-middle">
               <el-table :data="knowledgeBase.filesList">
@@ -94,7 +95,7 @@
                     </span>
                   </template>
                 </el-table-column>
-                <el-table-column fixed="right" label="操作" width="120">
+                <el-table-column fixed="right" label="操作" min-width="55">
                   <template #default="{ row }">
                     <div class="operation">
                       <el-button link type="primary" @click="handleImportFiles([toRaw(row)])">导入</el-button>
@@ -257,7 +258,7 @@ function fetchFile(fileName: string, fileUrl: string) {
       file.uid = genFileId()
       // file = file as UploadRawFile
       upload.value!.handleStart(file)
-      knowledgeBase.value.visible = false
+      // knowledgeBase.value.visible = false
       ElMessage({
         message: `文件“${fileName}”导入成功`,
         type: 'success'
@@ -318,6 +319,10 @@ const handleConfirm = () => {
 }
 defineExpose({ showDialog })
 
+function handleClosed() {
+  knowledgeBase.value.visible = false
+}
+
 watch(() => knowledgeBase.value.activeId, (newValue) => {
   debounceGetKBfileList()
   // console.log('activeId', newValue)
@@ -345,21 +350,24 @@ onMounted(() => {
 <style lang="less" scoped>
 .knowledge-base {
   position: fixed;
-  top: 0;
-  left: 0;
-  width: 100vw;
-  height: 100vh;
+  top: 50%;
+  left: 50%;
+  width: 80vw;
+  height: 90vh;
   background-color: white;
   display: flex;
   flex-direction: column;
   // overflow: auto;
+  transform: translate(-50%, -50%);
+  border-radius: 5px;
+  min-width: 800px;
 
   .topbar {
     padding: 5px;
     flex: 0 0 auto;
 
     .close-knowledge-base {
-      margin-left: calc(100vw - 30px);
+      margin-left: calc(100% - 24px);
       cursor: pointer;
 
     }

+ 14 - 5
src/router/index.ts

@@ -7,13 +7,14 @@ import KGBuilder from "@/views/KMPlatform/KGBuilder/KGBuilder.vue";
 import KnowledgeBase from "@/views/KMPlatform/KnowledgeBase/KnowledgeBase.vue";
 import OpenPlatform from "@/views/KMPlatform/OpenPlatform/OpenPlatform.vue";
 import TerminologyManagement from "@/views/KMPlatform/KGBuilder/TM/TerminologyManagement.vue";
-import EntityTypeManagement from "@/views/KMPlatform/KGBuilder/KTM/EntityTypeManagement.vue";
+import EntityTypeManagement from "@/views/KMPlatform/KGBuilder/ETM/EntityTypeManagement.vue";
 import KnowledgeBaseManagement from "@/views/KMPlatform/KnowledgeBase/KBM/KnowledgeBaseManagement.vue";
 import KnowledgeManagement from "@/views/KMPlatform/KnowledgeBase/KM/KnowledgeManagement.vue";
 import AccountManage from "@/views/KMPlatform/Permission/AccountManage.vue";
 import PermissionManage from "@/views/KMPlatform/Permission/permission.vue";
 import RoleManage from "@/views/KMPlatform/Permission/RoleManage.vue";
-import { getSessionVar, deleteSessionVar } from "@/utils/session";
+import EntityRelationshipTypeManagement from '@/views/KMPlatform/KGBuilder/KRTM/EntityRelationshipTypeManagement.vue'
+import { getSessionVar,  deleteSessionVar } from "@/utils/session";
 
 const router = createRouter({
   history: createWebHistory(import.meta.env.BASE_URL),
@@ -125,14 +126,22 @@ const router = createRouter({
               component: TerminologyManagement,
             },
             {
-              path: "ktm",
-              name: "kgb-ktm",
+              path: 'etm',
+              name: 'kgb-etm',
               meta: {
                 title: "实体类型管理",
               },
               component: EntityTypeManagement,
             },
-          ],
+            {
+              path: 'krtm',
+              name: 'kgb-krtm',
+              meta: {
+                title: "实体关系类型管理"
+              },
+              component: EntityRelationshipTypeManagement,
+            }
+          ]
         },
         {
           path: "openplatform",

+ 1 - 1
src/stores/menu.js

@@ -4,7 +4,7 @@ import { defineStore } from 'pinia'
 export const useMenuStore = defineStore('menu', () => {
   const routeList = ref([{
     path: '/kmplatform/home',
-    name: 'home',
+    name: 'kmplatform-home',
     title: "主页",
     children: []
   },

+ 2 - 0
src/utils/config.js

@@ -4,5 +4,7 @@ export const api = {
   batchUpdate: '/open-platform/files/batch-update'
 }
 
+export const knowledgeGraphAddr = process.env.NODE_ENV === 'development' ? 'http://173.18.12.191:1388/home.html' : 'http://' + window.location.hostname + ':1388/home.html'
+
 export const pdfjsAddr = window.location.origin + '/static/pdfjs310/web/viewer.html'
 

+ 16 - 7
src/views/KMPlatform/Home/Home.vue

@@ -21,7 +21,7 @@
         </div>
       </div>
       <div class="modules">
-        <div v-for="item in modules" @click="router.push({ path: item.path })">{{ item.name }}</div>
+        <div v-for="item in modules" @click="handleModuleClick(item.path)">{{ item.name }}</div>
       </div>
     </div>
   </div>
@@ -30,12 +30,13 @@
 <script setup lang="ts">
 import { ref } from 'vue'
 import { useRouter } from 'vue-router'
+import { knowledgeGraphAddr } from "@/utils/config"
 const router = useRouter()
 let process = ref<any>([
   {
     image: "node-icon",
     title: "构建知识库",
-    description: "文档载入、OCR识别、文档切片、知识抽取、自动构建",
+    description: "创建知识库、导入文档",
   },
   {
     image: "build-kg-icon",
@@ -50,18 +51,26 @@ let process = ref<any>([
 ])
 let modules = ref<any>([
   {
-    name: "构建知识库",
+    name: "知识库构建",
     path: "/kmplatform/knowledgebase/kbm"
   },
   {
-    name: '自动化构建知识图谱',
+    name: '知识图谱构建',
     path: "/kmplatform/kgbuilder/tm"
   },
   {
-    name: "知识更新管理",
-    path: ""
+    name: "知识图谱维护",
+    path: knowledgeGraphAddr
   }
 ])
+
+function handleModuleClick(path: string) {
+  if (/^https?/g.test(path)) {
+    window.open(path, '_blank');
+  } else {
+    router.push({ path: path })
+  }
+}
 </script>
 
 <style lang="less" scoped>
@@ -246,7 +255,7 @@ h1 {
   &>div {
     //background-color: #F2F2F2;
     // background: rgba(215, 223, 250, 0.5);
-    background: linear-gradient( #d7dffa 0%, #F6F6F9 100%);
+    background: linear-gradient(#d7dffa 0%, #F6F6F9 100%);
     width: 350px;
     height: 200px;
     line-height: 200px;

src/views/KMPlatform/KGBuilder/KTM/EntityTypeManagement.vue → src/views/KMPlatform/KGBuilder/ETM/EntityTypeManagement.vue


+ 6 - 1
src/views/KMPlatform/KGBuilder/KGBuilder.vue

@@ -28,8 +28,13 @@ let menuList = ref([
   },
   {
     name: 'kgb-ktm',
-    path: '/kmplatform/kgbuilder/ktm',
+    path: '/kmplatform/kgbuilder/etm',
     title: "实体类型管理"
+  },
+  {
+    name: 'kgb-krtm',
+    path: '/kmplatform/kgbuilder/krtm',
+    title: "实体关系类型管理"
   }
 ])
 

+ 7 - 0
src/views/KMPlatform/KGBuilder/KRTM/EntityRelationshipTypeManagement.vue

@@ -0,0 +1,7 @@
+<template>
+  Entity Relationship Type Management
+</template>
+
+<script setup lang="ts"></script>
+
+<style lang="less" scoped></style>

+ 6 - 4
src/views/KMPlatform/KnowledgeBase/KBM/KnowledgeBaseManagement.vue

@@ -117,15 +117,15 @@
     </footer>
 
     <!-- 创建知识库的对话框 -->
-    <el-dialog v-model="dialogFormVisible" class="kb-dialog" :show-close="false" title="创建知识库" width="800">
-      <template #header>
+    <el-dialog v-model="dialogFormVisible" class="kb-dialog" :show-close="true" title="创建知识库" width="800">
+      <!-- <template #header>
         <div class="kb-dialog-header">
           <i @click="dialogFormVisible = false"><el-icon>
               <ArrowLeft />
             </el-icon></i>
           <i>创建知识库</i>
         </div>
-      </template>
+      </template> -->
       <div class="form-title">定义知识库</div>
       <el-form :model="formData" label-width="auto" :rules="rules" ref="formRef" style="max-width: 700px">
         <el-form-item label="知识库名称:" label-width="150" prop="name" required label-position="left">
@@ -368,6 +368,8 @@ onMounted(() => {
   .top-bar {
     display: flex;
     justify-content: space-between;
+    background: white;
+    // padding: 5px 10px;
   }
 
   .search {
@@ -730,7 +732,7 @@ onMounted(() => {
     }
 
     .name-tip {
-      color: #A5BAD2;
+      color: #C7CAD2;
       text-align: right;
       // margin-left: auto;
     }

+ 7 - 3
src/views/KMPlatform/KnowledgeBase/KM/KnowledgeManagement.vue

@@ -263,28 +263,32 @@ getKnowledgeBaseById()
       width: 300px;
       flex: 0 0 auto;
 
-      &>div {
-        margin-top: 20px;
-      }
+      // &>div {
+      //   margin-top: 20px;
+      // }
 
       .name {
         font-weight: bold;
         font-size: 18px;
+        margin-top: 20px;
       }
 
       .tags {
         color: #A8ACB8;
         font-size: 14px;
         line-height: 1.4;
+        margin-top: 5px;
       }
 
       .description {
         color: #A8ACB8;
         font-size: 16px;
+        margin-top: 10px;
       }
 
       .other {
         color: #354052;
+        margin-top: 20px;
       }
     }