// 由前端定义文件名及文件类型
exportByProductNo = (item) => {
const reqUrl = `/api/configure/exportConfigure?productKey=${item.productNo}`;
fetch(reqUrl).then(resp =>resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = "filename.xls";
a.click();
})
};
// 由服务器返回文件名及文件类型
exportByProductNo = (item) => {
const reqUrl = `/api/configure/exportConfigure?productKey=${item.productNo}`;
fetch(reqUrl).then(resp => resp.blob().then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
const fileName = resp.headers.get('Content-Disposition').split('=')[1];
a.download = decodeURIComponent(fileName);
a.click();
}))
};