util.exportUrl(res.data, store.state.UserInfo.companyName + '_' + row.billNo + '.zip')
        // window.location.href = res.data
        // 由于文件名字乱码 更改下载方式

 

util.exportUrl = function (url, val) {
    const link = document.createElement('a')
    fetch(url)
        .then(res => res.blob())
        .then(blob => {
            link.href = URL.createObjectURL(blob)
            //   link.download = store.state.UserInfo.companyName + '_' + row.billNo + '.zip'
            link.download = val
            document.body.appendChild(link)
            link.click()
            window.URL.revokeObjectURL(link.href)
            document.body.removeChild(link)
        })
}

 

posted on 2024-05-30 11:03  鄢宁  阅读(10)  评论(0编辑  收藏  举报