mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 17:26:55 +08:00
fix: improve error message when uploading Excel file with incorrect column count
This commit is contained in:
@@ -11,7 +11,7 @@ import IconOpeDelete from '@/assets/svg/icon_delete.svg'
|
||||
import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlined.svg'
|
||||
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { cloneDeep, endsWith, startsWith } from 'lodash-es'
|
||||
import { genFileId, type UploadInstance, type UploadProps, type UploadRawFile } from 'element-plus'
|
||||
import { useCache } from '@/utils/useCache.ts'
|
||||
import { settingsApi } from '@/api/setting.ts'
|
||||
@@ -164,9 +164,18 @@ const onSuccess = (response: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onError = () => {
|
||||
const onError = (err: Error) => {
|
||||
uploadLoading.value = false
|
||||
uploadRef.value!.clearFiles()
|
||||
let msg = err.message
|
||||
if (startsWith(msg, '"') && endsWith(msg, '"')) {
|
||||
msg = msg.slice(1, msg.length - 1)
|
||||
}
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
|
||||
const exportExcel = () => {
|
||||
|
||||
@@ -13,7 +13,7 @@ import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlin
|
||||
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { cloneDeep, endsWith, startsWith } from 'lodash-es'
|
||||
import { genFileId, type UploadInstance, type UploadProps, type UploadRawFile } from 'element-plus'
|
||||
import { settingsApi } from '@/api/setting.ts'
|
||||
import { useCache } from '@/utils/useCache.ts'
|
||||
@@ -167,9 +167,18 @@ const onSuccess = (response: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onError = () => {
|
||||
const onError = (err: Error) => {
|
||||
uploadLoading.value = false
|
||||
uploadRef.value!.clearFiles()
|
||||
let msg = err.message
|
||||
if (startsWith(msg, '"') && endsWith(msg, '"')) {
|
||||
msg = msg.slice(1, msg.length - 1)
|
||||
}
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
|
||||
const exportExcel = () => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { cloneDeep, endsWith, startsWith } from 'lodash-es'
|
||||
import { getAdvancedApplicationList } from '@/api/embedded.ts'
|
||||
import { genFileId } from 'element-plus'
|
||||
|
||||
@@ -172,9 +172,18 @@ const onSuccess = (response: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onError = () => {
|
||||
const onError = (err: Error) => {
|
||||
uploadLoading.value = false
|
||||
uploadRef.value!.clearFiles()
|
||||
let msg = err.message
|
||||
if (startsWith(msg, '"') && endsWith(msg, '"')) {
|
||||
msg = msg.slice(1, msg.length - 1)
|
||||
}
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
|
||||
const exportExcel = () => {
|
||||
|
||||
Reference in New Issue
Block a user