diff --git a/src/App.vue b/src/App.vue index 27c6250f5dd08d4377c54f32551322eff25866e1..bcef1abea093760849c6f521ca9c55ce5942d008 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,7 @@ @@ -10,10 +11,13 @@ import { useI18n } from 'vue-i18n'; import { computed, ref } from 'vue'; import '@/styles/app.scss'; import router from './router'; +import CustomLoading from '@/components/CustomLoading/index.vue'; + -const appStore = useAppStore(); const { locale } = useI18n(); const locales = computed(() => appStore.locale); +const appStore = useAppStore(); +const {downLoading} = storeToRefs(appStore); const { changeParentToken } = appStore; // 新增路由状态标记 const isManualNavigation = ref(false); diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 1150e16c2116cfa227e4f0eacae561d91b655325..f81a06d05ea4cc277d63fbff6fada5540758b305 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -6,6 +6,11 @@ import en from 'element-plus/es/locale/lang/en'; import { store } from '@/store'; export const useAppStore = defineStore('app', () => { + const downLoading = ref(false); + + const changeDownLoading = (value: boolean) => { + downLoading.value = value; + }; const parentToken = ref(''); function changeParentToken(value: string) { @@ -39,6 +44,8 @@ export const useAppStore = defineStore('app', () => { changeLanguage, parentToken, changeParentToken, + downLoading, + changeDownLoading, }; }); diff --git a/src/styles/group.scss b/src/styles/group.scss index 09c2ccc4c160cc52e9da227030ac92bef2f12ddb..54cc9a164590d048878d1916aef19ffffdee0f32 100644 --- a/src/styles/group.scss +++ b/src/styles/group.scss @@ -98,6 +98,13 @@ gap: 16px; max-height: 690px; overflow-y: auto; + .group-card-empty{ + display: flex; + justify-content: center; + align-items: center; + width: 90vw; + height: 650px; + } .group-card-item { width: 339px; diff --git a/src/utils/downloadFun.ts b/src/utils/downloadFun.ts index 65560c46785fd03177e61a6d54b621a547d39e62..e1fea102330e296ab55038c7b876d69cc382a15a 100644 --- a/src/utils/downloadFun.ts +++ b/src/utils/downloadFun.ts @@ -1,20 +1,27 @@ -import { useAppStore } from '@/store'; +import { useAppStore, useAppStoreHook } from '@/store'; +import { storeToRefs } from 'pinia'; export function downloadFun(url: string) { const appStore = useAppStore(); const { parentToken } = storeToRefs(appStore); + const token = parentToken.value || localStorage.getItem('ECSESSION'); + if (!token) { + console.error('Token is not available yet'); + return; + } + useAppStoreHook().changeDownLoading(true); fetch(url, { headers: { - Authorization: parentToken.value - ? `Bearer ${parentToken.value}` - : `Bearer 99db1ba8eb0c9bb67e3e45dccfac8e60`, // 添加 Authorization 头 + Authorization: `Bearer ${token}`, }, }) .then((response) => { + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } // 提取 Content-Disposition 头部 const contentDisposition = response.headers.get('Content-Disposition'); let fileName = 'default-filename'; - // 解析文件名(处理编码及格式) if (contentDisposition) { const fileNameMatch = contentDisposition.match(/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i); @@ -32,5 +39,8 @@ export function downloadFun(url: string) { a.click(); URL.revokeObjectURL(a.href); }) - .catch((error) => console.error('下载失败:', error)); + .catch((error) => console.error('下载失败:', error)) + .finally(() => { + useAppStoreHook().changeDownLoading(false); + }); } diff --git a/src/views/dataSet/index.vue b/src/views/dataSet/index.vue index 8b7f8db198367cf6d2c86e18fee05d83327b7987..e4edd89cbe56123ea802dd7e00d249c708e3f807 100644 --- a/src/views/dataSet/index.vue +++ b/src/views/dataSet/index.vue @@ -168,7 +168,6 @@ cell-calss-name="tableCell" :row-key="(row) => row.datasetId" @selection-change="handleSelectionChange" - @sort-change="handleSortChange" ref="multipleTable" :border="false"> { }) const { handleKnowledgeTab } = store; -const {knowledgeTabActive,curTeamInfo} = storeToRefs(store); +const {knowledgeTabActive} = storeToRefs(store); watch(()=>knowledgeTabActive.value,()=>{ if(knowledgeTabActive.value === 'dataset'){ @@ -641,7 +640,9 @@ const handleInputSearch = debounce((value: string) => { const handleSearchPayload = (): Record => { return Object.entries(searchPayload.value).reduce((acc, [key, value]) => { - if (value === undefined || value === null || value === 'all') return acc; + if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) { + return acc; // 移除空值或空数组的字段 + } // 处理特殊字段类型转换 acc[key] = typeof value === 'string' ? value.trim() @@ -650,24 +651,12 @@ const handleSearchPayload = (): Record => { }, {} as Record); }; -const handleSortChange = (data: { column: any; prop: string; order: any }) => { - let sortKey = data.prop === 'score' ? 'scoreOrder' : null; - let sortValue = data.order ? (data.order === 'ascending' ? 'asc' : 'desc') : null; - searchPayload.value = sortValue - ? { - [sortKey || data.prop]: sortValue, - } - : {}; - handleSearchOpsData(true, true); -}; - const handlePollFileDataSet = () => { dataSetAPI.queryDataSetList({ page: currentPage.value, pageSize: currentPageSize.value, kbId: route.query.kb_id as string, ...handleSearchPayload(), - ...searchPayload.value, }) .then((res: any) => { if (res.page === currentPage.value && fileTableList.data?.length) { @@ -708,7 +697,6 @@ const handleSearchOpsData = (loadingStatus: boolean, startPollTimer: boolean) => pageSize: currentPageSize.value, kbId: route.query.kb_id as string, ...handleSearchPayload(), - ...searchPayload.value, }, loadingStatus, startPollTimer @@ -757,7 +745,6 @@ const handleSearchData = () => { pageSize: currentPageSize.value ?? 20, kbId: route.query.kb_id as string, ...handleSearchPayload(), - ...searchPayload.value, }, true, true @@ -841,7 +828,7 @@ const handleJumpFileSection = (row: any) => { }; const handelStatusFilterProper = (filterList: any) => { - searchPayload.value.generateStatus = filterList.length ? filterList : null; + searchPayload.value.generateStatus = filterList; handleSearchData(); }; diff --git a/src/views/evaluate/index.vue b/src/views/evaluate/index.vue index 89e82462c06cff7adc324472d72eebf89a7b1a0d..ba84d0efddb4d54feb2442c3eca0865a5d2ce95e 100644 --- a/src/views/evaluate/index.vue +++ b/src/views/evaluate/index.vue @@ -49,7 +49,7 @@