ludc
2023-07-27 efff5c8410c9657915eb05615c13c2de7421c61a
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -134,30 +134,21 @@
          exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{
            console.log('res',res)
            const filename = '下载.xlsx'; // 下载的文件名
            const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' });
            const a = document.createElement('a');
            const url = window.URL.createObjectURL(blob);
            a.href = url;
            a.download = filename;
            a.style.display = 'none';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
            window.URL.revokeObjectURL(url);
            // const filename = '下载.xlsx'; // 下载的文件名
            // const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' });
            //
            // const url = window.URL.createObjectURL(blob);
            // const link = document.createElement('a');
            // link.href = url;
            // link.setAttribute('download', filename);
            // document.body.appendChild(link);
            // link.click();
            // document.body.removeChild(link);
            // URL.revokeObjectURL(url);
            let blob = new Blob([res.data], {
              type: res.data.type + ";charset=utf-8",
            });
            let src = window.URL.createObjectURL(blob);
            if (src) {
              let link = document.createElement("a");
              link.style.display = "none";
              link.href = src;
              link.setAttribute("download", "文件名字.xls");
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link); //下载完成移除元素
              window.URL.revokeObjectURL(src); //释放掉blob对象
            }
          })
        }
      };
    },