-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Description
版本号:3.7.2
问题描述:
使用jeecgboot-vue3/src/hooks/system/useMethods.ts
的exportXls方法到处文件,如果文件内容中存在“success”字符串时,直接判断是Result类型,导致JSON解析出错
async function exportXls(name, url, params, isXlsx = false) {
.......
reader.onload = async () => {
if (reader.result) {
// 这个判断不严谨,没考虑文件内容可能包含"success"字符串
if (reader.result.toString().indexOf('success') != -1) {
const { success, message } = JSON.parse(reader.result.toString());
if (!success) {
createMessage.warning('导出失败,失败原因:' + message);
} else {
exportExcel(name, isXlsx, data);
}
return;
}
}
exportExcel(name, isXlsx, data);
//update-end---author:wangshuai---date:2024-04-18---for: 导出excel失败提示,不进行导出---
};
}
错误截图:
Metadata
Metadata
Assignees
Labels
No labels