瀏覽代碼

Merge branch 'master' of https://gogs.storlead.com/storlead/storlead-sasa-platform

Fan 19 小時之前
父節點
當前提交
1e7ee33b50
共有 2 個文件被更改,包括 42 次插入 和 22 次删除
  1. 6 2
      ui/smarttrade-platform/src/views/CustomersView.vue
  2. 36 20
      ui/smarttrade-platform/src/views/KnowledgeView.vue

+ 6 - 2
ui/smarttrade-platform/src/views/CustomersView.vue

@@ -123,7 +123,7 @@
     /> -->
 
     <!-- Customer Detail Modal -->
-    <div v-if="showDetailModal && selectedCustomer" class="modal-overlay" @click.self="showDetailModal = false">
+    <div v-if="showDetailModal && selectedCustomer" class="modal-overlay" @click.self="closeDetail()">
       <div class="modal customer-detail-modal">
         <div class="modal-header">
           <div class="modal-title">
@@ -243,7 +243,7 @@
           </div> -->
         </div>
         <div class="modal-footer">
-          <button class="btn btn-secondary" @click="showDetailModal = false">关闭</button>
+          <button class="btn btn-secondary" @click="closeDetail()">关闭</button>
           <!-- <button class="btn btn-secondary"><i class="fas fa-edit"></i> 编辑</button> -->
           <button class="btn btn-primary" @click="goOtherProject(selectedCustomer)">
             <i class="fas fa-rocket"></i> 客户详情
@@ -387,6 +387,10 @@ const goOtherProject = (data) => {
   window.open(jumpUrl, '_blank')
   // 当前窗口打开:window.location.href = jumpUrl
 }
+const closeDetail = ()=>{
+  showDetailModal.value = false
+  aiContentLoading.value=false
+}
 // const customers = ref([
 //   { 
 //     id: 1, flag: '🇸🇦', name: 'Riyadh Tech Distribution', status: 'prospect', contact: 'Ahmed Al-Rashid', 

+ 36 - 20
ui/smarttrade-platform/src/views/KnowledgeView.vue

@@ -406,8 +406,8 @@
     </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-title"><i class="fas fa-plus"></i> {{chunkType=='add'?'添加':'编辑'}}知识</div>
           <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 chunkType = ref('add')
 const knowledgeModelLoading = ref(false)
+const dialogVisible = ref(false)
 
 
 
@@ -852,30 +853,44 @@ const openCategory = (category) => {
   showToastMessage(`正在加载 ${category.name} 分类...`, 'success')
   getCategoryList(category.id)
 }
-const getCategoryList  = (id,type) => {
+const getCategoryList  = async (id,type) => {
+  const params = {...documentsParams.value}
   if(!type){
     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{
-    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()
 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) => {
   chunkType.value = 'edit'
+  dialogVisible.value = true
+  getCategoryList(item.dataset_id,'add')
   newKnowledge.value.content = item.content
   newKnowledge.value.answer=item.answer
   newKnowledge.value.dataset_id=item.dataset_id
   newKnowledge.value.segment_id=item.id
-  getCategoryList(item.dataset_id,'add')
   newKnowledge.value.document_id=item.document_id
   showAddModal.value = true
 }