From fa5fd89d1fd0f2d0b0bb1944b3ac4a452c49f83a Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期六, 17 八月 2024 16:30:33 +0800 Subject: [PATCH] fix: 修改分页id --- src/views/dmx/knowledgeLib/index.vue | 77 +++++++++++++++++++++++++++++++------- 1 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/views/dmx/knowledgeLib/index.vue b/src/views/dmx/knowledgeLib/index.vue index 442ca87..1be7bab 100644 --- a/src/views/dmx/knowledgeLib/index.vue +++ b/src/views/dmx/knowledgeLib/index.vue @@ -88,6 +88,32 @@ type="text" class="button" style="color: #2a2a2b" + @click="enableDisable(1)" + > + <template #icon> + <icon-play-circle /> + </template> + 鍚敤 + </a-button> + </p> + <p> + <a-button + type="text" + class="button" + style="color: #2a2a2b" + @click="enableDisable(0)" + > + <template #icon> + <icon-record color="" /> + </template> + 绂佺敤 + </a-button> + </p> + <p> + <a-button + type="text" + class="button" + style="color: #2a2a2b" @click="addBlock(1)" > <template #icon> @@ -401,7 +427,7 @@ </template> </a-button> - <a-button + <!-- <a-button type="text" size="small" :disabled="record.run == '1'" @@ -410,7 +436,7 @@ <template #icon> <icon-eye /> </template> - </a-button> + </a-button> --> </template> </a-table> </a-card> @@ -513,6 +539,7 @@ kbdocumentchangeStatus, downloadFile, chunkSwitch, + changeStatus, } from '@/api/kbList'; import { Pagination } from '@/types/global'; import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; @@ -578,7 +605,7 @@ embd_id: 'BAAI/bge-large-zh-v1.5', img2txt_id: 'qwen-vl-max', llm_id: 'qwen-plus', - name: 'wanghao鈥榮 Kingdom', + name: 'wanghaos 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', @@ -590,6 +617,7 @@ const selectTab = (index, item) => { selectedTab.value = index; + checkedArr.value = []; // console.log(item.id); kbobj = item; kbId = kbobj.id; @@ -745,7 +773,7 @@ }; const onPageChange = (current: number) => { - fetchData({ ...basePagination, current }); + fetchData({ ...basePagination, current, kb_id: kbobj.id }); }; const selectTabAll = (val) => { @@ -875,6 +903,20 @@ getKbdetail(id); // 鑾峰彇璇︽儏 }; + const enableDisable = async (type) => { + Promise.all( + checkedArr.value.map(async (item) => { + await changeStatus({ + doc_id: item, + status: type, + }); + }) + ).then(() => { + Message.success('鏇存柊鎴愬姛'); + getKbList(); + }); + }; + //鎵归噺鍚敤鍒犻櫎绂佺敤 const addBlock = async (type) => { if (type != 3) { @@ -891,11 +933,12 @@ } }); }); - fetchData({ - kb_id: tabs.value[selectedTab.value].id, - page: 1, - page_size: 20, - }); + // fetchData({ + // kb_id: tabs.value[selectedTab.value].id, + // page: 1, + // page_size: 20, + // }); + getKbList(); } else { // Message.error('瑙f瀽澶辫触'); // row.run = '1'; @@ -912,16 +955,20 @@ let data = await kbdocumentrm({ doc_id: checkedArr.value }); if (data.code == 0) { Message.success('鍒犻櫎鎴愬姛'); - fetchData({ - kb_id: tabs.value[selectedTab.value].id, - page: 1, - page_size: 20, - }); + getKbList(); } }, onCancel: () => {}, }); } + }; + + const getKbList = async () => { + await fetchData({ + kb_id: tabs.value[selectedTab.value].id, + page: 1, + page_size: 20, + }); }; const exchangeArray = <T extends Array<any>>( @@ -988,7 +1035,7 @@ }; const onDownloadDocument = async (record) => { console.log(record); - downloadFile({ + await downloadFile({ url: `/api/v1/document/get/${record.id}`, filename: record.name, }); -- Gitblit v1.8.0