@steedos-labs/plugin-workflow 3.0.0-beta.30 → 3.0.0-beta.31

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.
@@ -45,7 +45,7 @@ window.SteedosWorkflow.InstanceTask = {
45
45
  "showHeader": true,
46
46
  "id": "u:d29cef0d1007",
47
47
  "showDisplayAs": true,
48
- "className": "h-full w-full bg-white instance-tasks-list",
48
+ "className": "h-full w-full instance-tasks-list",
49
49
  "hiddenColumnOperation": true,
50
50
  "formFactor": "LARGE",
51
51
  "headerToolbarItems": [
@@ -113,7 +113,7 @@ window.SteedosWorkflow.Instance = {
113
113
  "showHeader": true,
114
114
  "id": "u:d29cef0d1007",
115
115
  "showDisplayAs": true,
116
- "className": "h-full w-full bg-white",
116
+ "className": "h-full w-full",
117
117
  "hiddenColumnOperation": true,
118
118
  "formFactor": "LARGE",
119
119
  "headerToolbarItems": [
@@ -5,6 +5,8 @@ const { getObject } = objectql;
5
5
  const { t } = require('@steedos/i18n');
6
6
  const { map } = require('lodash');
7
7
 
8
+ const WebhookQueue = require('../../../src/webhook_queue')
9
+
8
10
  const uuflowManager = {
9
11
  getFlow: async function (flow_id, options = {}) {
10
12
  if (process.env.STEEDOS_DEBUG) {
@@ -613,6 +615,12 @@ pushManager.send_message_by_raix_push = async function (data, lang) {
613
615
  from: from,
614
616
  to: toUsers
615
617
  })
618
+
619
+ await objectql.getSteedosSchema().broker.emit('push.send', {
620
+ message: notificationDoc,
621
+ from: from,
622
+ to: toUsers
623
+ })
616
624
 
617
625
 
618
626
  // data["toUsers"].forEach(userId => {
@@ -854,7 +862,7 @@ pushManager.triggerWebhook = async function (flowId, instance, currentApprove, a
854
862
  cfsInstances: await getCollection('cfs.instances.filerecord')
855
863
  };
856
864
 
857
- instance.attachments = (await cfsInstances.find({ 'metadata.instance': instance._id }).toArray()) || [];
865
+ instance.attachments = (await db.cfsInstances.find({ 'metadata.instance': instance._id }).toArray()) || [];
858
866
 
859
867
  const fromUser = await db.users.findOne({ "_id": fromUserId }, { fields: { _id: 1, username: 1 } }) || {};
860
868
  const fromSpaceUser = await db.space_users.findOne({ "user": fromUserId }, { fields: { mobile: 1, email: 1 } }) || {};
@@ -880,12 +888,12 @@ pushManager.triggerWebhook = async function (flowId, instance, currentApprove, a
880
888
  for (const w of webhooks) {
881
889
  WebhookQueue.send({
882
890
  instance,
883
- currentApprove,
884
- payloadUrl: w.payload_url,
885
- contentType: w.content_type,
891
+ current_approve: currentApprove,
892
+ payload_url: w.payload_url,
893
+ content_type: w.content_type,
886
894
  action,
887
- fromUser,
888
- toUsers: toUsers || []
895
+ from_user: fromUser,
896
+ to_users: toUsers || []
889
897
  });
890
898
  }
891
899
  };
@@ -7,7 +7,7 @@ const {
7
7
  insert_instance_tasks,
8
8
  remove_instance_tasks,
9
9
  direct_remove_many_instance_tasks
10
- } = require('../manager').instance_tasks_manager
10
+ } = require('../manager/instance_tasks_manager')
11
11
 
12
12
  module.exports = {
13
13
  cc_do: async function (approve, cc_user_ids, description, ctx = {}) {
@@ -127,7 +127,7 @@ module.exports = {
127
127
  });
128
128
  // 新增记录
129
129
  for (const a of new_approves) {
130
- insert_instance_tasks(ins_id, trace_id, a._id)
130
+ await insert_instance_tasks(ins_id, trace_id, a._id)
131
131
  }
132
132
 
133
133
  const updatedInstance = await instancesCollection.findOne({ _id: ins_id });
@@ -12,7 +12,7 @@ amis_schema: |-
12
12
  "weight": 0,
13
13
  "actions": [
14
14
  {
15
- "script": "// SteedosUI.refs(\"flows-listview-undefined\")\n// debugger;\nconst ids = SteedosUI.getRef(event.data.$scopeId).parent.getComponentById(\"listview_flows\").props.store.selectedItems.toJSON();\n\nif (ids && ids.length > 0) {\n \n window.open(Steedos.absoluteUrl(\"/api/workflow/export/form?flows=\" + _.map(ids,\"_id\").join(',')), '_blank');\n \n} else {\n \n alert(t('flows.newexport.alert'))\n \n }\n\n\n",
15
+ "script": "// SteedosUI.refs(\"flows-listview-undefined\")\n debugger;\nconst ids = event.data._scoped.parent.getComponentById(\"listview_flows\").props.store.selectedItems.toJSON();\n\nif (ids && ids.length > 0) {\n \n window.open(Steedos.absoluteUrl(\"/api/workflow/export/form?flows=\" + _.map(ids,\"_id\").join(',')), '_blank');\n \n} else {\n \n alert(t('flows.newexport.alert'))\n \n }\n\n\n",
16
16
  "actionType": "custom"
17
17
  }
18
18
  ]
@@ -541,6 +541,7 @@ actions:
541
541
  "type": "button",
542
542
  "label": "${'flows.standard_new.new' | t}",
543
543
  "id": "u:new_flow",
544
+ "level": "primary",
544
545
  "onEvent": {
545
546
  "click": {
546
547
  "actions": [
@@ -26,7 +26,7 @@ amis_schema: |-
26
26
  "title": {
27
27
  "type": "tpl",
28
28
  "id": "u:0bce3c33b6e5",
29
- "tpl": "<p>${'CustomAction.instances.instance_distribute' | t}<a href=\"https://www.steedos.cn/docs/user/workflow#%E5%A6%82%E4%BD%95%E5%88%86%E5%8F%91\" target=\"_blank\" rel=\"noopener\"> ?&nbsp;</a></p>"
29
+ "tpl": "<p>${'CustomAction.instances.instance_distribute' | t}</p>"
30
30
  },
31
31
  "body": [
32
32
  {
@@ -298,7 +298,8 @@ amis_schema: |-
298
298
  ],
299
299
  "weight": 0
300
300
  }
301
- }
301
+ },
302
+ "hiddenOn": "!(record.box === 'inbox' && record.step.allowDistribute == true)"
302
303
  }
303
304
  ],
304
305
  "regions": [
@@ -17,7 +17,7 @@ amis_schema: |-
17
17
  "title": {
18
18
  "type": "tpl",
19
19
  "id": "u:4733f85da58b",
20
- "tpl": "<p>${'CustomAction.instances.instance_forward' | t}&nbsp;<a href=\"https://www.steedos.cn/docs/user/workflow#%E5%A6%82%E4%BD%95%E8%BD%AC%E5%8F%91\" target=\"_blank\" rel=\"noopener\">?</a></p>"
20
+ "tpl": "<p>${'CustomAction.instances.instance_forward' | t}</p>"
21
21
  },
22
22
  "body": [
23
23
  {
@@ -17,7 +17,7 @@ amis_schema: |-
17
17
  "type": "button",
18
18
  "label": "转签核",
19
19
  "id": "u:instance_reassign",
20
- "hiddenOn": "!(this.record.box === 'monitor' && this.record.state == 'pending' && this.flowPermissions.includes('admin'))",
20
+ "hiddenOn": "!(this.record.box === 'monitor' && this.record.state == 'pending' && this.record.flowPermissions.includes('admin'))",
21
21
  "onEvent": {
22
22
  "click": {
23
23
  "weight": 0,
@@ -104,20 +104,5 @@ amis_schema: |-
104
104
  }
105
105
  }
106
106
  ],
107
- "data": {
108
- "context": {
109
- "rootUrl": "http://127.0.0.1:5300",
110
- "tenantId": "63ed8fb288feeecd0165843d",
111
- "userId": "1852bcb9-a3cb-4d04-905b-1cd12e4cdb3b",
112
- "authToken": "4c6a0b7d705b6fcab7f09d08006e644e30a37d3b5e198a056e85d7383ced3f492a097a30b63ad8e42d1c08"
113
- },
114
- "app_id": "",
115
- "tab_id": "",
116
- "object_name": "",
117
- "dataComponentId": "",
118
- "record_id": "",
119
- "record": {},
120
- "permissions": {}
121
- },
122
107
  "id": "u:fbe25e9811ea"
123
108
  }
@@ -16,7 +16,7 @@ amis_schema: |-
16
16
  {
17
17
  "type": "button",
18
18
  "label": "${'CustomAction.instances.instance_relocate' | t}",
19
- "hiddenOn": "!(this.record.box === 'monitor' && this.record.state != 'draft' && this.flowPermissions.includes('admin'))",
19
+ "hiddenOn": "!(this.record.box === 'monitor' && this.record.state != 'draft' && this.record.flowPermissions.includes('admin'))",
20
20
  "onEvent": {
21
21
  "click": {
22
22
  "weight": 0,
@@ -1,7 +1,111 @@
1
1
  name: instance_retrieve
2
- is_enable: false
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "取回",
9
+ "id": "u:instance_retrieve",
10
+ "editorState": "default",
11
+ "onEvent": {
12
+ "click": {
13
+ "weight": 0,
14
+ "actions": [
15
+ {
16
+ "ignoreError": false,
17
+ "actionType": "dialog",
18
+ "dialog": {
19
+ "type": "dialog",
20
+ "title": "取回",
21
+ "body": [
22
+ {
23
+ "type": "input-text",
24
+ "label": "备注",
25
+ "name": "retrieve_comment",
26
+ "id": "u:c7fa318c8af1",
27
+ "editorState": "default"
28
+ }
29
+ ],
30
+ "id": "u:b05694926b78",
31
+ "actions": [
32
+ {
33
+ "type": "button",
34
+ "actionType": "cancel",
35
+ "label": "取消",
36
+ "id": "u:76960d34d658"
37
+ },
38
+ {
39
+ "type": "button",
40
+ "actionType": "confirm",
41
+ "label": "确定",
42
+ "primary": true,
43
+ "id": "u:907978324dc2",
44
+ "editorState": "default",
45
+ "onEvent": {
46
+ "click": {
47
+ "weight": 0,
48
+ "actions": [
49
+ {
50
+ "ignoreError": false,
51
+ "actionType": "ajax",
52
+ "outputVar": "responseResult",
53
+ "options": {},
54
+ "api": {
55
+ "url": "${context.rootUrl}/api/workflow/retrieve",
56
+ "method": "post",
57
+ "requestAdaptor": "debugger;\nconsole.log(\"api:\", api);\napi.data = {\n \"_id\": api.body.record._id,\n \"retrieve_comment\": api.body.retrieve_comment\n};\nreturn api;",
58
+ "adaptor": "console.log('payload', payload);\nreturn payload;",
59
+ "messages": {},
60
+ "headers": {
61
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
62
+ },
63
+ "data": {
64
+ "&": "$$",
65
+ "record": "${record}"
66
+ }
67
+ }
68
+ },
69
+ {
70
+ "actionType": "broadcast",
71
+ "args": {
72
+ "eventName": "@data.@instanceDetail.changed"
73
+ },
74
+ "data": {}
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ ],
81
+ "showCloseButton": true,
82
+ "closeOnOutside": false,
83
+ "closeOnEsc": false,
84
+ "showErrorMsg": true,
85
+ "showLoading": true,
86
+ "draggable": false,
87
+ "actionType": "dialog"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ "hiddenOn": "!(record.box === 'outbox' && record.state === 'pending')"
94
+ }
95
+ ],
96
+ "regions": [
97
+ "body"
98
+ ],
99
+ "data": {
100
+ },
101
+ "id": "u:5b9a5a685ac9",
102
+ "bodyClassName": "p-0",
103
+ "dsType": "api",
104
+ "definitions": {}
105
+ }
106
+ is_enable: true
3
107
  label: 取回
4
108
  'on': record_only
109
+ sort: 40
5
110
  type: amis_button
6
111
  visible: true
7
- sort: 40
@@ -39,7 +39,7 @@
39
39
  "hideRoot": true,
40
40
  "showIcon": true,
41
41
  "initiallyOpen": false,
42
- "value": "${CONCATENATE('/app/', appId, '/', objectName, '/grid/', listViewId, '?additionalFilters=', additionalFilters,'&flowId=',flowId,'&categoryId=',categoryId)}",
42
+ "value": "${value}",
43
43
  "size": "md",
44
44
  "onEvent": {
45
45
  "change": {
@@ -122,7 +122,8 @@
122
122
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
123
123
  },
124
124
  "messages": {},
125
- "trackExpression": "${_reloadKey}"
125
+ "trackExpression": "${_reloadKey}",
126
+ "adaptor": "payload.data.value = window.location.pathname + decodeURIComponent(window.location.search); return payload;"
126
127
  },
127
128
  "messages": {},
128
129
  "dsType": "api",
@@ -164,7 +165,7 @@
164
165
  "showHeader": true,
165
166
  "id": "u:d29cef0d1007",
166
167
  "showDisplayAs": true,
167
- "className": "h-full w-full bg-white instance-tasks-list",
168
+ "className": "h-full w-full instance-tasks-list",
168
169
  "hiddenColumnOperation": true,
169
170
  "formFactor": "LARGE",
170
171
  "headerToolbarItems": [
@@ -194,7 +195,7 @@
194
195
  },
195
196
  {
196
197
  "type": "service",
197
- "visibleOn": "${!!flowId}",
198
+ "visibleOn": "${!!flowId && listName == 'inbox'}",
198
199
  "schemaApi": {
199
200
  "url": "/graphql?flowId=${flowId}&categoryId=${categoryId}",
200
201
  "method": "post",
@@ -244,101 +245,7 @@
244
245
  "objectName": "instance_tasks",
245
246
  "initialValues": {},
246
247
  "title": "",
247
- "context": {
248
- "rootUrl": "http://127.0.0.1:5600",
249
- "tenantId": "68400b7542187738fb1bab2c",
250
- "userId": "68400b7042187738fb1bab2a",
251
- "authToken": "c317dc22e82ffecda1f13f09767a9242b3ee44363f2b4d19a436afea7994c8e2bdb72ff0426aae544ecc5c",
252
- "user": {
253
- "authToken": "c317dc22e82ffecda1f13f09767a9242b3ee44363f2b4d19a436afea7994c8e2bdb72ff0426aae544ecc5c",
254
- "spaceId": "68400b7542187738fb1bab2c",
255
- "userId": "68400b7042187738fb1bab2a",
256
- "name": "YLH1",
257
- "username": "yinlianghui",
258
- "email": "yinlianghui@hotoa.com",
259
- "utcOffset": null,
260
- "steedos_id": "68400b7042187738fb1bab2a",
261
- "locale": "en-us",
262
- "language": "en",
263
- "roles": [
264
- "admin"
265
- ],
266
- "profile": "admin",
267
- "user": "68400b7042187738fb1bab2a",
268
- "user_accepted": true,
269
- "organization": {
270
- "_id": "68400b7542187738fb1bab2c",
271
- "name": "TEW",
272
- "fullname": "TEW",
273
- "company_id": "68400b7542187738fb1bab2c"
274
- },
275
- "organizations": [
276
- {
277
- "_id": "68400b7542187738fb1bab2c",
278
- "name": "TEW",
279
- "fullname": "TEW",
280
- "company_id": "68400b7542187738fb1bab2c"
281
- },
282
- {
283
- "_id": "684784a17f4aeba0af86e0bb",
284
- "name": "生产部",
285
- "fullname": "生产部",
286
- "company_id": "68400b7542187738fb1bab2c"
287
- }
288
- ],
289
- "space": {
290
- "_id": "68400b7542187738fb1bab2c",
291
- "name": "TEW",
292
- "admins": [
293
- "68400b7042187738fb1bab2a",
294
- "686ccd4a33466ba7d2a1fce6",
295
- "686cc9f8b6409ed05d63c80d"
296
- ]
297
- },
298
- "owner": "68400b7042187738fb1bab2a",
299
- "created_by": "68400b7042187738fb1bab2a",
300
- "created": "2025-06-04T09:01:41.340Z",
301
- "modified_by": "68400b7042187738fb1bab2a",
302
- "modified": "2025-08-31T09:38:56.388Z",
303
- "email_verified": null,
304
- "company_id": "68400b7542187738fb1bab2c",
305
- "organizations_parents": [
306
- "68400b7542187738fb1bab2c",
307
- "684784a17f4aeba0af86e0bb"
308
- ],
309
- "company_ids": [
310
- "68400b7542187738fb1bab2c"
311
- ],
312
- "spaces": [
313
- {
314
- "_id": "68400b7542187738fb1bab2c",
315
- "name": "TEW",
316
- "admins": [
317
- "68400b7042187738fb1bab2a",
318
- "686ccd4a33466ba7d2a1fce6",
319
- "686cc9f8b6409ed05d63c80d"
320
- ]
321
- }
322
- ],
323
- "companies": [
324
- {
325
- "_id": "68400b7542187738fb1bab2c",
326
- "name": "TEW",
327
- "organization": "68400b7542187738fb1bab2c"
328
- }
329
- ],
330
- "company": {
331
- "_id": "68400b7542187738fb1bab2c",
332
- "name": "TEW",
333
- "organization": "68400b7542187738fb1bab2c"
334
- },
335
- "permission_shares": [],
336
- "spaceUserId": "68400b7542187738fb1bab2d",
337
- "is_space_admin": true,
338
- "is_phone": false,
339
- "is_tablet": false
340
- }
341
- }
248
+ "context": {}
342
249
  },
343
250
  "id": "u:b7167e2fcaf0",
344
251
  "name": "page_instances_list",
@@ -41,7 +41,7 @@
41
41
  "hideRoot": true,
42
42
  "showIcon": true,
43
43
  "initiallyOpen": false,
44
- "value": "${CONCATENATE('/app/', appId, '/', objectName, '/grid/', listViewId, '?additionalFilters=', additionalFilters,'&flowId=',flowId,'&categoryId=',categoryId)}",
44
+ "value": "${value}",
45
45
  "size": "md",
46
46
  "onEvent": {
47
47
  "change": {
@@ -122,7 +122,8 @@
122
122
  "headers": {
123
123
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
124
124
  },
125
- "messages": {}
125
+ "messages": {},
126
+ "adaptor": "payload.data.value = window.location.pathname + decodeURIComponent(window.location.search); return payload;"
126
127
  },
127
128
  "messages": {},
128
129
  "dsType": "api"
@@ -163,7 +164,6 @@
163
164
  "showHeader": true,
164
165
  "id": "u:d29cef0d1007",
165
166
  "showDisplayAs": true,
166
- "className": "bg-gray-100",
167
167
  "hiddenColumnOperation": true,
168
168
  "formFactor": "LARGE",
169
169
  "headerToolbarItems": [
@@ -193,14 +193,14 @@
193
193
  },
194
194
  {
195
195
  "type": "service",
196
- "visibleOn": "${!!flowId}",
196
+ "visibleOn": "${!!flowId && listName == 'monitor'}",
197
197
  "schemaApi": {
198
198
  "url": "/graphql?flowId=${flowId}&categoryId=${categoryId}",
199
199
  "method": "post",
200
200
  "data": {
201
201
  "query": "{flow: flows__findOne(id:\"${flowId}\"){form__expand{current}}}"
202
202
  },
203
- "adaptor": "const schema = window.SteedosWorkflow.Instance.getListViewSchema(payload.data.flow); console.log('===schema==234==>', schema);return schema;"
203
+ "adaptor": "const schema = window.SteedosWorkflow.Instance.getListViewSchema(payload.data.flow); return schema;"
204
204
  },
205
205
  "id": "u:30c21a4ee7cb",
206
206
  "dsType": "api"
@@ -243,101 +243,7 @@
243
243
  "objectName": "instances",
244
244
  "initialValues": {},
245
245
  "title": "",
246
- "context": {
247
- "rootUrl": "http://127.0.0.1:5600",
248
- "tenantId": "68400b7542187738fb1bab2c",
249
- "userId": "68400b7042187738fb1bab2a",
250
- "authToken": "cc31877680017ca5bc8b6de2a9f1cb38debce7c39bd2f79e21c43400783f8c4d852662a1e443e9c44584be",
251
- "user": {
252
- "authToken": "cc31877680017ca5bc8b6de2a9f1cb38debce7c39bd2f79e21c43400783f8c4d852662a1e443e9c44584be",
253
- "spaceId": "68400b7542187738fb1bab2c",
254
- "userId": "68400b7042187738fb1bab2a",
255
- "name": "YLH1",
256
- "username": "yinlianghui",
257
- "email": "yinlianghui@hotoa.com",
258
- "utcOffset": null,
259
- "steedos_id": "68400b7042187738fb1bab2a",
260
- "locale": "en-us",
261
- "language": "en",
262
- "roles": [
263
- "admin"
264
- ],
265
- "profile": "admin",
266
- "user": "68400b7042187738fb1bab2a",
267
- "user_accepted": true,
268
- "organization": {
269
- "_id": "68400b7542187738fb1bab2c",
270
- "name": "TEW",
271
- "fullname": "TEW",
272
- "company_id": "68400b7542187738fb1bab2c"
273
- },
274
- "organizations": [
275
- {
276
- "_id": "68400b7542187738fb1bab2c",
277
- "name": "TEW",
278
- "fullname": "TEW",
279
- "company_id": "68400b7542187738fb1bab2c"
280
- },
281
- {
282
- "_id": "684784a17f4aeba0af86e0bb",
283
- "name": "生产部",
284
- "fullname": "生产部",
285
- "company_id": "68400b7542187738fb1bab2c"
286
- }
287
- ],
288
- "space": {
289
- "_id": "68400b7542187738fb1bab2c",
290
- "name": "TEW",
291
- "admins": [
292
- "68400b7042187738fb1bab2a",
293
- "686ccd4a33466ba7d2a1fce6",
294
- "686cc9f8b6409ed05d63c80d"
295
- ]
296
- },
297
- "owner": "68400b7042187738fb1bab2a",
298
- "created_by": "68400b7042187738fb1bab2a",
299
- "created": "2025-06-04T09:01:41.340Z",
300
- "modified_by": "68400b7042187738fb1bab2a",
301
- "modified": "2025-08-31T09:38:56.388Z",
302
- "email_verified": null,
303
- "company_id": "68400b7542187738fb1bab2c",
304
- "organizations_parents": [
305
- "68400b7542187738fb1bab2c",
306
- "684784a17f4aeba0af86e0bb"
307
- ],
308
- "company_ids": [
309
- "68400b7542187738fb1bab2c"
310
- ],
311
- "spaces": [
312
- {
313
- "_id": "68400b7542187738fb1bab2c",
314
- "name": "TEW",
315
- "admins": [
316
- "68400b7042187738fb1bab2a",
317
- "686ccd4a33466ba7d2a1fce6",
318
- "686cc9f8b6409ed05d63c80d"
319
- ]
320
- }
321
- ],
322
- "companies": [
323
- {
324
- "_id": "68400b7542187738fb1bab2c",
325
- "name": "TEW",
326
- "organization": "68400b7542187738fb1bab2c"
327
- }
328
- ],
329
- "company": {
330
- "_id": "68400b7542187738fb1bab2c",
331
- "name": "TEW",
332
- "organization": "68400b7542187738fb1bab2c"
333
- },
334
- "permission_shares": [],
335
- "spaceUserId": "68400b7542187738fb1bab2d",
336
- "is_space_admin": true,
337
- "is_phone": false,
338
- "is_tablet": false
339
- }
340
- }
246
+ "context": {}
341
247
  },
342
248
  "id": "u:b7167e2fcaf0",
343
249
  "name": "page_instances_list",
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2023-03-18 15:05:39
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-03-18 15:25:49
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2025-10-08 09:35:17
6
6
  * @Description:
7
7
  */
8
8
  const express = require("express");
@@ -13,9 +13,14 @@ const _ = require('lodash');
13
13
 
14
14
  router.get('/api/workflow/v2/flow_permissions/:flow', requireAuthentication, async function (req, res) {
15
15
  let userSession = req.user;
16
+ const { is_space_admin } = userSession;
16
17
  const { flow } = req.params;
17
18
  try {
18
19
  const permissions = await PermissionManager.getFlowPermissions(flow, userSession.userId);
20
+ // 工作区管理员默认对流程有管理权限
21
+ if (is_space_admin && !_.includes(permissions, 'admin')) {
22
+ permissions.push('admin');
23
+ }
19
24
  res.status(200).send({
20
25
  permissions: permissions
21
26
  })
@@ -2,7 +2,7 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-09-15 13:09:51
4
4
  * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
- * @LastEditTime: 2025-10-04 13:43:13
5
+ * @LastEditTime: 2025-10-05 15:05:13
6
6
  * @Description:
7
7
  */
8
8
  const express = require("express");
@@ -161,7 +161,7 @@ router.post('/api/workflow/v2/instance/return', requireAuthentication, async fun
161
161
  $set: setObj
162
162
  });
163
163
  // 更新当前记录
164
- update_instance_tasks(instance_id, last_trace._id, approve._id)
164
+ await update_instance_tasks(instance_id, last_trace._id, approve._id)
165
165
  b = await instancesCollection.updateOne({
166
166
  _id: instance_id,
167
167
  }, {
@@ -170,7 +170,7 @@ router.post('/api/workflow/v2/instance/return', requireAuthentication, async fun
170
170
  }
171
171
  });
172
172
  // 生成新记录
173
- insert_instance_tasks(instance_id, newTrace._id, newTrace.approves[0]._id)
173
+ await insert_instance_tasks(instance_id, newTrace._id, newTrace.approves[0]._id)
174
174
  if (r && b) {
175
175
  await pushManager.send_message_to_specifyUser("current_user", current_user);
176
176
  instance = await UUFlowManager.getInstance(instance_id);
@@ -182,11 +182,17 @@ router.post('/api/workflow/v2/instance/return', requireAuthentication, async fun
182
182
  await pushManager.triggerWebhook(instance.flow, instance, {}, 'return', current_user, instance.inbox_users);
183
183
  }
184
184
 
185
- res.status(200).send({});
185
+ res.status(200).send({
186
+ status: 0,
187
+ msg: '',
188
+ data: {}
189
+ });
186
190
  } catch (error) {
187
191
  console.error(error);
188
192
  res.status(200).send({
189
- error: error.message
193
+ status: 0,
194
+ msg: error.message,
195
+ data: {}
190
196
  });
191
197
  }
192
198
  });