fix: 修复 crud nested 模式深层次点选异常 (#9440)

This commit is contained in:
liaoxuezhi 2024-01-16 11:34:05 +08:00 committed by GitHub
parent 9cc9a72bc2
commit 1b90148c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -471,9 +471,9 @@ const data = [
version: '1', version: '1',
grade: 'A' grade: 'A'
} }
].map(function (child, i) { ].map(function (child, j) {
return Object.assign({}, child, { return Object.assign({}, child, {
id: (i + 1) * 100 + (index + 1) * 1000 + i + 1 id: (index + 1) * 10000 + (i + 1) * 100 + 1 + j
}); });
}) })
}); });

View File

@ -1546,11 +1546,11 @@ export const TableStore = iRendererStore
self.selectedRows.clear(); self.selectedRows.clear();
selected.forEach(item => { selected.forEach(item => {
let resolved = self.rows.find(a => a.pristine === item); let resolved = findTree(self.rows, a => a.pristine === item);
// 先严格比较, // 先严格比较,
if (!resolved) { if (!resolved) {
resolved = self.rows.find(a => { resolved = findTree(self.rows, a => {
const selectValue = item[valueField || 'value']; const selectValue = item[valueField || 'value'];
const itemValue = a.pristine[valueField || 'value']; const itemValue = a.pristine[valueField || 'value'];
return selectValue === itemValue; return selectValue === itemValue;
@ -1559,14 +1559,14 @@ export const TableStore = iRendererStore
// 再宽松比较 // 再宽松比较
if (!resolved) { if (!resolved) {
resolved = self.rows.find(a => { resolved = findTree(self.rows, a => {
const selectValue = item[valueField || 'value']; const selectValue = item[valueField || 'value'];
const itemValue = a.pristine[valueField || 'value']; const itemValue = a.pristine[valueField || 'value'];
return selectValue == itemValue; return selectValue == itemValue;
}); });
} }
resolved && self.selectedRows.push(resolved); resolved && self.selectedRows.push(resolved as any);
}); });
updateCheckDisable(); updateCheckDisable();