@steedos-labs/plugin-workflow 3.0.1-beta.7 → 3.0.2
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/objects/instance_tasks/listviews/inbox.listview.yml +0 -1
- package/main/default/objects/instance_tasks/listviews/outbox.listview.yml +0 -1
- package/main/default/objects/instances/listviews/completed.listview.yml +0 -1
- package/main/default/objects/instances/listviews/draft.listview.yml +0 -1
- package/main/default/objects/instances/listviews/monitor.listview.yml +0 -1
- package/main/default/objects/instances/listviews/pending.listview.yml +0 -1
- package/main/default/pages/instance_tasks_list.page.amis.json +3 -3
- package/main/default/pages/instances_list.page.amis.json +3 -3
- package/main/default/routes/api_workflow_next_step.router.js +88 -0
- package/package.json +1 -1
- package/public/workflow/index.css +1 -2
|
@@ -19,7 +19,6 @@ mobile_columns:
|
|
|
19
19
|
filter_scope: space
|
|
20
20
|
filters: !!js/function |
|
|
21
21
|
function(filters, data){
|
|
22
|
-
console.log('inbox ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
23
22
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
24
23
|
type: 'get', async: false
|
|
25
24
|
});
|
|
@@ -18,7 +18,6 @@ mobile_columns:
|
|
|
18
18
|
filter_scope: space
|
|
19
19
|
filters: !!js/function |
|
|
20
20
|
function(filters, data){
|
|
21
|
-
console.log('outbox ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
22
21
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
23
22
|
type: 'get', async: false
|
|
24
23
|
});
|
|
@@ -18,7 +18,6 @@ mobile_columns:
|
|
|
18
18
|
filter_scope: space
|
|
19
19
|
filters: !!js/function |
|
|
20
20
|
function(filters, data){
|
|
21
|
-
console.log('completed ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
22
21
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
23
22
|
type: 'get', async: false
|
|
24
23
|
});
|
|
@@ -9,7 +9,6 @@ columns:
|
|
|
9
9
|
filter_scope: space
|
|
10
10
|
filters: !!js/function |
|
|
11
11
|
function(filters, data){
|
|
12
|
-
console.log('draft ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
13
12
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
14
13
|
type: 'get', async: false
|
|
15
14
|
});
|
|
@@ -18,7 +18,6 @@ mobile_columns:
|
|
|
18
18
|
filter_scope: space
|
|
19
19
|
filters: !!js/function |
|
|
20
20
|
function(filters, data){
|
|
21
|
-
console.log('monitor ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
22
21
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
23
22
|
type: 'get', async: false
|
|
24
23
|
});
|
|
@@ -18,7 +18,6 @@ mobile_columns:
|
|
|
18
18
|
filter_scope: space
|
|
19
19
|
filters: !!js/function |
|
|
20
20
|
function(filters, data){
|
|
21
|
-
console.log('pending ===filters ===> ',data, `/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`);
|
|
22
21
|
var result = Steedos.authRequest(`/api/workflow/v2/\${data.listName}/filter?app=\${data.appId}`, {
|
|
23
22
|
type: 'get', async: false
|
|
24
23
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{
|
|
14
14
|
"type": "wrapper",
|
|
15
15
|
"size": "none",
|
|
16
|
-
"className": "instances-sidebar-wrapper flex-shrink-0 min-w-[240px] overflow-y-auto
|
|
16
|
+
"className": "instances-sidebar-wrapper flex-shrink-0 min-w-[240px] overflow-y-auto m-0 lg:order-first lg:flex lg:flex-col bg-white border-r",
|
|
17
17
|
"body": [
|
|
18
18
|
{
|
|
19
19
|
"type": "service",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"type": "input-tree",
|
|
33
33
|
"name": "tree",
|
|
34
34
|
"treeContainerClassName": "h-full",
|
|
35
|
-
"className": "instance-box-tree
|
|
35
|
+
"className": "instance-box-tree h-full w-full p-0",
|
|
36
36
|
"stacked": true,
|
|
37
37
|
"multiple": false,
|
|
38
38
|
"enableNodePath": false,
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
{
|
|
156
156
|
"type": "wrapper",
|
|
157
157
|
"size": "none",
|
|
158
|
-
"className": "flex-1 focus:outline-none lg:order-last
|
|
158
|
+
"className": "flex-1 focus:outline-none lg:order-last",
|
|
159
159
|
"body": [
|
|
160
160
|
{
|
|
161
161
|
"type": "steedos-object-listview",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{
|
|
14
14
|
"type": "wrapper",
|
|
15
15
|
"size": "none",
|
|
16
|
-
"className": "instances-sidebar-wrapper flex-shrink-0 min-w-[240px] overflow-y-auto
|
|
16
|
+
"className": "instances-sidebar-wrapper flex-shrink-0 min-w-[240px] overflow-y-auto m-0 lg:order-first lg:flex lg:flex-col bg-white border-r",
|
|
17
17
|
"body": [
|
|
18
18
|
{
|
|
19
19
|
"type": "service",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"type": "input-tree",
|
|
34
34
|
"name": "tree",
|
|
35
35
|
"treeContainerClassName": "h-full",
|
|
36
|
-
"className": "instance-box-tree
|
|
36
|
+
"className": "instance-box-tree h-full w-full p-0",
|
|
37
37
|
"id": "u:9f3dd961ca12",
|
|
38
38
|
"stacked": true,
|
|
39
39
|
"multiple": false,
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
{
|
|
155
155
|
"type": "wrapper",
|
|
156
156
|
"size": "none",
|
|
157
|
-
"className": "flex-1 focus:outline-none lg:order-last
|
|
157
|
+
"className": "flex-1 focus:outline-none lg:order-last",
|
|
158
158
|
"body": [
|
|
159
159
|
{
|
|
160
160
|
"type": "steedos-object-listview",
|
|
@@ -215,4 +215,92 @@ router.post('/api/workflow/v2/nextStep', requireAuthentication, async function (
|
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
+
const calcSteps = async function(instance, flow, flowVersionId, formFields, values, step, track){
|
|
219
|
+
if (!step) {
|
|
220
|
+
step = getStep(flow, flowVersionId, instance.traces[0].step);
|
|
221
|
+
}
|
|
222
|
+
if (!track) {
|
|
223
|
+
track = []
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
var _steps = [];
|
|
227
|
+
var judge = 'approved';
|
|
228
|
+
|
|
229
|
+
_steps.push(step);
|
|
230
|
+
var nextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values);
|
|
231
|
+
for (const nextStep of nextSteps) {
|
|
232
|
+
try {
|
|
233
|
+
if (!_.includes(track, nextStep._id)) {
|
|
234
|
+
const __steps = await calcSteps(instance, flow, flowVersionId, formFields, values, nextStep, track.concat(_.map(_steps, '_id')));
|
|
235
|
+
_steps = _steps.concat(__steps)
|
|
236
|
+
}
|
|
237
|
+
} catch (e) {
|
|
238
|
+
console.log(e)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
_steps = _.compact(_.uniqBy(_steps, 'id'));
|
|
242
|
+
return _steps;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
router.post('/api/workflow/v2/nextSteps', requireAuthentication, async function (req, res) {
|
|
246
|
+
try {
|
|
247
|
+
const userSession = req.user;
|
|
248
|
+
const { instanceId, flowId, values, flowVersionId } = req.body;
|
|
249
|
+
const flow = await objectql.getObject('flows').findOne(flowId);
|
|
250
|
+
const instance = await objectql.getObject('instances').findOne(instanceId);
|
|
251
|
+
const form = await objectql.getObject('forms').findOne(instance.form);
|
|
252
|
+
const { fields } = await UUFlowManager.getFormVersion(form, instance.form_version);
|
|
253
|
+
const resNextSteps = await calcSteps(instance, flow, flowVersionId, fields, values);
|
|
254
|
+
res.status(200).send({
|
|
255
|
+
'nextSteps': resNextSteps
|
|
256
|
+
});
|
|
257
|
+
} catch (error) {
|
|
258
|
+
console.error(error);
|
|
259
|
+
res.status(200).send({
|
|
260
|
+
error: error.message
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
router.post('/api/workflow/v2/set_instance_steps', requireAuthentication, async function (req, res) {
|
|
266
|
+
try {
|
|
267
|
+
const userSession = req.user;
|
|
268
|
+
const { instanceId, stepId, selected, handler } = req.body;
|
|
269
|
+
if(instanceId === 'none'){
|
|
270
|
+
return res.status(200).send({ status: 0 });
|
|
271
|
+
}
|
|
272
|
+
const instance = await objectql.getObject('instances').findOne(instanceId);
|
|
273
|
+
if(!instance){
|
|
274
|
+
return res.status(200).send({
|
|
275
|
+
error: 'not find instance'
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
if(instance.state != 'draft'){
|
|
279
|
+
return res.status(200).send({
|
|
280
|
+
error: 'not allow'
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const doc = {
|
|
284
|
+
['step_approve.' + stepId]: handler
|
|
285
|
+
};
|
|
286
|
+
if(selected){
|
|
287
|
+
doc.$pull = {
|
|
288
|
+
skip_steps: stepId
|
|
289
|
+
}
|
|
290
|
+
}else{
|
|
291
|
+
doc.$push = {
|
|
292
|
+
skip_steps: stepId
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
await objectql.getObject('instances').update(instanceId, doc);
|
|
296
|
+
|
|
297
|
+
return res.status(200).send({ status: 0 });
|
|
298
|
+
} catch (error) {
|
|
299
|
+
console.error(error);
|
|
300
|
+
res.status(200).send({
|
|
301
|
+
error: error.message
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
|
|
218
306
|
exports.default = router;
|
package/package.json
CHANGED
|
@@ -374,10 +374,9 @@ tbody .color-priority-muted *{
|
|
|
374
374
|
|
|
375
375
|
.instances-sidebar-wrapper{
|
|
376
376
|
overflow-y: auto;
|
|
377
|
-
height: calc(100vh -
|
|
377
|
+
height: calc(100vh - 50px);
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
|
|
381
380
|
.steedos-instance-related-view-wrapper{
|
|
382
381
|
.antd-Page-header{
|
|
383
382
|
display: none;
|