diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx index 7ef3adcfbc..c177c278ac 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx @@ -36,7 +36,7 @@ function DynamicExpression({ value, onChange }) { export default class extends Instruction { title = `{{t("Dynamic Calculation", { ns: "${NAMESPACE}" })}}`; type = 'dynamic-calculation'; - group = 'control'; + group = 'extended'; description = `{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.", { ns: "${NAMESPACE}" })}}`; fieldset = { expression: { diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx index a489d1ae7f..4840ecfe13 100644 --- a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/client/FormTrigger.tsx @@ -70,6 +70,8 @@ export default class extends Trigger { const langTriggerData = useLang('Trigger data'); // eslint-disable-next-line react-hooks/rules-of-hooks const langUserSubmittedForm = useLang('User submitted form'); + // eslint-disable-next-line react-hooks/rules-of-hooks + const langRoleSubmittedForm = useLang('Role of user submitted form'); const rootFields = [ { collectionName: config.collection, @@ -89,6 +91,12 @@ export default class extends Trigger { title: langUserSubmittedForm, }, }, + { + name: 'roleName', + uiSchema: { + title: langRoleSubmittedForm, + }, + }, ]; const result = getCollectionFieldOptions({ // depth, diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json index ef9819aac0..51dcf64a7d 100644 --- a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json +++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/en-US.json @@ -4,5 +4,6 @@ "Form data model": "Form data model", "Use a collection to match form data.": "Use a collection to match form data.", "Associations to use": "Associations to use", - "User submitted form": "User submitted form" + "User submitted form": "User submitted form", + "Role of user submitted form": "Role of user submitted form" } diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json index 112e933be2..476d4a7952 100644 --- a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/locale/zh-CN.json @@ -4,5 +4,6 @@ "Form data model": "表单数据模型", "Use a collection to match form data.": "使用一个数据表来匹配表单数据。", "Associations to use": "待使用的关系数据", - "User submitted form": "提交表单的用户" + "User submitted form": "提交表单的用户", + "Role of user submitted form": "提交表单用户的角色" } diff --git a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts index c77a27875c..16a4329a10 100644 --- a/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts +++ b/packages/plugins/@nocobase/plugin-workflow-form-trigger/src/server/FormTrigger.ts @@ -51,7 +51,11 @@ export default class extends Trigger { private async trigger(context) { const { triggerWorkflows = '', values } = context.action.params; - const { currentUser } = context.state; + const { currentUser, currentRole } = context.state; + const userInfo = { + user: toJSON(currentUser), + roleName: currentRole, + }; const triggers = triggerWorkflows.split(',').map((trigger) => trigger.split('!')); const workflowRepo = this.plugin.db.getRepository('workflows'); @@ -91,13 +95,13 @@ export default class extends Trigger { appends, }); } - this.plugin.trigger(workflow, { data: toJSON(payload), user: toJSON(currentUser) }); + this.plugin.trigger(workflow, { data: toJSON(payload), ...userInfo }); }); } else { const data = trigger[1] ? get(values, trigger[1]) : values; this.plugin.trigger(workflow, { data, - user: currentUser, + ...userInfo, }); } });