yangyin
2024-12-16 999edd29f1ca3d1560693a0259650069d1b7e29b
src/views/project/yw/dataManage/knowledge/ViewKnowledge.vue
@@ -1,15 +1,15 @@
<template>
   <div class="flex flex-col h100">
      <div class="h100" v-show="!state.showKnowledgeForm">
         <div class="mb-[10px] flex flex-shrink-0 items-center">
            <el-button style="margin-left: 8px; width: 40px" link @click="handleExitFlow">
               <el-icon style="font-size: 24px !important">
                  <ArrowLeft />
               </el-icon>
            </el-button>
            <span class="text-[24px] text-[#26244c] font-[700]">{{ state.knowledgeInfo.knowledge_title }}</span>
         </div>
         <div class="set-table-height">
            <div class="mb-[10px] flex flex-shrink-0 items-center">
               <el-button style="margin-left: 8px; width: 40px" link @click="handleExitFlow">
                  <el-icon style="font-size: 24px !important">
                     <ArrowLeft />
                  </el-icon>
               </el-button>
               <span class="text-[24px] text-[#26244c] font-[700]">{{ state.knowledgeInfo.knowledge_title }}</span>
            </div>
            <!-- 查询、重置、排序、增加表单 -->
            <el-form :inline="true" :model="graphQueryParams">
               <el-form-item label="名称" prop="title">
@@ -34,12 +34,18 @@
                  <el-table-column prop="name" label="文件名称" fixed="left" show-overflow-tooltip align="left" />
                  <el-table-column prop="type" width="120" label="文件类型" show-overflow-tooltip align="center" />
                  <el-table-column prop="time" label="上传时间" show-overflow-tooltip width="280" align="center"></el-table-column>
                  <el-table-column label="操作" width="80" fixed="right" show-overflow-tooltip align="center">
                  <el-table-column label="操作" width="120" fixed="right" show-overflow-tooltip align="center">
                     <template #default="scope">
                        <div class="space-x-2.5">
                           <el-tooltip effect="dark" content="查看" placement="top">
                           <el-tooltip effect="dark" content="文本" placement="top">
                              <i
                                 class="ywifont ywicon-yulan !text-[17px] cursor-pointer text-blue-400"
                                 class="ywifont ywicon-wendang !text-[17px] cursor-pointer text-blue-400"
                                 @click="openOperateDemoPage(scope.row)"
                              ></i>
                           </el-tooltip>
                           <el-tooltip effect="dark" content="分块" placement="top">
                              <i
                                 class="ywifont ywicon-01wenjianfenkuai !text-[17px] cursor-pointer text-blue-400"
                                 @click="handleViewKnowledgeFile(scope.row)"
                              ></i>
                           </el-tooltip>
@@ -79,9 +85,9 @@
                              :treedata="state.knowledgeBaseData"
                              :current-node-key="currentListID"
                              :defaultProps="{
                                 id: 'group_id',
                                 label: 'group_name',
                                 children: 'Children',
                                 label: 'title',
                                 id: 'id',
                              }"
                              @click="handleClickNode"
                           >
@@ -168,6 +174,8 @@
import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue';
import { useQueryTable } from '/@/hooks/useQueryTable';
import { convertListToTree } from '/@/utils/util';
import { OptClassificationMap, classificationEnum } from '/@/views/types/metrics';
import item from 'element-plus/es/components/space/src/item';
const viewKnowledgeTableRef = ref();
const router = useRouter();
const route = useRoute();
@@ -228,9 +236,19 @@
      knowledgeTableData.value = res.values;
   }
};
const handleViewKnowledgeFile = (row) => {
//查看文档
const openOperateDemoPage = (row: any) => {
   router.push({
      name: 'ViewFile',
      query: {
         id: row.id,
      },
   });
};
//查看文档块
const handleViewKnowledgeFile = (row) => {
   router.push({
      name: 'ViewSegmentationFile',
      query: {
         id: row.id,
      },
@@ -293,7 +311,7 @@
const treeLoading = ref(false);
const currentTreeNode = ref(null);
const leftTreeRef = ref(null);
const currentListID = computed(() => currentTreeNode.value?.id);
const currentListID = computed(() => currentTreeNode.value?.group_id);
//获取文件列表
const getImportantFileTreeData = async (selectFirst = false) => {
   treeLoading.value = true;
@@ -301,12 +319,19 @@
      treeLoading.value = false;
   });
   if (res?.json_ok) {
      const resData = (res.values || []) as [];
      state.knowledgeBaseData = convertListToTree(resData, {
         ID: 'id',
      const resData = (res.groups || []) as [];
      const byParentData = convertListToTree(resData, {
         ID: 'group_id',
         Children: 'Children',
         ParentID: 'parent',
         ParentID: 'p_group_id',
      });
      const result = [];
      byParentData.forEach((item) => {
         if (item.group_type == OptClassificationMap[classificationEnum.Knowledge]) {
            result.push(item);
         }
      });
      state.knowledgeBaseData = result;
      if (selectFirst) {
         const firstListTreeNode = state.knowledgeBaseData[0];
         if (firstListTreeNode) {
@@ -323,7 +348,7 @@
const handleClickNode = (data: any) => {
   multipleSelection.value = [];
   nextTick(() => {
      leftTreeRef.value?.treeRef.setCurrentKey(data.id);
      leftTreeRef.value?.treeRef.setCurrentKey(data.group_id);
   });
   currentTreeNode.value = data;
   getFileTableData();
@@ -382,7 +407,7 @@
.set-table-height {
   background: #fff;
   border-radius: 16px;
   height: calc(100% - 80px);
   height: calc(100% - 50px);
   margin-top: 12px;
   overflow-y: auto;
   padding: 20px 24px;