|
@@ -406,8 +406,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 添加知识弹窗 -->
|
|
<!-- 添加知识弹窗 -->
|
|
|
- <div v-if="showAddModal" class="modal-overlay" style="z-index: 1002;" @click.self="showAddModal = false">
|
|
|
|
|
- <div class="modal add-modal">
|
|
|
|
|
|
|
+ <div v-if="showAddModal" class="modal-overlay" style="z-index: 1002;" @click.self="showAddModal = false" >
|
|
|
|
|
+ <div class="modal add-modal" v-loading='dialogVisible' element-loading-background="rgba(0, 0, 0, 0.8)">
|
|
|
<div class="modal-header">
|
|
<div class="modal-header">
|
|
|
<div class="modal-title"><i class="fas fa-plus"></i> {{chunkType=='add'?'添加':'编辑'}}知识</div>
|
|
<div class="modal-title"><i class="fas fa-plus"></i> {{chunkType=='add'?'添加':'编辑'}}知识</div>
|
|
|
<button class="modal-close" @click="showAddModal = false"><i class="fas fa-times"></i></button>
|
|
<button class="modal-close" @click="showAddModal = false"><i class="fas fa-times"></i></button>
|
|
@@ -706,6 +706,7 @@ const toastMessage = ref('')
|
|
|
const toastType = ref('success')
|
|
const toastType = ref('success')
|
|
|
const chunkType = ref('add')
|
|
const chunkType = ref('add')
|
|
|
const knowledgeModelLoading = ref(false)
|
|
const knowledgeModelLoading = ref(false)
|
|
|
|
|
+const dialogVisible = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -852,30 +853,44 @@ const openCategory = (category) => {
|
|
|
showToastMessage(`正在加载 ${category.name} 分类...`, 'success')
|
|
showToastMessage(`正在加载 ${category.name} 分类...`, 'success')
|
|
|
getCategoryList(category.id)
|
|
getCategoryList(category.id)
|
|
|
}
|
|
}
|
|
|
-const getCategoryList = (id,type) => {
|
|
|
|
|
|
|
+const getCategoryList = async (id,type) => {
|
|
|
|
|
+ const params = {...documentsParams.value}
|
|
|
if(!type){
|
|
if(!type){
|
|
|
categoryId.value = id?id:''
|
|
categoryId.value = id?id:''
|
|
|
- documentsParams.value.dataset_id = id?id:''
|
|
|
|
|
- documentsParams.value.keyword = searchQuery.value
|
|
|
|
|
- documentsParams.value.pageSize = 10
|
|
|
|
|
|
|
+ params.dataset_id = id?id:''
|
|
|
|
|
+ params.keyword = searchQuery.value
|
|
|
|
|
+ params.pageSize = 10
|
|
|
}else{
|
|
}else{
|
|
|
- documentsParams.value.dataset_id = id?id:''
|
|
|
|
|
- documentsParams.value.pageSize = 9999
|
|
|
|
|
|
|
+ params.dataset_id = id?id:''
|
|
|
|
|
+ params.pageIndex = 1
|
|
|
|
|
+ params.pageSize = 9999
|
|
|
}
|
|
}
|
|
|
- getAllDocumnets(documentsParams.value).then(res => {
|
|
|
|
|
- if(type=='add'){ //添加知识获取分类
|
|
|
|
|
- documentList.value = res.result.data
|
|
|
|
|
- }else{
|
|
|
|
|
- knowledgeList.value = res.result.data
|
|
|
|
|
-
|
|
|
|
|
- tabs.value[1].count = categoryTotal.value = res.result.total
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if(chunkType.value == 'edit'){
|
|
|
|
|
+ dialogVisible.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ await getAllDocumnets(params).then(res => {
|
|
|
|
|
+ if(type=='add'){ //添加知识获取分类
|
|
|
|
|
+ documentList.value = res.result.data
|
|
|
|
|
+ if(chunkType.value == 'edit'){
|
|
|
|
|
+ dialogVisible.value = false
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ knowledgeList.value = res.result.data
|
|
|
|
|
+
|
|
|
|
|
+ tabs.value[1].count = categoryTotal.value = res.result.total
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ ElMessage.error(err?.message || '稍后再试!')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
getCategoryList()
|
|
getCategoryList()
|
|
|
const categoryPageCurrentChange = (page) => {
|
|
const categoryPageCurrentChange = (page) => {
|
|
|
- documentsParams.value.pageIndex = page
|
|
|
|
|
- getCategoryList(categoryId.value)
|
|
|
|
|
|
|
+ documentsParams.value.pageIndex = page
|
|
|
|
|
+ getCategoryList(categoryId.value)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 删除知识文档
|
|
// 删除知识文档
|
|
@@ -1083,11 +1098,12 @@ const showKnowledgeDetail = (item) => {
|
|
|
|
|
|
|
|
const editKnowledge = (item) => {
|
|
const editKnowledge = (item) => {
|
|
|
chunkType.value = 'edit'
|
|
chunkType.value = 'edit'
|
|
|
|
|
+ dialogVisible.value = true
|
|
|
|
|
+ getCategoryList(item.dataset_id,'add')
|
|
|
newKnowledge.value.content = item.content
|
|
newKnowledge.value.content = item.content
|
|
|
newKnowledge.value.answer=item.answer
|
|
newKnowledge.value.answer=item.answer
|
|
|
newKnowledge.value.dataset_id=item.dataset_id
|
|
newKnowledge.value.dataset_id=item.dataset_id
|
|
|
newKnowledge.value.segment_id=item.id
|
|
newKnowledge.value.segment_id=item.id
|
|
|
- getCategoryList(item.dataset_id,'add')
|
|
|
|
|
newKnowledge.value.document_id=item.document_id
|
|
newKnowledge.value.document_id=item.document_id
|
|
|
showAddModal.value = true
|
|
showAddModal.value = true
|
|
|
}
|
|
}
|