@@ -225,8 +225,9 @@ export const exportExcel: (
225225 params : any ,
226226 loading ?: NProgress | Ref < boolean >
227227) => {
228- return promise ( request ( { url : url , method : 'get' , params, responseType : 'blob' } ) , loading )
229- . then ( ( res : any ) => {
228+ return promise ( request ( { url : url , method : 'get' , params, responseType : 'blob' } ) , loading ) . then (
229+ ( res : any ) => {
230+ console . log ( res )
230231 if ( res ) {
231232 const blob = new Blob ( [ res ] , {
232233 type : 'application/vnd.ms-excel'
@@ -239,8 +240,8 @@ export const exportExcel: (
239240 window . URL . revokeObjectURL ( link . href )
240241 }
241242 return true
242- } )
243- . catch ( ( e ) => { } )
243+ }
244+ )
244245}
245246
246247export const exportExcelPost : (
@@ -265,22 +266,20 @@ export const exportExcelPost: (
265266 responseType : 'blob'
266267 } ) ,
267268 loading
268- )
269- . then ( ( res : any ) => {
270- if ( res ) {
271- const blob = new Blob ( [ res ] , {
272- type : 'application/vnd.ms-excel'
273- } )
274- const link = document . createElement ( 'a' )
275- link . href = window . URL . createObjectURL ( blob )
276- link . download = fileName
277- link . click ( )
278- // 释放内存
279- window . URL . revokeObjectURL ( link . href )
280- }
281- return true
282- } )
283- . catch ( ( e ) => { } )
269+ ) . then ( ( res : any ) => {
270+ if ( res ) {
271+ const blob = new Blob ( [ res ] , {
272+ type : 'application/vnd.ms-excel'
273+ } )
274+ const link = document . createElement ( 'a' )
275+ link . href = window . URL . createObjectURL ( blob )
276+ link . download = fileName
277+ link . click ( )
278+ // 释放内存
279+ window . URL . revokeObjectURL ( link . href )
280+ }
281+ return true
282+ } )
284283}
285284
286285export const download : (
0 commit comments