@steedos-labs/plugin-workflow 3.0.1-beta.1 → 3.0.1-beta.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.
|
@@ -607,6 +607,8 @@ UUFlowManager.calculateConditionWithAmis = function (values, condition_str) {
|
|
|
607
607
|
UUFlowManager.calculateCondition = function (values, condition_str) {
|
|
608
608
|
try {
|
|
609
609
|
const __values = values;
|
|
610
|
+
|
|
611
|
+
condition_str = condition_str.replace(/\=/g, "==").replace(/\>==/g, ">=").replace(/\<==/g, "<=").replace(/\======/g, "===").replace(/\====/g, "==");
|
|
610
612
|
|
|
611
613
|
// Helper functions for condition calculation
|
|
612
614
|
const sum = (subform_field) => {
|
|
@@ -666,7 +668,7 @@ UUFlowManager.calculateCondition = function (values, condition_str) {
|
|
|
666
668
|
|
|
667
669
|
return eval(condition_str);
|
|
668
670
|
} catch (error) {
|
|
669
|
-
console.error(error.stack);
|
|
671
|
+
console.error(error.stack, condition_str);
|
|
670
672
|
return false;
|
|
671
673
|
}
|
|
672
674
|
};
|
|
@@ -31,6 +31,22 @@
|
|
|
31
31
|
|
|
32
32
|
let comp = document.querySelector("builder-fiddle");
|
|
33
33
|
|
|
34
|
+
const getArgumentsList = (func)=>{
|
|
35
|
+
let funcString;
|
|
36
|
+
if (typeof func === 'function') {
|
|
37
|
+
funcString = func.toString();
|
|
38
|
+
} else {
|
|
39
|
+
funcString = func;
|
|
40
|
+
}
|
|
41
|
+
const regExp = /function\s*\w*\(([\s\S]*?)\)/;
|
|
42
|
+
if (regExp.test(funcString)) {
|
|
43
|
+
const argList = RegExp.$1.split(',');
|
|
44
|
+
return argList.map(arg => arg.replace(/\s/g, ''));
|
|
45
|
+
} else {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
34
50
|
const loadPage = async () => {
|
|
35
51
|
//settings结果集同样加入formId
|
|
36
52
|
const { assetUrls, rootUrl, userId, tenantId, authToken, id, formId } = settings;
|
|
@@ -182,6 +198,7 @@
|
|
|
182
198
|
break;
|
|
183
199
|
case "number":
|
|
184
200
|
tpl.type = "input-number";
|
|
201
|
+
tpl.precision=2
|
|
185
202
|
break;
|
|
186
203
|
case "date":
|
|
187
204
|
tpl.type = "input-date";
|
|
@@ -279,22 +296,22 @@
|
|
|
279
296
|
tpl.options = getSelectOptions(field);
|
|
280
297
|
break;
|
|
281
298
|
case "odata":
|
|
282
|
-
|
|
299
|
+
const argsName = getArgumentsList(field.filters);
|
|
283
300
|
var labelField = field.formula.substr(1, field.formula.length - 2);
|
|
284
301
|
labelField = labelField.substr(labelField.indexOf(".") + 1);
|
|
285
302
|
// 加入odata标签以示区别 把field-老表单设计器的元素加入
|
|
286
303
|
tpl.type = "select";
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
tpl.description = field.description
|
|
305
|
+
tpl.detail_url = field.detail_url
|
|
306
|
+
tpl.filters = field.filters
|
|
307
|
+
tpl.formula = field.formula
|
|
308
|
+
tpl.is_list_display = field.is_list_display
|
|
309
|
+
tpl.is_multiselect = field.is_multiselect
|
|
310
|
+
tpl.is_required = field.is_required
|
|
311
|
+
tpl.is_searchable = field.is_searchable
|
|
312
|
+
tpl.is_wide = field.is_wide
|
|
313
|
+
tpl.search_field = field.search_field
|
|
314
|
+
tpl._id = field._id
|
|
298
315
|
// tpl.labelField = labelField;
|
|
299
316
|
// tpl.valueField = "_value";
|
|
300
317
|
tpl.source = {
|
|
@@ -308,21 +325,45 @@
|
|
|
308
325
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
309
326
|
},
|
|
310
327
|
adaptor: `
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
328
|
+
payload.data = {
|
|
329
|
+
options: _.map(payload.value, (item)=>{
|
|
330
|
+
const value = item;
|
|
331
|
+
item["@label"] = item["${labelField}"]
|
|
332
|
+
delete item['@odata.editLink'];
|
|
333
|
+
delete item['@odata.etag'];
|
|
334
|
+
delete item['@odata.id'];
|
|
335
|
+
return {
|
|
336
|
+
label: item["@label"],
|
|
337
|
+
value: value
|
|
338
|
+
}
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
return payload;
|
|
342
|
+
`,
|
|
343
|
+
requestAdaptor: `
|
|
344
|
+
const filters = ${_.replace(field.filters, /_.pluck/g, '_.map')};
|
|
345
|
+
const url = ${field.url}
|
|
346
|
+
if(filters){
|
|
347
|
+
console.log('filters', filters);
|
|
348
|
+
const joinKey = field.url.indexOf('?') > 0 ? '&' : '?';
|
|
349
|
+
if(filters.startsWith('function(') || filters.startsWith('function (')){
|
|
350
|
+
const argsName = ${JSON.stringify(argsName)};
|
|
351
|
+
const fun = eval('_fun='+filters);
|
|
352
|
+
const funArgs = [];
|
|
353
|
+
for(const item of argsName){
|
|
354
|
+
funArgs.push(context[item])
|
|
355
|
+
}
|
|
356
|
+
api.url = url + joinKey + "$filter=" + fun.apply({}, funArgs)
|
|
357
|
+
}else{
|
|
358
|
+
api.url = url + joinKey + "$filter=" + filters
|
|
321
359
|
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
360
|
+
}else{
|
|
361
|
+
api.url = url
|
|
362
|
+
}
|
|
363
|
+
api.query = {};
|
|
364
|
+
return api;
|
|
365
|
+
`,
|
|
366
|
+
trackExpression: _.join(_.map(argsName, (item)=>{return `\${${item}|json}`}), '-')
|
|
326
367
|
};
|
|
327
368
|
break;
|
|
328
369
|
case "html":
|
|
@@ -194,7 +194,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
194
194
|
|
|
195
195
|
let nextUserIds = _.map(finalNextStepUsers, 'id');
|
|
196
196
|
await excuteTriggers({ when: 'cacluateNextStepUsers', userId: userId, flowId: instance.flow, insId: insId, nextStep: nextStep, nextUserIds });
|
|
197
|
-
let nextUsersDocs = await objectql.getObject('space_users').find({ filters: [ ['user', 'in', nextUserIds] ], fields: ['name','user'] });
|
|
197
|
+
let nextUsersDocs = await objectql.getObject('space_users').find({ filters: [ ['space', '=', spaceId], ['user', 'in', nextUserIds] ], fields: ['name','user'] });
|
|
198
198
|
let newNextUsers = [];
|
|
199
199
|
for(const doc of nextUsersDocs) {
|
|
200
200
|
newNextUsers.push({
|
|
@@ -72,6 +72,22 @@
|
|
|
72
72
|
deployText: "<%=locale%>" === 'zh-CN' ? '发布': 'Deploy',
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const getArgumentsList = (func)=>{
|
|
76
|
+
let funcString;
|
|
77
|
+
if (typeof func === 'function') {
|
|
78
|
+
funcString = func.toString();
|
|
79
|
+
} else {
|
|
80
|
+
funcString = func;
|
|
81
|
+
}
|
|
82
|
+
const regExp = /function\s*\w*\(([\s\S]*?)\)/;
|
|
83
|
+
if (regExp.test(funcString)) {
|
|
84
|
+
const argList = RegExp.$1.split(',');
|
|
85
|
+
return argList.map(arg => arg.replace(/\s/g, ''));
|
|
86
|
+
} else {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
let comp = document.querySelector("builder-fiddle");
|
|
76
92
|
|
|
77
93
|
// set the modal menu element
|
|
@@ -283,6 +299,7 @@
|
|
|
283
299
|
break;
|
|
284
300
|
case "number":
|
|
285
301
|
tpl.type = "input-number";
|
|
302
|
+
tpl.precision=2
|
|
286
303
|
break;
|
|
287
304
|
case "date":
|
|
288
305
|
tpl.type = "input-date";
|
|
@@ -380,7 +397,7 @@
|
|
|
380
397
|
tpl.options = getSelectOptions(field);
|
|
381
398
|
break;
|
|
382
399
|
case "odata":
|
|
383
|
-
|
|
400
|
+
const argsName = getArgumentsList(field.filters);
|
|
384
401
|
var labelField = field.formula.substr(1, field.formula.length - 2);
|
|
385
402
|
labelField = labelField.substr(labelField.indexOf(".") + 1);
|
|
386
403
|
// 加入odata标签以示区别 把field-老表单设计器的元素加入
|
|
@@ -400,30 +417,52 @@
|
|
|
400
417
|
// tpl.valueField = "_value";
|
|
401
418
|
tpl.source = {
|
|
402
419
|
//判断该field.url是否为http开头
|
|
403
|
-
url:
|
|
404
|
-
? field.url
|
|
405
|
-
: `\${context.rootUrl}${field.url}`,
|
|
420
|
+
url: field.url,
|
|
406
421
|
method: "get",
|
|
407
422
|
dataType: "json",
|
|
408
423
|
headers: {
|
|
409
424
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
410
425
|
},
|
|
411
426
|
adaptor: `
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
427
|
+
payload.data = {
|
|
428
|
+
options: _.map(payload.value, (item)=>{
|
|
429
|
+
const value = item;
|
|
430
|
+
item["@label"] = item["${labelField}"]
|
|
431
|
+
delete item['@odata.editLink'];
|
|
432
|
+
delete item['@odata.etag'];
|
|
433
|
+
delete item['@odata.id'];
|
|
434
|
+
return {
|
|
435
|
+
label: item["@label"],
|
|
436
|
+
value: value
|
|
437
|
+
}
|
|
438
|
+
})
|
|
439
|
+
}
|
|
440
|
+
return payload;
|
|
441
|
+
`,
|
|
442
|
+
requestAdaptor: `
|
|
443
|
+
const filters = ${_.replace(field.filters, /_.pluck/g, '_.map')};
|
|
444
|
+
const url = ${field.url}
|
|
445
|
+
if(filters){
|
|
446
|
+
console.log('filters', filters);
|
|
447
|
+
const joinKey = field.url.indexOf('?') > 0 ? '&' : '?';
|
|
448
|
+
if(filters.startsWith('function(') || filters.startsWith('function (')){
|
|
449
|
+
const argsName = ${JSON.stringify(argsName)};
|
|
450
|
+
const fun = eval('_fun='+filters);
|
|
451
|
+
const funArgs = [];
|
|
452
|
+
for(const item of argsName){
|
|
453
|
+
funArgs.push(context[item])
|
|
454
|
+
}
|
|
455
|
+
api.url = url + joinKey + "$filter=" + fun.apply({}, funArgs)
|
|
456
|
+
}else{
|
|
457
|
+
api.url = url + joinKey + "$filter=" + filters
|
|
422
458
|
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
459
|
+
}else{
|
|
460
|
+
api.url = url
|
|
461
|
+
}
|
|
462
|
+
api.query = {};
|
|
463
|
+
return api;
|
|
464
|
+
`,
|
|
465
|
+
trackExpression: _.join(_.map(argsName, (item)=>{return `\${${item}|json}`}), '-')
|
|
427
466
|
};
|
|
428
467
|
break;
|
|
429
468
|
case "html":
|