@tachybase/plugin-workflow-approval 0.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -0
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/h5/ApprovalBlockInitializer.d.ts +8 -0
- package/dist/client/h5/ApprovalSettings.d.ts +2 -0
- package/dist/client/h5/collection/ApprovalTodos.d.ts +105 -0
- package/dist/client/h5/collection/Approvals.collection.d.ts +85 -0
- package/dist/client/h5/collection/FlowNodes.collection.d.ts +38 -0
- package/dist/client/h5/collection/UserJobs.collection.d.ts +141 -0
- package/dist/client/h5/collection/Workflows.collection.d.ts +30 -0
- package/dist/client/h5/collection/approvalCarbonCopy.collection.d.ts +156 -0
- package/dist/client/h5/collection/notice.collection.d.ts +131 -0
- package/dist/client/h5/component/ApprovalProcess.view.d.ts +2 -0
- package/dist/client/h5/component/ApprovalReachDataType.d.ts +2 -0
- package/dist/client/h5/component/ApprovalTemplateType.d.ts +2 -0
- package/dist/client/h5/constants.d.ts +159 -0
- package/dist/client/h5/context/ApprovalExecution.d.ts +3 -0
- package/dist/client/h5/context/FormBlock.d.ts +2 -0
- package/dist/client/h5/context/SchemaComponent.d.ts +5 -0
- package/dist/client/h5/context/WithActionEnabled.d.ts +3 -0
- package/dist/client/h5/index.d.ts +6 -0
- package/dist/client/h5/initiations/InitiationsBlock.d.ts +5 -0
- package/dist/client/h5/initiations/component/ApprovalItem.d.ts +2 -0
- package/dist/client/h5/initiations/component/ApprovalStatus.d.ts +2 -0
- package/dist/client/h5/initiations/component/InitiationsItem.d.ts +3 -0
- package/dist/client/h5/initiations/component/UserInitiationsItem.d.ts +3 -0
- package/dist/client/h5/initiations/component/ViewActionInitiationsContent.d.ts +10 -0
- package/dist/client/h5/initiations/component/ViewActionUserInitiationsContent.d.ts +3 -0
- package/dist/client/h5/initiations/config/LauncherActionConfig.d.ts +2 -0
- package/dist/client/h5/initiations/config/LauncherActionConfigComponent.d.ts +2 -0
- package/dist/client/h5/initiations/hook/useActionResubmit.d.ts +3 -0
- package/dist/client/h5/initiations/hook/useCreateSubmit.d.ts +3 -0
- package/dist/client/h5/initiations/hook/useDestroyAction.d.ts +3 -0
- package/dist/client/h5/initiations/hook/useFormBlockProps.d.ts +3 -0
- package/dist/client/h5/initiations/hook/useUpadteSubmit.d.ts +3 -0
- package/dist/client/h5/initiations/hook/useWithdrawAction.d.ts +3 -0
- package/dist/client/h5/initiations/provider/ActionBar.d.ts +1 -0
- package/dist/client/h5/initiations/provider/ActionResubmit.provider.d.ts +1 -0
- package/dist/client/h5/initiations/provider/ApplyActionStatus.d.ts +3 -0
- package/dist/client/h5/initiations/provider/Resubmit.provider.d.ts +10 -0
- package/dist/client/h5/initiations/provider/WithdrawAction.d.ts +3 -0
- package/dist/client/h5/locale.d.ts +7 -0
- package/dist/client/h5/todos/TodosBlock.d.ts +3 -0
- package/dist/client/h5/todos/component/TabApplicantType.d.ts +2 -0
- package/dist/client/h5/todos/component/TabApprovalItem.d.ts +3 -0
- package/dist/client/h5/todos/component/TabApprovalType.d.ts +2 -0
- package/dist/client/h5/todos/component/TabDuplicateItem.d.ts +3 -0
- package/dist/client/h5/todos/component/TabExecutedItem.d.ts +3 -0
- package/dist/client/h5/todos/component/TabPendingItem.d.ts +3 -0
- package/dist/client/h5/todos/component/TabProcessedItem.d.ts +3 -0
- package/dist/client/h5/todos/component/ViewActionTodosContent.d.ts +3 -0
- package/dist/client/h5/todos/component/ViewTodosDetailsContent.d.ts +2 -0
- package/dist/client/h5/todos/component/ViewTodosUserJobsContent.d.ts +6 -0
- package/dist/client/h5/todos/component/ViewTodosWorkflowNoticeContent.d.ts +3 -0
- package/dist/client/h5/todos/componentSchema.d.ts +32 -0
- package/dist/client/h5/todos/hook/useApprovalDetailBlockProps.d.ts +3 -0
- package/dist/client/h5/todos/hook/useApprovalFormBlockProps.d.ts +3 -0
- package/dist/client/h5/todos/hook/useDestroyAction.d.ts +3 -0
- package/dist/client/h5/todos/hook/useFormBlockProps.d.ts +9 -0
- package/dist/client/h5/todos/hook/usePropsNoticeDetail.d.ts +3 -0
- package/dist/client/h5/todos/hook/useSubmit.d.ts +6 -0
- package/dist/client/h5/todos/interface/interface.d.ts +139 -0
- package/dist/client/h5/todos/provider/ActionBarProvider.d.ts +3 -0
- package/dist/client/h5/todos/provider/ApplyActionStatus.d.ts +3 -0
- package/dist/client/h5/todos/provider/ApprovalAction.d.ts +9 -0
- package/dist/client/h5/todos/provider/ApprovalFormBlock.d.ts +2 -0
- package/dist/client/h5/todos/provider/FormBlockProvider.d.ts +2 -0
- package/dist/client/h5/todos/provider/ManualActionStatusProvider.d.ts +6 -0
- package/dist/client/h5/todos/provider/WithdrawAction.d.ts +3 -0
- package/dist/client/h5/todos/provider/todosContext.d.ts +2 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +183 -0
- package/dist/client/pc/collections/approvalCarbonCopy.d.ts +156 -0
- package/dist/client/pc/collections/approvalRecords.d.ts +131 -0
- package/dist/client/pc/collections/approvals.d.ts +109 -0
- package/dist/client/pc/collections/flowNodes.d.ts +38 -0
- package/dist/client/pc/collections/workflows.d.ts +41 -0
- package/dist/client/pc/common/FormBlock.provider.d.ts +2 -0
- package/dist/client/pc/configuration/Approval.setting.d.ts +8 -0
- package/dist/client/pc/configuration/ApprovalPane.component.d.ts +2 -0
- package/dist/client/pc/configuration/ApprovalPane.schema.d.ts +651 -0
- package/dist/client/pc/configuration/instruction-approval/Approval.node.d.ts +152 -0
- package/dist/client/pc/configuration/instruction-approval/ApprovalNode.component.d.ts +4 -0
- package/dist/client/pc/configuration/instruction-approval/ApproverConfig.context.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/SkipApproval.schema.d.ts +14 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/SkipApproval.view.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/VC.AssigneesAddition.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/VC.AssigneesSelect.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/VC.ContentTooltip.d.ts +5 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/VC.NegotiationConfig.d.ts +5 -0
- package/dist/client/pc/configuration/instruction-approval/approval-config/VC.SchemaConfigButtonApprover.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/ApprovalUpdateForm.provider.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/ApproverAddBlock.initializer.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/ApproverBlock.view.d.ts +5 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/ApproverInterface.schema.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/Iz.ApproverActionConfig.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/Pd.ActionBarProvider.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/Pd.ApprovalActionProvider.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/Pd.SchemaConfigButtonContext.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/VC.ApprovalActionConfig.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/VC.ApprovalFormBlockProvider.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/VC.ApproverAddBlock.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/VC.ApproverAddBlockKit.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/approver-interface/useApprovalFormBlockProps.d.ts +3 -0
- package/dist/client/pc/configuration/instruction-approval/forms/AddActionButton.setting.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-approval/forms/Approval.options.d.ts +42 -0
- package/dist/client/pc/configuration/instruction-approval/forms/FormBlock.factory.d.ts +6 -0
- package/dist/client/pc/configuration/instruction-approval/forms/update.d.ts +28 -0
- package/dist/client/pc/configuration/instruction-approval/kit.d.ts +5 -0
- package/dist/client/pc/configuration/instruction-approval/utils.d.ts +1 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/ApprovalCarbonCopy.instruction.d.ts +76 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/config-items/AddNotifiedPerson.view.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/config-items/ConfigButtonNotice.view.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/config-items/SelectNotifiedPerson.view.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/kit.d.ts +5 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/show-interface/CarbonCopyDetail.block.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/show-interface/CarbonCopyDetail.initializer.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/show-interface/CarbonCopyDetail.schema.d.ts +6 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/show-interface/CarbonCopyDetailContainer.schema.d.ts +2 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/show-interface/style.d.ts +3 -0
- package/dist/client/pc/configuration/instruction-carbon-copy/style.d.ts +5 -0
- package/dist/client/pc/configuration/plugin.d.ts +5 -0
- package/dist/client/pc/configuration/trigger/Approval.trigger.d.ts +121 -0
- package/dist/client/pc/configuration/trigger/ConfigButton.view.d.ts +2 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/LauncherActionConfig.component.d.ts +3 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/LauncherActionConfig.initializer.d.ts +2 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/LauncherAddBlockButton.initializer.d.ts +2 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/LauncherBlockButton.component.d.ts +2 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/LauncherInterface.schema.d.ts +2 -0
- package/dist/client/pc/configuration/trigger/launcher-interface/SchemaAddBlock.component.d.ts +5 -0
- package/dist/client/pc/configuration/trigger/plugin.d.ts +6 -0
- package/dist/client/pc/constants.d.ts +91 -0
- package/dist/client/pc/index.d.ts +5 -0
- package/dist/client/pc/locale.d.ts +7 -0
- package/dist/client/pc/usage/block/ApprovalBlock.initializer.d.ts +70 -0
- package/dist/client/pc/usage/block/BlockInitItem.provider.d.ts +5 -0
- package/dist/client/pc/usage/block/BlockInitItem.schema.d.ts +21 -0
- package/dist/client/pc/usage/block/BlockInitItem.view.d.ts +2 -0
- package/dist/client/pc/usage/block/InitiateApplication.component.d.ts +6 -0
- package/dist/client/pc/usage/block/carbon-copy/CarbonCopyBlock.provider.d.ts +5 -0
- package/dist/client/pc/usage/block/carbon-copy/CarbonCopyCenter.schema.d.ts +2 -0
- package/dist/client/pc/usage/block/common/ApprovalExecution.provider.d.ts +6 -0
- package/dist/client/pc/usage/block/common/FlowContext.provider.d.ts +6 -0
- package/dist/client/pc/usage/block/common/FuzzySearch.component.d.ts +2 -0
- package/dist/client/pc/usage/block/common/SchemaComponent.provider.d.ts +5 -0
- package/dist/client/pc/usage/block/common/useHandleRefresh.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/ApprovalStatus.context.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/CheckContent.component.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/CheckContent.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/CheckContent.schema.d.ts +45 -0
- package/dist/client/pc/usage/block/initiations/CheckContent.view.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/CheckLink.schema.d.ts +24 -0
- package/dist/client/pc/usage/block/initiations/CheckLink.view.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/TableInitiated.d.ts +6 -0
- package/dist/client/pc/usage/block/initiations/TableInitiated.schema.d.ts +182 -0
- package/dist/client/pc/usage/block/initiations/WithdrawAction.provider.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ActionBar.provider.d.ts +1 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ActionStatus.provider.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ActionWithdraw.provider.d.ts +1 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ApplyButton.component.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ApplyButton.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/apply-button/ApplyButton.view.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/apply-button/hooks/useActionResubmit.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/apply-button/hooks/useSubmitCreate.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/apply-button/hooks/useWithdrawAction.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/hooks/useActionResubmit.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/hooks/useDestroyAction.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/hooks/useFormBlockProps.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/hooks/useSubmitUpdate.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/hooks/useWithdrawAction.d.ts +3 -0
- package/dist/client/pc/usage/block/initiations/providers/ActionBar.provider.d.ts +1 -0
- package/dist/client/pc/usage/block/initiations/providers/ActionResubmit.provider.d.ts +1 -0
- package/dist/client/pc/usage/block/initiations/providers/ApplyActionStatus.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/initiations/providers/Record.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/plugin.d.ts +5 -0
- package/dist/client/pc/usage/block/todos/CheckContent.component.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/CheckContent.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/CheckContent.schema.d.ts +40 -0
- package/dist/client/pc/usage/block/todos/CheckContent.view.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/CheckLink.schema.d.ts +19 -0
- package/dist/client/pc/usage/block/todos/CheckLink.view.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/TableTodos.d.ts +6 -0
- package/dist/client/pc/usage/block/todos/TableTodos.schema.d.ts +195 -0
- package/dist/client/pc/usage/block/todos/hooks/useApprovalDetailBlockProps.d.ts +3 -0
- package/dist/client/pc/usage/block/todos/hooks/useApprovalFormBlockProps.d.ts +3 -0
- package/dist/client/pc/usage/block/todos/hooks/useSubmit.d.ts +3 -0
- package/dist/client/pc/usage/block/todos/providers/ActionBar.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/providers/ApprovalAction.provider.d.ts +10 -0
- package/dist/client/pc/usage/block/todos/providers/ApprovalExecutions.provider.d.ts +28 -0
- package/dist/client/pc/usage/block/todos/providers/ApprovalFormBlock.provider.d.ts +2 -0
- package/dist/client/pc/usage/block/todos/providers/ApprovalUpdateForm.provider.d.ts +1 -0
- package/dist/client/pc/usage/common/ApprovalData.provider.d.ts +5 -0
- package/dist/client/pc/usage/common/ApprovalProcess.view.d.ts +2 -0
- package/dist/client/pc/usage/common/Resubmit.provider.d.ts +10 -0
- package/dist/client/pc/usage/common/WithActionEnabled.provider.d.ts +3 -0
- package/dist/client/pc/usage/common/approval-columns/approvalStatus.column.d.ts +3 -0
- package/dist/client/pc/usage/common/approval-columns/lastNode.column.d.ts +2 -0
- package/dist/client/pc/usage/common/approval-columns/node.column.d.ts +1 -0
- package/dist/client/pc/usage/common/approval-columns/status.column.d.ts +3 -0
- package/dist/client/pc/usage/common/approval-columns/summary.column.d.ts +2 -0
- package/dist/client/pc/usage/common/approval-columns/user.column.d.ts +1 -0
- package/dist/client/pc/usage/common/approval-columns/workflow.column.d.ts +2 -0
- package/dist/client/pc/usage/common/notice-columns/column.action.d.ts +2 -0
- package/dist/client/pc/usage/common/notice-columns/column.node.d.ts +1 -0
- package/dist/client/pc/usage/common/notice-columns/column.status.d.ts +8 -0
- package/dist/client/pc/usage/common/notice-columns/column.user.d.ts +1 -0
- package/dist/client/pc/usage/common/notice-columns/column.workflow.d.ts +2 -0
- package/dist/client/pc/usage/common/notice-show-detail/NoticeDetail.provider.d.ts +5 -0
- package/dist/client/pc/usage/common/notice-show-detail/NoticeDetail.schema.d.ts +2 -0
- package/dist/client/pc/usage/common/notice-show-detail/contexts/MyComponent.context.d.ts +9 -0
- package/dist/client/pc/usage/common/notice-show-detail/contexts/WorkflowNotice.context.d.ts +4 -0
- package/dist/client/pc/usage/common/notice-show-detail/hooks/usePropsNoticeDetail.d.ts +3 -0
- package/dist/client/pc/usage/common/plugin.d.ts +4 -0
- package/dist/client/pc/usage/common/process-columns/index.d.ts +44 -0
- package/dist/client/pc/usage/common/process-columns/renderDetail.d.ts +2 -0
- package/dist/client/pc/usage/common/process-columns/renderStatus.d.ts +2 -0
- package/dist/client/pc/usage/common/process-columns/renderTaskNode.d.ts +2 -0
- package/dist/client/pc/usage/common/style.d.ts +4 -0
- package/dist/client/pc/usage/common/tools.d.ts +1 -0
- package/dist/client/pc/usage/plugin.d.ts +5 -0
- package/dist/client/pc/usage/record-block/RecordApprovals.decorator.d.ts +5 -0
- package/dist/client/pc/usage/record-block/RecordApprovals.initializer.d.ts +2 -0
- package/dist/client/pc/usage/record-block/RecordApprovals.schema.d.ts +110 -0
- package/dist/client/pc/usage/record-block/RecordApprovals.view.d.ts +2 -0
- package/dist/client/pc/usage/record-block/plugin.d.ts +6 -0
- package/dist/common/collection-name.d.ts +4 -0
- package/dist/common/collection-name.js +36 -0
- package/dist/externalVersion.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +311 -0
- package/dist/locale/zh-CN.json +388 -0
- package/dist/server/actions/approvalCarbonCopy.d.ts +3 -0
- package/dist/server/actions/approvalCarbonCopy.js +71 -0
- package/dist/server/actions/approvalRecords.d.ts +4 -0
- package/dist/server/actions/approvalRecords.js +111 -0
- package/dist/server/actions/approvals.d.ts +8 -0
- package/dist/server/actions/approvals.js +275 -0
- package/dist/server/actions/index.d.ts +3 -0
- package/dist/server/actions/index.js +48 -0
- package/dist/server/actions/workflows.d.ts +3 -0
- package/dist/server/actions/workflows.js +49 -0
- package/dist/server/collections/approvalCarbonCopy.d.ts +2 -0
- package/dist/server/collections/approvalCarbonCopy.js +87 -0
- package/dist/server/collections/approvalExecutions.d.ts +2 -0
- package/dist/server/collections/approvalExecutions.js +70 -0
- package/dist/server/collections/approvalRecords.d.ts +2 -0
- package/dist/server/collections/approvalRecords.js +88 -0
- package/dist/server/collections/approvals.d.ts +2 -0
- package/dist/server/collections/approvals.js +96 -0
- package/dist/server/constants/error-code.d.ts +22 -0
- package/dist/server/constants/error-code.js +48 -0
- package/dist/server/constants/status.d.ts +20 -0
- package/dist/server/constants/status.js +46 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/instructions/Approval.d.ts +9 -0
- package/dist/server/instructions/Approval.js +220 -0
- package/dist/server/instructions/ApprovalCarbonCopy.d.ts +8 -0
- package/dist/server/instructions/ApprovalCarbonCopy.js +99 -0
- package/dist/server/instructions/tools.d.ts +11 -0
- package/dist/server/instructions/tools.js +139 -0
- package/dist/server/plugin.d.ts +12 -0
- package/dist/server/plugin.js +89 -0
- package/dist/server/tools.d.ts +11 -0
- package/dist/server/tools.js +70 -0
- package/dist/server/triggers/Approval.d.ts +23 -0
- package/dist/server/triggers/Approval.js +313 -0
- package/dist/server/triggers/tools.d.ts +12 -0
- package/dist/server/triggers/tools.js +44 -0
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +39 -0
- package/package.json +45 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var approvals_exports = {};
|
|
19
|
+
__export(approvals_exports, {
|
|
20
|
+
default: () => approvals_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(approvals_exports);
|
|
23
|
+
var import_database = require("@tachybase/database");
|
|
24
|
+
var approvals_default = (0, import_database.defineCollection)({
|
|
25
|
+
namespace: "workflow.approvals",
|
|
26
|
+
dumpRules: "required",
|
|
27
|
+
name: "approvals",
|
|
28
|
+
createdBy: true,
|
|
29
|
+
updatedBy: true,
|
|
30
|
+
fields: [
|
|
31
|
+
{
|
|
32
|
+
type: "string",
|
|
33
|
+
name: "collectionName"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "string",
|
|
37
|
+
name: "dataKey"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "belongsTo",
|
|
41
|
+
name: "workflow",
|
|
42
|
+
onDelete: "CASCADE"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: "string",
|
|
46
|
+
name: "workflowKey"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "belongsToMany",
|
|
50
|
+
name: "executions",
|
|
51
|
+
through: "approvalExecutions",
|
|
52
|
+
targetKey: "id",
|
|
53
|
+
sourceKey: "id",
|
|
54
|
+
foreignKey: "approvalId",
|
|
55
|
+
otherKey: "executionId"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "hasMany",
|
|
59
|
+
name: "approvalExecutions",
|
|
60
|
+
target: "approvalExecutions",
|
|
61
|
+
onDelete: "CASCADE"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "belongsTo",
|
|
65
|
+
name: "latestApprovalExecution",
|
|
66
|
+
target: "approvalExecutions",
|
|
67
|
+
foreignKey: "latestExecutionId"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "hasMany",
|
|
71
|
+
name: "records",
|
|
72
|
+
target: "approvalRecords",
|
|
73
|
+
onDelete: "CASCADE"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "integer",
|
|
77
|
+
name: "status"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "json",
|
|
81
|
+
name: "data",
|
|
82
|
+
defaultValue: {}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "jsonb",
|
|
86
|
+
name: "summary",
|
|
87
|
+
defaultValue: {}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: "belongsTo",
|
|
91
|
+
name: "applicantRole",
|
|
92
|
+
foreignKey: "applicantRoleName",
|
|
93
|
+
target: "roles"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const ERROR_CODE_MAP: {
|
|
2
|
+
not_enable_workflow: {
|
|
3
|
+
code: number;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
execution_finished: {
|
|
7
|
+
code: number;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
job_finished: {
|
|
11
|
+
code: number;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
not_approval_pending: {
|
|
15
|
+
code: number;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
not_need_update: {
|
|
19
|
+
code: number;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var error_code_exports = {};
|
|
19
|
+
__export(error_code_exports, {
|
|
20
|
+
ERROR_CODE_MAP: () => ERROR_CODE_MAP
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(error_code_exports);
|
|
23
|
+
const ERROR_CODE_MAP = {
|
|
24
|
+
["not_enable_workflow"]: {
|
|
25
|
+
code: 9e3,
|
|
26
|
+
message: "not_enable_workflow"
|
|
27
|
+
},
|
|
28
|
+
["execution_finished"]: {
|
|
29
|
+
code: 9001,
|
|
30
|
+
message: "execution_finished"
|
|
31
|
+
},
|
|
32
|
+
["job_finished"]: {
|
|
33
|
+
code: 9002,
|
|
34
|
+
message: "job_finished"
|
|
35
|
+
},
|
|
36
|
+
["not_approval_pending"]: {
|
|
37
|
+
code: 9003,
|
|
38
|
+
message: "not_approval_pending"
|
|
39
|
+
},
|
|
40
|
+
["not_need_update"]: {
|
|
41
|
+
code: 9004,
|
|
42
|
+
message: "not_need_update"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
ERROR_CODE_MAP
|
|
48
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** 审批发起的状态 */
|
|
2
|
+
export declare const APPROVAL_STATUS: {
|
|
3
|
+
DRAFT: number;
|
|
4
|
+
RETURNED: number;
|
|
5
|
+
SUBMITTED: number;
|
|
6
|
+
PROCESSING: number;
|
|
7
|
+
APPROVED: number;
|
|
8
|
+
RESUBMIT: number;
|
|
9
|
+
REJECTED: number;
|
|
10
|
+
ERROR: number;
|
|
11
|
+
};
|
|
12
|
+
/** 审批执行的状态 */
|
|
13
|
+
export declare const APPROVAL_ACTION_STATUS: {
|
|
14
|
+
ASSIGNED: any;
|
|
15
|
+
PENDING: number;
|
|
16
|
+
RETURNED: number;
|
|
17
|
+
APPROVED: number;
|
|
18
|
+
REJECTED: number;
|
|
19
|
+
CANCELED: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var status_exports = {};
|
|
19
|
+
__export(status_exports, {
|
|
20
|
+
APPROVAL_ACTION_STATUS: () => APPROVAL_ACTION_STATUS,
|
|
21
|
+
APPROVAL_STATUS: () => APPROVAL_STATUS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(status_exports);
|
|
24
|
+
const APPROVAL_STATUS = {
|
|
25
|
+
DRAFT: 0,
|
|
26
|
+
RETURNED: 1,
|
|
27
|
+
SUBMITTED: 2,
|
|
28
|
+
PROCESSING: 3,
|
|
29
|
+
APPROVED: 4,
|
|
30
|
+
RESUBMIT: 5,
|
|
31
|
+
REJECTED: -1,
|
|
32
|
+
ERROR: -2
|
|
33
|
+
};
|
|
34
|
+
const APPROVAL_ACTION_STATUS = {
|
|
35
|
+
ASSIGNED: null,
|
|
36
|
+
PENDING: 0,
|
|
37
|
+
RETURNED: 1,
|
|
38
|
+
APPROVED: 2,
|
|
39
|
+
REJECTED: -1,
|
|
40
|
+
CANCELED: -2
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
APPROVAL_ACTION_STATUS,
|
|
45
|
+
APPROVAL_STATUS
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_plugin.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Instruction } from '@tachybase/module-workflow';
|
|
2
|
+
/** 工作流节点:审批节点 */
|
|
3
|
+
export default class ApprovalInstruction extends Instruction {
|
|
4
|
+
run(node: any, prevJob: any, processor: any): Promise<any>;
|
|
5
|
+
resume(node: any, job: any, processor: any): Promise<any>;
|
|
6
|
+
duplicateConfig(node: any, { transaction }: {
|
|
7
|
+
transaction: any;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Approval_exports = {};
|
|
29
|
+
__export(Approval_exports, {
|
|
30
|
+
default: () => ApprovalInstruction
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Approval_exports);
|
|
33
|
+
var import_data_source = require("@tachybase/data-source");
|
|
34
|
+
var import_module_workflow = require("@tachybase/module-workflow");
|
|
35
|
+
var import_utils = require("@tachybase/utils");
|
|
36
|
+
var import_status = require("../constants/status");
|
|
37
|
+
var import_Approval = __toESM(require("../triggers/Approval"));
|
|
38
|
+
var import_tools = require("./tools");
|
|
39
|
+
class ApprovalInstruction extends import_module_workflow.Instruction {
|
|
40
|
+
async run(node, prevJob, processor) {
|
|
41
|
+
const job = await processor.saveJob({
|
|
42
|
+
status: import_module_workflow.JOB_STATUS.PENDING,
|
|
43
|
+
nodeId: node.id,
|
|
44
|
+
nodeKey: node.key,
|
|
45
|
+
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
46
|
+
});
|
|
47
|
+
const assignees = await (0, import_tools.parseAssignees)(node, processor);
|
|
48
|
+
const { db } = processor.options.plugin;
|
|
49
|
+
const ApprovalRepo = db.getRepository("approvals");
|
|
50
|
+
const approval = await ApprovalRepo.findOne({
|
|
51
|
+
filter: {
|
|
52
|
+
"executions.id": processor.execution.id
|
|
53
|
+
},
|
|
54
|
+
fields: ["id", "status", "data", "summary", "collectionName"],
|
|
55
|
+
appends: ["approvalExecutions", "createdBy"],
|
|
56
|
+
except: ["data"]
|
|
57
|
+
});
|
|
58
|
+
const approvalExecution = approval.approvalExecutions.find((item) => item.executionId === processor.execution.id);
|
|
59
|
+
if ([import_status.APPROVAL_STATUS.RESUBMIT, import_status.APPROVAL_STATUS.DRAFT].includes(approval.status)) {
|
|
60
|
+
return job;
|
|
61
|
+
}
|
|
62
|
+
const RecordModel = db.getModel("approvalRecords");
|
|
63
|
+
await RecordModel.bulkCreate(
|
|
64
|
+
assignees.map((userId, index) => {
|
|
65
|
+
var _a;
|
|
66
|
+
return {
|
|
67
|
+
approvalId: approval.id,
|
|
68
|
+
approvalExecutionId: approvalExecution.id,
|
|
69
|
+
createdById: (_a = approval.createdBy) == null ? void 0 : _a.id,
|
|
70
|
+
userId,
|
|
71
|
+
jobId: job.id,
|
|
72
|
+
nodeId: node.id,
|
|
73
|
+
executionId: job.executionId,
|
|
74
|
+
workflowId: node.workflowId,
|
|
75
|
+
index,
|
|
76
|
+
status: node.config.order && index ? import_status.APPROVAL_ACTION_STATUS.ASSIGNED : import_status.APPROVAL_ACTION_STATUS.PENDING,
|
|
77
|
+
snapshot: approvalExecution.snapshot,
|
|
78
|
+
summary: approval.summary,
|
|
79
|
+
collectionName: approval.collectionName
|
|
80
|
+
};
|
|
81
|
+
}),
|
|
82
|
+
{
|
|
83
|
+
transaction: processor.transaction
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
for (const userId of assignees) {
|
|
87
|
+
const message = {
|
|
88
|
+
userId,
|
|
89
|
+
title: '{{t("Approval", { ns: "@tachybase/plugin-workflow-approval" })}}',
|
|
90
|
+
content: "",
|
|
91
|
+
collectionName: approval.collectionName,
|
|
92
|
+
jsonContent: approval.summary,
|
|
93
|
+
schemaName: node.config.applyDetail
|
|
94
|
+
};
|
|
95
|
+
this.workflow.app.messageManager.sendMessage(+userId, message);
|
|
96
|
+
}
|
|
97
|
+
return job;
|
|
98
|
+
}
|
|
99
|
+
async resume(node, job, processor) {
|
|
100
|
+
if (job.nodeId !== node.id) {
|
|
101
|
+
const nodeJob = processor.findBranchParentJob(job, node);
|
|
102
|
+
if (job.status === import_module_workflow.JOB_STATUS.RESOLVED) {
|
|
103
|
+
const jobNode = processor.nodesMap.get(job.nodeId);
|
|
104
|
+
const branchStart = processor.findBranchStartNode(jobNode);
|
|
105
|
+
if (branchStart.branchIndex === import_status.APPROVAL_ACTION_STATUS.RETURNED) {
|
|
106
|
+
nodeJob.set("status", import_module_workflow.JOB_STATUS.RETRY_NEEDED);
|
|
107
|
+
} else if (branchStart.branchIndex === import_status.APPROVAL_ACTION_STATUS.REJECTED && node.config.endOnReject) {
|
|
108
|
+
nodeJob.set("status", import_module_workflow.JOB_STATUS.REJECTED);
|
|
109
|
+
}
|
|
110
|
+
return nodeJob;
|
|
111
|
+
}
|
|
112
|
+
return processor.exit(job.status);
|
|
113
|
+
}
|
|
114
|
+
const { branchMode, negotiation, order } = node.config;
|
|
115
|
+
const assignees = await (0, import_tools.parseAssignees)(node, processor);
|
|
116
|
+
const RecordRepo = this.workflow.app.db.getRepository("approvalRecords");
|
|
117
|
+
const records = await RecordRepo.find({
|
|
118
|
+
filter: {
|
|
119
|
+
jobId: job.id
|
|
120
|
+
},
|
|
121
|
+
appends: ["approval"],
|
|
122
|
+
except: ["snapshot"],
|
|
123
|
+
sort: ["index"],
|
|
124
|
+
transaction: processor.transaction
|
|
125
|
+
});
|
|
126
|
+
const distribution = records.reduce((prev, record) => {
|
|
127
|
+
const item = prev.find((item2) => item2.status === record.status);
|
|
128
|
+
if (item) {
|
|
129
|
+
item.count += 1;
|
|
130
|
+
} else {
|
|
131
|
+
prev.push({
|
|
132
|
+
status: record.status,
|
|
133
|
+
count: 1
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return prev;
|
|
137
|
+
}, []);
|
|
138
|
+
const processing = Boolean(distribution.find((item) => item.status !== import_status.APPROVAL_ACTION_STATUS.PENDING));
|
|
139
|
+
const status = (0, import_tools.getNegotiationMode)(+negotiation).getStatus(distribution, assignees, negotiation) ?? import_module_workflow.JOB_STATUS.PENDING;
|
|
140
|
+
const result = import_tools.ApprovalJobStatusMap[status];
|
|
141
|
+
processor.logger.debug(`approval resume job and next status: ${status}`);
|
|
142
|
+
job.set({
|
|
143
|
+
status: status && status !== import_module_workflow.JOB_STATUS.CANCELED ? branchMode ? import_module_workflow.JOB_STATUS.RESOLVED : status : status,
|
|
144
|
+
result
|
|
145
|
+
});
|
|
146
|
+
if (status && status !== import_module_workflow.JOB_STATUS.CANCELED || negotiation && processing) {
|
|
147
|
+
await job.latestUserJob.approval.update(
|
|
148
|
+
{
|
|
149
|
+
status: import_status.APPROVAL_STATUS.PROCESSING
|
|
150
|
+
},
|
|
151
|
+
{ transaction: processor.transaction }
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const nextAssignee = assignees[assignees.indexOf(job.latestUserJob.userId) + 1];
|
|
155
|
+
if (!status && negotiation && order && nextAssignee) {
|
|
156
|
+
await RecordRepo.update({
|
|
157
|
+
values: {
|
|
158
|
+
status: import_status.APPROVAL_ACTION_STATUS.PENDING
|
|
159
|
+
},
|
|
160
|
+
filter: {
|
|
161
|
+
jobId: job.id,
|
|
162
|
+
userId: nextAssignee
|
|
163
|
+
},
|
|
164
|
+
transaction: processor.transaction
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (branchMode) {
|
|
168
|
+
const branchNode = processor.nodes.find((item) => item.upstream === node && item.branchIndex === result);
|
|
169
|
+
if (branchNode) {
|
|
170
|
+
await processor.saveJob(job);
|
|
171
|
+
await processor.run(branchNode, job);
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
const approval = records[0].approval;
|
|
177
|
+
const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(approval.collectionName);
|
|
178
|
+
const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
179
|
+
const workflow = await approval.getWorkflow({
|
|
180
|
+
where: {
|
|
181
|
+
id: approval.get("workflowId"),
|
|
182
|
+
type: import_Approval.default.TYPE,
|
|
183
|
+
enabled: true,
|
|
184
|
+
"config.collection": approval.collectionName
|
|
185
|
+
},
|
|
186
|
+
transaction: processor.transaction
|
|
187
|
+
});
|
|
188
|
+
const data = await repository.findOne({
|
|
189
|
+
filterByTk: approval.get("dataKey"),
|
|
190
|
+
appends: workflow.config.appends,
|
|
191
|
+
transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction)
|
|
192
|
+
});
|
|
193
|
+
await RecordRepo.update({
|
|
194
|
+
values: {
|
|
195
|
+
snapshot: (0, import_module_workflow.toJSON)(data)
|
|
196
|
+
},
|
|
197
|
+
filter: {
|
|
198
|
+
jobId: job.id
|
|
199
|
+
},
|
|
200
|
+
transaction: processor.transaction
|
|
201
|
+
});
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.log("%c Line:269 \u{1F95B} error", error);
|
|
204
|
+
}
|
|
205
|
+
return job;
|
|
206
|
+
}
|
|
207
|
+
async duplicateConfig(node, { transaction }) {
|
|
208
|
+
const uiSchemaRepo = this.workflow.app.db.getRepository("uiSchemas");
|
|
209
|
+
if (!node.config.applyDetail) {
|
|
210
|
+
return node.config;
|
|
211
|
+
}
|
|
212
|
+
const result = await uiSchemaRepo.duplicate(node.config.applyDetail, {
|
|
213
|
+
transaction
|
|
214
|
+
});
|
|
215
|
+
return {
|
|
216
|
+
...node.config,
|
|
217
|
+
applyDetail: (result == null ? void 0 : result["x-uid"]) ?? (0, import_utils.uid)()
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Instruction } from '@tachybase/module-workflow';
|
|
2
|
+
/** 工作流节点: 审批抄送节点 */
|
|
3
|
+
export default class ApprovalCarbonCopyInstruction extends Instruction {
|
|
4
|
+
run(node: any, prevJob: any, processor: any): Promise<any>;
|
|
5
|
+
duplicateConfig(node: any, { transaction }: {
|
|
6
|
+
transaction: any;
|
|
7
|
+
}): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var ApprovalCarbonCopy_exports = {};
|
|
19
|
+
__export(ApprovalCarbonCopy_exports, {
|
|
20
|
+
default: () => ApprovalCarbonCopyInstruction
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(ApprovalCarbonCopy_exports);
|
|
23
|
+
var import_module_workflow = require("@tachybase/module-workflow");
|
|
24
|
+
var import_collection_name = require("../../common/collection-name");
|
|
25
|
+
var import_status = require("../constants/status");
|
|
26
|
+
var import_tools = require("../tools");
|
|
27
|
+
class ApprovalCarbonCopyInstruction extends import_module_workflow.Instruction {
|
|
28
|
+
async run(node, prevJob, processor) {
|
|
29
|
+
const job = await processor.saveJob({
|
|
30
|
+
status: import_module_workflow.JOB_STATUS.RESOLVED,
|
|
31
|
+
nodeId: node.id,
|
|
32
|
+
nodeKey: node.key,
|
|
33
|
+
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
34
|
+
});
|
|
35
|
+
const targetPersonList = await (0, import_tools.parsePerson)({ node, processor, keyName: "carbonCopyPerson" });
|
|
36
|
+
if (targetPersonList && targetPersonList.length > 0) {
|
|
37
|
+
const { db } = processor.options.plugin;
|
|
38
|
+
const ApprovalRepo = db.getRepository("approvals");
|
|
39
|
+
const approval = await ApprovalRepo.findOne({
|
|
40
|
+
filter: {
|
|
41
|
+
"executions.id": processor.execution.id
|
|
42
|
+
},
|
|
43
|
+
fields: ["id", "status", "data", "summary", "collectionName"],
|
|
44
|
+
appends: ["approvalExecutions", "createdBy"],
|
|
45
|
+
except: ["data"]
|
|
46
|
+
});
|
|
47
|
+
if ([import_status.APPROVAL_STATUS.SUBMITTED].includes(approval.status)) {
|
|
48
|
+
const CarbonCopyModel = db.getModel(import_collection_name.COLLECTION_NAME_APPROVAL_CARBON_COPY);
|
|
49
|
+
const notifiedPersonDataMap = targetPersonList.map((userId, index) => {
|
|
50
|
+
var _a;
|
|
51
|
+
return {
|
|
52
|
+
userId,
|
|
53
|
+
jobId: job.id,
|
|
54
|
+
nodeId: node.id,
|
|
55
|
+
executionId: job.executionId,
|
|
56
|
+
workflowId: node.workflowId,
|
|
57
|
+
index,
|
|
58
|
+
createdById: (_a = approval.createdBy) == null ? void 0 : _a.id,
|
|
59
|
+
approvalId: approval.id,
|
|
60
|
+
status: approval.status,
|
|
61
|
+
snapshot: approval.data,
|
|
62
|
+
summary: approval.summary,
|
|
63
|
+
collectionName: approval.collectionName,
|
|
64
|
+
dataKey: approval.dataKey
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
await CarbonCopyModel.bulkCreate(notifiedPersonDataMap, {
|
|
68
|
+
transaction: processor.transaction
|
|
69
|
+
});
|
|
70
|
+
for (const userId of targetPersonList) {
|
|
71
|
+
const message = {
|
|
72
|
+
userId,
|
|
73
|
+
title: '{{t("Approval Carbon Copy", { ns: "@tachybase/plugin-workflow-approval" })}}',
|
|
74
|
+
content: "",
|
|
75
|
+
jsonContent: approval.summary,
|
|
76
|
+
collectionName: approval.collectionName,
|
|
77
|
+
schemaName: node.config.showCarbonCopyDetail
|
|
78
|
+
};
|
|
79
|
+
this.workflow.app.messageManager.sendMessage(+userId, message);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return job;
|
|
84
|
+
}
|
|
85
|
+
async duplicateConfig(node, { transaction }) {
|
|
86
|
+
const keyName = "showCarbonCopyDetail";
|
|
87
|
+
const uiSchemaRepo = this.workflow.app.db.getRepository("uiSchemas");
|
|
88
|
+
if (!node.config[keyName]) {
|
|
89
|
+
return node.config;
|
|
90
|
+
}
|
|
91
|
+
const resultSchema = await uiSchemaRepo.duplicate(node.config[keyName], {
|
|
92
|
+
transaction
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
...node.config,
|
|
96
|
+
[keyName]: resultSchema == null ? void 0 : resultSchema["x-uid"]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ApprovalJobStatusMap: {
|
|
2
|
+
0: number;
|
|
3
|
+
1: number;
|
|
4
|
+
[-5]: number;
|
|
5
|
+
[-6]: number;
|
|
6
|
+
[-4]: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getNegotiationMode(mode: any): {
|
|
9
|
+
getStatus(distribution: any, assignees: any, mode: any): number;
|
|
10
|
+
};
|
|
11
|
+
export declare function parseAssignees(node: any, processor: any): Promise<unknown[]>;
|