@@ -41,6 +41,7 @@ const checkList = ref<any>([])
4141const tableList = ref <any >([])
4242const excelUploadSuccess = ref (false )
4343const tableListLoading = ref (false )
44+ const tableListLoadingV1 = ref (false )
4445const checkLoading = ref (false )
4546const dialogTitle = ref (' ' )
4647const getUploadURL = import .meta .env .VITE_API_BASE_URL + ' /datasource/uploadExcel'
@@ -167,38 +168,44 @@ const initForm = (item: any, editTable: boolean = false) => {
167168 isCreate .value = false
168169 // request tables and check tables
169170
170- datasourceApi .tableList (item .id ).then ((res : any ) => {
171- checkList .value = res .map ((ele : any ) => {
172- return ele .table_name
173- })
174- if (item .type === ' excel' ) {
175- tableList .value = form .value .sheets
176- nextTick (() => {
177- handleCheckedTablesChange ([... checkList .value ])
171+ tableListLoadingV1 .value = true
172+ datasourceApi
173+ .tableList (item .id )
174+ .then ((res : any ) => {
175+ checkList .value = res .map ((ele : any ) => {
176+ return ele .table_name
178177 })
179- } else {
180- tableListLoading .value = true
181- const requestObj = buildConf ()
182- datasourceApi
183- .getTablesByConf (requestObj )
184- .then ((table ) => {
185- tableList .value = table
186- checkList .value = checkList .value .filter ((ele : string ) => {
187- return table
188- .map ((ele : any ) => {
189- return ele .tableName
190- })
191- .includes (ele )
178+ if (item .type === ' excel' ) {
179+ tableList .value = form .value .sheets
180+ nextTick (() => {
181+ handleCheckedTablesChange ([... checkList .value ])
182+ })
183+ } else {
184+ tableListLoading .value = true
185+ const requestObj = buildConf ()
186+ datasourceApi
187+ .getTablesByConf (requestObj )
188+ .then ((table ) => {
189+ tableList .value = table
190+ checkList .value = checkList .value .filter ((ele : string ) => {
191+ return table
192+ .map ((ele : any ) => {
193+ return ele .tableName
194+ })
195+ .includes (ele )
196+ })
197+ nextTick (() => {
198+ handleCheckedTablesChange ([... checkList .value ])
199+ })
192200 })
193- nextTick (() => {
194- handleCheckedTablesChange ([ ... checkList . value ])
201+ . finally (() => {
202+ tableListLoading . value = false
195203 })
196- })
197- .finally (() => {
198- tableListLoading .value = false
199- })
200- }
201- })
204+ }
205+ })
206+ .finally (() => {
207+ tableListLoadingV1 .value = false
208+ })
202209 }
203210 } else {
204211 dialogTitle .value = t (' ds.form.title.add' )
@@ -708,7 +715,11 @@ defineExpose({
708715 </el-form-item >
709716 </div >
710717 </el-form >
711- <div v-show =" activeStep === 2" v-loading =" tableListLoading" class =" select-data_table" >
718+ <div
719+ v-show =" activeStep === 2"
720+ v-loading =" tableListLoading || tableListLoadingV1"
721+ class =" select-data_table"
722+ >
712723 <div class =" title" >
713724 {{ $t('ds.form.choose_tables') }} ({{ checkTableList.length }}/ {{ tableList.length }})
714725 </div >
0 commit comments