From 324db843282ae84085e52a7e8ad03d01a6fb52cc Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期四, 08 八月 2024 11:51:51 +0800
Subject: [PATCH] 配置上传图片bug页面修改

---
 src/views/dmx/knowledgeLib/index.vue |  135 +++++++++++++++++++++++++++++---------------
 1 files changed, 88 insertions(+), 47 deletions(-)

diff --git a/src/views/dmx/knowledgeLib/index.vue b/src/views/dmx/knowledgeLib/index.vue
index b61853d..c5f134d 100644
--- a/src/views/dmx/knowledgeLib/index.vue
+++ b/src/views/dmx/knowledgeLib/index.vue
@@ -8,7 +8,7 @@
             :placeholder="$t('cardList.searchInput.placeholder')"
             style="width: 130px;"
           />
-          <addKnow @getknowledge="getknowledge"></addKnow>
+          <addKnow @getknowledge="getknowledge" @getKbdetail="getKbdetail"></addKnow>
         </div>
         <div class="lf-container-down">
           <a-scrollbar style="height:56rem;overflow: auto;">
@@ -24,16 +24,17 @@
                 <icon-more  :style="{position: 'absolute',top:'10px',right:'20px'}"/>
                 <template #content>
                   <a-popconfirm content="纭畾鍒犻櫎鍚�?" @ok="deleteKnowledge(tab.id)" type="warning">
-                    <span style="cursor: pointer;color: #0960bd;font-size: 12px"><icon-delete />鍒犻櫎</span>
+                    <span style="cursor: pointer;color: #4977ba;font-size: 12px"><icon-delete style="font-size: 14px"/>鍒犻櫎</span>
                   </a-popconfirm>
+<!--                  <span style="cursor: pointer;color: #0960bd;font-size: 12px" @click="deleteKnowledge(tab.id)"><icon-delete />鍒犻櫎</span>-->
                 </template>
               </a-popover>
             </div>
           </a-scrollbar>
           </div>
       </div>
-      <div class="rt-container">
-        <a-tabs default-active-key="1">
+      <div class="rt-container" v-if="tabs.length > 0">
+        <a-tabs :activeKey="activeKey" @change="handleTabChange">
           <a-tab-pane key="1" :title= "t('dmx.list.DataSet')">
             <div class="rt-container-main">
               <a-card  ref="account" class="general-card" title="" style="padding-top: 20px">
@@ -54,7 +55,7 @@
                             @change="search"
                           />
                           <!--鏂板缓-->
-                          <span v-if="tabs.length > 0">
+                          <span>
                             <add :kbobj="kbobj" @changeFetchData="changeFetchData"/>
                           </span>
                         </a-col>
@@ -256,7 +257,7 @@
           </a-tab-pane>
           <a-tab-pane key="3" :title="t('dmx.list.disposition')">
             <div class="rt-container-main">
-              <config ref="configForm" :kbtenantInfo="kbtenantInfo"  :kbobj="kbobj"></config>
+              <config ref="configForm" :kbtenantInfo="kbtenantInfo"  :kbobj="kbobj"  @cancleConfig="cancleConfig" @saveConfig="saveConfig"></config>
             </div>
           </a-tab-pane>
         </a-tabs>
@@ -359,6 +360,7 @@
   const size = ref<SizeProps>('medium');
   let visible = ref(false)
   let keywords = ref('')
+  let activeKey = ref('1')
   let detailsShow = ref(false)
   let selectedTab = ref(0)
   let testForm = ref(null)
@@ -371,15 +373,15 @@
   let parser_ids = reactive({})
   let seeObj = reactive({})
   let kbtenantInfo = reactive({
-    "asr_id": "paraformer-realtime-8k-v1",
-    "embd_id": "BAAI/bge-large-zh-v1.5",
-    "img2txt_id": "qwen-vl-max",
-    "llm_id": "qwen-plus",
-    "name": "wanghao鈥榮 Kingdom",
-    "parser_ids": "naive:General,qa:Q&A,resume:Resume,manual:Manual,table:Table,paper:Paper,book:Book,laws:Laws,presentation:Presentation,picture:Picture,one:One",
-    "rerank_id": "BAAI/bge-reranker-v2-m3",
-    "role": "owner",
-    "tenant_id": "948fc6fa41ab11ef8fb80242ac120004",
+    asr_id: "paraformer-realtime-8k-v1",
+    embd_id: "BAAI/bge-large-zh-v1.5",
+    img2txt_id: "qwen-vl-max",
+    llm_id: "qwen-plus",
+    name: "wanghao鈥榮 Kingdom",
+    parser_ids: "naive:General,qa:Q&A,resume:Resume,manual:Manual,table:Table,paper:Paper,book:Book,laws:Laws,presentation:Presentation,picture:Picture,one:One",
+    rerank_id: "BAAI/bge-reranker-v2-m3",
+    role: "owner",
+    tenant_id: "948fc6fa41ab11ef8fb80242ac120004",
     parser_idObj:{}
   })
   let tabs = ref([])
@@ -389,13 +391,12 @@
     // console.log(item.id);
     kbobj= item;
     kbId = kbobj.id;
-    testForm.value.changekbid(kbId);
-    configForm.value.changekbObj(kbobj);
     fetchData({
       kb_id: kbobj.id,
       page: 1,
       page_size: 20
     })
