@@ -13,6 +13,7 @@ import UploaderRemark from '@/views/system/excel-upload/UploaderRemark.vue'
1313import TableRelationship from ' @/views/ds/TableRelationship.vue'
1414import icon_mindnote_outlined from ' @/assets/svg/icon_mindnote_outlined.svg'
1515import { Refresh } from ' @element-plus/icons-vue'
16+ import { debounce } from ' lodash-es'
1617
1718interface Table {
1819 name: string
@@ -106,7 +107,9 @@ const handleCurrentChange = (val: number) => {
106107
107108const fieldListComputed = computed (() => {
108109 const { currentPage, pageSize } = pageInfo
109- return fieldList .value .slice ((currentPage - 1 ) * pageSize , currentPage * pageSize )
110+ return fieldList .value
111+ .filter ((ele : any ) => ele .field_name .toLowerCase ().includes (fieldName .value .toLowerCase ()))
112+ .slice ((currentPage - 1 ) * pageSize , currentPage * pageSize )
110113})
111114
112115const init = (reset = false ) => {
@@ -166,6 +169,7 @@ const clickTable = (table: any) => {
166169 fieldList .value = res
167170 pageInfo .total = res .length
168171 pageInfo .currentPage = 1
172+ fieldName .value = ' '
169173 datasourceApi .previewData (props .info .id , buildData ()).then ((res ) => {
170174 previewData .value = res
171175 })
@@ -313,22 +317,23 @@ const renderHeader = ({ column }: any) => {
313317 document .body .removeChild (span )
314318 return column .label
315319}
316-
317- const fieldNameSearch = () => {
318- btnSelectClick ( btnSelect . value )
319- }
320+ const fieldNameSearch = debounce (() => {
321+ pageInfo . currentPage = 1
322+ pageInfo . total = fieldListComputed . value . length
323+ }, 100 )
320324const fieldName = ref (' ' )
321325const btnSelectClick = (val : any ) => {
322326 btnSelect .value = val
323327 loading .value = true
324328
325329 if (val === ' d' ) {
326330 datasourceApi
327- .fieldList (currentTable .value .id , { fieldName: fieldName . value })
331+ .fieldList (currentTable .value .id , { fieldName: ' ' })
328332 .then ((res ) => {
329333 fieldList .value = res
330334 pageInfo .total = res .length
331335 pageInfo .currentPage = 1
336+ fieldName .value = ' '
332337 })
333338 .finally (() => {
334339 loading .value = false
@@ -496,7 +501,7 @@ const btnSelectClick = (val: any) => {
496501 :placeholder =" t('dashboard.search')"
497502 autocomplete =" off"
498503 clearable
499- @blur =" fieldNameSearch"
504+ @input =" fieldNameSearch"
500505 />
501506 <el-button
502507 v-if =" ds.type !== 'excel'"
@@ -565,7 +570,7 @@ const btnSelectClick = (val: any) => {
565570 </el-table-column >
566571 </el-table >
567572 </div >
568- <div v-if =" fieldList.length && btnSelect === 'd'" class =" pagination-container" >
573+ <div v-if =" pageInfo.total && btnSelect === 'd'" class =" pagination-container" >
569574 <el-pagination
570575 v-model:current-page =" pageInfo.currentPage"
571576 v-model:page-size =" pageInfo.pageSize"
0 commit comments