fix(plugin-workflow): fix form trigger data bug (#2472)

This commit is contained in:
Junyi 2023-08-17 10:05:05 +07:00 committed by GitHub
parent efa153e92e
commit c6070378f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import Plugin from '..';
import { WorkflowModel } from '../types'; import { WorkflowModel } from '../types';
import { Model, modelAssociationByKey } from '@nocobase/database'; import { Model, modelAssociationByKey } from '@nocobase/database';
import { BelongsTo, HasOne } from 'sequelize'; import { BelongsTo, HasOne } from 'sequelize';
import { toJSON } from '../utils';
export default class FormTrigger extends Trigger { export default class FormTrigger extends Trigger {
constructor(plugin: Plugin) { constructor(plugin: Plugin) {
@ -85,7 +86,7 @@ export default class FormTrigger extends Trigger {
appends, appends,
}); });
} }
this.plugin.trigger(workflow, { data: payload }); this.plugin.trigger(workflow, { data: toJSON(payload) });
}); });
} else { } else {
this.plugin.trigger(workflow, { data: trigger[1] ? get(values, trigger[1]) : values }); this.plugin.trigger(workflow, { data: trigger[1] ? get(values, trigger[1]) : values });