Parcourir la source

通用下载方法新增config配置选项

RuoYi il y a 3 ans
Parent
commit
fd89356ed7
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      ruoyi-ui/src/utils/request.js

+ 3 - 2
ruoyi-ui/src/utils/request.js

@@ -130,12 +130,13 @@ service.interceptors.response.use(res => {
130 130
 )
131 131
 
132 132
 // 通用下载方法
133
-export function download(url, params, filename) {
133
+export function download(url, params, filename, config) {
134 134
   downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
135 135
   return service.post(url, params, {
136 136
     transformRequest: [(params) => { return tansParams(params) }],
137 137
     headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
138
-    responseType: 'blob'
138
+    responseType: 'blob',
139
+    ...config
139 140
   }).then(async (data) => {
140 141
     const isLogin = await blobValidate(data);
141 142
     if (isLogin) {