Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-frontend-base into dev
This commit is contained in:
commit
c8176819e1
|
|
@ -252,6 +252,49 @@ class ListNode extends Node {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
/**
|
||||
* update有可能将原本满足condition的行变成不满足,也可能将原本不满足的行变成满足
|
||||
*/
|
||||
const { e, f } = record;
|
||||
if (e === this.entity) {
|
||||
const filters = this.constructFilters(true, true, true);
|
||||
if (filters) {
|
||||
// rows是f中满足当前list条件的行
|
||||
const rows = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.cache.getSchema(), [f, ...filters]),
|
||||
});
|
||||
const ids = Object.keys(this.sr);
|
||||
if (ids.length > 0) {
|
||||
// ids中可能有的行因为这次update不再满足了
|
||||
const rows2 = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.cache.getSchema(), [
|
||||
{ id: { $in: ids } },
|
||||
...filters
|
||||
])
|
||||
});
|
||||
ids.forEach((id) => {
|
||||
if (!rows2.find(ele => ele.id === id)) {
|
||||
unset(this.sr, id);
|
||||
}
|
||||
});
|
||||
}
|
||||
rows.forEach((row) => {
|
||||
if (!this.sr[row.id]) {
|
||||
this.sr[row.id] = {};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 如果原来没有filter反而不用处理,因为更新不会影响原来的sr
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,6 +255,49 @@ class ListNode extends Node {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
/**
|
||||
* update有可能将原本满足condition的行变成不满足,也可能将原本不满足的行变成满足
|
||||
*/
|
||||
const { e, f } = record;
|
||||
if (e === this.entity) {
|
||||
const filters = this.constructFilters(true, true, true);
|
||||
if (filters) {
|
||||
// rows是f中满足当前list条件的行
|
||||
const rows = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: (0, filter_1.combineFilters)(this.entity, this.cache.getSchema(), [f, ...filters]),
|
||||
});
|
||||
const ids = Object.keys(this.sr);
|
||||
if (ids.length > 0) {
|
||||
// ids中可能有的行因为这次update不再满足了
|
||||
const rows2 = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: (0, filter_1.combineFilters)(this.entity, this.cache.getSchema(), [
|
||||
{ id: { $in: ids } },
|
||||
...filters
|
||||
])
|
||||
});
|
||||
ids.forEach((id) => {
|
||||
if (!rows2.find(ele => ele.id === id)) {
|
||||
(0, lodash_1.unset)(this.sr, id);
|
||||
}
|
||||
});
|
||||
}
|
||||
rows.forEach((row) => {
|
||||
if (!this.sr[row.id]) {
|
||||
this.sr[row.id] = {};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 如果原来没有filter反而不用处理,因为更新不会影响原来的sr
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { cloneDeep, pull, unset, merge, uniq, omit } from "oak-domain/lib/utils/
|
|||
import { checkFilterContains, combineFilters } from "oak-domain/lib/store/filter";
|
||||
import { createOperationsFromModies } from 'oak-domain/lib/store/modi';
|
||||
import { judgeRelation } from "oak-domain/lib/store/relation";
|
||||
import { EntityDict, StorageSchema, OpRecord, CreateOpResult, RemoveOpResult, AspectWrapper, AuthDefDict, CascadeRelationItem, CascadeActionItem } from "oak-domain/lib/types";
|
||||
import { EntityDict, StorageSchema, OpRecord, CreateOpResult, RemoveOpResult, AspectWrapper, AuthDefDict, CascadeRelationItem, CascadeActionItem, UpdateOpResult } from "oak-domain/lib/types";
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
|
||||
|
|
@ -329,6 +329,55 @@ class ListNode<
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'u': {
|
||||
/**
|
||||
* update有可能将原本满足condition的行变成不满足,也可能将原本不满足的行变成满足
|
||||
*/
|
||||
const { e, f } = record as UpdateOpResult<ED, T>;
|
||||
if (e === this.entity) {
|
||||
const filters = this.constructFilters(true, true, true);
|
||||
if (filters) {
|
||||
// rows是f中满足当前list条件的行
|
||||
const rows = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.cache.getSchema(), [f, ...filters]),
|
||||
});
|
||||
|
||||
const ids = Object.keys(this.sr);
|
||||
if (ids.length > 0) {
|
||||
// ids中可能有的行因为这次update不再满足了
|
||||
const rows2 = this.cache.get(this.entity, {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.cache.getSchema(), [
|
||||
{ id: { $in: ids }},
|
||||
...filters
|
||||
])
|
||||
});
|
||||
|
||||
ids.forEach(
|
||||
(id) => {
|
||||
if (!rows2.find(ele => ele.id === id)) {
|
||||
unset(this.sr, id);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
rows.forEach(
|
||||
(row) => {
|
||||
if (!this.sr[row.id!]) {
|
||||
this.sr[row.id!] = {};
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
// 如果原来没有filter反而不用处理,因为更新不会影响原来的sr
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue