@steedos-labs/plugin-workflow 3.0.7 → 3.0.8

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.
@@ -0,0 +1,46 @@
1
+ ;(
2
+ function (){
3
+
4
+ async function sleep(ms) {
5
+ return new Promise((resolve) => setTimeout(resolve, ms));
6
+ }
7
+
8
+ Promise.all([
9
+ waitForThing(window, 'SteedosUI'),
10
+ ]).then(()=>{
11
+ SteedosUI.navigationGuard.registerBeforeChange(
12
+ async function(blocker){
13
+ console.log(`blocker`, blocker);
14
+ // 检查当前路径是否符合条件
15
+ const urlParams = new URLSearchParams(window.location.search);
16
+ const sideListViewId = urlParams.get('side_listview_id');
17
+ if((window.location.pathname.startsWith('/app/approve_workflow/instance_tasks/view/') || window.location.pathname.startsWith('/app/approve_workflow/instances/view/')) && (sideListViewId==='draft' || sideListViewId==='inbox')){
18
+ // 检查是否发生了变化
19
+ if(window.SteedosWorkflow.Instance.changed){
20
+ // 触发保存按钮点击
21
+ $(".instance-save-btn").trigger('click');
22
+ await sleep(100);
23
+ try {
24
+ // 等待 SteedosWorkflow.Instance.changed 变为 false
25
+ await waitForThing(window, 'SteedosWorkflow.Instance', function(){
26
+ console.log('SteedosWorkflow.Instance.changed===>', SteedosWorkflow.Instance.changed)
27
+ return SteedosWorkflow.Instance.changed === false;
28
+ });
29
+ console.log('暂存完成....')
30
+ // 等待完成后返回 true
31
+ return true;
32
+ } catch (error) {
33
+ console.error('等待保存完成时发生错误:', error);
34
+ return true;
35
+ }
36
+ } else {
37
+ return true;
38
+ }
39
+ }
40
+ return true;
41
+ }
42
+ )
43
+ })
44
+
45
+ }
46
+ )()
@@ -53,7 +53,7 @@ amis_schema: |-
53
53
  },
54
54
  {
55
55
  "actionType": "custom",
56
- "script": "\nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);if(window.Meteor){\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 url: `/app/${appId}/instances/view/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n"
56
+ "script": "\nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);doAction({\n actionType: 'link',\n args: {\n blank: false,\n url: `/app/${appId}/instances/view/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n"
57
57
  },
58
58
  {
59
59
  "componentId": "",
@@ -15,11 +15,7 @@ amis_schema: |-
15
15
  "actionType": "dialog",
16
16
  "dialog": {
17
17
  "type": "dialog",
18
- "title": {
19
- "type": "tpl",
20
- "id": "u:0bce3c33b6e5",
21
- "tpl": "<p>${'CustomAction.instances.instance_cc' | t}</p>"
22
- },
18
+ "title": "${'CustomAction.instances.instance_cc' | t}",
23
19
  "body": [
24
20
  {
25
21
  "type": "tpl",
@@ -29,69 +25,76 @@ amis_schema: |-
29
25
  "className": "m-b-sm"
30
26
  },
31
27
  {
32
- "type": "form",
33
- "title": "表单",
34
- "debug": false,
35
- "body": [
36
- {
37
- "type": "steedos-select-user",
38
- "label": "${'CustomLabels.instance_action_instance_cc_dialog_field_users' | t}",
39
- "name": "users",
40
- "id": "u:c3ad733db360",
41
- "multiple": true,
42
- "mode": "normal",
43
- "required": true
44
- },
45
- {
46
- "type": "textarea",
47
- "label": "${'CustomLabels.instance_action_instance_cc_dialog_field_description' | t}",
48
- "name": "description",
49
- "id": "u:1dc7e49e6e7d",
50
- "minRows": 3,
51
- "maxRows": 20
52
- }
53
- ],
54
- "id": "u:742f9c0dc8a1",
55
- "mode": "normal",
28
+ "type": "form",
29
+ "title": "表单",
30
+ "debug": false,
31
+ "body": [
32
+ {
33
+ "type": "steedos-select-user",
34
+ "label": "${'CustomLabels.instance_action_instance_cc_dialog_field_users' | t}",
35
+ "name": "users",
36
+ "id": "u:c3ad733db360",
37
+ "multiple": true,
38
+ "mode": "normal",
39
+ "required": true
40
+ },
41
+ {
42
+ "type": "textarea",
43
+ "label": "${'CustomLabels.instance_action_instance_cc_dialog_field_description' | t}",
44
+ "name": "description",
45
+ "id": "u:1dc7e49e6e7d",
46
+ "minRows": 3,
47
+ "maxRows": 20
48
+ }
49
+ ],
50
+ "id": "u:742f9c0dc8a1",
51
+ "mode": "normal",
56
52
  "api": {
57
- "url": "${context.rootUrl}/api/workflow/v2/cc_do",
58
- "method": "post",
59
- "dataType": "json",
60
- "data": {
61
- "&": "$$",
62
- "record": "${record}"
63
- },
64
- "requestAdaptor": "console.log(\"api\", api);\n api.data = {instanceId: api.body.record._id, traceId: api.body.record.approve.trace, approveId: api.body.record.approve._id, usersId: api.body.users, description: api.body.description}; return api;",
65
- "adaptor": "console.log('payload', payload);\nreturn payload;",
66
- "headers": {
67
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
68
- },
69
- "messages": {
70
- "success": "传阅成功!",
71
- "failed": "传阅失败"
72
- }
73
- },
74
- "onEvent": {
75
- "submitSucc": {
76
- "actions": [
77
- {
78
- "actionType": "broadcast",
79
- "args": {
80
- "eventName": "@data.@instanceDetail.changed"
81
- },
82
- "data": {
83
-
84
- }
53
+ "url": "${context.rootUrl}/api/workflow/v2/cc_do",
54
+ "method": "post",
55
+ "dataType": "json",
56
+ "data": {
57
+ "&": "$$",
58
+ "record": "${record}"
59
+ },
60
+ "requestAdaptor": "console.log(\"api\", api);\nconst { record, users, description } = api.body;\nconst { _id, box, approve, traces } = record;\n\nlet myApprove;\n\nif ('inbox' == box) {\n myApprove = approve;\n} else if ('outbox' == box) {\n\n const getLastCCApprove = function (traces) {\n\n var currentApprove, i, user_id;\n\n user_id = context.global.userId;\n\n currentApprove = null;\n\n i = traces.length - 1;\n\n while (i >= 0) {\n if (!currentApprove && traces[i].is_finished) {\n _.each(traces[i].approves, function (ap) {\n if (!currentApprove) {\n if (ap.is_finished && ap.handler === user_id && (!ap.type || ap.type == 'cc') && ['approved', 'submitted', 'rejected'].includes(ap.judge)) {\n currentApprove = ap;\n }\n }\n });\n }\n i--;\n }\n\n return currentApprove;\n }\n\n myApprove = getLastCCApprove(traces);\n}\n\napi.data = {\n instanceId: _id,\n traceId: myApprove.trace,\n approveId: myApprove._id,\n usersId: users,\n description: description\n};\nreturn api;",
61
+ "adaptor": "console.log('payload', payload);\nreturn payload;",
62
+ "headers": {
63
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
64
+ },
65
+ "messages": {
66
+ "success": "传阅成功!",
67
+ "failed": "传阅失败"
68
+ }
69
+ },
70
+ "onEvent": {
71
+ "submitSucc": {
72
+ "actions": [
73
+ {
74
+ "actionType": "broadcast",
75
+ "args": {
76
+ "eventName": "@data.@instanceDetail.changed"
77
+ },
78
+ "data": {}
85
79
  },
86
- {
80
+ {
87
81
  "componentId": "",
88
82
  "args": {},
89
83
  "actionType": "closeDialog"
90
- }
91
- ]
92
- }
93
- }
94
- }
84
+ }
85
+ ]
86
+ }
87
+ },
88
+ "actions": [
89
+ {
90
+ "type": "submit",
91
+ "label": "提交",
92
+ "primary": true
93
+ }
94
+ ],
95
+ "feat": "Insert",
96
+ "dsType": "api"
97
+ }
95
98
  ],
96
99
  "id": "u:519ca64b1934",
97
100
  "actions": [
@@ -117,31 +120,32 @@ amis_schema: |-
117
120
  "onEvent": {
118
121
  "click": {
119
122
  "actions": [
120
- {
123
+ {
121
124
  "args": {},
122
125
  "actionType": "validate",
123
126
  "componentId": "u:742f9c0dc8a1"
124
127
  },
125
128
  {
126
- "componentId": "u:742f9c0dc8a1",
127
- "args": {
128
- },
129
- "actionType": "submit"
130
- }
129
+ "componentId": "u:742f9c0dc8a1",
130
+ "args": {},
131
+ "actionType": "submit"
132
+ }
131
133
  ]
132
134
  }
133
135
  },
134
136
  "id": "u:f7f767bed23f",
135
137
  "level": "primary"
136
138
  }
137
- ]
139
+ ],
140
+ "actionType": "dialog"
138
141
  }
139
142
  }
140
143
  ],
141
144
  "weight": 0
142
145
  }
143
146
  },
144
- "hiddenOn": "!(\n\t(record.box === 'inbox' && record.state === 'pending' && \n \t\t(_.includes(record.cc_users, context.user.userId) \n || (record.step?.disableCC != true && record.step?.step_type != 'start')))\n \t||\n \t(record.box === 'outbox' && record.state === 'pending' &&\n \t(record.lastCCStep?.disableCC != true && record.lastCCStep?.step_type != 'start')\n )\n \n)"
147
+ "hiddenOn": "${!(\n (record.box === 'inbox' && record.state === 'pending' && (_.includes(record.cc_users, context.user.userId) || (record.step && record.step.disableCC != true && record.step.step_type != 'start')))\n || (record.box === 'outbox' && record.state === 'pending' && record.lastCCStep && record.lastCCStep.disableCC != true && record.lastCCStep.step_type != 'start')\n)}",
148
+ "editorState": "default"
145
149
  }
146
150
  ],
147
151
  "regions": [
@@ -150,11 +154,12 @@ amis_schema: |-
150
154
  "data": {
151
155
  },
152
156
  "bodyClassName": "p-0",
153
- "id": "u:7414f3c8128c"
157
+ "id": "u:7414f3c8128c",
158
+ "dsType": "api",
159
+ "definitions": {}
154
160
  }
155
161
  is_enable: true
156
162
  label: 传阅
157
163
  'on': record_only
158
164
  type: amis_button
159
165
  visible: true
160
- sort: 90
@@ -52,32 +52,21 @@ amis_schema: |-
52
52
  "actionType": "ajax"
53
53
  },
54
54
  {
55
- "componentId": "",
56
- "args": {
57
- },
58
- "actionType": "closeDrawer"
55
+ "componentId": "",
56
+ "args": {
57
+ },
58
+ "actionType": "closeDrawer"
59
59
  }
60
60
  ,
61
61
  {
62
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;"
63
+ "script": "const {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);doAction({\n actionType: 'link',\n args: {\n blank: false,\n link: `/app/${appId}/instances/view/${instance._id}?side_object=instances&side_listview_id=draft`\n }\n});\n;"
64
64
  },
65
65
  {
66
66
  "actionType": "wait",
67
67
  "args": {
68
68
  "time": 2000
69
69
  }
70
- },
71
- {
72
- "actionType": "broadcast",
73
- "args": {
74
- "eventName": "@data.changed.steedos_keyvalues"
75
- },
76
- "data": {
77
- "type": "",
78
- "keyvalue": "",
79
- "keyvalues": "${ss:keyvalues}"
80
- }
81
70
  }
