Explorar o código

文档上传预览

CzRger hai 2 semanas
pai
achega
a015c520a4

+ 5 - 12
src/api/interceptors.ts

@@ -46,19 +46,12 @@ export class Interceptors {
     this.instance.interceptors.response.use(
       // 请求成功
       (res: any) => {
-        if (
-          res.config.url.includes(
-            (import.meta as any).env.VITE_WORKFLOW_API_PROXY,
-          )
-        ) {
-          if (res.data.success) {
-            return Promise.resolve(res.data)
-          } else {
-            this.errorHandle(res)
-            return Promise.reject(res.data)
-          }
+        if (res.data.success) {
+          return Promise.resolve(res.data)
+        } else {
+          this.errorHandle(res)
+          return Promise.reject(res.data)
         }
-        return Promise.resolve(res.data)
       },
       // 请求失败
       (error: { response: any }) => {

+ 5 - 12
src/api/modules/global/upload.ts

@@ -1,12 +1,5 @@
-// import { handle } from '../../index'
-//
-// const suffix = 'bm-api'
-//
-// // 查询字典项
-// export const axUpload = (params, onProcess) =>
-//   handle({
-//     url: `http://8.130.72.63:18099/api/common/upload`,
-//     method: 'upload',
-//     params,
-//     onProcess,
-//   })
+import { get, post, upload } from '@/api/request'
+
+// 文件上传
+export const fileUploadFile = (params, onProcess) =>
+  upload('/file/uploadFile', params, {}, '', onProcess)

+ 8 - 0
src/api/modules/knowledge/document.ts

@@ -0,0 +1,8 @@
+import { get, post, put, del } from '@/api/request'
+
+// 知识库文档分页
+export const documentGetDocumentsByPage = (params) =>
+  post(`/document/getDocumentsByPage`, params, {})
+// 知识库文档分段预览
+export const datasetsDocumentsDealView = (params) =>
+  post(`/datasets/documents/deal/view`, params, {})

+ 27 - 0
src/api/request.ts

@@ -84,3 +84,30 @@ export const put = (
       })
   })
 }
+export const upload = (
+  url = '',
+  params: any = {},
+  config: any = {},
+  proxy = '',
+  onProcess = (p) => {},
+) => {
+  return new Promise((resolve, reject) => {
+    const rUrl = (proxy || (import.meta as any).env.VITE_BASE_API_PROXY) + url
+    request
+      .post(rUrl, params, {
+        ...config,
+        onUploadProgress: (progressEvent) => {
+          const percent = Math.round(
+            (progressEvent.loaded / progressEvent.total) * 100,
+          )
+          onProcess(percent)
+        },
+      })
+      .then((res: any) => {
+        resolve(res)
+      })
+      .catch((res: any) => {
+        reject(res)
+      })
+  })
+}

+ 4 - 12
src/stores/modules/dictionary.ts

@@ -69,9 +69,7 @@ export const useDictionaryStore = defineStore('dictionary', {
             this.knowledgeTags.map = listToMap({ list: arr })
             this.knowledgeTags.objMap = listToMap({ list: arr, isObj: true })
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
-          })
+          .catch(() => {})
           .finally(() => {
             this.knowledgeTags.waiting = false
           })
@@ -91,9 +89,7 @@ export const useDictionaryStore = defineStore('dictionary', {
             this.knowledgeGroups.map = listToMap({ list: arr })
             this.knowledgeGroups.objMap = listToMap({ list: arr, isObj: true })
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
-          })
+          .catch(() => {})
           .finally(() => {
             this.knowledgeGroups.waiting = false
           })
@@ -113,9 +109,7 @@ export const useDictionaryStore = defineStore('dictionary', {
             this.modelTypes.map = listToMap({ list: arr })
             this.modelTypes.objMap = listToMap({ list: arr, isObj: true })
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
-          })
+          .catch(() => {})
           .finally(() => {
             this.modelTypes.waiting = false
           })
@@ -140,9 +134,7 @@ export const useDictionaryStore = defineStore('dictionary', {
             this.modelProvides.map = listToMap({ list: arr })
             this.modelProvides.objMap = listToMap({ list: arr, isObj: true })
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
-          })
+          .catch(() => {})
           .finally(() => {
             this.modelProvides.waiting = false
           })

+ 2 - 2
src/views/global/login/index.vue

