wuzhen 提交代码
This commit is contained in:
1 parent
913e542e7c
commit
6820ebc45f
97 files changed
+27269
-1
No files matched your search
@@ -56,6 +56,23 @@ export default {
|
||||
downloadLoadingInstance.close();
|
||||
}
|
||||
},
|
||||
async excel(data: any, filename: string) {
|
||||
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
try {
|
||||
const isBlob = blobValidate(data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
FileSaver.saveAs(blob, filename);
|
||||
} else {
|
||||
this.printErrMsg(data);
|
||||
}
|
||||
downloadLoadingInstance.close();
|
||||
} catch (r) {
|
||||
console.error(r);
|
||||
ElMessage.error('下载文件出现错误,请联系管理员!');
|
||||
downloadLoadingInstance.close();
|
||||
}
|
||||
},
|
||||
async printErrMsg(data: any) {
|
||||
const resText = await data.text();
|
||||
const rspObj = JSON.parse(resText);
|
||||
|
||||
Reference in new issue
Block a user