对于selection也检查是否对listNode的resultSet有影响

This commit is contained in:
Xu Chang 2025-05-08 12:05:21 +08:00
parent cf6f7d0271
commit 206a2a927c
3 changed files with 81 additions and 75 deletions

View File

@ -429,6 +429,22 @@ class ListNode extends EntityNode {
if (this.loading) {
return;
}
const tryAddRowToList = (id, filter) => {
if (this.sr[id]) {
return;
}
if (!filter || this.cache.checkFilterContains(this.entity, filter, {
id,
}, true)) {
this.sr[id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
};
// let hasUpdated = false;
for (const record of records) {
const { a } = record;
@ -438,32 +454,10 @@ class ListNode extends EntityNode {
if (e === this.entity) {
const { filter } = this.constructSelection(true, true, true);
if (d instanceof Array) {
d.forEach((dd) => {
if (!filter || (!this.sr.hasOwnProperty(dd.id) && this.cache.checkFilterContains(e, filter, {
id: dd.id,
}, true))) {
this.sr[dd.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
});
d.forEach((dd) => tryAddRowToList(dd.id, filter));
}
else {
if (!filter || (!this.sr.hasOwnProperty(d.id) && this.cache.checkFilterContains(e, filter, {
id: d.id,
}, true))) {
this.sr[d.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
tryAddRowToList(d.id, filter);
}
}
// hasUpdated = true;
@ -510,7 +504,15 @@ class ListNode extends EntityNode {
break;
}
case 's': {
// 这里可能不对
const { d } = record;
for (const entity in d) {
if (entity === this.entity) {
const { filter } = this.constructSelection(true, true, true);
for (const id in d) {
tryAddRowToList(id, filter);
}
}
}
break;
}
case 'u':

View File

@ -432,6 +432,22 @@ class ListNode extends EntityNode {
if (this.loading) {
return;
}
const tryAddRowToList = (id, filter) => {
if (this.sr[id]) {
return;
}
if (!filter || this.cache.checkFilterContains(this.entity, filter, {
id,
}, true)) {
this.sr[id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
};
// let hasUpdated = false;
for (const record of records) {
const { a } = record;
@ -441,32 +457,10 @@ class ListNode extends EntityNode {
if (e === this.entity) {
const { filter } = this.constructSelection(true, true, true);
if (d instanceof Array) {
d.forEach((dd) => {
if (!filter || (!this.sr.hasOwnProperty(dd.id) && this.cache.checkFilterContains(e, filter, {
id: dd.id,
}, true))) {
this.sr[dd.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
});
d.forEach((dd) => tryAddRowToList(dd.id, filter));
}
else {
if (!filter || (!this.sr.hasOwnProperty(d.id) && this.cache.checkFilterContains(e, filter, {
id: d.id,
}, true))) {
this.sr[d.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
tryAddRowToList(d.id, filter);
}
}
// hasUpdated = true;
@ -513,7 +507,15 @@ class ListNode extends EntityNode {
break;
}
case 's': {
// 这里可能不对
const { d } = record;
for (const entity in d) {
if (entity === this.entity) {
const { filter } = this.constructSelection(true, true, true);
for (const id in d) {
tryAddRowToList(id, filter);
}
}
}
break;
}
case 'u':

View File

@ -547,6 +547,22 @@ class ListNode<
if (this.loading) {
return;
}
const tryAddRowToList = (id: string, filter?: ED[T]['Filter']) => {
if (this.sr[id]) {
return;
}
if (!filter || this.cache.checkFilterContains<T>(this.entity, filter, {
id,
}, true)) {
this.sr[id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
};
// let hasUpdated = false;
for (const record of records) {
const { a } = record;
@ -557,33 +573,11 @@ class ListNode<
const { filter } = this.constructSelection(true, true, true);
if (d instanceof Array) {
d.forEach(
(dd) => {
if (!filter || (!this.sr.hasOwnProperty(dd.id) && this.cache.checkFilterContains<T>(e, filter, {
id: dd.id!,
}, true))) {
this.sr[dd.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
}
(dd) => tryAddRowToList(dd.id, filter)
);
}
else {
if (!filter || (!this.sr.hasOwnProperty(d.id) && this.cache.checkFilterContains<T>(e, filter, {
id: d.id!,
}, true))) {
this.sr[d.id] = {}; // 如果有aggr怎么办一般有aggr的页面不会出现这种情况以后再说
if (typeof this.pagination.total === 'number') {
this.pagination.total += 1;
}
if (typeof this.pagination.count === 'number') {
this.pagination.count += 1;
}
}
tryAddRowToList(d.id, filter);
}
}
// hasUpdated = true;
@ -632,7 +626,15 @@ class ListNode<
break;
}
case 's': {
// 这里可能不对
const { d } = record as SelectOpResult<ED>;
for (const entity in d) {
if (entity as keyof ED === this.entity) {
const { filter } = this.constructSelection(true, true, true);
for (const id in d) {
tryAddRowToList(id, filter);
}
}
}
break;
}
case 'u':