82
71
  ]
83
72
  }
@@ -32,7 +32,8 @@ amis_schema: |-
32
32
  "id": "u:ff88cc3375b5",
33
33
  "reference_to": "instances",
34
34
  "pickerSchema": {
35
- "rowClassNameExpr": "<%= data.__selected === true ? 'hidden' : '' %>"
35
+ "rowClassNameExpr": "<%= data.__selected === true ? 'hidden' : '' %>",
36
+ "perPage": 20
36
37
  },
37
38
  "amis": {
38
39
  "id": "u:f0273e374d19",
@@ -55,7 +56,7 @@ amis_schema: |-
55
56
  "orderBy": "${orderBy}",
56
57
  "orderDir": "${orderDir}",
57
58
  "pageNo": "${page}",
58
- "pageSize": "${perPage}",
59
+ "pageSize": 20,
59
60
  "$self": "$$",
60
61
  "keywords": "${keywords}",
61
62
  "ids": "${ids}"
@@ -40,25 +40,32 @@ amis_schema: |-
40
40
  "tpl": "${'instance_action_instance_relocate_dialog_title_prefix' | t} <p class='font-medium inline'>${record.currentStep.name}</p>",
41
41
  "inline": true,
42
42
  "wrapperComponent": "",
43
- "id": "u:1f7dd93080d3"
43
+ "id": "u:1f7dd93080d3",
44
+ "className": "antd-Form-item block"
44
45
  },
45
46
  {
46
47
  "type": "select",
47
- "label": "${'instance_next_step' | t",
48
+ "label": "${'instance_next_step' | t}",
48
49
  "name": "relocate_step",
49
50
  "id": "u:ee15214c1808",
50
51
  "multiple": false,
51
52
  "required": true,
52
- "source": "${stepsOption}"
53
+ "source": "${stepsOption}",
54
+ "onEvent": {
55
+ "change": {
56
+ "actions": [
57
+ {
58
+ "actionType": "custom",
59
+ "script": "let step = event.data.selectedItems.step; doAction({actionType: 'setValue', componentId: 'u:1779a48caedb', args: {value: {deal_type: step.deal_type, step_type: step.step_type, _id: step._id }}})"
60
+ }]
61
+ }
62
+ }
53
63
  },
54
64
  {
55
- "type": "steedos-select-user",
56
- "label": "${'instance_next_step_users' | t}",
65
+ "type": "steedos-instance-handler",
66
+ "label": "处理人",
67
+ "id": "u:relocate_users",
57
68
  "name": "relocate_users",
58
- "id": "u:c3ad733db360",
59
- "multiple": true,
60
- "mode": "normal",
61
- "required": true,
62
69
  "visibleOn": "this.relocate_step && !this.relocate_step.startsWith('start.') && !this.relocate_step.startsWith('end.')"
63
70
  },
64
71
  {
@@ -79,7 +86,7 @@ amis_schema: |-
79
86
  "url": "${context.rootUrl}/api/workflow/relocate",
80
87
  "method": "post",
81
88
  "dataType": "json",
82
- "requestAdaptor": "const { record, relocate_users, relocate_step, reason } = api.data;\napi.data = {\n \"Instances\": [{\n _id: record._id, relocate_next_step: relocate_step.split('.')[1], relocate_inbox_users: relocate_users, relocate_comment: reason\n }]\n}\n\nreturn api;",
89
+ "requestAdaptor": "const { record, relocate_users, relocate_step, reason } = api.data;\napi.data = {\n \"Instances\": [{\n _id: record._id, relocate_next_step: relocate_step.split('.')[1], relocate_inbox_users: _.isString(relocate_users) ? [relocate_users] : relocate_users, relocate_comment: reason\n }]\n}\n\nreturn api;",
83
90
  "adaptor": "return response.status == 200 ? {data: {...payload}, status: 0, msg: t('instance_action_relocate_dialog_msg_success')} : {...payload, status: 1, msg: t('instance_action_relocate_dialog_msg_failed')};"
84
91
  },
