chore: 调整弹框动作的 reload 优先级 (#2445)

* chore: 优化 tabs 成员的 key

* chore: 调整弹框动作的 reload 优先级
This commit is contained in:
liaoxuezhi 2021-08-26 19:54:15 +08:00 committed by GitHub
parent 48c23e2bfe
commit 29009d7e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 16 deletions

View File

@ -931,8 +931,9 @@ export default class CRUD extends React.Component<CRUDProps, any> {
if (component && component.props.type === 'form') {
// 数据保存了,说明列表数据已经无效了,重新刷新。
if (value && (value as any).__saved) {
const reload = action.reload ?? dialogAction.reload;
// 配置了 reload 则跳过自动更新。
dialogAction.reload ||
reload ||
this.search(
dialogAction.__from ? {[pageField || 'page']: 1} : undefined,
undefined,
@ -950,11 +951,13 @@ export default class CRUD extends React.Component<CRUDProps, any> {
}
}
if (dialogAction.reload) {
this.reloadTarget(dialogAction.reload, ctx);
const reload = action.reload ?? dialogAction.reload;
if (reload) {
this.reloadTarget(reload, ctx);
}
const redirect = dialogAction.redirect && filter(action.redirect, ctx);
let redirect = action.redirect ?? dialogAction.redirect;
redirect = redirect && filter(redirect, ctx);
redirect && env.jumpTo(redirect, dialogAction);
}

View File

@ -847,11 +847,10 @@ export class DialogRenderer extends Dialog {
const scoped = this.context as IScopedContext;
const store = this.props.store;
const dialogAction = store.action as Action;
const reload = action.reload ?? dialogAction.reload;
if (dialogAction.reload) {
scoped.reload(dialogAction.reload, store.data);
} else if (action.reload) {
scoped.reload(action.reload, store.data);
if (reload) {
scoped.reload(reload, store.data);
} else {
// 没有设置,则自动让页面中 crud 刷新。
scoped

View File

@ -866,11 +866,10 @@ export class DrawerRenderer extends Drawer {
const scoped = this.context as IScopedContext;
const store = this.props.store;
const dialogAction = store.action as Action;
const reload = action.reload ?? dialogAction.reload;
if (dialogAction.reload) {
scoped.reload(dialogAction.reload, store.data);
} else if (action.reload) {
scoped.reload(action.reload, store.data);
if (reload) {
scoped.reload(reload, store.data);
} else {
// 没有设置,则自动让页面中 crud 刷新。
scoped

View File

@ -722,9 +722,10 @@ export class PageRenderer extends Page {
const scoped = this.context;
const store = this.props.store;
const dialogAction = store.action as Action;
const reload = action.reload ?? dialogAction.reload;
if (dialogAction.reload) {
scoped.reload(dialogAction.reload, store.data);
if (reload) {
scoped.reload(reload, store.data);
} else {
// 没有设置,则自动让页面中 crud 刷新。
scoped
@ -739,11 +740,12 @@ export class PageRenderer extends Page {
const scoped = this.context as IScopedContext;
const store = this.props.store;
const drawerAction = store.action as Action;
const reload = action.reload ?? drawerAction.reload;
// 稍等会,等动画结束。
setTimeout(() => {
if (drawerAction.reload) {
scoped.reload(drawerAction.reload, store.data);
if (reload) {
scoped.reload(reload, store.data);
} else {
// 没有设置,则自动让页面中 crud 刷新。
scoped