public Down(path: string) { return this.http.get(path, { responseType: "blob" }).subscribe((results) => { this.saveExcel(results, "导出数据");
}); }
/**
* 请求成功之后保存成excel文件(基本导出方法,请求成功之后调用)
* @param data
* @param name
*/
public saveExcel(data: Blob, name: string) {
var a = document.createElement('a');
var blob = new Blob([data], { 'type': "application/vnd.ms-excel" });
a.href = URL.createObjectURL(blob);
a.download = name + ".csv";
a.click();
}