mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
fix:刷新crud未执行切刷新service的问题
This commit is contained in:
parent
4a65a97990
commit
968d349b3e
@ -2762,7 +2762,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
headerToolbarRender: this.renderHeaderToolbar,
|
||||
footerToolbarRender: this.renderFooterToolbar,
|
||||
data: store.mergedData,
|
||||
loading: store.loading
|
||||
loading: store.loading,
|
||||
host: this
|
||||
}
|
||||
)}
|
||||
{render(
|
||||
|
@ -1382,7 +1382,8 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
|
||||
onSort: this.handleQuerySearch,
|
||||
onSelect: this.handleSelect,
|
||||
data: store.mergedData,
|
||||
loading: store.loading
|
||||
loading: store.loading,
|
||||
host: this
|
||||
}
|
||||
)}
|
||||
{/* spinner可以交给孩子处理 */}
|
||||
|
@ -1123,11 +1123,9 @@ export class CardsRenderer extends Cards {
|
||||
* 因为Cards在scope上注册,导致getComponentByName查询组件时会优先找到Cards,和CRUD联动的动作都会失效
|
||||
* 这里先做兼容处理,把动作交给上层的CRUD处理
|
||||
*/
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Cards,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.receive?.(values, subPath);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Cards,这样可以保证找到CRUD
|
||||
return this.props.host.receive?.(values, subPath);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
@ -1151,13 +1149,10 @@ export class CardsRenderer extends Cards {
|
||||
}
|
||||
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Cards,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.reload?.(subPath, query, ctx);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Cards,这样可以保证找到CRUD
|
||||
return this.props.host.reload?.(subPath, query, ctx);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
|
@ -1112,17 +1112,14 @@ export class ListRenderer extends List {
|
||||
|
||||
receive(values: any, subPath?: string) {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
/**
|
||||
* 因为List在scope上注册,导致getComponentByName查询组件时会优先找到List,和CRUD联动的动作都会失效
|
||||
* 这里先做兼容处理,把动作交给上层的CRUD处理
|
||||
*/
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给List,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.receive?.(values, subPath);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给List,这样可以保证找到CRUD
|
||||
return this.props.host.receive?.(values, subPath);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
@ -1146,13 +1143,10 @@ export class ListRenderer extends List {
|
||||
}
|
||||
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给List,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.reload?.(subPath, query, ctx);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给List,这样可以保证找到CRUD
|
||||
return this.props?.host.reload?.(subPath, query, ctx);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
|
@ -2842,17 +2842,14 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
export class TableRenderer extends Table {
|
||||
receive(values: any, subPath?: string) {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
/**
|
||||
* 因为Table在scope上注册,导致getComponentByName查询组件时会优先找到Table,和CRUD联动的动作都会失效
|
||||
* 这里先做兼容处理,把动作交给上层的CRUD处理
|
||||
*/
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.receive?.(values, subPath);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Table,这样可以保证找到CRUD
|
||||
return this.props.host.receive?.(values, subPath);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
@ -2904,13 +2901,10 @@ export class TableRenderer extends Table {
|
||||
}
|
||||
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.reload?.(subPath, query, ctx);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Table,这样可以保证找到CRUD
|
||||
return this.props.host.reload?.(subPath, query, ctx);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
|
@ -2123,17 +2123,14 @@ export default class Table2 extends React.Component<Table2Props, object> {
|
||||
export class TableRenderer extends Table2 {
|
||||
receive(values: any, subPath?: string) {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
/**
|
||||
* 因为Table在scope上注册,导致getComponentByName查询组件时会优先找到Table,和CRUD联动的动作都会失效
|
||||
* 这里先做兼容处理,把动作交给上层的CRUD处理
|
||||
*/
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.receive?.(values, subPath);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Table,这样可以保证找到CRUD
|
||||
return this.props.host.receive?.(values, subPath);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
@ -2145,11 +2142,9 @@ export class TableRenderer extends Table2 {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const parents = scoped?.parent?.getComponents();
|
||||
|
||||
if (Array.isArray(parents) && parents.length) {
|
||||
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
||||
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
||||
|
||||
return crud?.reload?.(subPath, query, ctx);
|
||||
if (this.props?.host) {
|
||||
// CRUD会把自己透传给Table,这样可以保证找到CRUD
|
||||
return this.props.host.reload?.(subPath, query, ctx);
|
||||
}
|
||||
|
||||
if (subPath) {
|
||||
|
Loading…
Reference in New Issue
Block a user