4747 </el-form >
4848 </div >
4949 <div v-show =" active === 2" class =" container" >
50- 222
50+ <el-scrollbar height =" 480px" >
51+ <el-checkbox-group v-model =" checkList" >
52+ <el-row :gutter =" 10" >
53+ <el-col v-for =" item in tableList" :key =" item.value" :span =" 12" >
54+ <el-checkbox :label =" item.tableName" >{{ item.tableName }}</el-checkbox >
55+ </el-col >
56+ </el-row >
57+ </el-checkbox-group >
58+ </el-scrollbar >
59+ <span >Selected: {{ checkList.length }}/{{ tableList.length }}</span >
5160 </div >
52- <div style =" display : flex ;justify-content : flex-end ;" >
61+ <div style =" display : flex ;justify-content : flex-end ;margin-top : 20 px ; " >
5362 <el-button @click =" close" >Cancel</el-button >
5463 <el-button v-show =" !isCreate && !isEditTable" @click =" check" >Test Connect</el-button >
5564 <el-button v-show =" active === 1 && isCreate" type =" primary" @click =" next" >Next</el-button >
@@ -70,6 +79,8 @@ const emit = defineEmits(['refresh'])
7079const active = ref (1 )
7180const isCreate = ref (true )
7281const isEditTable = ref (false )
82+ const checkList = ref <any >([])
83+ const tableList = ref <any >([])
7384
7485const rules = reactive <FormRules >({
7586 name: [
@@ -109,6 +120,7 @@ const open = (item: any, editTable: boolean = false) => {
109120 active .value = 2
110121 isEditTable .value = true
111122 isCreate .value = false
123+ // request tables
112124 } else {
113125 isEditTable .value = false
114126 if (item ) {
@@ -193,7 +205,6 @@ const buildConf = () => {
193205const check = () => {
194206 buildConf ()
195207 datasourceApi .check (form .value ).then ((res : any ) => {
196- console .log (res )
197208 if (res ) {
198209 ElMessage ({
199210 message: ' Connect success' ,
@@ -207,13 +218,12 @@ const check = () => {
207218const next = () => {
208219 // check status if success do next
209220 buildConf ()
210- datasourceApi .check (form .value ).then ((res : any ) => {
211- console .log (res )
221+ datasourceApi .check (form .value ).then ((res : boolean ) => {
212222 if (res ) {
213223 active .value ++
214224 // request tables
215225 datasourceApi .getTablesByConf (form .value ).then ((res ) => {
216- console . log ( res )
226+ tableList . value = res
217227 })
218228 }
219229 })
0 commit comments