@tachybase/plugin-workflow-approval 1.3.25 → 1.4.0
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/dist/client/base/ApprovalPane.schema.d.ts +14 -71
- package/dist/client/common/collections/workflows.d.ts +23 -0
- package/dist/client/index.js +34 -34
- package/dist/client/user-interface/pc/block/table-initiations/CheckContent.schema.d.ts +7 -0
- package/dist/client/user-interface/pc/block/table-todos/CheckContent.schema.d.ts +7 -0
- package/dist/client/user-interface/pc/common/ApprovalInfo.d.ts +1 -0
- package/dist/client/user-interface/pc/common/notice-show-detail/NoticeDetail.schema.d.ts +1 -1
- package/dist/externalVersion.js +3 -3
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/server/actions/approvals.js +46 -2
- package/dist/server/collections/approvalCarbonCopy.js +1 -0
- package/dist/server/utils.d.ts +2 -0
- package/dist/server/utils.js +25 -2
- package/package.json +5 -5
|
@@ -11,6 +11,13 @@ export declare const getSchemaCheckContent: (params: any) => {
|
|
|
11
11
|
title: string;
|
|
12
12
|
'x-component': string;
|
|
13
13
|
properties: {
|
|
14
|
+
approvalInfo: {
|
|
15
|
+
type: string;
|
|
16
|
+
'x-component': string;
|
|
17
|
+
'x-component-props': {
|
|
18
|
+
approval: any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
detail: {
|
|
15
22
|
type: string;
|
|
16
23
|
'x-decorator': string;
|
|
@@ -8,6 +8,13 @@ export declare const getSchemaActionTodosContent: (params: any) => {
|
|
|
8
8
|
title: string;
|
|
9
9
|
'x-component': string;
|
|
10
10
|
properties: {
|
|
11
|
+
approvalInfo: {
|
|
12
|
+
type: string;
|
|
13
|
+
'x-component': string;
|
|
14
|
+
'x-component-props': {
|
|
15
|
+
approval: any;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
11
18
|
detail: {
|
|
12
19
|
type: string;
|
|
13
20
|
'x-decorator': string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ApprovalInfo: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const NoticeDetailContent: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const NoticeDetailContent: (props: any) => import("react/jsx-runtime").JSX.Element;
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.
|
|
3
|
-
"@tachybase/module-workflow": "1.
|
|
2
|
+
"@tachybase/client": "1.4.0",
|
|
3
|
+
"@tachybase/module-workflow": "1.4.0",
|
|
4
4
|
"@tego/server": "1.3.52",
|
|
5
5
|
"lodash": "4.17.21",
|
|
6
6
|
"react": "18.3.1",
|
|
7
7
|
"@tachybase/schema": "1.3.52",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
|
-
"@tachybase/module-ui-schema": "1.
|
|
9
|
+
"@tachybase/module-ui-schema": "1.4.0",
|
|
10
10
|
"sequelize": "6.37.5",
|
|
11
11
|
"@tego/client": "1.3.52",
|
|
12
12
|
"@ant-design/icons": "5.6.1",
|
package/dist/locale/en-US.json
CHANGED
package/dist/locale/zh-CN.json
CHANGED
|
@@ -61,9 +61,30 @@ const approvals = {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
const { repository, model } = collection;
|
|
64
|
+
let dataToCreate = (0, import_server.traverseJSON)(data, { collection });
|
|
65
|
+
if (workflowKey) {
|
|
66
|
+
Object.values(collection.model.associations || {}).forEach((assocUnknown) => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
const assoc = assocUnknown;
|
|
69
|
+
if (assoc.foreignKey && Object.prototype.hasOwnProperty.call(dataToCreate, assoc.foreignKey)) {
|
|
70
|
+
delete dataToCreate[assoc.foreignKey];
|
|
71
|
+
}
|
|
72
|
+
if (assoc.associationType === "BelongsToMany" && assoc.as && Array.isArray(dataToCreate[assoc.as])) {
|
|
73
|
+
const targetKey = assoc.targetKey && typeof assoc.targetKey === "string" ? assoc.targetKey : (
|
|
74
|
+
// fallback: 一般为 target model 的主键
|
|
75
|
+
((_a = assoc.target) == null ? void 0 : _a.primaryKeyAttribute) || ((_b = assoc.target) == null ? void 0 : _b.primaryKey) || "id"
|
|
76
|
+
);
|
|
77
|
+
dataToCreate[assoc.as].forEach((item) => {
|
|
78
|
+
if (item && typeof item === "object" && Object.prototype.hasOwnProperty.call(item, targetKey)) {
|
|
79
|
+
delete item[targetKey];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
64
85
|
const values = await repository.create({
|
|
65
86
|
values: {
|
|
66
|
-
...
|
|
87
|
+
...dataToCreate,
|
|
67
88
|
createdBy: context.state.currentUser.id,
|
|
68
89
|
updatedBy: context.state.currentUser.id
|
|
69
90
|
},
|
|
@@ -138,7 +159,7 @@ const approvals = {
|
|
|
138
159
|
return import_server.actions.destroy(context, next);
|
|
139
160
|
},
|
|
140
161
|
async withdraw(context, next) {
|
|
141
|
-
var _a;
|
|
162
|
+
var _a, _b;
|
|
142
163
|
const { filterByTk } = context.action.params;
|
|
143
164
|
const repository = import_server.utils.getRepositoryFromParams(context);
|
|
144
165
|
const approval = await repository.findOne({
|
|
@@ -161,6 +182,29 @@ const approvals = {
|
|
|
161
182
|
},
|
|
162
183
|
limit: 1
|
|
163
184
|
});
|
|
185
|
+
if (!execution) {
|
|
186
|
+
return context.throw(404, "Execution not found! Please contact the administrator.");
|
|
187
|
+
}
|
|
188
|
+
if (!approval.workflow.enabled && ((_b = approval.workflow) == null ? void 0 : _b.key)) {
|
|
189
|
+
const latestWorkflow = await context.db.getRepository("workflows").findOne({
|
|
190
|
+
filter: {
|
|
191
|
+
key: approval.workflow.key,
|
|
192
|
+
enabled: true
|
|
193
|
+
},
|
|
194
|
+
order: [["updatedAt", "DESC"]]
|
|
195
|
+
});
|
|
196
|
+
if (latestWorkflow && approval.workflow.id !== latestWorkflow.id) {
|
|
197
|
+
approval.workflow = latestWorkflow;
|
|
198
|
+
await approval.update(
|
|
199
|
+
{
|
|
200
|
+
workflowId: latestWorkflow.id
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
transaction: context.transaction
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
164
208
|
execution.workflow = approval.workflow;
|
|
165
209
|
await context.db.sequelize.transaction(async (transaction) => {
|
|
166
210
|
const records = await approval.getRecords({
|
|
@@ -26,6 +26,7 @@ var approvalCarbonCopy_default = (0, import_server.defineCollection)({
|
|
|
26
26
|
namespace: "workflow.approvalCarbonCopy",
|
|
27
27
|
dumpRules: "required",
|
|
28
28
|
name: import_constants.COLLECTION_NAME_APPROVAL_CARBON_COPY,
|
|
29
|
+
origin: "@tachybase/plugin-workflow-approval",
|
|
29
30
|
createdBy: true,
|
|
30
31
|
updatedBy: true,
|
|
31
32
|
fields: [
|
package/dist/server/utils.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export declare function findUniqueObjects(sourceArray: any[], uniqueByArray: string[], compareByKey?: string, compareByFunc?: (a: any, b: any) => number): any[];
|
|
2
|
+
export declare function getWorkflow(context: any, workflowId: any): Promise<any>;
|
|
3
|
+
export declare function getWorkflowByKey(context: any, workflowKey: any): Promise<any>;
|
package/dist/server/utils.js
CHANGED
|
@@ -17,7 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var utils_exports = {};
|
|
19
19
|
__export(utils_exports, {
|
|
20
|
-
findUniqueObjects: () => findUniqueObjects
|
|
20
|
+
findUniqueObjects: () => findUniqueObjects,
|
|
21
|
+
getWorkflow: () => getWorkflow,
|
|
22
|
+
getWorkflowByKey: () => getWorkflowByKey
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(utils_exports);
|
|
23
25
|
function findUniqueObjects(sourceArray = [], uniqueByArray, compareByKey = "", compareByFunc = (a, b) => a - b) {
|
|
@@ -33,7 +35,28 @@ function findUniqueObjects(sourceArray = [], uniqueByArray, compareByKey = "", c
|
|
|
33
35
|
result = Object.values(uniqueMap);
|
|
34
36
|
return result;
|
|
35
37
|
}
|
|
38
|
+
async function getWorkflow(context, workflowId) {
|
|
39
|
+
if (workflowId) {
|
|
40
|
+
return await context.db.getRepository("workflows").findOne({
|
|
41
|
+
filterByTk: workflowId
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
async function getWorkflowByKey(context, workflowKey) {
|
|
47
|
+
if (workflowKey) {
|
|
48
|
+
return await context.db.getRepository("workflows").findOne({
|
|
49
|
+
filter: {
|
|
50
|
+
key: workflowKey,
|
|
51
|
+
enabled: true
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
36
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
58
|
0 && (module.exports = {
|
|
38
|
-
findUniqueObjects
|
|
59
|
+
findUniqueObjects,
|
|
60
|
+
getWorkflow,
|
|
61
|
+
getWorkflowByKey
|
|
39
62
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-workflow-approval",
|
|
3
3
|
"displayName": "Approval",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "Approval base in Workflow",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Approval",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"file-saver": "^2.0.5",
|
|
25
25
|
"jsonata": "^2.0.6",
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
|
-
"react-i18next": "
|
|
27
|
+
"react-i18next": "16.2.1",
|
|
28
28
|
"react-router-dom": "6.28.1",
|
|
29
29
|
"sequelize": "^6.37.5",
|
|
30
|
-
"@tachybase/client": "1.
|
|
31
|
-
"@tachybase/module-
|
|
32
|
-
"@tachybase/module-
|
|
30
|
+
"@tachybase/client": "1.4.0",
|
|
31
|
+
"@tachybase/module-workflow": "1.4.0",
|
|
32
|
+
"@tachybase/module-ui-schema": "1.4.0"
|
|
33
33
|
},
|
|
34
34
|
"description.zh-CN": "审批系统是一个强大的BPM工具,为业务流程自动化提供基础支持,同时具备高度灵活性和可扩展性,确保审批流程的效率和合规性,助力企业释放创新潜力。",
|
|
35
35
|
"displayName.zh-CN": "审批"
|