mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 15:48:06 +00:00
fix: bug T-3026
This commit is contained in:
parent
d18c7b389b
commit
56be4a38c5
@ -22,7 +22,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
|
||||
const parents: string[] = [];
|
||||
const getParentCollectionsInner = (collectionName: string) => {
|
||||
const collection = this.collectionManager.getCollection(collectionName);
|
||||
const collection = this.collectionManager.getCollection(collectionName, { dataSource: this.dataSource });
|
||||
if (collection) {
|
||||
const { inherits } = collection;
|
||||
if (inherits) {
|
||||
@ -45,7 +45,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
return this.parentCollections;
|
||||
}
|
||||
this.parentCollections = this.getParentCollectionsName().map((collectionName) => {
|
||||
return this.collectionManager.getCollection(collectionName);
|
||||
return this.collectionManager.getCollection(collectionName, { dataSource: this.dataSource });
|
||||
});
|
||||
return this.parentCollections;
|
||||
}
|
||||
@ -57,7 +57,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
}
|
||||
|
||||
const children: string[] = [];
|
||||
const collections = this.collectionManager.getCollections();
|
||||
const collections = this.collectionManager.getCollections({ dataSource: this.dataSource });
|
||||
const getChildrenCollectionsInner = (collectionName: string) => {
|
||||
const inheritCollections = collections.filter((v) => {
|
||||
return v.inherits?.includes(collectionName);
|
||||
@ -90,7 +90,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
return this.childrenCollections[cacheKey];
|
||||
}
|
||||
this.childrenCollections[cacheKey] = this.getChildrenCollectionsName(isSupportView).map((collectionName) => {
|
||||
return this.collectionManager.getCollection(collectionName);
|
||||
return this.collectionManager.getCollection(collectionName, { dataSource: this.dataSource });
|
||||
});
|
||||
return this.childrenCollections[cacheKey];
|
||||
}
|
||||
@ -102,7 +102,10 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
|
||||
const parentCollections = this.getParentCollectionsName();
|
||||
this.inheritsFields = parentCollections
|
||||
.map((collectionName) => this.collectionManager.getCollection(collectionName)?.getFields())
|
||||
.map(
|
||||
(collectionName) =>
|
||||
this.collectionManager.getCollection(collectionName, { dataSource: this.dataSource })?.getFields(),
|
||||
)
|
||||
.flat()
|
||||
.filter(Boolean);
|
||||
|
||||
@ -134,14 +137,18 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
|
||||
const currentFields = this.getCurrentFields();
|
||||
const parentCollections = this.getParentCollectionsName();
|
||||
const parentCollection = this.collectionManager.getCollection<InheritanceCollectionMixin>(parentCollectionName);
|
||||
const parentCollection = this.collectionManager.getCollection<InheritanceCollectionMixin>(parentCollectionName, {
|
||||
dataSource: this.dataSource,
|
||||
});
|
||||
const parentFields = parentCollection.getCurrentFields();
|
||||
const index = parentCollections.indexOf(parentCollectionName);
|
||||
let filterFields = currentFields;
|
||||
if (index > 0) {
|
||||
parentCollections.splice(index);
|
||||
parentCollections.forEach((collectionName) => {
|
||||
const collection = this.collectionManager.getCollection<InheritanceCollectionMixin>(collectionName);
|
||||
const collection = this.collectionManager.getCollection<InheritanceCollectionMixin>(collectionName, {
|
||||
dataSource: this.dataSource,
|
||||
});
|
||||
filterFields = filterFields.concat(collection.getCurrentFields());
|
||||
});
|
||||
}
|
||||
@ -161,7 +168,9 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
|
||||
const collectionsInheritChain = [this.name];
|
||||
const getInheritChain = (name: string) => {
|
||||
const collection = this.collectionManager.getCollection<InheritanceCollectionMixin>(name);
|
||||
const collection = this.collectionManager.getCollection<InheritanceCollectionMixin>(name, {
|
||||
dataSource: this.dataSource,
|
||||
});
|
||||
if (collection) {
|
||||
const { inherits } = collection;
|
||||
const children = collection.getChildrenCollectionsName();
|
||||
@ -179,7 +188,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
// 搜寻后代表
|
||||
if (children) {
|
||||
for (let index = 0; index < children.length; index++) {
|
||||
const collection = this.collectionManager.getCollection(children[index]);
|
||||
const collection = this.collectionManager.getCollection(children[index], { dataSource: this.dataSource });
|
||||
const collectionKey = collection.name;
|
||||
if (collectionsInheritChain.includes(collectionKey)) {
|
||||
continue;
|
||||
@ -202,7 +211,7 @@ export class InheritanceCollectionMixin extends CollectionV2 {
|
||||
}
|
||||
const collectionsInheritChain = [this.name];
|
||||
const getInheritChain = (name: string) => {
|
||||
const collection = this.collectionManager.getCollection(name);
|
||||
const collection = this.collectionManager.getCollection(name, { dataSource: this.dataSource });
|
||||
if (collection) {
|
||||
const { inherits } = collection;
|
||||
if (inherits) {
|
||||
|
Loading…
Reference in New Issue
Block a user