164
164
@on-choose =" onChooseCard"
165
165
></tab-card >
166
166
</Scroll >
167
+ <Divider v-if =" isCompleted" orientation =" center" >到底了</Divider >
167
168
</div >
168
169
<div class =" assets-index-b-r" v-else >
169
170
<div style =" text-align : center ; margin-top : 50px ; font-weight : bolder " >
@@ -206,6 +207,7 @@ export default {
206
207
isLoading: false ,
207
208
subjectList: [],
208
209
layerList: [],
210
+ isCompleted: false ,
209
211
};
210
212
},
211
213
created () {
@@ -218,6 +220,11 @@ export default {
218
220
getHiveTbls (JSON .parse (searchParams))
219
221
.then ((data ) => {
220
222
if (data .result ) {
223
+ if ( data .result .length == this .searchOption .limit ) {
224
+ this .isCompleted = false
225
+ } else {
226
+ this .isCompleted = true
227
+ }
221
228
this .cardTabs = data .result ;
222
229
}
223
230
})
@@ -228,6 +235,11 @@ export default {
228
235
getHiveTbls ({ query: " " , limit: 10 , offset: 0 })
229
236
.then ((data ) => {
230
237
if (data .result ) {
238
+ if ( data .result .length == this .searchOption .limit ) {
239
+ this .isCompleted = false
240
+ } else {
241
+ this .isCompleted = true
242
+ }
231
243
this .cardTabs = data .result ;
232
244
}
233
245
})
@@ -282,6 +294,11 @@ export default {
282
294
getHiveTbls (params)
283
295
.then ((data ) => {
284
296
if (data .result ) {
297
+ if ( data .result .length == this .searchOption .limit ) {
298
+ this .isCompleted = false
299
+ } else {
300
+ this .isCompleted = true
301
+ }
285
302
if ( this .queryForTbls ) {
286
303
this .cardTabs = this .foamtDataToHighLigth (data .result , this .queryForTbls )
287
304
} else {
@@ -327,6 +344,11 @@ export default {
327
344
getHiveTbls (params)
328
345
.then ((data ) => {
329
346
if (data .result ) {
347
+ if ( data .result .length == this .searchOption .limit ) {
348
+ this .isCompleted = false
349
+ } else {
350
+ this .isCompleted = true
351
+ }
330
352
that .cardTabs = res .concat (data .result );
331
353
} else {
332
354
that .$Message .success (" 所有数据已加载完成" );
@@ -432,22 +454,36 @@ export default {
432
454
this .onSearch ();
433
455
},
434
456
435
- // 处理高亮
457
+ // 处理高亮 并过滤没有 高亮 的结果
436
458
foamtDataToHighLigth (result , query ) {
437
459
const _result = result .slice () || []
438
460
const _query = ` <span>${ query} </span>`
439
461
const reg = new RegExp (query, ' g' )
440
- _result .forEach (item => {
462
+ const filter_arr = []
463
+ _result .forEach ((item , idx ) => {
464
+ let flag = false
441
465
Object .keys (item).forEach (key => {
442
- if ( typeof item[key] == ' string' ) {
466
+ if ( key == ' classifications' && item[' classifications' ] && item[' classifications' ].length > 0 ) {
467
+ item[' classifications' ].forEach (item => {
468
+ if ( item[' typeName' ].indexOf (query) > - 1 ) {
469
+ flag = true
470
+ }
471
+ })
472
+ }
473
+ if ( typeof item[key] == ' string' && item[key].indexOf (query) > - 1 ) {
443
474
item[key] = item[key].replace (reg, _query)
475
+ flag = true
444
476
}
445
- if ( item[key] instanceof Array && item[key].length > 0 && typeof item[key][0 ] == ' string' ) {
477
+ if ( item[key] instanceof Array && item[key].length > 0 && typeof item[key][0 ] == ' string' && item[key]. join ( ' @ ' ). indexOf (query) > - 1 ) {
446
478
item[key] = item[key].join (' @' ).replace (reg, _query).split (' @' )
479
+ flag = true
447
480
}
448
481
})
482
+ if ( ! flag ){
483
+ filter_arr .push (idx)
484
+ }
449
485
})
450
- return _result
486
+ return _result . filter (( item , idx ) => ! filter_arr . includes (idx))
451
487
}
452
488
},
453
489
};
0 commit comments