1. getData('exportCollision',{
    2. params:{
    3. humanNo:that.inputID,
    4. archiveId:that.inputTxt,
    5. description:that.queryOptions,
    6. page:that.pageable.page - 1,
    7. size:that.pageable.rows
    8. },
    9. headers: {
    10. 'Authorization': 'Bearer ' + sessionStorage.getItem("access_token"),
    11. },
    12. responseType:'blob'
    13. }).then(res=>{
    14. // console.log(res)
    15. if(res.status==200){
    16. that.exportModalVisible = false
    17. that.$message.success('下载成功')
    18. var disposition = res.headers['content-disposition'];
    19. const content = res.request.response;
    20. const blob = new Blob([content]);
    21. var matches = disposition.split(';')[1].split('=')[1]; //不固定
    22. var filename = decodeURI((matches != null && matches ? matches : 'file.xls').replace(/\"/g, ''));
    23. var link = document.createElement('a');
    24. link.href = window.URL.createObjectURL(blob);
    25. link.download = filename;
    26. document.body.appendChild(link);
    27. link.click();
    28. document.body.removeChild(link);
    29. }else{
    30. that.$message.error(res.data.msg)
    31. }
    32. }).catch(err=>{
    33. console.log(err)
    34. if(err.response.status==401){
    35. location.href = '/login.html';
    36. }
    37. })