From ef59bad21dab16db52b70c63850a61c978fe9353 Mon Sep 17 00:00:00 2001 From: JiangSheng Date: Thu, 13 Nov 2025 16:03:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E5=86=B5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.ts | 32 +++++++++-- src/utils/project.ts | 54 +++++++++++++------ .../condition/components/taskPool.vue | 33 +++++------- 3 files changed, 79 insertions(+), 40 deletions(-) diff --git a/src/api/request.ts b/src/api/request.ts index e523d576..21b93a34 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -75,13 +75,35 @@ const download = (url: string, params = {}, filename = 'download') => { responseType: 'blob', }) .then((res: any) => { - // 从响应头获取文件名 - const contentDisposition = res.headers?.['content-disposition'] || ''; + const contentDisposition = + res.headers?.['content-disposition'] || + res.headers?.['Content-Disposition'] || + ''; let fileName = filename; - const match = contentDisposition.match(/filename\*?=(?:UTF-8'')?["']?([^;"']+)/i); - if (match && match[1]) { - fileName = decodeURIComponent(match[1]); + + if (contentDisposition) { + const regex = /(filename\*?)\s*=\s*(?:UTF-8'')?["']?([^;"']+)["']?/ig; + let match: RegExpExecArray | null = null; + while ((match = regex.exec(contentDisposition)) !== null) { + const key = match[1]; + const val = match[2]; + if (!val) continue; + if (key.endsWith('*')) { + if (val.toLowerCase() === 'utf-8') { + continue; + } + try { + fileName = decodeURIComponent(val); + } catch { + fileName = val; + } + } else { + fileName = val.replace(/^["']|["']$/g, ''); + } + break; + } } + const blob = new Blob([res.data]); const link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); diff --git a/src/utils/project.ts b/src/utils/project.ts index 055ae9b5..184da16e 100644 --- a/src/utils/project.ts +++ b/src/utils/project.ts @@ -7,24 +7,46 @@ const commonStore = CommonStore(); const nodeTypeMap = toMap(nodeTypeList); -const poolCategoryTypeOptions = ref([]); +const analysisSoftwareOptions = ref([]); +const performanceTypeOptions = ref([]); +const performanceUnitOptions = ref([]); +const capacityOptions = ref([]); +const departmentListOptions = ref([]); +const sectionListOptions = ref([]); +const groupListOptions = ref([]); const taskPoolDictOptions = ref({}); -const allNodeTypeMap: any = ref({}); - +const poolCategoryTypeOptions = ref([]); +const allNodeTypeMap: any = ref(); const initProjectDicts = async () => { - try { - const poolCategoryTypeList: any = await commonStore.getDictData('POOL_CATEGORY_TYPE'); - poolCategoryTypeOptions.value = poolCategoryTypeList?.A || []; - taskPoolDictOptions.value = { - poolCategoryTypeOptions, - }; - allNodeTypeMap.value = { - ...nodeTypeMap, - ...toMap(poolCategoryTypeOptions.value), - }; - } catch (e) { - throw e; - } + const analysisSoftware: any = await commonStore.getDictData('ANALYSIS_SOFTWARE'); + const performanceType: any = await commonStore.getDictData('PERFORMANCE_TYPE'); + const performanceUnit: any = await commonStore.getDictData('PERFORMANCE_UNIT'); + const capacityList: any = await commonStore.getDictData('SIMULATION_CAPACITY'); + const departmentList: any = await commonStore.getDictData('DEPARTMENT_LIST'); + const sectionList: any = await commonStore.getDictData('SECTION_LIST'); + const groupList: any = await commonStore.getDictData('GROUP_LIST'); + const poolCategoryTypeList: any = await commonStore.getDictData('POOL_CATEGORY_TYPE'); + analysisSoftwareOptions.value = analysisSoftware.A; + performanceTypeOptions.value = performanceType.A; + performanceUnitOptions.value = performanceUnit.A; + capacityOptions.value = capacityList.A; + departmentListOptions.value = departmentList.A; + sectionListOptions.value = sectionList.A; + groupListOptions.value = groupList.A; + poolCategoryTypeOptions.value = poolCategoryTypeList.A; + taskPoolDictOptions.value = { + analysisSoftwareOptions, + performanceTypeOptions, + performanceUnitOptions, + capacityOptions, + departmentListOptions, + sectionListOptions, + groupListOptions, + }; + allNodeTypeMap.value = { + ...nodeTypeMap, + ...toMap(poolCategoryTypeOptions.value), + }; }; try { diff --git a/src/views/competenceCenter/condition/components/taskPool.vue b/src/views/competenceCenter/condition/components/taskPool.vue index 166b61c7..980872e3 100644 --- a/src/views/competenceCenter/condition/components/taskPool.vue +++ b/src/views/competenceCenter/condition/components/taskPool.vue @@ -112,7 +112,7 @@ :editMode="false" > - - + -->
@@ -193,7 +193,7 @@ :data="performanceData" :hasOperationColumn="false" > - {{ row[column.field] }} - + -->
@@ -250,15 +250,10 @@