@steedos/standard-process-approval 2.7.27-beta.6 → 3.0.0-beta.100
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/main/default/applications/process_automation.app.yml +1 -38
- package/main/default/client/core.client.js +0 -31
- package/main/default/client/process.client.js +17 -21
- package/main/default/objectTranslations/workflow_notifications.zh-CN/workflow_notifications.zh-CN.objectTranslation.yml +1 -1
- package/main/default/objectTranslations/workflow_outbound_messages.zh-CN/workflow_outbound_messages.zh-CN.objectTranslation.yml +1 -1
- package/main/default/objects/process/approval/process_definition/buttons/copy.button.yml +58 -0
- package/main/default/objects/process/approval/process_definition/buttons/customize.button.yml +135 -0
- package/main/default/objects/process/approval/process_definition/buttons/disable.button.yml +64 -0
- package/main/default/objects/process/approval/process_definition/buttons/enable.button.yml +64 -0
- package/main/default/objects/process/approval/{process_definition.object.yml → process_definition/process_definition.object.yml} +48 -16
- package/main/default/objects/process/approval/process_definition.action.js +39 -56
- package/main/default/objects/process/approval/process_node.object.yml +58 -24
- package/main/default/objects/process_instance_history/buttons/approve.button.yml +0 -3
- package/main/default/objects/process_instance_history/buttons/reassign.button.yml +0 -3
- package/main/default/objects/process_instance_history/buttons/recall.button.yml +0 -4
- package/main/default/objects/process_instance_history/buttons/reject.button.yml +0 -3
- package/main/default/objects/process_instance_history/pages/process_instance_detail.page.amis.json +38 -43
- package/main/default/objects/workflow-actions/action_field_updates.action.js +1 -1
- package/main/default/objects/workflow-actions/action_field_updates.object.yml +1 -0
- package/main/default/objects/workflow-actions/workflow_notifications.action.js +1 -1
- package/main/default/objects/workflow-actions/workflow_notifications.object.yml +1 -0
- package/main/default/objects/workflow-actions/workflow_outbound_messages/workflow_outbound_messages.object.yml +2 -1
- package/main/default/objects/workflow-actions/workflow_rule.action.js +1 -1
- package/main/default/objects/workflow-actions/workflow_rule.object.yml +26 -24
- package/main/default/pages/process_definition_form.page.amis.json +35 -0
- package/main/default/pages/process_definition_form.page.yml +13 -0
- package/main/default/pages/process_node_form.page.amis.json +65 -0
- package/main/default/pages/process_node_form.page.yml +13 -0
- package/main/default/pages/workflow_notifications_form.page.amis.json +47 -0
- package/main/default/pages/workflow_notifications_form.page.yml +13 -0
- package/main/default/pages/workflow_rule_form.page.amis.json +55 -0
- package/main/default/pages/workflow_rule_form.page.yml +13 -0
- package/main/default/services/action_field_updates.service.js +3 -3
- package/main/default/services/approval_process.service.js +70 -2
- package/main/default/triggers/action_field_updates.trigger.js +3 -121
- package/main/default/triggers/process_definition.trigger.js +73 -12
- package/main/default/triggers/process_instance_history.trigger.js +8 -1
- package/main/default/triggers/process_node.trigger.js +2 -4
- package/main/default/triggers/workflow_notifications.trigger.js +3 -115
- package/main/default/triggers/workflow_outbound_messages.trigger.js +3 -133
- package/main/default/triggers/workflow_rule.trigger.js +4 -77
- package/package.json +3 -3
- package/package.service.js +1 -1
- package/main/default/client/action_field_updates.client.js +0 -155
- package/main/default/client/workflow_notifications.client.js +0 -74
- package/public/.md +0 -3
- package/src/.md +0 -3
- package/webapp/.md +0 -1
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
3
|
+
* @Date: 2025-04-14 09:47:57
|
|
4
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5
|
+
* @LastEditTime: 2025-04-29 11:24:43
|
|
6
|
+
*/
|
|
1
7
|
const _ = require("underscore");
|
|
2
8
|
const auth = require("@steedos/auth");
|
|
9
|
+
const steedosI18n = require("@steedos/i18n");
|
|
3
10
|
|
|
4
11
|
const getLng = async function(userId){
|
|
5
12
|
const userSession = await auth.getSessionByUserId(userId);
|
|
@@ -8,7 +15,7 @@ const getLng = async function(userId){
|
|
|
8
15
|
|
|
9
16
|
const getEmptyNodeTitle = async function(userId){
|
|
10
17
|
let lng = await getLng(userId);
|
|
11
|
-
return
|
|
18
|
+
return steedosI18n.t('process_approval_empty_node_title', {}, lng);
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
module.exports = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const _ = require("underscore");
|
|
2
2
|
const objectql = require('@steedos/objectql');
|
|
3
|
-
const util = require('@steedos/standard-objects').util;
|
|
4
|
-
const InternalData = require('@steedos/standard-objects').internalData;
|
|
5
3
|
|
|
6
4
|
function setSpaceAndOwner(record, that){
|
|
7
5
|
record['space'] = that.spaceId
|
|
@@ -131,7 +129,7 @@ module.exports = {
|
|
|
131
129
|
if (this.doc.order === 1) {
|
|
132
130
|
this.doc.reject_behavior = 'reject_request';
|
|
133
131
|
}
|
|
134
|
-
await
|
|
132
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, null, [['process_definition', '=', this.doc.process_definition]]);
|
|
135
133
|
if(!this.doc.filtrad){
|
|
136
134
|
const objectName = await getProcessNodeObjectName(this.doc.process_definition);
|
|
137
135
|
if(objectName){
|
|
@@ -157,7 +155,7 @@ module.exports = {
|
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
if (_.has(this.doc, 'name')) {
|
|
160
|
-
await
|
|
158
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['process_definition', '=', this.doc.process_definition]]);
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
if(!this.doc.filtrad && this.doc.process_definition){
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const _ = require("underscore");
|
|
2
|
-
const util = require('@steedos/standard-objects').util;
|
|
3
2
|
const objectql = require("@steedos/objectql");
|
|
4
|
-
const InternalData = require('@steedos/standard-objects').internalData;
|
|
5
3
|
|
|
6
4
|
const getInternalWorkflowNotifications = function(sourceWorkflowNotifications, filters, dbWorkflowNotifications){
|
|
7
5
|
let workflowNotifications = [];
|
|
@@ -20,121 +18,11 @@ const getInternalWorkflowNotifications = function(sourceWorkflowNotifications, f
|
|
|
20
18
|
|
|
21
19
|
module.exports = {
|
|
22
20
|
beforeInsert: async function () {
|
|
23
|
-
await
|
|
21
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true]]);
|
|
24
22
|
},
|
|
25
23
|
beforeUpdate: async function () {
|
|
26
24
|
if (_.has(this.doc, 'name')) {
|
|
27
|
-
await
|
|
25
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['is_system','!=', true]]);
|
|
28
26
|
}
|
|
29
|
-
}
|
|
30
|
-
afterFind: async function(){
|
|
31
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
32
|
-
let fObjectName = filters.object_name;
|
|
33
|
-
if(fObjectName){
|
|
34
|
-
delete filters.object_name;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if(filters._id && filters._id.$ne){
|
|
38
|
-
if(!_.isArray(filters._id.$ne)){
|
|
39
|
-
filters._id.$ne = [filters._id.$ne]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
let dbWorkflowNotifications = Creator.getCollection("workflow_notifications").find(filters, {fields:{_id:1, name:1}}).fetch();
|
|
43
|
-
|
|
44
|
-
let workflowNotifications = [];
|
|
45
|
-
if(filters.name && filters.name.$in){
|
|
46
|
-
for(let _name of filters.name.$in){
|
|
47
|
-
let workflowNotification = await objectql.getWorkflowNotification(_name);
|
|
48
|
-
if(workflowNotification){
|
|
49
|
-
workflowNotifications.push(workflowNotification);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}else if(filters._id && !filters._id.$ne){
|
|
53
|
-
let notification = await objectql.getWorkflowNotification(filters._id);
|
|
54
|
-
if(notification){
|
|
55
|
-
workflowNotifications.push(notification);
|
|
56
|
-
}
|
|
57
|
-
}else if(fObjectName){
|
|
58
|
-
workflowNotifications = await objectql.getObjectWorkflowNotifications(fObjectName);
|
|
59
|
-
}else{
|
|
60
|
-
workflowNotifications = await objectql.getAllWorkflowNotifications();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if(filters._id && filters._id.$ne){
|
|
64
|
-
for(let neid of filters._id.$ne){
|
|
65
|
-
workflowNotifications = _.filter(workflowNotifications, function(item){
|
|
66
|
-
return item._id !== neid
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters, dbWorkflowNotifications);
|
|
72
|
-
|
|
73
|
-
if(workflowNotifications && workflowNotifications.length>0){
|
|
74
|
-
this.data.values = this.data.values.concat(workflowNotifications)
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
afterCount: async function(){
|
|
78
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
79
|
-
let fObjectName = filters.object_name;
|
|
80
|
-
if(fObjectName){
|
|
81
|
-
delete filters.object_name;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if(filters._id && filters._id.$ne){
|
|
85
|
-
if(!_.isArray(filters._id.$ne)){
|
|
86
|
-
filters._id.$ne = [filters._id.$ne]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
let dbWorkflowNotifications = Creator.getCollection("workflow_notifications").find(filters, {fields:{_id:1, name:1}}).fetch();
|
|
90
|
-
|
|
91
|
-
let workflowNotifications = [];
|
|
92
|
-
if(filters._id && filters._id.$in){
|
|
93
|
-
for(let id of filters._id.$in){
|
|
94
|
-
let workflowNotification = await objectql.getWorkflowNotification(id);
|
|
95
|
-
if(workflowNotification){
|
|
96
|
-
workflowNotifications.push(workflowNotification);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}else if(filters._id && !filters._id.$ne){
|
|
100
|
-
let notification = await objectql.getWorkflowNotification(filters._id);
|
|
101
|
-
if(notification){
|
|
102
|
-
workflowNotifications.push(notification);
|
|
103
|
-
}
|
|
104
|
-
}else if(fObjectName){
|
|
105
|
-
workflowNotifications = await objectql.getObjectWorkflowNotifications(fObjectName);
|
|
106
|
-
}else{
|
|
107
|
-
workflowNotifications = await objectql.getAllWorkflowNotifications();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if(filters._id && filters._id.$ne){
|
|
111
|
-
for(let neid of filters._id.$ne){
|
|
112
|
-
workflowNotifications = _.filter(workflowNotifications, function(item){
|
|
113
|
-
return item._id !== neid
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
workflowNotifications = getInternalWorkflowNotifications(workflowNotifications, filters, dbWorkflowNotifications);
|
|
119
|
-
|
|
120
|
-
if(workflowNotifications && workflowNotifications.length>0){
|
|
121
|
-
this.data.values = this.data.values + workflowNotifications.length
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
afterFindOne: async function(){
|
|
125
|
-
if(_.isEmpty(this.data.values)){
|
|
126
|
-
let id = this.id
|
|
127
|
-
|
|
128
|
-
let dbNotification = Creator.getCollection("workflow_notifications").find({name: id}).fetch();
|
|
129
|
-
if(dbNotification && dbNotification.length > 0){
|
|
130
|
-
this.data.values = dbNotification[0];
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
let workflowNotification = await objectql.getWorkflowNotification(id);
|
|
135
|
-
if(workflowNotification){
|
|
136
|
-
this.data.values = workflowNotification;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
27
|
+
}
|
|
140
28
|
}
|
|
@@ -1,143 +1,13 @@
|
|
|
1
1
|
const _ = require("underscore");
|
|
2
|
-
const util = require('@steedos/standard-objects').util;
|
|
3
2
|
const objectql = require("@steedos/objectql");
|
|
4
|
-
const InternalData = require('@steedos/standard-objects').internalData;
|
|
5
|
-
|
|
6
|
-
const getInternalOutboundMessages = function(sourceOutboundMessages, filters, dbOutboundMessages){
|
|
7
|
-
let messages = [];
|
|
8
|
-
|
|
9
|
-
if(!filters.is_system){
|
|
10
|
-
_.forEach(sourceOutboundMessages, function(doc){
|
|
11
|
-
if(!_.find(dbOutboundMessages, function(p){
|
|
12
|
-
return p.name === doc.name
|
|
13
|
-
})){
|
|
14
|
-
messages.push(doc);
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
return messages;
|
|
19
|
-
}
|
|
20
3
|
|
|
21
4
|
module.exports = {
|
|
22
5
|
beforeInsert: async function () {
|
|
23
|
-
await
|
|
6
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true]]);
|
|
24
7
|
},
|
|
25
8
|
beforeUpdate: async function () {
|
|
26
9
|
if (_.has(this.doc, 'name')) {
|
|
27
|
-
await
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
afterFind: async function(){
|
|
31
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
32
|
-
let fObjectName = filters.object_name;
|
|
33
|
-
|
|
34
|
-
if(fObjectName){
|
|
35
|
-
delete filters.object_name;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if(filters._id && filters._id.$ne){
|
|
39
|
-
if(!_.isArray(filters._id.$ne)){
|
|
40
|
-
filters._id.$ne = [filters._id.$ne]
|
|
41
|
-
}
|
|
10
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['is_system','!=', true]]);
|
|
42
11
|
}
|
|
43
|
-
|
|
44
|
-
let dbOutboundMessages = Creator.getCollection("workflow_outbound_messages").find(filters, {fields:{_id:1, name:1}}).fetch();
|
|
45
|
-
|
|
46
|
-
let messages = [];
|
|
47
|
-
if(filters.name && filters.name.$in){
|
|
48
|
-
for(let _name of filters.name.$in){
|
|
49
|
-
let message = await objectql.getWorkflowOutboundMessage(_name);
|
|
50
|
-
if(message){
|
|
51
|
-
messages.push(message);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}else if(filters._id && !filters._id.$ne){
|
|
55
|
-
let message = await objectql.getWorkflowOutboundMessage(filters._id);
|
|
56
|
-
if(message){
|
|
57
|
-
messages.push(message);
|
|
58
|
-
}
|
|
59
|
-
}else if(fObjectName){
|
|
60
|
-
messages = await objectql.getObjectWorkflowOutboundMessages(fObjectName);
|
|
61
|
-
}else{
|
|
62
|
-
messages = await objectql.getAllWorkflowOutboundMessages();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if(filters._id && filters._id.$ne){
|
|
66
|
-
for(let neid of filters._id.$ne){
|
|
67
|
-
messages = _.filter(messages, function(item){
|
|
68
|
-
return item._id !== neid
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
messages = getInternalOutboundMessages(messages, filters, dbOutboundMessages);
|
|
74
|
-
|
|
75
|
-
if(messages && messages.length>0){
|
|
76
|
-
this.data.values = this.data.values.concat(messages)
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
afterCount: async function(){
|
|
80
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
81
|
-
let fObjectName = filters.object_name;
|
|
82
|
-
|
|
83
|
-
if(fObjectName){
|
|
84
|
-
delete filters.object_name;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if(filters._id && filters._id.$ne){
|
|
88
|
-
if(!_.isArray(filters._id.$ne)){
|
|
89
|
-
filters._id.$ne = [filters._id.$ne]
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let dbOutboundMessages = Creator.getCollection("workflow_outbound_messages").find(filters, {fields:{_id:1, name:1}}).fetch();
|
|
94
|
-
let messages = [];
|
|
95
|
-
if(filters._id && filters._id.$in){
|
|
96
|
-
for(let id of filters._id.$in){
|
|
97
|
-
let message = await objectql.getWorkflowOutboundMessage(id);
|
|
98
|
-
if(message){
|
|
99
|
-
messages.push(message);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}else if(filters._id && !filters._id.$ne){
|
|
103
|
-
let message = await objectql.getWorkflowOutboundMessage(filters._id);
|
|
104
|
-
if(message){
|
|
105
|
-
messages.push(message);
|
|
106
|
-
}
|
|
107
|
-
}else if(fObjectName){
|
|
108
|
-
messages = await objectql.getObjectWorkflowOutboundMessages(fObjectName);
|
|
109
|
-
}else{
|
|
110
|
-
messages = await objectql.getAllWorkflowOutboundMessages();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if(filters._id && filters._id.$ne){
|
|
114
|
-
for(let neid of filters._id.$ne){
|
|
115
|
-
messages = _.filter(messages, function(item){
|
|
116
|
-
return item._id !== neid
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
messages = getInternalOutboundMessages(messages, filters, dbOutboundMessages);
|
|
122
|
-
|
|
123
|
-
if(messages && messages.length>0){
|
|
124
|
-
this.data.values = this.data.values + messages.length
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
afterFindOne: async function(){
|
|
128
|
-
if(_.isEmpty(this.data.values)){
|
|
129
|
-
let id = this.id
|
|
130
|
-
|
|
131
|
-
let dbNotification = Creator.getCollection("workflow_outbound_messages").find({name: id}).fetch();
|
|
132
|
-
if(dbNotification && dbNotification.length > 0){
|
|
133
|
-
this.data.values = dbNotification[0];
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let message = await objectql.getWorkflowOutboundMessage(id);
|
|
138
|
-
if(message){
|
|
139
|
-
this.data.values = message;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
12
|
+
}
|
|
143
13
|
}
|
|
@@ -2,93 +2,20 @@
|
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 2021-08-30 12:06:41
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2025-03-05 16:42:15
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const _ = require("underscore");
|
|
9
|
-
const util = require('@steedos/standard-objects').util;
|
|
10
9
|
const objectql = require("@steedos/objectql");
|
|
11
|
-
const register = require("@steedos/metadata-registrar")
|
|
12
|
-
const InternalData = require('@steedos/standard-objects').internalData;
|
|
13
|
-
|
|
14
|
-
const getInternalWorkflowRules = function(sourceWorkflowRules, filters, dbWorkflowRules){
|
|
15
|
-
let workflowRules = [];
|
|
16
|
-
|
|
17
|
-
if(!filters.is_system){
|
|
18
|
-
_.forEach(sourceWorkflowRules, function(doc){
|
|
19
|
-
if(!_.find(dbWorkflowRules, function(p){
|
|
20
|
-
return p.name === doc.name
|
|
21
|
-
})){
|
|
22
|
-
workflowRules.push(doc);
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
return workflowRules;
|
|
27
|
-
}
|
|
28
10
|
|
|
29
11
|
module.exports = {
|
|
30
12
|
beforeInsert: async function () {
|
|
31
|
-
await
|
|
13
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true]]);
|
|
32
14
|
|
|
33
15
|
},
|
|
34
16
|
beforeUpdate: async function () {
|
|
35
17
|
if (_.has(this.doc, 'name')) {
|
|
36
|
-
await
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
afterFind: async function(){
|
|
40
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
41
|
-
let workflowRules = [];
|
|
42
|
-
|
|
43
|
-
let fObjectName = filters.object_name;
|
|
44
|
-
|
|
45
|
-
if(fObjectName){
|
|
46
|
-
delete filters.object_name;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let dbWorkflowRules = Creator.getCollection("workflow_rule").find(filters, {fields:{_id:1, name:1}}).fetch()
|
|
50
|
-
|
|
51
|
-
if(fObjectName){
|
|
52
|
-
workflowRules = await register.getObjectWorkflowRules(fObjectName);
|
|
53
|
-
}else{
|
|
54
|
-
workflowRules = await register.getAllWorkflowRules();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
workflowRules = getInternalWorkflowRules(workflowRules, filters, dbWorkflowRules);
|
|
58
|
-
|
|
59
|
-
if(workflowRules && workflowRules.length>0){
|
|
60
|
-
this.data.values = this.data.values.concat(workflowRules)
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
afterCount: async function(){
|
|
64
|
-
let filters = InternalData.parserFilters(this.query.filters)
|
|
65
|
-
let workflowRules = [];
|
|
66
|
-
let fObjectName = filters.object_name;
|
|
67
|
-
|
|
68
|
-
if(fObjectName){
|
|
69
|
-
delete filters.object_name;
|
|
70
|
-
}
|
|
71
|
-
let dbWorkflowRules = Creator.getCollection("workflow_rule").find(filters, {fields:{_id:1, name:1}}).fetch()
|
|
72
|
-
|
|
73
|
-
if(fObjectName){
|
|
74
|
-
workflowRules = await register.getObjectWorkflowRules(fObjectName);
|
|
75
|
-
}else{
|
|
76
|
-
workflowRules = await register.getAllWorkflowRules();
|
|
18
|
+
await objectql.checkAPIName(this.object_name, 'name', this.doc.name, this.id, [['is_system','!=', true]]);
|
|
77
19
|
}
|
|
78
|
-
|
|
79
|
-
workflowRules = getInternalWorkflowRules(workflowRules, filters, dbWorkflowRules);
|
|
80
|
-
|
|
81
|
-
if(workflowRules && workflowRules.length>0){
|
|
82
|
-
this.data.values = this.data.values + workflowRules.length
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
afterFindOne: async function(){
|
|
86
|
-
if(_.isEmpty(this.data.values)){
|
|
87
|
-
let id = this.id
|
|
88
|
-
let workflowRule = await register.getWorkflowRule(id);
|
|
89
|
-
if(workflowRule){
|
|
90
|
-
this.data.values = workflowRule;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
20
|
+
}
|
|
94
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-process-approval",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.100",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/process": "
|
|
13
|
+
"@steedos/process": "3.0.0-beta.100",
|
|
14
14
|
"nanoid": "^3.3.4"
|
|
15
15
|
},
|
|
16
16
|
"description": "steedos package",
|
|
17
17
|
"repository": {},
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "89c69deb3ceb9d9e97c70ee23694ccecf1b4ce2b"
|
|
20
20
|
}
|
package/package.service.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"use strict";
|
|
9
9
|
const project = require('./package.json');
|
|
10
10
|
const packageName = project.name;
|
|
11
|
-
const packageLoader = require('@steedos/service-
|
|
11
|
+
const packageLoader = require('@steedos/service-package-loader');
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {import('moleculer').Context} Context Moleculer's Context
|
|
14
14
|
*/
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
Steedos.ProcessFieldUpdatesManager = {};
|
|
2
|
-
|
|
3
|
-
Steedos.ProcessFieldUpdatesManager.changeSchema = function (doc, schema) {
|
|
4
|
-
var objectSchema = Creator.getObjectSchema(Creator.getObject("action_field_updates"));
|
|
5
|
-
var operation = doc.operation;
|
|
6
|
-
|
|
7
|
-
var hiddenField = function (fieldName) {
|
|
8
|
-
schema._schema[fieldName].autoform.omit = true;
|
|
9
|
-
schema._schema[fieldName].autoform.type = 'hidden';
|
|
10
|
-
}
|
|
11
|
-
// var recordId = Session.get("record_id");
|
|
12
|
-
var objectName = Session.get("object_name");
|
|
13
|
-
var actionObjectName = Session.get("action_object_name");
|
|
14
|
-
var actionOperation = Session.get("cmOperation");
|
|
15
|
-
if (objectName == 'process_node') {
|
|
16
|
-
var processDefinitionId = AutoForm.getFormValues("creatorEditForm").insertDoc.process_definition; //Creator.odata.get("process_node", recordId, "process_definition").process_definition;
|
|
17
|
-
if(processDefinitionId){
|
|
18
|
-
var object_name = Creator.odata.get("process_definition", processDefinitionId, "object_name").object_name;
|
|
19
|
-
schema._schema.object_name.autoform.readonly = true;
|
|
20
|
-
doc.object_name = object_name;
|
|
21
|
-
}else{
|
|
22
|
-
toastr.error(t("action_field_updates_field__error_process_node_process_definition_required"));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (objectName == 'process_definition') {
|
|
27
|
-
var object_name = null;
|
|
28
|
-
if(actionObjectName == "process_definition"){
|
|
29
|
-
// 当前正在新建或编辑批准过程
|
|
30
|
-
if (actionOperation == 'update') {
|
|
31
|
-
object_name = AutoForm.getFormValues("creatorEditForm").insertDoc.object_name;
|
|
32
|
-
} else {
|
|
33
|
-
object_name = AutoForm.getFormValues("creatorAddForm").insertDoc.object_name;
|
|
34
|
-
}
|
|
35
|
-
if(!object_name){
|
|
36
|
-
toastr.error(t("action_field_updates_field__error_process_definition_object_required"));
|
|
37
|
-
}
|
|
38
|
-
}else{
|
|
39
|
-
// 当前正在新建或编辑批准过程以外其他对象,目前只有批准过程详细界面新建或编辑批准步骤
|
|
40
|
-
if (actionOperation == 'update') {
|
|
41
|
-
var processDefinitionId = AutoForm.getFormValues("creatorEditForm").insertDoc.process_definition;
|
|
42
|
-
if(processDefinitionId){
|
|
43
|
-
object_name = Creator.odata.get("process_definition", processDefinitionId, "object_name").object_name;
|
|
44
|
-
}
|
|
45
|
-
else{
|
|
46
|
-
toastr.error(t("action_field_updates_field__error_process_node_process_definition_required"));
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
var formValues = AutoForm.getFormValues("creatorAddRelatedForm");
|
|
50
|
-
if(!formValues){
|
|
51
|
-
// 有可能是在批准过程详细界面点击了批准步骤列表顶部的链接进入了“相关批准步骤列表界面”然后点击的右上角的新建按钮触发的
|
|
52
|
-
formValues = AutoForm.getFormValues("creatorAddForm");
|
|
53
|
-
}
|
|
54
|
-
var processDefinitionId = formValues.insertDoc.process_definition;
|
|
55
|
-
if(processDefinitionId){
|
|
56
|
-
object_name = Creator.odata.get("process_definition", processDefinitionId, "object_name").object_name;
|
|
57
|
-
}
|
|
58
|
-
else{
|
|
59
|
-
toastr.error(t("action_field_updates_field__error_process_node_process_definition_required"));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
schema._schema.object_name.autoform.readonly = true;
|
|
64
|
-
doc.object_name = object_name;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (objectName == 'workflow_rule') {
|
|
68
|
-
var object_name = null;
|
|
69
|
-
if (actionOperation == 'update') {
|
|
70
|
-
object_name = AutoForm.getFormValues("creatorEditForm").insertDoc.object_name //Creator.odata.get("workflow_rule", Session.get("record_id"), "object_name").object_name;
|
|
71
|
-
} else {
|
|
72
|
-
object_name = AutoForm.getFormValues("creatorAddForm").insertDoc.object_name
|
|
73
|
-
}
|
|
74
|
-
schema._schema.object_name.autoform.readonly = true;
|
|
75
|
-
if(object_name){
|
|
76
|
-
doc.object_name = object_name;
|
|
77
|
-
}
|
|
78
|
-
else{
|
|
79
|
-
toastr.error(t("action_field_updates_field__error_workflow_rule_object_required"));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// if(doc.process_definition){
|
|
84
|
-
// hiddenField('process_node');
|
|
85
|
-
// schema._schema.when.autoform.options = _.filter(objectSchema.when.autoform.options, function(option){return _.include(['final_approval','final_rejection','recall','initial_submission'], option.value)});
|
|
86
|
-
// var pid = doc.process_definition;
|
|
87
|
-
// if(_.isObject(pid)){
|
|
88
|
-
// if(_.has(pid, 'ids') && pid.ids.length > 0){
|
|
89
|
-
// pid = pid.ids[0];
|
|
90
|
-
// }else{
|
|
91
|
-
// pid = pid._id;
|
|
92
|
-
// }
|
|
93
|
-
// }
|
|
94
|
-
// var object_name = Creator.odata.get("process_definition", pid, "object_name").object_name;
|
|
95
|
-
// schema._schema.object_name.optionsFunction = function(){var _obj = Creator.getObject(object_name); return [{label: _obj.label, value: _obj.name, icon: _obj.icon}]}
|
|
96
|
-
// doc.object_name = object_name;
|
|
97
|
-
// }else{
|
|
98
|
-
// schema._schema.process_node = objectSchema.process_node;
|
|
99
|
-
// schema._schema.when.autoform.options = _.filter(objectSchema.when.autoform.options, function(option){return _.include(['approval','rejection'], option.value)})
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// if(doc.process_node){
|
|
103
|
-
// hiddenField('process_definition');
|
|
104
|
-
// var pnid = doc.process_node;
|
|
105
|
-
// if(_.isObject(pnid)){
|
|
106
|
-
// if(_.has(pnid, 'ids') && pnid.ids.length > 0){
|
|
107
|
-
// pnid = pnid.ids[0];
|
|
108
|
-
// }else{
|
|
109
|
-
// pnid = pnid._id;
|
|
110
|
-
// }
|
|
111
|
-
// }
|
|
112
|
-
// var processDefinitionId = Creator.odata.get("process_node", pnid, "process_definition").process_definition;
|
|
113
|
-
// var object_name = Creator.odata.get("process_definition", processDefinitionId, "object_name").object_name;
|
|
114
|
-
// schema._schema.object_name.optionsFunction = function(){var _obj = Creator.getObject(object_name); return [{label: _obj.label, value: _obj.name, icon: _obj.icon}]}
|
|
115
|
-
// doc.object_name = object_name;
|
|
116
|
-
// schema._schema.when.autoform.options = _.filter(objectSchema.when.autoform.options, function(option){return _.include(['approval','rejection'], option.value)})
|
|
117
|
-
// }else{
|
|
118
|
-
// schema._schema.process_definition = objectSchema.process_definition;
|
|
119
|
-
// schema._schema.when.autoform.options = _.filter(objectSchema.when.autoform.options, function(option){return _.include(['final_approval','final_rejection','recall','initial_submission'], option.value)})
|
|
120
|
-
// }
|
|
121
|
-
|
|
122
|
-
if (operation === 'null') {
|
|
123
|
-
hiddenField('formula');
|
|
124
|
-
hiddenField('literal_value');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (operation === 'formula') {
|
|
128
|
-
schema._schema.formula = objectSchema.formula;
|
|
129
|
-
hiddenField('literal_value');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (operation === 'literal') {
|
|
133
|
-
schema._schema.formula.autoform.type = 'hidden';
|
|
134
|
-
var doc = doc;
|
|
135
|
-
var mainObjectName = null;
|
|
136
|
-
if (doc.target_object && doc.target_object != doc.object_name) {
|
|
137
|
-
var mainObjectName = Creator.objectsByName[doc.object_name].fields[doc.target_object].reference_to;
|
|
138
|
-
} else {
|
|
139
|
-
mainObjectName = doc.object_name;
|
|
140
|
-
}
|
|
141
|
-
var object = Creator.objectsByName[mainObjectName];
|
|
142
|
-
if (object && doc.field_name) {
|
|
143
|
-
schema._schema.literal_value = Object.assign({}, Creator.getObjectSchema(Creator.getObject(mainObjectName))[doc.field_name], { label: schema._schema.literal_value.label });
|
|
144
|
-
schema._schema.literal_value.autoform.disabled = false;
|
|
145
|
-
schema._schema.literal_value.autoform.omit = false;
|
|
146
|
-
schema._schema.literal_value.autoform.readonly = false;
|
|
147
|
-
schema._schema.literal_value.autoform.is_wide = true;
|
|
148
|
-
} else {
|
|
149
|
-
schema._schema.literal_value.autoform.type = 'text';
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}else{
|
|
153
|
-
schema._schema.literal_value.optional = true;
|
|
154
|
-
}
|
|
155
|
-
}
|