From 8eeab4eae52f828f3e628f4a6ff7ad3daa257b7b Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期六, 27 七月 2024 23:49:44 +0800
Subject: [PATCH] 知识库页面接口调用开发
---
src/views/dmx/knowledgeLib/index.vue | 86 +++++++++++++++++++++++++++++-------------
1 files changed, 59 insertions(+), 27 deletions(-)
diff --git a/src/views/dmx/knowledgeLib/index.vue b/src/views/dmx/knowledgeLib/index.vue
index 07dba76..12287ee 100644
--- a/src/views/dmx/knowledgeLib/index.vue
+++ b/src/views/dmx/knowledgeLib/index.vue
@@ -172,39 +172,38 @@
<template #run="{ record }">
<div style="display: flex;align-items: center;">
<div style="width: 100px">
+ <a-popover title="Title" v-if="record.run == '3'">
+ <a-tag :loading="record.loading" :color="'blue'" border>{{$t('dmx.list.complete')}}</a-tag>
+ <template #content>
+ <p>Here is the text content</p>
+ </template>
+ </a-popover>
<a-popover title="Title" v-if="record.run == '2'">
- <a-tag :color="'blue'" border>{{$t('dmx.list.complete')}}</a-tag>
+ <a-tag :loading="record.loading" :color="'blue'" border>{{$t('dmx.list.complete')}}</a-tag>
<template #content>
<p>Here is the text content</p>
</template>
</a-popover>
<a-popover title="Title" v-if="record.run == '1'">
- <a-tag :color="'gold'" border>{{$t('dmx.list.cancel')}}</a-tag>
+ <a-tag :loading="record.loading" :color="'gold'" border>{{$t('dmx.list.cancel')}}</a-tag>
<template #content>
<p>Here is the text content</p>
</template>
</a-popover>
<a-popover title="Title" v-if="record.run == '0'">
- <a-tag :color="'green'" border>{{$t('dmx.list.NotStarted')}}</a-tag>
+ <a-tag :loading="record.loading" :color="'green'" border>{{$t('dmx.list.NotStarted')}}</a-tag>
<template #content>
<p>Here is the text content</p>
</template>
</a-popover>
</div>
- <div>
- <a-button type="text" size="large" v-if="record.run == '2'">
+ <div >
+ <a-button type="text" size="large" @click="run(record)" :loading="record.loading">
<template #icon>
- <icon-sync />
- </template>
- </a-button>
- <a-button type="text" size="large" v-if="record.run == '1'">
- <template #icon>
- <icon-sync style="color: green" />
- </template>
- </a-button>
- <a-button type="text" size="large" v-if="record.run == '0'">
- <template #icon>
- <icon-play-circle style="color: green" />
+ <icon-sync v-if="record.run == '3'"/>
+ <icon-sync v-if="record.run == '2'"/>
+ <icon-sync style="color: green" v-if="record.run == '1'"/>
+ <icon-play-circle style="color: green" v-if="record.run == '0'"/>
</template>
</a-button>
</div>
@@ -212,7 +211,7 @@
</template>
<template #action="{ record }" >
<tool/>
- <edit/>
+ <edit :item="record" @upTabdateItem="upTabdateItem"/>
<a-popconfirm :content="t('纭畾鍒犻櫎鍚�')" type="warning" @ok="deleteItem(record)">
<a-button type="text" size="small">
<template #icon>
@@ -293,7 +292,7 @@
queryKbDocumentList,
deleteKnow,
queryKbdetail,
- queryKbtenantInfo
+ queryKbtenantInfo, kbdocumentrm, kbdocumentchangeparser
} from "@/api/kbList";
import { Pagination } from '@/types/global';
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
@@ -452,6 +451,14 @@
console.log(data, 'data');
if(data.code=='0'){
renderData.value = data.data.docs||[];
+ renderData.value = renderData.value.map((item) => {
+ return {
+ ...item,
+ loading: false,
+ };
+ });
+ console.log(renderData.value, 'renderData.value');
+
pagination.current = params.page;
pagination.total = data.data.total;
// 鏌ヨ鐭ヨ瘑搴撹鎯�
@@ -595,17 +602,42 @@
detailsShow.value = false
}
-
- const deleteItem = async (row)=>{
- console.log(row);
- // let data = await deleteAccount({id: row.number})
- account.value.$messageSuccess('鍒犻櫎鎴愬姛')
- //
- // if(data.code == 200){
- // this.$messageSuccess('鍒犻櫎鎴愬姛')
- // }
+ function upTabdateItem(id, newName) {
+ console.log(id, newName);
+ const itemToUpdate = renderData.value.find(item => item.id === id);
+ if (itemToUpdate) {
+ itemToUpdate.name = newName;
+ }
}
+const deleteItem = async (row)=>{
+ console.log(row);
+ let data = await kbdocumentrm({doc_id: row.id})
+ if(data.code == 0){
+ Message.success('鍒犻櫎鎴愬姛');
+ knowledgeData()
+ }
+ }
+
+const run = async (row)=>{
+ console.log(row);
+ row.loading = true;
+ let data = await kbdocumentchangeparser({
+ parser_id: row.parser_id,
+ doc_id: row.id,
+ parser_config: row.parser_config,
+ })
+ if(data.code == 0){
+ Message.success('瑙f瀽鎴愬姛');
+ row.run = '3';
+ }else{
+ Message.error('瑙f瀽澶辫触');
+ row.run = '1';
+ }
+ row.loading = false;
+}
+
+
watch(
() => columns.value,
(val) => {
--
Gitblit v1.8.0