@steedos-labs/plugin-workflow 3.0.1-beta.1 → 3.0.1-beta.3
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/client/instance.client.js +1 -1
- package/main/default/manager/uuflow_manager.js +3 -1
- package/main/default/objects/instance_tasks/instance_tasks.object.yml +1 -0
- package/main/default/objects/instances/buttons/instance_new.button.yml +11 -4
- package/main/default/objects/instances/instances.object.yml +1 -0
- package/main/default/pages/instance_detail.page.amis.json +2 -2
- package/main/default/pages/instance_tasks_detail.page.amis.json +5 -29
- package/main/default/pages/instance_tasks_list.page.amis.json +1 -1
- package/main/default/routes/amis_form_design.ejs +67 -26
- package/main/default/routes/api_workflow_nav.router.js +16 -16
- package/main/default/routes/api_workflow_next_step_users.router.js +1 -1
- package/main/default/routes/flow_form_design.ejs +57 -18
- package/package.json +1 -1
|
@@ -69,7 +69,7 @@ window.SteedosWorkflow.InstanceTask = {
|
|
|
69
69
|
}
|
|
70
70
|
],
|
|
71
71
|
"listName": "inbox",
|
|
72
|
-
"rowClassNameExpr": "<%=(data.is_read === false && (!data.clientIds || data.clientIds.length == 0 || !data.clientIds.includes(data._id))) ? 'unread-instance' : '' %>",
|
|
72
|
+
"rowClassNameExpr": "<%=(data.is_read === false && (!data.clientIds || data.clientIds.length == 0 || !data.clientIds.includes(data._id))) ? 'unread-instance steedos-record-tr steedos-record-tr-'+data._id : 'steedos-record-tr steedos-record-tr-'+data._id %>",
|
|
73
73
|
"crudDataFilter": crudDataFilter
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -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
|
};
|
|
@@ -51,15 +51,22 @@ amis_schema: |-
|
|
|
51
51
|
},
|
|
52
52
|
"actionType": "ajax"
|
|
53
53
|
},
|
|
54
|
-
{
|
|
55
|
-
"actionType": "custom",
|
|
56
|
-
"script": "\nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);if(window.Meteor && false){\ndoAction({\n actionType: 'link',\n args: {\n blank: false,\n url: `/workflow/space/${instance.space}/draft/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n return ;}\ndoAction({\n actionType: 'link',\n args: {\n blank: false,\n link: `/app/${appId}/${objectName}/view/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n"
|
|
57
|
-
},
|
|
58
54
|
{
|
|
59
55
|
"componentId": "",
|
|
60
56
|
"args": {
|
|
61
57
|
},
|
|
62
58
|
"actionType": "closeDrawer"
|
|
59
|
+
}
|
|
60
|
+
,
|
|
61
|
+
{
|
|
62
|
+
"actionType": "custom",
|
|
63
|
+
"script": "window.$('.list-view-btn-reload').click(); \nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);if(window.Meteor && false){\ndoAction({\n actionType: 'link',\n args: {\n blank: false,\n url: `/workflow/space/${instance.space}/draft/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n return ;}\ndoAction({\n actionType: 'link',\n args: {\n blank: false,\n link: `/app/${appId}/${objectName}/view/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n;"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"actionType": "wait",
|
|
67
|
+
"args": {
|
|
68
|
+
"time": 2000
|
|
69
|
+
}
|
|
63
70
|
},
|
|
64
71
|
{
|
|
65
72
|
"actionType": "broadcast",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"id": "u:d6db0c84f150",
|
|
110
110
|
"schemaApi": {
|
|
111
111
|
"method": "get",
|
|
112
|
-
"url": "/api/health_check",
|
|
113
|
-
"adaptor": "
|
|
112
|
+
"url": "/api/health_check?trace=${recordId}",
|
|
113
|
+
"adaptor": "const result = {data: {'type':'wrapper','className':'p-0 h-full','body':[{'type':'steedos-instance-detail','id':'u:40052b3812c1','label':'Instance Detail','instanceId':context.recordId,'boxName':context.side_listview_id}],'id':'u:829a40757f0a'}};console.log('result===>', result); return result;"
|
|
114
114
|
},
|
|
115
115
|
"body": {},
|
|
116
116
|
"className": "h-full",
|
|
@@ -95,26 +95,10 @@
|
|
|
95
95
|
{
|
|
96
96
|
"type": "service",
|
|
97
97
|
"id": "u:d6db0c84f150",
|
|
98
|
-
"body":
|
|
99
|
-
{
|
|
100
|
-
"type": "wrapper",
|
|
101
|
-
"className": "p-0 h-full",
|
|
102
|
-
"body": [
|
|
103
|
-
{
|
|
104
|
-
"type": "steedos-instance-detail",
|
|
105
|
-
"label": "Instance Detail",
|
|
106
|
-
"id": "u:40052b3812c1",
|
|
107
|
-
"instanceId": "${instanceId}",
|
|
108
|
-
"boxName": "${boxName}",
|
|
109
|
-
"hiddenOn": "!!!this.instanceId"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"id": "u:dc5cb678096b"
|
|
113
|
-
}
|
|
114
|
-
],
|
|
98
|
+
"body": {},
|
|
115
99
|
"messages": {
|
|
116
100
|
},
|
|
117
|
-
"
|
|
101
|
+
"schemaApi": {
|
|
118
102
|
"url": "${context.rootUrl}/graphql?recordId=${recordId}",
|
|
119
103
|
"method": "post",
|
|
120
104
|
"messages": {
|
|
@@ -124,10 +108,10 @@
|
|
|
124
108
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
125
109
|
},
|
|
126
110
|
"requestAdaptor": "\nconst { recordId } = api.body;\napi.data = {\n query: `{instance_task:instance_tasks__findOne(id: \"${recordId}\"){_id,instance,is_read}}`\n};\n\nreturn api;",
|
|
127
|
-
"adaptor": "\nlet boxName = api.body.side_listview_id === 'inbox' ? 'inbox' : 'outbox';\npayload.data = {\n instanceId: payload.data.instance_task.instance,\n boxName: boxName,\n isRead: payload.data.instance_task.is_read\n}\n; console.log('=======>payload===>', payload); \
|
|
111
|
+
"adaptor": "\nlet boxName = api.body.side_listview_id === 'inbox' ? 'inbox' : 'outbox';\npayload.data = {\n instanceId: payload.data.instance_task.instance,\n boxName: boxName,\n isRead: payload.data.instance_task.is_read\n}\n; console.log('=======>payload===>', payload); \n const result = {data: {'type':'wrapper','className':'p-0 h-full','body':[{'type':'steedos-instance-detail','id':'u:40052b3812c1','label':'Instance Detail','instanceId':payload.data.instanceId,'boxName':context.side_listview_id}],'id':'u:829a40757f0a'}};console.log('result===>', result); return result;"
|
|
128
112
|
},
|
|
129
113
|
"onEvent": {
|
|
130
|
-
"
|
|
114
|
+
"fetchSchemaInited": {
|
|
131
115
|
"actions": [
|
|
132
116
|
{
|
|
133
117
|
"actionType": "ajax",
|
|
@@ -135,7 +119,7 @@
|
|
|
135
119
|
"url": "${context.rootUrl}/api/workflow/v2/set_have_read",
|
|
136
120
|
"method": "post",
|
|
137
121
|
"requestAdaptor": "api.data={instanceTaskId: context.recordId, isRead: context.isRead}\n\n\nreturn api;",
|
|
138
|
-
"adaptor": "
|
|
122
|
+
"adaptor": "if(payload.success){$('.steedos-record-tr-'+context.recordId).removeClass('unread-instance')}; return {data: {...payload}, status: 0};"
|
|
139
123
|
},
|
|
140
124
|
"expression": "${!event.data.isRead}"
|
|
141
125
|
}
|
|
@@ -152,14 +136,6 @@
|
|
|
152
136
|
"body"
|
|
153
137
|
],
|
|
154
138
|
"data": {
|
|
155
|
-
"objectName": "instance_tasks",
|
|
156
|
-
"recordId": "5f032f591d4951790b84f3a0",
|
|
157
|
-
"context": {
|
|
158
|
-
"rootUrl": "http://127.0.0.1:5000",
|
|
159
|
-
"tenantId": "644484b7aff6100247b3e6cf",
|
|
160
|
-
"userId": "6c017281-b966-49fe-aa2b-f09b835feed7",
|
|
161
|
-
"authToken": "ec7b993f86f01162b471f17d9063241beb7c57987a45d40f911e40269ca2e21b8f806cba87de7be1a07c41"
|
|
162
|
-
}
|
|
163
139
|
},
|
|
164
140
|
"className": "steedos-instance-wrapper",
|
|
165
141
|
"id": "u:d37465183f56",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
}
|
|
190
190
|
],
|
|
191
191
|
"listName": "inbox",
|
|
192
|
-
"rowClassNameExpr": "<%=(data.is_read === false && (!data.clientIds || data.clientIds.length == 0 || !data.clientIds.includes(data._id))) ? 'unread-instance' : '' %>",
|
|
192
|
+
"rowClassNameExpr": "<%=(data.is_read === false && (!data.clientIds || data.clientIds.length == 0 || !data.clientIds.includes(data._id))) ? 'unread-instance steedos-record-tr steedos-record-tr-'+data._id : 'steedos-record-tr steedos-record-tr-'+data._id %>",
|
|
193
193
|
"rebuildOn": "\\${flowId || categoryId}",
|
|
194
194
|
"adaptor": "const isSearch = _.some(_.keys(api.body.self), key => key.includes('__keywords') || key.includes('__searchable__'));\nif(payload.data.count==0 && !isSearch){\n const searchParams = new URLSearchParams(window.location.search);\n const flowId = searchParams.get(\"flowId\");\n const categoryId = searchParams.get(\"categoryId\");\n const pathname = window.location.pathname;\n if(flowId || categoryId){\n window.FlowRouter.go(pathname + \"?additionalFilters=&flowId=&categoryId=\");\n }\n // if(flowId) {\n // window.FlowRouter.go(pathname + \"?additionalFilters=['category','=','\" + categoryId +\"']&flowId=&categoryId=\" + categoryId);\n // }else if(categoryId) {\n // window.FlowRouter.go(pathname + \"?additionalFilters=&flowId=&categoryId=\");\n // }\n};\nif (api.body.self.listName == \"inbox\") {\n _.each(payload.data.rows, function (item, index) {\n if (item.type == 'cc') {\n item.instance_name += '(传阅)';\n }\n if (item.instance__expand.values) {\n const form_fields = api.body.self.form_fields;\n _.each(item.instance__expand.values, function (field, field_code) {\n const form_field = _.find(form_fields, { code: field_code });\n if (form_field && form_field.type == \"group\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'fullname').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.fullname : \"\";\n }\n } else if (form_field && form_field.type == \"user\") {\n if (form_field.is_multiselect) {\n item.instance__expand.values[field_code] = field && field.length > 0 ? _.map(field, 'name').toString() : \"\";\n } else {\n item.instance__expand.values[field_code] = field ? field.name : \"\";\n }\n }\n })\n }\n })\n}\n"
|
|
195
195
|
},
|
|
@@ -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":
|
|
@@ -62,10 +62,10 @@ const getCategoriesInbox = async (userSession, req, currentUrl) => {
|
|
|
62
62
|
let categoryBadge = 0;
|
|
63
63
|
const flowGroups = lodash.groupBy(v, 'flow_name');
|
|
64
64
|
const flows = [];
|
|
65
|
-
const categoryValue = `/app/${appId}/instance_tasks/
|
|
65
|
+
const categoryValue = `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=inbox&additionalFilters=['category','=',${v[0].category?"'" + v[0].category + "'":v[0].category}]&flowId=&categoryId=${v[0].category}`;
|
|
66
66
|
let categoryIsUnfolded = false;
|
|
67
67
|
lodash.each(flowGroups, (v2, k2)=>{
|
|
68
|
-
const flowValue = `/app/${appId}/instance_tasks/
|
|
68
|
+
const flowValue = `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=inbox&additionalFilters=['flow','=','${v2[0].flow}']&flowId=${v2[0].flow}&categoryId=${v[0].category}`;
|
|
69
69
|
let flowIsUnfolded = false;
|
|
70
70
|
if(currentUrl == flowValue){
|
|
71
71
|
flowIsUnfolded = true;
|
|
@@ -182,10 +182,10 @@ const getCategoriesMonitor = async (userSession, req, currentUrl) => {
|
|
|
182
182
|
lodash.each(categoryGroups, (v, k) => {
|
|
183
183
|
const flowGroups = lodash.groupBy(v, 'name');
|
|
184
184
|
const flows = [];
|
|
185
|
-
const categoryValue = `/app/${appId}/instances/
|
|
185
|
+
const categoryValue = `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=['category','=',${v[0].category__expand?"'" + v[0].category__expand._id + "'":null}]&flowId=&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
|
|
186
186
|
let categoryIsUnfolded = false;
|
|
187
187
|
lodash.each(flowGroups, (v2, k2) => {
|
|
188
|
-
const flowValue = `/app/${appId}/instances/
|
|
188
|
+
const flowValue = `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=['flow','=','${v2[0]._id}']&flowId=${v2[0]._id}&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
|
|
189
189
|
let flowIsUnfolded = false;
|
|
190
190
|
if(currentUrl == flowValue){
|
|
191
191
|
flowIsUnfolded = true;
|
|
@@ -253,18 +253,18 @@ router.get('/api/:appId/workflow/nav', requireAuthentication, async function (re
|
|
|
253
253
|
"tag":inboxResult.count,
|
|
254
254
|
"options":{
|
|
255
255
|
"level":1,
|
|
256
|
-
"to": `/app/${appId}/instance_tasks/
|
|
256
|
+
"to": `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=inbox&additionalFilters=&flowId=&categoryId=`
|
|
257
257
|
},
|
|
258
|
-
"value": `/app/${appId}/instance_tasks/
|
|
258
|
+
"value": `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=inbox&additionalFilters=&flowId=&categoryId=`,
|
|
259
259
|
"children": inboxResult.schema
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
262
|
"label": t('outbox', {}, userSession.language),
|
|
263
263
|
"options":{
|
|
264
264
|
"level":1,
|
|
265
|
-
"to": `/app/${appId}/instance_tasks/
|
|
265
|
+
"to": `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=outbox&additionalFilters=&flowId=&categoryId=`
|
|
266
266
|
},
|
|
267
|
-
"value": `/app/${appId}/instance_tasks/
|
|
267
|
+
"value": `/app/${appId}/instance_tasks/view/none?side_object=instance_tasks&side_listview_id=outbox&additionalFilters=&flowId=&categoryId=`,
|
|
268
268
|
"icon": "fa fa-check"
|
|
269
269
|
},
|
|
270
270
|
{
|
|
@@ -272,9 +272,9 @@ router.get('/api/:appId/workflow/nav', requireAuthentication, async function (re
|
|
|
272
272
|
"icon": "fa fa-eye",
|
|
273
273
|
"options":{
|
|
274
274
|
"level":1,
|
|
275
|
-
"to": `/app/${appId}/instances/
|
|
275
|
+
"to": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=&flowId=&categoryId=`,
|
|
276
276
|
},
|
|
277
|
-
"value": `/app/${appId}/instances/
|
|
277
|
+
"value": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=&flowId=&categoryId=`,
|
|
278
278
|
"children": monitorResult.schema,
|
|
279
279
|
"unfolded": monitorResult.monitorIsUnfolded,
|
|
280
280
|
"visible": monitorResult.hasFlowsPer
|
|
@@ -291,9 +291,9 @@ router.get('/api/:appId/workflow/nav', requireAuthentication, async function (re
|
|
|
291
291
|
"label": t('draft', {}, userSession.language),
|
|
292
292
|
"options":{
|
|
293
293
|
"level":1,
|
|
294
|
-
"to": `/app/${appId}/instances/
|
|
294
|
+
"to": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=`
|
|
295
295
|
},
|
|
296
|
-
"value": `/app/${appId}/instances/
|
|
296
|
+
"value": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=`,
|
|
297
297
|
"icon": "fa fa-pencil",
|
|
298
298
|
"tag": draftCount
|
|
299
299
|
},
|
|
@@ -301,18 +301,18 @@ router.get('/api/:appId/workflow/nav', requireAuthentication, async function (re
|
|
|
301
301
|
"label": t('pending', {}, userSession.language),
|
|
302
302
|
"options":{
|
|
303
303
|
"level":1,
|
|
304
|
-
"to": `/app/${appId}/instances/
|
|
304
|
+
"to": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=pending&additionalFilters=&flowId=&categoryId=`,
|
|
305
305
|
},
|
|
306
|
-
"value": `/app/${appId}/instances/
|
|
306
|
+
"value": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=pending&additionalFilters=&flowId=&categoryId=`,
|
|
307
307
|
"icon": "fa fa-circle"
|
|
308
308
|
},
|
|
309
309
|
{
|
|
310
310
|
"label": t('completed', {}, userSession.language),
|
|
311
311
|
"options":{
|
|
312
312
|
"level":1,
|
|
313
|
-
"to": `/app/${appId}/instances/
|
|
313
|
+
"to": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=completed&additionalFilters=&flowId=&categoryId=`,
|
|
314
314
|
},
|
|
315
|
-
"value": `/app/${appId}/instances/
|
|
315
|
+
"value": `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=completed&additionalFilters=&flowId=&categoryId=`,
|
|
316
316
|
"icon": "fa fa-check-square"
|
|
317
317
|
}
|
|
318
318
|
]
|
|
@@ -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":
|