mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
chore: 兼容异常数据 (#8923)
This commit is contained in:
parent
abcf0ed0d6
commit
2c05f9c7fb
@ -34,6 +34,7 @@ import {
|
||||
import {CardProps, CardSchema} from './Card';
|
||||
import {Card2Props, Card2Schema} from './Card2';
|
||||
import type {IItem} from 'amis-core';
|
||||
import find from 'lodash/find';
|
||||
|
||||
/**
|
||||
* Cards 卡片集合渲染器。
|
||||
@ -496,11 +497,25 @@ export default class Cards extends React.Component<GridProps, object> {
|
||||
store.reset();
|
||||
}
|
||||
|
||||
bulkUpdate(value: object, items: Array<object>) {
|
||||
const {store} = this.props;
|
||||
bulkUpdate(value: any, items: Array<object>) {
|
||||
// const {store} = this.props;
|
||||
|
||||
const items2 = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
items2.forEach(item => item.change(value));
|
||||
// const items2 = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
// items2.forEach(item => item.change(value));
|
||||
|
||||
const {store, primaryField} = this.props;
|
||||
|
||||
if (primaryField && value.ids) {
|
||||
const ids = value.ids.split(',');
|
||||
const rows = store.items.filter(item =>
|
||||
find(ids, (id: any) => id && id == item.data[primaryField])
|
||||
);
|
||||
const newValue = {...value, ids: undefined};
|
||||
rows.forEach(item => item.change(newValue));
|
||||
} else if (Array.isArray(items)) {
|
||||
const rows = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
rows.forEach(item => item.change(value));
|
||||
}
|
||||
}
|
||||
|
||||
getSelected() {
|
||||
|
@ -45,6 +45,7 @@ import {ActionSchema} from './Action';
|
||||
import {SchemaRemark} from './Remark';
|
||||
import type {IItem} from 'amis-core';
|
||||
import type {OnEventProps} from 'amis-core';
|
||||
import find from 'lodash/find';
|
||||
|
||||
/**
|
||||
* 不指定类型默认就是文本
|
||||
@ -560,11 +561,25 @@ export default class List extends React.Component<ListProps, object> {
|
||||
store.reset();
|
||||
}
|
||||
|
||||
bulkUpdate(value: object, items: Array<object>) {
|
||||
const {store} = this.props;
|
||||
bulkUpdate(value: any, items: Array<object>) {
|
||||
// const {store} = this.props;
|
||||
|
||||
const items2 = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
items2.forEach(item => item.change(value));
|
||||
// const items2 = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
// items2.forEach(item => item.change(value));
|
||||
|
||||
const {store, primaryField} = this.props;
|
||||
|
||||
if (primaryField && value.ids) {
|
||||
const ids = value.ids.split(',');
|
||||
const rows = store.items.filter(item =>
|
||||
find(ids, (id: any) => id && id == item.data[primaryField])
|
||||
);
|
||||
const newValue = {...value, ids: undefined};
|
||||
rows.forEach(item => item.change(newValue));
|
||||
} else if (Array.isArray(items)) {
|
||||
const rows = store.items.filter(item => ~items.indexOf(item.pristine));
|
||||
rows.forEach(item => item.change(value));
|
||||
}
|
||||
}
|
||||
|
||||
getSelected() {
|
||||
|
@ -1251,7 +1251,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
);
|
||||
const newValue = {...value, ids: undefined};
|
||||
rows.forEach(row => row.change(newValue));
|
||||
} else {
|
||||
} else if (Array.isArray(items)) {
|
||||
const rows = store.rows.filter(item => ~items.indexOf(item.pristine));
|
||||
rows.forEach(row => row.change(value));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user