85
92
  "onEvent": {
@@ -103,7 +110,7 @@ amis_schema: |-
103
110
  }
104
111
  ],
105
112
  "messages": {},
106
- "dataProvider": "const stepsOption = [];\n\n_.each(data.record.flowVersion.steps, (step) => {\n stepsOption.push({\n label: step.name,\n value: `${step.step_type}.${step._id}`\n })\n})\nsetData({ stepsOption })\n\n"
113
+ "dataProvider": "const stepsOption = [];\n\n_.each(data.record.flowVersion.steps, (step) => {\n stepsOption.push({\n label: step.name,\n value: `${step.step_type}.${step._id}`,\n step: step })\n})\nsetData({ stepsOption })\n\n"
107
114
  }
108
115
  ],
109
116
  "showCloseButton": true,
@@ -54,7 +54,7 @@ amis_schema: |-
54
54
  "api": {
55
55
  "url": "${context.rootUrl}/api/workflow/retrieve",
56
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;",
57
+ "requestAdaptor": "api.data = {\n \"_id\": api.body.record._id,\n \"retrieve_comment\": api.body.retrieve_comment\n};\nreturn api;",
58
58
  "adaptor": "console.log('payload', payload);\nreturn payload;",
59
59
  "messages": {},
60
60
  "headers": {
@@ -72,6 +72,10 @@ amis_schema: |-
72
72
  "eventName": "@data.@instanceDetail.changed"
73
73
  },
74
74
  "data": {}
75
+ },
76
+ {
77
+ "actionType": "custom",
78
+ "script": "$('.steedos-workflow-reload-btn').trigger('click')"
75
79
  }
76
80
  ]
77
81
  }
@@ -7,7 +7,7 @@ amis_schema: |-
7
7
  "type": "button",
8
8
  "label": "${'CustomAction.instances.instance_save' | t}",
9
9
  "id": "u:instance_save",
10
- "className": " ",
10
+ "className": "instance-save-btn",
11
11
  "onEvent": {
12
12
  "click": {
13
13
  "actions": [
@@ -18,7 +18,7 @@ amis_schema: |-
18
18
  "method": "post",
19
19
  "sendOn": "",
20
20
  "requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();const _formValues = JSON.parse(JSON.stringify(formValues)); if(_formValues){delete _formValues.__applicant} \nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n instance: {\n _id: instance._id,\n applicant: formValues.applicant.user,\n submitter: formValues.submitter,\n traces: [{\n _id: instance.trace._id,\n step: instance.step._id,\n approves: [{\n _id: instance.approve._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n values: _formValues\n }]\n }]\n }\n};\napi.data = body;\nreturn api;",
21
- "adaptor": "if (payload.instance == \"upgraded\") { window.setTimeout(function(){ window.location.reload(); }, 2000); return {...payload, status: 1, msg: t('instance_action_instance_save_msg_upgraded')}; } \n return payload.instance === true ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
21
+ "adaptor": "window.SteedosWorkflow.Instance.changed = false; if (payload.instance == \"upgraded\") { window.setTimeout(function(){ window.location.reload(); }, 2000); return {...payload, status: 1, msg: t('instance_action_instance_save_msg_upgraded')}; } \n return payload.instance === true ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
22
22
  "headers": {
23
23
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
24
24
  },
@@ -37,7 +37,7 @@ amis_schema: |-
37
37
  "method": "post",
38
38
  "sendOn": "",
39
39
  "requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();\nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n approve: {\n id: instance.approve._id,\n instance: instance._id,\n trace: instance.trace._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n judge: approveValues === null || approveValues === void 0 ? void 0 : approveValues.judge,\n values: formValues\n }\n};\napi.data = body;\nreturn api;",
40
- "adaptor": "return payload.instance ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
40
+ "adaptor": "window.SteedosWorkflow.Instance.changed = false; return payload.instance ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
41
41
  "headers": {
42
42
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
43
43
  },
@@ -5,6 +5,7 @@ enable_search: true
5
5
  enable_dataloader: false
6
6
  hidden: false
7
7
  enable_split: true
8
+ enable_enhanced_lookup: true
8
9
  fields:
9
10
  name:
10
11
  label: Name
@@ -121,7 +121,7 @@
121
121
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
122
122
  },
123
123
  "requestAdaptor": "\nconst { recordId } = api.body;\napi.data = {\n query: `{instance_task:instance_tasks__findOne(id: \"${recordId}\"){_id,instance,is_read}}`\n};\n\nreturn api;",
124
- "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;"
124
+ "adaptor": "if(!payload.data.instance_task){return payload;}\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;"
125
125
  },
126
126
  "onEvent": {
127
127
  "fetchSchemaInited": {
@@ -17,7 +17,7 @@ const afterHook = (req, res, next) => {
17
17
  id: ins_id,
18
18
  doc: {},
19
19
  })
20
- }else if(req.ulr.includes('/api/workflow/relocate')){
20
+ }else if(req.url.includes('/api/workflow/relocate')){
21
21
  var hashData = req.body;
22
22
  const instance_from_client = hashData['Instances'][0];
23
23
  const ins_id = instance_from_client._id;
@@ -43,6 +43,11 @@ router.post('/api/workflow/v2/set_have_read', requireAuthentication, async funct
43
43
  "type": 1
44
44
  }
45
45
  });
