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 => {
|
const uploadFail = response => {
|
||||||
|
state.excelData = []
|
||||||
|
activeTab.value = ''
|
||||||
|
tabList.value = []
|
||||||
|
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||||
let myError = response.toString()
|
let myError = response.toString()
|
||||||
myError.replace('Error: ', '')
|
myError.replace('Error: ', '')
|
||||||
}
|
}
|
||||||
@ -160,6 +164,10 @@ const handleExcelDel = () => {
|
|||||||
|
|
||||||
const uploadSuccess = response => {
|
const uploadSuccess = response => {
|
||||||
if (response?.code !== 0) {
|
if (response?.code !== 0) {
|
||||||
|
state.excelData = []
|
||||||
|
activeTab.value = ''
|
||||||
|
tabList.value = []
|
||||||
|
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||||
ElMessage.warning(response.msg)
|
ElMessage.warning(response.msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -365,6 +373,10 @@ const uploadExcel = () => {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
state.excelData = []
|
||||||
|
activeTab.value = ''
|
||||||
|
tabList.value = []
|
||||||
|
Object.assign(sheetObj, cloneDeep(defaultSheetObj))
|
||||||
if (error.code === 'ECONNABORTED') {
|
if (error.code === 'ECONNABORTED') {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -884,6 +884,9 @@ const uploadExcel = editType => {
|
|||||||
addLoading.value = editType === 1
|
addLoading.value = editType === 1
|
||||||
return uploadFile(formData)
|
return uploadFile(formData)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
if (res?.code !== 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
nodeInfo.editType = editType
|
nodeInfo.editType = editType
|
||||||
datasourceEditor.value.init(nodeInfo, nodeInfo.id, res)
|
datasourceEditor.value.init(nodeInfo, nodeInfo.id, res)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user