修复crud 在开启保留条目选择或者 primaryField 没值时导致的勾选混乱问题 (#1053)

* 修复City某些城市不可选中问题

* 判断优化,以防万一

* Tree 的 editControls 失效问题修复

Change-Id: I7fb0385612c6eda45b386ba1dfbddac7bc37d47b

* lodash template 语法也支持 this.xxx

Change-Id: Ibc0384031b6d0a1ba280dcae5f90b3477ad3d8ba

* 修复crud 在开启保留条目选择或者 primaryField 没值时导致的勾选混乱问题

Change-Id: I6e3fd0cdbdc996f8856e39922c21f2157704d3bc
This commit is contained in:
liaoxuezhi 2020-11-11 12:28:16 +08:00 committed by GitHub
parent 0af075b3e5
commit ffa2958087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 6 deletions

View File

@ -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) {

View File

@ -780,6 +780,7 @@ export const TableStore = iRendererStore
find(
selected,
a =>
a[valueField || 'value'] &&
a[valueField || 'value'] == item.pristine[valueField || 'value']
)
) {