@steedos-labs/plugin-workflow 3.0.16 → 3.0.19
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/approve_workflow.app.yml +18 -104
- package/main/default/manager/instance_tasks_manager.js +11 -0
- package/main/default/manager/push_manager.js +4 -1
- package/main/default/manager/uuflow_manager.js +72 -3
- package/main/default/objects/instances/buttons/instance_delete.button.yml +4 -0
- package/main/default/objects/instances/buttons/instance_new.button.yml +4 -0
- package/main/default/pages/page_instance_print.page.amis.json +28 -2
- package/main/default/routes/am.router.js +2 -1
- package/main/default/routes/api_workflow_chart.router.js +1 -1
- package/main/default/routes/api_workflow_engine.router.js +19 -1
- package/main/default/routes/designer.router.js +26 -0
- package/main/default/utils/designerManager.js +84 -46
- package/package.json +1 -1
- package/public/applications/designer/5410/en-us/javascript-packed.js +1 -1
- package/public/applications/designer/5410/zh-cn/javascript-packed.js +1 -1
- package/public/workflow/index.css +53 -0
- package/src/util/templateConverter.js +2 -1
|
@@ -137,6 +137,32 @@ var DesignerAPI = {
|
|
|
137
137
|
}
|
|
138
138
|
}, 100);
|
|
139
139
|
|
|
140
|
+
var closeBtnInterval = setInterval(function(){
|
|
141
|
+
var iframeWin = $(self)[0].contentWindow;
|
|
142
|
+
var iframeDoc = iframeWin.document;
|
|
143
|
+
var closeBtn = $(iframeDoc).find(".htv3.designer.square.sc-view.sc-button-view.button.sc-huge-size");
|
|
144
|
+
if(closeBtn.length > 0){
|
|
145
|
+
clearInterval(closeBtnInterval);
|
|
146
|
+
var lastBtn = closeBtn.last()[0];
|
|
147
|
+
|
|
148
|
+
var newBtn = iframeDoc.createElement("div");
|
|
149
|
+
newBtn.setAttribute("role", "button");
|
|
150
|
+
newBtn.className = lastBtn.className;
|
|
151
|
+
newBtn.style.cssText = lastBtn.style.cssText;
|
|
152
|
+
newBtn.innerHTML = '<div class="left"></div><div class="middle"></div><div class="right"></div><label class="sc-button-label sc-huge-size ellipsis">关闭</label>';
|
|
153
|
+
|
|
154
|
+
if(lastBtn.parentNode){
|
|
155
|
+
lastBtn.parentNode.replaceChild(newBtn, lastBtn);
|
|
156
|
+
|
|
157
|
+
newBtn.onclick = function(e){
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
window.close();
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, 100);
|
|
165
|
+
|
|
140
166
|
});
|
|
141
167
|
var designer = {
|
|
142
168
|
urlQuery:function(name){
|
|
@@ -4,82 +4,120 @@ const lodash = require('lodash');
|
|
|
4
4
|
|
|
5
5
|
const { _makeNewID, getCollection } = require('./collection');
|
|
6
6
|
|
|
7
|
-
async function getByAdminSpaceIds(spaceIds, companyId, isCompanyAdmin) {
|
|
7
|
+
async function getByAdminSpaceIds(spaceIds, companyId, isCompanyAdmin, flowId) {
|
|
8
8
|
let filters = _makeInFilters('space', spaceIds);
|
|
9
9
|
let spaceFilters = filters;
|
|
10
10
|
if (isCompanyAdmin && companyId) {
|
|
11
11
|
filters = `(${filters}) and ((company_id eq '${companyId}') or (company_id eq null))`;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
spaceUsers = await getObject('space_users').find({
|
|
13
|
+
|
|
14
|
+
const spaceUsersPromise = getObject('space_users').find({
|
|
17
15
|
filters: spaceFilters,
|
|
18
16
|
fields: ['name', 'email', 'space', 'organization', 'organizations', 'user', 'user_accepted', 'company_id']
|
|
19
17
|
})
|
|
20
|
-
userIds = _.pluck(spaceUsers, 'user');
|
|
21
|
-
|
|
22
|
-
let usersCollection = await getCollection('users');
|
|
23
|
-
let users = await usersCollection.find({
|
|
24
|
-
_id: {
|
|
25
|
-
$in: userIds
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
fields: {
|
|
29
|
-
'photo': 1,
|
|
30
|
-
'google_id': 1,
|
|
31
|
-
'imo_uid': 1,
|
|
32
|
-
'company': 1,
|
|
33
|
-
'name': 1,
|
|
34
|
-
'locale': 1,
|
|
35
|
-
'steedos_id': 1,
|
|
36
|
-
'primary_email_verified': 1,
|
|
37
|
-
'is_paid_user': 1,
|
|
38
|
-
'mobile': 1,
|
|
39
|
-
'email': 1,
|
|
40
|
-
'created': 1,
|
|
41
|
-
'modified': 1,
|
|
42
|
-
'created_by': 1,
|
|
43
|
-
'modified_by': 1,
|
|
44
|
-
'email_notification': 1,
|
|
45
|
-
'qq_open_id': 1
|
|
46
|
-
}
|
|
47
|
-
}).toArray();
|
|
48
18
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
19
|
+
const usersPromise = spaceUsersPromise.then(async (spaceUsers) => {
|
|
20
|
+
let userIds = _.pluck(spaceUsers, 'user');
|
|
21
|
+
let usersCollection = await getCollection('users');
|
|
22
|
+
return await usersCollection.find({
|
|
23
|
+
_id: {
|
|
24
|
+
$in: userIds
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
fields: {
|
|
28
|
+
'photo': 1,
|
|
29
|
+
'google_id': 1,
|
|
30
|
+
'imo_uid': 1,
|
|
31
|
+
'company': 1,
|
|
32
|
+
'name': 1,
|
|
33
|
+
'locale': 1,
|
|
34
|
+
'steedos_id': 1,
|
|
35
|
+
'primary_email_verified': 1,
|
|
36
|
+
'is_paid_user': 1,
|
|
37
|
+
'mobile': 1,
|
|
38
|
+
'email': 1,
|
|
39
|
+
'created': 1,
|
|
40
|
+
'modified': 1,
|
|
41
|
+
'created_by': 1,
|
|
42
|
+
'modified_by': 1,
|
|
43
|
+
'email_notification': 1,
|
|
44
|
+
'qq_open_id': 1
|
|
45
|
+
}
|
|
46
|
+
}).toArray();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let flowsFilters = filters;
|
|
50
|
+
if (flowId) {
|
|
51
|
+
flowsFilters = `(${flowsFilters}) and (_id eq '${flowId}')`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const flowsPromise = getObject('flows').find({
|
|
55
|
+
filters: flowsFilters,
|
|
55
56
|
fields: ['name', 'name_formula', 'code_formula', 'space', 'description', 'is_valid', 'form', 'flowtype', 'state', 'is_deleted', 'created', 'created_by', 'help_text', 'current_no', 'current', 'perms', 'error_message', 'app', 'distribute_optional_users', 'company_id']
|
|
56
57
|
})
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
let formsPromise;
|
|
60
|
+
if (flowId) {
|
|
61
|
+
formsPromise = flowsPromise.then(async (flows) => {
|
|
62
|
+
let formsFilters = filters;
|
|
63
|
+
if (flows.length > 0) {
|
|
64
|
+
const formIds = _.pluck(flows, 'form');
|
|
65
|
+
if (formIds && formIds.length > 0) {
|
|
66
|
+
formsFilters = `(${formsFilters}) and (_id eq '${formIds[0]}')`
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
formsFilters = `(1 eq 0)`
|
|
70
|
+
}
|
|
71
|
+
return await getObject('forms').find({
|
|
72
|
+
filters: formsFilters,
|
|
73
|
+
fields: ['name', 'state', 'is_deleted', 'is_valid', 'space', 'description', 'help_text', 'created', 'created_by', 'error_message', 'current', 'enable_workflow', 'enable_view_others', 'app', 'category', 'is_subform', 'instance_style', 'company_id']
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
} else {
|
|
77
|
+
formsPromise = getObject('forms').find({
|
|
78
|
+
filters: filters,
|
|
79
|
+
fields: ['name', 'state', 'is_deleted', 'is_valid', 'space', 'description', 'help_text', 'created', 'created_by', 'error_message', 'current', 'enable_workflow', 'enable_view_others', 'app', 'category', 'is_subform', 'instance_style', 'company_id']
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const rolesPromise = getObject('flow_roles').find({
|
|
58
84
|
filters: filters
|
|
59
85
|
});
|
|
60
|
-
|
|
86
|
+
const organizationsPromise = getObject('organizations').find({
|
|
61
87
|
filters: spaceFilters
|
|
62
88
|
});
|
|
63
|
-
|
|
89
|
+
const positionsPromise = getObject('flow_positions').find({
|
|
64
90
|
filters: filters
|
|
65
91
|
});
|
|
66
|
-
|
|
92
|
+
const categoriesPromise = getObject('categories').find({
|
|
67
93
|
filters: _makeInFilters('space', spaceIds)
|
|
68
94
|
});
|
|
69
95
|
|
|
70
|
-
|
|
96
|
+
const hrRolesPromise = getObject('roles').find({
|
|
71
97
|
filters: filters
|
|
72
98
|
})
|
|
73
99
|
|
|
100
|
+
let [spaceUsers, users, forms, flows, organizations, positions, roles, categories, hrRoles] = await Promise.all([
|
|
101
|
+
spaceUsersPromise,
|
|
102
|
+
usersPromise,
|
|
103
|
+
formsPromise,
|
|
104
|
+
flowsPromise,
|
|
105
|
+
organizationsPromise,
|
|
106
|
+
positionsPromise,
|
|
107
|
+
rolesPromise,
|
|
108
|
+
categoriesPromise,
|
|
109
|
+
hrRolesPromise
|
|
110
|
+
]);
|
|
111
|
+
|
|
74
112
|
if (_.isArray(roles)) {
|
|
75
|
-
|
|
113
|
+
await Promise.all(roles.map(async (role) => {
|
|
76
114
|
if (role && role.company_id) {
|
|
77
115
|
let company = await getObject('company').findOne(role.company_id, { fields: ['name'] }) //, 'abbreviation'
|
|
78
116
|
if (company && (company.name || company.abbreviation)) {
|
|
79
117
|
role.name = `${role.name} (${company.abbreviation || company.name})`
|
|
80
118
|
}
|
|
81
119
|
}
|
|
82
|
-
}
|
|
120
|
+
}))
|
|
83
121
|
}
|
|
84
122
|
|
|
85
123
|
return {
|