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") } // 是否可以多选