46
+ if(!instance_task){
47
+ return res.status(200).send({
48
+ success: true
49
+ });
50
+ }
46
51
  if (instance_task.is_read){
47
52
  return res.status(200).send({
48
53
  success: true
@@ -227,16 +227,20 @@ const calcSteps = async function(instance, flow, flowVersionId, formFields, valu
227
227
  var judge = 'approved';
228
228
 
229
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)
230
+ try {
231
+ var nextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values);
232
+ for (const nextStep of nextSteps) {
233
+ try {
234
+ if (!_.includes(track, nextStep._id)) {
235
+ const __steps = await calcSteps(instance, flow, flowVersionId, formFields, values, nextStep, track.concat(_.map(_steps, '_id')));
236
+ _steps = _steps.concat(__steps)
237
+ }
238
+ } catch (e) {
239
+ console.log(e)
236
240
  }
237
- } catch (e) {
238
- console.log(e)
239
241
  }
242
+ } catch (error) {
243
+ console.log(error)
240
244
  }
241
245
  _steps = _.compact(_.uniqBy(_steps, 'id'));
242
246
  return _steps;
@@ -498,9 +498,9 @@
498
498
  }
499
499
  break;
500
500
  case "section":
501
- tpl.type = "fieldset";
501
+ tpl.type = "steedos-field-group";
502
502
  tpl.title = field.name;
503
- tpl.collapsable = true;
503
+ tpl.description = field.description;
504
504
  tpl.body = []
505
505
  if (field.fields) {
506
506
  for (let i = 0; i < field.fields.length; i++) {
@@ -198,9 +198,12 @@ function transformFormFields(amisField) {
198
198
  is_list_display: _.includes(amisField.className, "is_list_display"),
199
199
  is_searchable: _.includes(amisField.className, "is_searchable"),
200
200
  visibleOn: amisField.visibleOn,
201
- requiredOn: amisField.requiredOn
201
+ requiredOn: amisField.requiredOn,
202
+ description: amisField.description
202
203
  }
203
204
 
205
+ // console.log('formFieldsItem', formFieldsItem)
206
+
204
207
  switch (amisField.type) {
205
208
  case 'steedos-field-group':
206
209
  formFieldsItem.type = 'section';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "scripts": {