|
@@ -72,3 +72,29 @@ export function deleteExportData(id) {
|
|
|
data
|
|
|
})
|
|
|
}
|
|
|
+//导出结果
|
|
|
+export function RecordFile(Fileurl,fileName){
|
|
|
+ return request({
|
|
|
+ url: Fileurl,
|
|
|
+ method: 'get',
|
|
|
+ responseType: 'blob',
|
|
|
+ }).then(data=>{
|
|
|
+ console.log("RecordFile then", data)
|
|
|
+ if (!data) return alert('文件下载失败');
|
|
|
+ // let fileName = '统计表计';
|
|
|
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
+ // window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx');
|
|
|
+ window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName);
|
|
|
+ } else {
|
|
|
+ let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }));
|
|
|
+ let link = document.createElement('a');
|
|
|
+ link.style.display = 'none';
|
|
|
+ link.href = url;
|
|
|
+ link.setAttribute('download', fileName);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link); //下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|