mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-10 10:16:55 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -189,8 +189,9 @@ const open = (item: any, editTable: boolean = false) => {
|
||||
if(item.type === 'excel') {
|
||||
tableList.value = config.value.sheets
|
||||
} else {
|
||||
datasourceApi.getTablesByConf(form.value).then((res) => {
|
||||
tableList.value = res
|
||||
datasourceApi.getTablesByConf(form.value).then((table) => {
|
||||
tableList.value = table
|
||||
checkList.value = checkList.value.filter((ele:string) => {return table.map((ele:any) => {return ele.tableName}).includes(ele)})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -280,20 +281,26 @@ const check = () => {
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: 'Connect failed',
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const next = async(formEl: FormInstance | undefined) => {
|
||||
if (form.value.type === "excel") {
|
||||
// next, show tables
|
||||
if (excelUploadSuccess.value) {
|
||||
active.value++
|
||||
}
|
||||
} else {
|
||||
if(!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
if(!formEl) return
|
||||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.type === "excel") {
|
||||
// next, show tables
|
||||
if (excelUploadSuccess.value) {
|
||||
active.value++
|
||||
}
|
||||
} else {
|
||||
// check status if success do next
|
||||
buildConf()
|
||||
datasourceApi.check(form.value).then((res: boolean) => {
|
||||
@@ -303,11 +310,17 @@ const next = async(formEl: FormInstance | undefined) => {
|
||||
datasourceApi.getTablesByConf(form.value).then((res) => {
|
||||
tableList.value = res
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: 'Connect failed',
|
||||
type: 'error',
|
||||
showClose: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const preview = () => {
|
||||
@@ -323,7 +336,6 @@ const beforeUpload = (rawFile: any) => {
|
||||
}
|
||||
|
||||
const onSuccess = (response: any) => {
|
||||
console.log(response)
|
||||
config.value.filename = response.data.filename
|
||||
config.value.sheets = response.data.sheets
|
||||
tableList.value = response.data.sheets
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-loading="loading">
|
||||
<div class="header">
|
||||
<div class="mt-4">
|
||||
<el-input
|
||||
@@ -72,6 +72,7 @@ const dsForm = ref()
|
||||
const dsList = ref<any>([])// show ds list
|
||||
const allDsList = ref<any>([])// all ds list
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
|
||||
const getStatus = (status: string) => {
|
||||
if (status === 'Success') {
|
||||
@@ -98,9 +99,11 @@ const refresh = () => {
|
||||
}
|
||||
|
||||
const list = () => {
|
||||
loading.value = true
|
||||
datasourceApi.list().then((res) => {
|
||||
allDsList.value = res
|
||||
dsList.value = JSON.parse(JSON.stringify(allDsList.value))
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user