【fix bug】导入导出加全局遮罩

This commit is contained in:
zhaoxiao
2023-03-16 15:43:48 +08:00
parent 90fb5c1017
commit c95d112e9b
3 changed files with 44 additions and 2 deletions
+11
View File
@@ -270,6 +270,8 @@ export const JeroListMixin = {
param.selections = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
// 添加全局遮罩
this.$store.commit('SET_IS_EXPORTING', true)
downFile(this.url.exportXlsUrl, param).then((data) => {
if (!data) {
this.$message.warning('文件下载失败')
@@ -288,15 +290,22 @@ export const JeroListMixin = {
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 去掉全局遮罩
this.$store.commit('SET_IS_EXPORTING', false)
})
},
/* 导入 */
handleImportExcel (info) {
this.loading = true
// 添加全局遮罩
this.$store.commit('SET_IS_IMPORTING', true)
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
}
if (info.file.status === 'done') {
// 去掉全局遮罩
this.$store.commit('SET_IS_IMPORTING', false)
this.loading = false
if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
@@ -319,6 +328,8 @@ export const JeroListMixin = {
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
}
} else if (info.file.status === 'error') {
// 去掉全局遮罩
this.$store.commit('SET_IS_IMPORTING', false)
this.loading = false
if (info.file.response.status === 500) {
const data = info.file.response