vm.downLoad = function () {
$http.get(FileURL + 'getModelFile.do', {
params: {
modelFileType: vm.selectedSite
},
responseType: 'arraybuffer'
}).success(function (res) {
var data = res;
var url = window.URL.createObjectURL(new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}))
var link = document.createElement('a')
console.log(url);
var excelName = vm.showDownloadFileName();
link.style.display = 'none';
link.href = url;
link.setAttribute('download', excelName + '.xlsx');
document.body.appendChild(link);
link.click();
document.body.removeChild(link)
}).error(function (res) {
console.log(res);
})
};
vm.showDownloadFileName = function () {
if (vm.selectedSite === '1') {
return '存量信贷数据'
} else if (vm.selectedSite === '2') {
return 'crm数据'
} else if (vm.selectedSite === '3') {
return '存量黑名单数据'
} else {
return '金燕e付数据'
}
}
下载Excel文件
最新推荐文章于 2022-04-10 08:01:40 发布