From 925f25e9a6b106eb9210964b5dcd59e94afc94f7 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Thu, 28 Aug 2025 19:31:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AF=BC=E5=87=BA=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/other.ts | 5 ++++- src/views/admin/system/user/index.vue | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/other.ts b/src/utils/other.ts index 6d95f83..251f19b 100644 --- a/src/utils/other.ts +++ b/src/utils/other.ts @@ -331,6 +331,7 @@ export function handleBlobFile(response: any, fileName: string) { blob = new Blob(safeData, { type: "application/octet-stream" }) } } catch (error) { + console.error("导出错误", error) useMessage().error("文件数据格式错误") return } @@ -353,8 +354,10 @@ export function handleBlobFile(response: any, fileName: string) { "image/jpeg", "image/png", // "application/zip" // 添加 ZIP 文件类型支持 - "application/octet-stream" + "application/octet-stream", + "text/xml", ] + if (!allowedTypes.includes(blob.type) && blob.type !== "") { useMessage().error("不支持的文件类型") return diff --git a/src/views/admin/system/user/index.vue b/src/views/admin/system/user/index.vue index d88a6b4..69324e5 100644 --- a/src/views/admin/system/user/index.vue +++ b/src/views/admin/system/user/index.vue @@ -246,12 +246,12 @@ const taskSubmitEvent = () => { // 导出excel const exportExcel = () => { const _data = { ...state.queryForm } - if (_data.role) { + if (_data.role && !Array.isArray(_data.role)) { _data.role = [_data.role] } else { _data.role = [] } - postDownBlobFile("/admin/user/export", Object.assign(_data, { ids: selectObjs }), "用户管理.xlsx") + postDownBlobFile("/admin/user/export", Object.assign(_data, { ids: selectObjs.value }), "用户管理.xlsx") } // 是否可以多选