+    getKbdetail(kbobj.id)
   }
 
   const basePagination: Pagination = {
@@ -500,10 +501,7 @@
     setLoading(true);
     try {
       const  data  = await queryKbDocumentList(params);
-      console.log(data, 'data');
       if(data.code=='0'){
-        //   璇︽儏
-        // const  kbtenantInfo  = await queryKbtenantInfo();
         parser_ids = kbtenantInfo.parser_ids.split(',').reduce((acc, pair) => {
           const [key, value] = pair.split(':');
           acc[key] = value;
@@ -519,14 +517,10 @@
             parser_id: parser_ids[item.parser_id],
           };
         });
-        console.log(renderData.value, 'renderData');
+        // console.log(renderData.value, 'renderData');
 
         pagination.current = params.page;
         pagination.total = data.data.total;
-        //   鏌ヨ鐭ヨ瘑搴撹鎯�
-        // kbdetail  = await queryKbdetail({
-        //   kb_id:params.kb_id,
-        // });
 
       }
     } catch (err) {
@@ -559,19 +553,21 @@
     setLoading(true);
     try {
       const { data } = await queryKbList(params);
-      console.log(data, 'data');
+      // console.log(data, 'data');
       tabs.value = data;
-      console.log(tabs.value, 'tabs');
+      // console.log(tabs.value, 'tabs');
       if(tabs.value.length>0 && tabs.value[0]){
         kbobj = tabs.value[0]
         kbId = kbobj.id;
-        testForm.value.changekbid(kbId);
-        configForm.value.changekbObj(kbobj);
+        activeKey.value = '1';
         fetchData({
           kb_id: kbobj.id,
           page: 1,
           page_size: 20
         })
+        getKbdetail(kbobj.id)
+      }else{
+
       }
       // renderData.value = data.list;
       // console.log(renderData, 'renderData');
@@ -583,24 +579,32 @@
       setLoading(false);
     }
   };
-const getknowledge = async (
-  params = { page: 1, page_size: 20 }
-) => {
+
+
+  const getKbdetail = async (kb_id) => {
+    //   鏌ヨ鐭ヨ瘑搴撹鎯�
+    const data = await queryKbdetail({
+      kb_id:kb_id,
+    });
+    kbdetail = data.data;
+    testForm.value.changekbid(kbdetail.id);
+    configForm.value.changekbObj(kbdetail);
+  };
+
+
+
+
+const getknowledge = async (id) => {
   setLoading(true);
   try {
-    const { data } = await queryKbList(params);
+    const { data } = await queryKbList({ page: 1, page_size: 20 });
     console.log(data, '鏌ヨ鐭ヨ瘑搴撳垪琛�');
     tabs.value = data;
-    if(tabs.value.length>0 && tabs.value[0]){
-      kbobj = tabs.value[0]
-      kbId = kbobj.id;
-      testForm.value.changekbid(kbId);
-      configForm.value.changekbObj(kbobj);
-      // fetchData({
-      //   kb_id: kbobj.id,
-      //   page: 1,
-      //   page_size: 20
-      // })
+    if(tabs.value.length>0){
+      // 瀹氫綅鍒版柊澧炵殑鐭ヨ瘑搴撳崟鍏�
+      selectedTab.value = tabs.value.findIndex(item=>item.id==id);
+      getKbdetail(id) // 鑾峰彇璇︽儏
+      activeKey.value = '3';
     }
 
 
@@ -627,13 +631,41 @@
   const reset = () => {
     formModel.value = generateFormModel();
   };
-
+  function handleTabChange(key: string) {
+    // 澶勭悊鏍囩鏀瑰彉浜嬩欢
+    console.log('Changed to tab:', key);
+    activeKey.value=key;
+  }
   const handleSelectDensity = (
     val: string | number | Record<string, any> | undefined,
     e: Event
   ) => {
     size.value = val as SizeProps;
   };
+
+  const cancleConfig = () => {
+    activeKey.value = '1';
+    let id = tabs.value[selectedTab.value].id;
+    fetchData({
+      kb_id: id,
+      page: 1,
+      page_size: 20
+    })
+  }
+
+  const saveConfig = async () => {
+    activeKey.value = '1';
+    let id = tabs.value[selectedTab.value].id;
+    const { data } = await queryKbList({ page: 1, page_size: 20 });
+    tabs.value = data;
+    fetchData({
+      kb_id: id,
+      page: 1,
+      page_size: 20
+    })
+    getKbdetail(id) // 鑾峰彇璇︽儏
+  }
+
 
   const handleChange = (
     checked: boolean | (string | boolean | number)[],
@@ -704,7 +736,7 @@
     let data = await kbdocumentrm({doc_id: row.id})
     if(data.code == 0){
       Message.success('鍒犻櫎鎴愬姛');
-      console.log(kbobj, 'kbobj');
+      // console.log(kbobj, 'kbobj');
       fetchData({
         kb_id: kbobj.id,
         page: 1,
@@ -753,7 +785,7 @@
 
 
 const   run =  async (row)=>{
-  console.log(row);
+  // console.log(row);
   row.loading = true;
   let run = '1'
   if(row.run!='2'){
@@ -772,6 +804,12 @@
     Message.error('瑙f瀽澶辫触');
     row.run = '1';
   }
+  fetchData({
+    kb_id: tabs.value[selectedTab.value].id,
+    page: 1,
+    page_size: 20
+  })
+
   row.loading = false;
 }
 
@@ -795,7 +833,10 @@
     { deep: true, immediate: true }
   );
 
-  onBeforeMount(()=>{
+  onBeforeMount(async()=>{
+    // const  {data}  = await queryKbtenantInfo();
+    // Object.assign(kbtenantInfo,data);
+    // console.log(kbtenantInfo,'kbtenantInfo鐨勬暟鎹�');
 
   })
   onMounted(()=>{

--
Gitblit v1.8.0