diff --git a/packages/plugins/@nocobase/plugin-action-import/src/server/actions/import-xlsx.ts b/packages/plugins/@nocobase/plugin-action-import/src/server/actions/import-xlsx.ts index 5d62c7cebe..80ecd19407 100644 --- a/packages/plugins/@nocobase/plugin-action-import/src/server/actions/import-xlsx.ts +++ b/packages/plugins/@nocobase/plugin-action-import/src/server/actions/import-xlsx.ts @@ -51,7 +51,9 @@ async function importXlsxAction(ctx: Context, next: Next) { explain: (ctx.request.body as any).explain, }); - const importedCount = await importer.run(); + const importedCount = await importer.run({ + context: ctx, + }); ctx.bodyMeta = { successCount: importedCount }; ctx.body = ctx.bodyMeta; diff --git a/packages/plugins/@nocobase/plugin-action-import/src/server/services/xlsx-importer.ts b/packages/plugins/@nocobase/plugin-action-import/src/server/services/xlsx-importer.ts index 7229447fc3..bbeb042f9c 100644 --- a/packages/plugins/@nocobase/plugin-action-import/src/server/services/xlsx-importer.ts +++ b/packages/plugins/@nocobase/plugin-action-import/src/server/services/xlsx-importer.ts @@ -30,6 +30,7 @@ type ImporterOptions = { type RunOptions = { transaction?: Transaction; + context?: any; }; export class XlsxImporter extends EventEmitter { @@ -180,6 +181,7 @@ export class XlsxImporter extends EventEmitter { await this.options.collection.repository.create({ values: rowValues, + context: options?.context, transaction, });