@@ -105,8 +105,8 @@ const onLogin = () => {
             router.replace({ name: 'root' })
             state.loading = false
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
+          .catch(() => {})
+          .finally(() => {
             state.loading = false
           })
       })

+ 7 - 11
src/views/manage/knowledge/detail.vue

@@ -128,7 +128,9 @@ watch(
   (n) => {
     if (n) {
       initDictionary()
-      state.form = {}
+      state.form = {
+        tenantId: AppStore.tenantInfo?.id,
+      }
       ref_modelConfig.value?.reset()
       if (props.transfer.mode !== 'add') {
         initData()
@@ -147,9 +149,7 @@ const initData = () => {
       state.form = data
       ref_modelConfig.value.init(data)
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       state.loading = false
     })
@@ -166,7 +166,6 @@ const onSubmit = (isImport) => {
             datasetsCreate({
               ...state.form,
               ...ref_modelConfig.value.getData(),
-              tenantId: AppStore.tenantInfo?.id,
               contentConfig: {
                 maxParentSize: 500,
                 overlapSize: 20,
@@ -188,9 +187,7 @@ const onSubmit = (isImport) => {
                   emit('refresh')
                 }
               })
-              .catch(({ message }: any) => {
-                ElMessage.error(message)
-              })
+              .catch(() => {})
               .finally(() => {
                 state.loading = false
               })
@@ -202,10 +199,9 @@ const onSubmit = (isImport) => {
             })
               .then(({ data }: any) => {
                 ElMessage.success(`${titleCpt.value}成功!`)
+                emit('refresh')
               })
-              .catch(({ message }: any) => {
-                ElMessage.error(message)
-              })
+              .catch(() => {})
               .finally(() => {
                 state.loading = false
               })

+ 17 - 31
src/views/manage/knowledge/documents/document/index.vue

@@ -150,6 +150,7 @@ import detailCom from './detail.vue'
 import renameCom from './rename.vue'
 import knowledgeSelectCom from './knowledge-select.vue'
 import stageIndexCom from './stage-index.vue'
+import { documentGetDocumentsByPage } from '@/api/modules/knowledge/document'
 
 const DialogStore = useDialogStore()
 const DictionaryStore = useDictionaryStore()
@@ -162,6 +163,7 @@ const ID = inject('ID')
 const state: any = reactive({
   text: '',
   query: {
+    init: false,
     loading: false,
     head: [
       { value: 'name', label: '文件名称', show: true },
@@ -225,18 +227,24 @@ watch(
 watch(
   () => state.query.form,
   (n) => {
-    onSearch()
+    if (state.query.init) {
+      onSearch()
+    }
   },
   { deep: true },
 )
 const onPage = (pageNum, pageSize) => {
+  setTimeout(() => {
+    state.query.init = true
+  }, 100)
   state.query.page = {
     pageNum: pageNum,
     pageSize: pageSize,
   }
   const params = {
-    pageNum: state.query.page.pageNum,
-    pageSize: state.query.page.pageSize,
+    datasetId: ID,
+    page: state.query.page.pageNum,
+    size: state.query.page.pageSize,
   }
   //  添加表单参数
   for (const [k, v] of Object.entries(state.query.formReal)) {
@@ -245,34 +253,12 @@ const onPage = (pageNum, pageSize) => {
     }
   }
   state.query.loading = true
-  setTimeout(() => {
-    state.query.result.total = 100
-    const arr: any = []
-    for (let i = 1; i <= params.pageSize; i++) {
-      const n = (params.pageNum - 1) * params.pageSize + i
-      arr.push({
-        id: i + '',
-        p1: '文件' + n + '.md',
-      })
-    }
-    state.query.result.data = arr
-    // setTimeout(() => {
-    //   state.query.selected = [arr[1], arr[5]]
-    // })
-    state.query.loading = false
-  }, 1000)
-  // state.query.loading = true
-  // listRuleLogisticsDataSubscribeInfo(params).then(res => {
-  //   if (res.code == 200) {
-  //     state.query.result.total = res.total
-  //     state.query.result.data = res.rows
-  //     state.query.loading = false
-  //   } else {
-  //     ElMessage.error(res.msg)
-  //   }
-  // }).catch(() => {
-  //   state.query.loading = false
-  // })
+  documentGetDocumentsByPage(params)
+    .then(({ data }: any) => {
+      state.query.result.total = data.totalElements
+      state.query.result.data = data.content
+    })
+    .catch(() => {})
 }
 const onSearch = () => {
   state.query.selected = []

+ 12 - 4
src/views/manage/knowledge/documents/index.vue

@@ -2,7 +2,7 @@
   <div class="flex h-full w-full">
     <div class="mr-[1rem] w-[13rem]">
       <div class="menu-title">
-        <span v-title>部门知识库-新</span>
+        <span v-title>{{ state.knowledge?.name }}</span>
       </div>
       <template v-for="(item, index) in menus">
         <div
@@ -21,6 +21,7 @@
       </template>
     </div>
     <component
+      v-if="state.knowledge.ID"
       :is="menus.filter((v) => v.value === state.menu)[0]?.com"
       :knowledge="state.knowledge"
     />
@@ -37,6 +38,8 @@ import {
   ref,
 } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
+import { datasetsDetail } from '@/api/modules/knowledge'
+import { ElMessage } from 'element-plus'
 
 const route = useRoute()
 const router = useRouter()
@@ -72,15 +75,20 @@ const state: any = reactive({
 provide('ID', state.ID)
 const initDetail = () => {
   if (state.ID) {
-    state.knowledge = {
-      ID: state.ID,
-    }
     const m = route.query.menu
     if (m && menus.some((v) => v.value === m)) {
       state.menu = m
     } else {
       state.menu = menus[0].value
     }
+    datasetsDetail(state.ID)
+      .then(({ data }: any) => {
+        state.knowledge = {
+          ...data,
+          ID: data.id,
+        }
+      })
+      .catch(() => {})
   } else {
     router.push({ name: '4342bfff-1ea8-4f4c-b562-3cdc1fde116f' })
   }

+ 6 - 16
src/views/manage/knowledge/index.vue

@@ -92,7 +92,7 @@
                 $router.push({
                   name: '78430247-a531-4c8f-8a08-c88e93a836e2',
                   params: {
-                    id: index,
+                    id: row.id,
                   },
                 })
               "
@@ -282,9 +282,7 @@ const onPage = (pageNum, pageSize) => {
       state.query.result.total = data.totalElements
       state.query.result.data = [{ empty: true }, ...data.content]
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       state.query.loading = false
     })
@@ -323,9 +321,7 @@ const onDel = (row: any) => {
         .then(() => {
           ElMessage.success('删除成功!')
         })
-        .catch(({ message }: any) => {
-          ElMessage.error(message)
-        })
+        .catch(() => {})
         .finally(() => {
           onSearch()
         })
@@ -340,9 +336,7 @@ const onChangeTag = (row, tags) => {
     .then(() => {
       ElMessage.success('标签绑定成功!')
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       onSearch()
     })
@@ -353,9 +347,7 @@ const onStart = (row) => {
       .then(() => {
         ElMessage.success('取消收藏成功!')
       })
-      .catch(({ message }: any) => {
-        ElMessage.error(message)
-      })
+      .catch(() => {})
       .finally(() => {
         onSearch()
       })
@@ -367,9 +359,7 @@ const onStart = (row) => {
       .then(() => {
         ElMessage.success('收藏成功!')
       })
-      .catch(({ message }: any) => {
-        ElMessage.error(message)
-      })
+      .catch(() => {})
       .finally(() => {
         onSearch()
       })

+ 2 - 6
src/views/manage/knowledge/model-config.vue

@@ -776,9 +776,7 @@ const initDictionary = () => {
         return v
       })
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
   pluginGetListByType({ type: 'RERANK' })
     .then(({ data }: any) => {
       state.optionsRerank = data.map((v) => {
@@ -787,9 +785,7 @@ const initDictionary = () => {
         return v
       })
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
 }
 </script>
 

+ 3 - 7
src/views/manage/knowledge/tags-select.vue

@@ -207,9 +207,7 @@ const onAdd = () => {
       state.text = ''
       ElMessage.success('创建标签成功!')
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       DictionaryStore.initKnowledgeTags(AppStore.tenantInfo?.id)
     })
@@ -221,9 +219,7 @@ const onDel = (row) => {
       .then(() => {
         ElMessage.success('删除标签成功!')
       })
-      .catch(({ message }: any) => {
-        ElMessage.error(message)
-      })
+      .catch(() => {})
       .finally(() => {
         DictionaryStore.initKnowledgeTags(AppStore.tenantInfo?.id)
         state.loading = false
@@ -254,7 +250,7 @@ const onEdit = (row) => {
       .then(() => {
         ElMessage.success('修改标签成功!')
       })
-      .catch(({ message }: any) => {
+      .catch(() => {
         row.__edit = false
         ElMessage.error(message)
       })

+ 100 - 87
src/views/manage/knowledge/upload/index.vue

@@ -11,7 +11,7 @@
         :active="true"
       />文档列表
     </div>
-    <div class="bm-main-box mt-[1.25rem]">
+    <div class="bm-main-box mt-[1.25rem]" v-if="state.knowledge.ID">
       <div class="flex gap-[1rem]">
         <CzrButton
           :type="state.uploadType == UploadTypeEnum.Text ? 'primary' : 'normal'"
@@ -194,7 +194,7 @@
             >
               <div class="flex-1"></div>
               <div>
-                <CzrButton type="normal" title="预览块" />
+                <CzrButton type="normal" title="预览块" @click="onTextView" />
               </div>
             </div>
             <div class="mt-[1.5rem] flex justify-end gap-[var(--czr-gap)]">
@@ -203,7 +203,7 @@
                 title="返回上一步"
                 icon="czr_arrow"
                 :rotate="180"
-                @click="() => (state.step = 1)"
+                @click="() => ((state.step = 1), (state.query.init = false))"
               />
               <CzrButton
                 type="primary"
@@ -217,46 +217,67 @@
             <div
               class="flex flex-1 flex-col overflow-hidden rounded-[0.25rem] bg-[var(--czr-default-color)] p-[1rem]"
             >
-              <div>
+              <div class="flex items-center">
                 <CzrFormColumn
+                  class="__czr-table-form-column"
                   :span="12"
                   label-width="0px"
                   v-model:param="state.previewFile"
                   link="select"
                   :options="state.uploadFileList"
                   labelKey="name"
-                  valueKey="name"
+                  valueKey="url"
+                  :clearable="false"
+                  @change="() => $nextTick(() => onTextView())"
                 />
+                <div class="ml-2" v-if="state.query.init">
+                  <a-tag color="green"
+                    >{{ state.query.result.data.length }} 预估块</a-tag
+                  >
+                </div>
               </div>
-              <div class="flex flex-1 flex-col gap-[1rem] overflow-y-auto">
-                <template v-for="(item, index) in state.query.result.data">
-                  <div>
-                    <div class="text-[1rem] font-bold text-[#576275]">
-                      Chunk-{{ index + 1 }} . 195 charact
-                    </div>
-                    <div
-                      class="mt-[0.25rem] text-[0.88rem] text-[#6F7889]"
-                      style="line-height: 1.25rem"
-                    >
-                      啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊
+              <div
+                class="mt-2 flex flex-1 flex-col gap-[1rem] overflow-y-auto"
+                v-loading="state.query.loading"
+              >
+                <template v-if="state.query.init">
+                  <template v-for="(item, index) in state.query.result.data">
+                    <div>
+                      <div class="text-[1rem] font-bold text-[#576275]">
+                        Chunk-{{ index + 1 }} .
+                        {{ item.content.length }} charact
+                      </div>
+                      <div
+                        class="mt-[0.25rem] text-[0.88rem] text-[#6F7889]"
+                        style="line-height: 1.25rem"
+                      >
+                        {{ item.content }}
+                      </div>
                     </div>
+                  </template>
+                </template>
+                <template v-else>
+                  <div
+                    class="flex flex-1 items-center justify-center text-gray-400"
+                  >
+                    点击左侧的“预览块”按钮来加载预览
                   </div>
                 </template>
               </div>
-              <div class="mt-[1rem]">
-                <el-pagination
-                  ref="ref_tablePage"
-                  class="__czr-pagination"
-                  :current-page="state.query.page.pageNum"
-                  :page-size="state.query.page.pageSize"
-                  background
-                  :page-sizes="[20]"
-                  layout="total,prev,pager,next"
-                  :total="Number(state.query.result.total)"
-                  @current-change="onPage"
-                  :pager-count="5"
-                />
-              </div>
+              <!--              <div class="mt-[1rem]">-->
+              <!--                <el-pagination-->
+              <!--                  ref="ref_tablePage"-->
+              <!--                  class="__czr-pagination"-->
+              <!--                  :current-page="state.query.page.pageNum"-->
+              <!--                  :page-size="state.query.page.pageSize"-->
+              <!--                  background-->
+              <!--                  :page-sizes="[20]"-->
+              <!--                  layout="total,prev,pager,next"-->
+              <!--                  :total="Number(state.query.result.total)"-->
+              <!--                  @current-change="onTextPage"-->
+              <!--                  :pager-count="5"-->
+              <!--                />-->
+              <!--              </div>-->
             </div>
           </div>
         </div>
@@ -394,10 +415,12 @@ import {
 } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import { ElMessage } from 'element-plus'
-// import { axUpload } from '@/api/modules/global/upload'
 import { v4 } from 'uuid'
 import { useDialogStore } from '@/stores'
 import { comTime } from '@/utils/czr-util'
+import { fileUploadFile } from '@/api/modules/global/upload'
+import { datasetsDetail } from '@/api/modules/knowledge'
+import { datasetsDocumentsDealView } from '@/api/modules/knowledge/document'
 
 const DialogStore = useDialogStore()
 const route = useRoute()
@@ -411,19 +434,21 @@ enum UploadTypeEnum {
 }
 const state: any = reactive({
   ID: route.params.id,
+  knowledge: {},
   uploadType: UploadTypeEnum.Text,
   step: 1,
   uploadFiles: new Map(),
   uploadFileList: [],
   previewFile: '',
   query: {
+    init: false,
     loading: false,
-    page: {
-      pageNum: 1,
-      pageSize: 20,
-    },
+    // page: {
+    //   pageNum: 1,
+    //   pageSize: 20,
+    // },
     result: {
-      total: 0,
+      // total: 0,
       data: [],
     },
   },
@@ -500,6 +525,14 @@ const AcceptType = {
 }
 const initDetail = () => {
   if (state.ID) {
+    datasetsDetail(state.ID)
+      .then(({ data }: any) => {
+        state.knowledge = {
+          ...data,
+          ID: data.id,
+        }
+      })
+      .catch(() => {})
   } else {
     router.push({ name: '4342bfff-1ea8-4f4c-b562-3cdc1fde116f' })
   }
@@ -530,6 +563,7 @@ const handleBeforeUpload = (file) => {
   }
   state.uploadFiles.set(file.uid, {
     name: file.name,
+    url: '',
     success: false,
     process: 0,
   })
@@ -540,21 +574,22 @@ const handleHttpRequest = (options) => {
   const id = options.file.uid
   const formData = new FormData()
   formData.append('file', options.file)
-  // axUpload(formData, (process) => {
-  //   if (state.uploadFiles.get(id)) {
-  //     state.uploadFiles.get(id).process = process
-  //   }
-  // }).then((res) => {
-  //   if (state.uploadFiles.get(id)) {
-  //     state.uploadFiles.get(id).success = true
-  //   }
-  // })
+  fileUploadFile(formData, (process) => {
+    if (state.uploadFiles.get(id)) {
+      state.uploadFiles.get(id).process = process
+    }
+  }).then(({ data }: any) => {
+    if (state.uploadFiles.get(id)) {
+      state.uploadFiles.get(id).success = true
+      state.uploadFiles.get(id).url = data.path
+    }
+  })
 }
 const onNextOne = () => {
   state.uploadFileList = Array.from(state.uploadFiles.values()).filter(
     (v: any) => v.success,
   )
-  // state.previewFile = state.uploadFileList[0]
+  state.previewFile = state.uploadFileList[0].url
   if (state.uploadFileList.length === 0) {
     DialogStore.confirm({
       title: '上传确认',
@@ -574,48 +609,27 @@ const onNextOne = () => {
     state.step = 2
   }
 }
-const onPage = (pageNum, pageSize) => {
-  state.query.page = {
-    pageNum: pageNum,
-    pageSize: pageSize,
-  }
-  const params = {
-    pageNum: state.query.page.pageNum,
-    pageSize: state.query.page.pageSize,
-  }
+const onTextView = () => {
+  state.query.init = true
   state.query.loading = true
-  setTimeout(() => {
-    state.query.result.total = 100
-    const arr: any = [{ empty: true }]
-    for (let i = 1; i <= params.pageSize; i++) {
-      const n = (params.pageNum - 1) * params.pageSize + i
-      arr.push({
-        p1: '部门知识库-部门知识库-部门知识库-' + n,
-        p2: '王一鸣',
-        p3: '只是一个政务服务事项办事指南',
-        p4: n,
-        p5: '2980k',
-        p6: n % 4,
-        p7: n % 2,
-        tags: n % 2 ? '1,2,3,41,2,3,41,2,3,41,2,3,41,2,3,4' : '',
-      })
-    }
-    state.query.result.data = arr
-    state.query.loading = false
-  }, 1000)
-  // state.query.loading = true
-  // listRuleLogisticsDataSubscribeInfo(params).then(res => {
-  //   if (res.code == 200) {
-  //     state.query.result.total = res.total
-  //     state.query.result.data = res.rows
-  //     state.query.loading = false
-  //   } else {
-  //     ElMessage.error(res.msg)
-  //   }
-  // }).catch(() => {
-  //   state.query.loading = false
-  // })
+  datasetsDocumentsDealView({
+    fileId: state.previewFile,
+    contentConfig: {
+      maxParentSize: 500,
+      overlapSize: 20,
+      parentSeparator: '\n\n',
+      splitType: 'CustomSymbolSplitter',
+    },
+  })
+    .then(({ data }: any) => {
+      state.query.result.data = data.contentResult
+    })
+    .catch(() => {})
+    .finally(() => {
+      state.query.loading = false
+    })
 }
+
 watch(
   () => state.step,
   (n) => {
@@ -630,7 +644,6 @@ watch(
 const initTask = () => {}
 onMounted(() => {
   initDetail()
-  onPage(1, 10)
 })
 </script>
 

+ 3 - 10
src/views/manage/model/detail.vue

@@ -173,9 +173,7 @@ const initData = () => {
     .then(({ data }: any) => {
       state.form = data
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       state.loading = false
     })
@@ -195,9 +193,7 @@ const onSubmit = () => {
                 emit('update:show', false)
                 emit('refresh')
               })
-              .catch(({ message }: any) => {
-                ElMessage.error(message)
-              })
+              .catch(() => {})
               .finally(() => {
                 state.loading = false
               })
@@ -205,12 +201,9 @@ const onSubmit = () => {
             pluginUpdateInstance(state.form)
               .then(() => {
                 ElMessage.success(`${titleCpt.value}成功!`)
-                emit('update:show', false)
                 emit('refresh')
               })
-              .catch(({ message }: any) => {
-                ElMessage.error(message)
-              })
+              .catch(() => {})
               .finally(() => {
                 state.loading = false
               })

+ 4 - 12
src/views/manage/model/index.vue

@@ -238,9 +238,7 @@ const onPage = (pageNum, pageSize) => {
       state.query.result.total = data.total
       state.query.result.data = data.records
     })
-    .catch(({ message }: any) => {
-      ElMessage.error(message)
-    })
+    .catch(() => {})
     .finally(() => {
       state.query.loading = false
     })
@@ -279,9 +277,7 @@ const onDel = (row: any) => {
         .then(() => {
           ElMessage.success('删除成功!')
         })
-        .catch(({ message }: any) => {
-          ElMessage.error(message)
-        })
+        .catch(() => {})
         .finally(() => {
           onSearch()
         })
@@ -298,9 +294,7 @@ const onSwitch = (row) => {
           .then(() => {
             ElMessage.success('停用成功!')
           })
-          .catch(({ message }: any) => {
-            ElMessage.error(message)
-          })
+          .catch(() => {})
           .finally(() => {
             onSearch()
           })
@@ -312,9 +306,7 @@ const onSwitch = (row) => {
       .then(() => {
         ElMessage.success('启用成功!')
       })
-      .catch(({ message }: any) => {
-        ElMessage.error(message)
-      })
+      .catch(() => {})
       .finally(() => {
         onSearch()
       })

+ 1 - 3
src/views/manage/model/statistic/index.vue

@@ -234,9 +234,7 @@ const initDetail = () => {
       .then(({ data }: any) => {
         state.detail = data
       })
-      .catch(({ message }: any) => {
-        ElMessage.error(message)
-      })
+      .catch(() => {})
       .finally(() => {})
     initStatistic()
   } else {