ezhizao_zx 9 months ago
parent
commit
d07dabc3b9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/utils/request.js

+ 3 - 0
src/utils/request.js

@@ -6,6 +6,7 @@ import { tansParams, blobValidate } from '@/utils/ruoyi'
 import cache from '@/plugins/cache'
 import { saveAs } from 'file-saver'
 import useUserStore from '@/store/modules/user'
+import { reject } from 'lodash-es'
 
 let downloadLoadingInstance
 // 是否显示重新登录
@@ -188,12 +189,14 @@ export function downloadPdf(url, params, filename, config) {
       const rspObj = JSON.parse(resText);
       const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
       ElMessage.error(errMsg);
+      throw new Error(errMsg);
     }
     downloadLoadingInstance.close();
   }).catch((r) => {
     console.error(r)
     ElMessage.error('下载文件出现错误,请联系管理员!')
     downloadLoadingInstance.close();
+    throw new Error(r);
   })
 }