mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
修复crud 在开启保留条目选择或者 primaryField 没值时导致的勾选混乱问题
Change-Id: I6e3fd0cdbdc996f8856e39922c21f2157704d3bc
This commit is contained in:
parent
f99ddf7232
commit
9fbb4971a6
@ -1254,8 +1254,9 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
const idx = findIndex(
|
||||
oldItems,
|
||||
a =>
|
||||
a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id']
|
||||
a === item ||
|
||||
(a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id'])
|
||||
);
|
||||
|
||||
if (~idx) {
|
||||
@ -1263,21 +1264,35 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
} else {
|
||||
oldItems.push(item);
|
||||
}
|
||||
|
||||
const idx2 = findIndex(
|
||||
oldUnselectedItems,
|
||||
a =>
|
||||
a === item ||
|
||||
(a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id'])
|
||||
);
|
||||
|
||||
if (~idx2) {
|
||||
oldUnselectedItems.splice(idx2, 1);
|
||||
}
|
||||
});
|
||||
|
||||
unSelectedItems.forEach(item => {
|
||||
const idx = findIndex(
|
||||
oldUnselectedItems,
|
||||
a =>
|
||||
a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id']
|
||||
a === item ||
|
||||
(a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id'])
|
||||
);
|
||||
|
||||
const idx2 = findIndex(
|
||||
oldItems,
|
||||
a =>
|
||||
a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id']
|
||||
a === item ||
|
||||
(a[primaryField || 'id'] &&
|
||||
a[primaryField || 'id'] == item[primaryField || 'id'])
|
||||
);
|
||||
|
||||
if (~idx) {
|
||||
|
@ -780,6 +780,7 @@ export const TableStore = iRendererStore
|
||||
find(
|
||||
selected,
|
||||
a =>
|
||||
a[valueField || 'value'] &&
|
||||
a[valueField || 'value'] == item.pristine[valueField || 'value']
|
||||
)
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user