CRUD 一次性加载逻辑优化

This commit is contained in:
2betop 2020-06-15 15:40:40 +08:00
parent f62a7a20d0
commit ea52e58ceb
1 changed files with 12 additions and 3 deletions

View File

@ -630,6 +630,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
this.search( this.search(
dialogAction.__from ? {[pageField || 'page']: 1} : undefined, dialogAction.__from ? {[pageField || 'page']: 1} : undefined,
undefined, undefined,
true,
true true
); );
} else if ( } else if (
@ -757,7 +758,15 @@ export default class CRUD extends React.Component<CRUDProps, any> {
evalExpression(stopAutoRefreshWhen, data) evalExpression(stopAutoRefreshWhen, data)
)) && )) &&
(this.timer = setTimeout( (this.timer = setTimeout(
silentPolling ? this.silentSearch : this.search, silentPolling
? this.silentSearch.bind(this, undefined, undefined, true)
: this.search.bind(
this,
undefined,
undefined,
undefined,
true
),
Math.max(interval, 3000) Math.max(interval, 3000)
)); ));
return value; return value;
@ -765,8 +774,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
: source && store.initFromScope(data, source); : source && store.initFromScope(data, source);
} }
silentSearch(values?: object) { silentSearch(values?: object, clearSelection?: boolean, forceReload = false) {
return this.search(values, true); return this.search(values, true, clearSelection, forceReload);
} }
handleChangePage(page: number, perPage?: number) { handleChangePage(page: number, perPage?: number) {