From 56be4a38c52f4ccdad877df1f6ed1e721238ea09 Mon Sep 17 00:00:00 2001 From: dream2023 <1098626505@qq.com> Date: Fri, 2 Feb 2024 11:04:24 +0800 Subject: [PATCH] fix: bug T-3026 --- .../mixins/InheritanceCollectionMixin.ts | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts index 867e99102a..e252f43af7 100644 --- a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts +++ b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts @@ -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(parentCollectionName); + const parentCollection = this.collectionManager.getCollection(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(collectionName); + const collection = this.collectionManager.getCollection(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(name); + const collection = this.collectionManager.getCollection(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) {