forked from github/dataease
fix: 上传excel异常情况,清理缓存
This commit is contained in:
parent
4c0f8893e5
commit
5693e06233
@ -145,6 +145,10 @@ const handleTabClick = tab => {
|
||||
}
|
||||
|
||||
const uploadFail = response => {
|
||||
state.excelData = []
|
||||
activeTab.value = ''
|
||||
tabList.value = []
|
||||
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||
let myError = response.toString()
|
||||
myError.replace('Error: ', '')
|
||||
}
|
||||
@ -160,6 +164,10 @@ const handleExcelDel = () => {
|
||||
|
||||
const uploadSuccess = response => {
|
||||
if (response?.code !== 0) {
|
||||
state.excelData = []
|
||||
activeTab.value = ''
|
||||
tabList.value = []
|
||||
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||
ElMessage.warning(response.msg)
|
||||
return
|
||||
}
|
||||
@ -365,6 +373,10 @@ const uploadExcel = () => {
|
||||
loading.value = false
|
||||
})
|
||||
.catch(error => {
|
||||
state.excelData = []
|
||||
activeTab.value = ''
|
||||
tabList.value = []
|
||||
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||
if (error.code === 'ECONNABORTED') {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
|
@ -884,6 +884,9 @@ const uploadExcel = editType => {
|
||||
addLoading.value = editType === 1
|
||||
return uploadFile(formData)
|
||||
.then(res => {
|
||||
if (res?.code !== 0) {
|
||||
return
|
||||
}
|
||||
nodeInfo.editType = editType
|
||||
datasourceEditor.value.init(nodeInfo, nodeInfo.id, res)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user