Skip to content

Commit

Permalink
fix: 修复 crud nested 模式深层次点选异常 (baidu#9440)
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Jan 16, 2024
1 parent 9cc9a72 commit 1b90148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mock/cfc/mock/crud/table2.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ const data = [
version: '1',
grade: 'A'
}
].map(function (child, i) {
].map(function (child, j) {
return Object.assign({}, child, {
id: (i + 1) * 100 + (index + 1) * 1000 + i + 1
id: (index + 1) * 10000 + (i + 1) * 100 + 1 + j
});
})
});
Expand Down
8 changes: 4 additions & 4 deletions packages/amis-core/src/store/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1546,11 +1546,11 @@ export const TableStore = iRendererStore
self.selectedRows.clear();

selected.forEach(item => {
let resolved = self.rows.find(a => a.pristine === item);
let resolved = findTree(self.rows, a => a.pristine === item);

// 先严格比较,
if (!resolved) {
resolved = self.rows.find(a => {
resolved = findTree(self.rows, a => {
const selectValue = item[valueField || 'value'];
const itemValue = a.pristine[valueField || 'value'];
return selectValue === itemValue;
Expand All @@ -1559,14 +1559,14 @@ export const TableStore = iRendererStore

// 再宽松比较
if (!resolved) {
resolved = self.rows.find(a => {
resolved = findTree(self.rows, a => {
const selectValue = item[valueField || 'value'];
const itemValue = a.pristine[valueField || 'value'];
return selectValue == itemValue;
});
}

resolved && self.selectedRows.push(resolved);
resolved && self.selectedRows.push(resolved as any);
});

updateCheckDisable();
Expand Down

0 comments on commit 1b90148

Please sign in to comment.