@steedos-labs/plugin-workflow 3.0.6 → 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.
Files changed (24) hide show
  1. package/main/default/client/navigation_guard.client.js +46 -0
  2. package/main/default/client/socket.client.js +1 -0
  3. package/main/default/manager/uuflow_manager.js +1 -1
  4. package/main/default/objects/instance_tasks/buttons/instance_new.button.yml +1 -1
  5. package/main/default/objects/instances/buttons/instance_cc.button.yml +78 -73
  6. package/main/default/objects/instances/buttons/instance_flow_chart.button.yml +1 -1
  7. package/main/default/objects/instances/buttons/instance_new.button.yml +5 -16
  8. package/main/default/objects/instances/buttons/instance_related.button.yml +7 -2
  9. package/main/default/objects/instances/buttons/instance_relocate.button.yml +18 -11
  10. package/main/default/objects/instances/buttons/instance_retrieve.button.yml +5 -1
  11. package/main/default/objects/instances/buttons/instance_save.button.yml +3 -3
  12. package/main/default/objects/instances/buttons/instance_submit.button.yml +23 -12
  13. package/main/default/objects/instances/instances.object.yml +1 -0
  14. package/main/default/pages/instance_detail.page.amis.json +16 -3
  15. package/main/default/pages/instance_tasks_detail.page.amis.json +16 -4
  16. package/main/default/pages/instance_tasks_list.page.amis.json +14 -2
  17. package/main/default/pages/instances_list.page.amis.json +14 -2
  18. package/main/default/pages/page_instance_print.page.amis.json +42 -5
  19. package/main/default/routes/afterHook.js +1 -1
  20. package/main/default/routes/api_have_read.router.js +5 -0
  21. package/main/default/routes/api_workflow_next_step.router.js +12 -8
  22. package/main/default/routes/flow_form_design.ejs +2 -2
  23. package/main/default/triggers/amis_form_design.trigger.js +4 -1
  24. package/package.json +1 -1
@@ -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
+ )()
@@ -45,6 +45,7 @@ window.waitForThing(window, 'socket').then(()=>{
45
45
  };
46
46
  if (shouldReloadView()) {
47
47
  window.$(".list-view-btn-reload").click()
48
+ window.$(".instance-nav-reload").click()
48
49
  }
49
50
  });
50
51
 
@@ -4316,7 +4316,7 @@ UUFlowManager.caculateExtras = async function (values = {}, formDoc, formVersion
4316
4316
  extras[field.code] = tableExtras;
4317
4317
  }
4318
4318
  } else if (field.type === 'section') {
4319
- field.fields.forEach(s_field => {
4319
+ field.fields?.forEach(s_field => {
4320
4320
  if (s_field.is_list_display && values[s_field.code] !== undefined) {
4321
4321
  extras[s_field.code] = values[s_field.code];
4322
4322
  }
@@ -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
@@ -13,7 +13,7 @@ amis_schema: |-
13
13
  "actions": [
14
14
  {
15
15
  "args": {
16
- "url": "${context.rootUrl}/api/workflow/chart?instance_id=${instanceId || recordId}&title=${record.flow.name}",
16
+ "url": "${context.rootUrl}/api/workflow/chart?instance_id=${instanceId || record._id || recordId}&title=${record.flow.name}",
17
17
  "blank": true
18
18
  },
19
19
  "actionType": "url"
@@ -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}"
@@ -126,6 +127,10 @@ amis_schema: |-
126
127
 
127
128
  }
128
129
  },
130
+ {
131
+ "actionType": "reload",
132
+ "componentId": "u:instancePage"
133
+ },
129
134
  {
130
135
  "componentId": "",
131
136
  "args": {},
@@ -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
  },
@@ -2,8 +2,7 @@ name: instance_submit
2
2
  amis_schema: |-
3
3
  {
4
4
  "type": "service",
5
- "body": [
6
- {
5
+ "body": [{
7
6
  "type": "button",
8
7
  "label": "${'CustomAction.instances.instance_submit' | t}",
9
8
  "level": "primary",
@@ -11,18 +10,30 @@ amis_schema: |-
11
10
  "hiddenOn": "!(this.record.box === 'inbox' || this.record.box === 'draft')",
12
11
  "onEvent": {
13
12
  "click": {
14
- "weight": 0,
15
- "actions": [
16
- {
17
- "componentId": "steedos-approve-button",
18
- "groupType": "component",
19
- "actionType": "click"
20
- }
21
- ]
13
+ "weight": 0,
14
+ "actions": [
15
+ {
16
+ "actionType": "custom",
17
+ "script": "event.data.isApprovalDrawerOpen = !!document.querySelector('.steedos-instance-detail-wrapper .approval-drawer');"
18
+ },
19
+ {
20
+ "componentId": "steedos-approve-button",
21
+ "groupType": "component",
22
+ "actionType": "click",
23
+ "args": {
24
+ "autoSubmitInstance": true
25
+ },
26
+ "expression": "${!isApprovalDrawerOpen}"
27
+ },
28
+ {
29
+ "componentId": "steedos-approve-submit-button",
30
+ "actionType": "click",
31
+ "expression": "${isApprovalDrawerOpen}"
32
+ }
33
+ ]
22
34
  }
23
35
  }
24
- }
25
- ],
36
+ }],
26
37
  "regions": [
27
38
  "body"
28
39
  ],
@@ -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
@@ -14,7 +14,21 @@
14
14
  }]
15
15
  }
16
16
  },
17
- "body": [{
17
+ "body": [
18
+ {
19
+ "type": "button",
20
+ "label": "刷新",
21
+ "className": "instance-nav-reload hidden",
22
+ "onEvent": {
23
+ "click": {
24
+ "actions": [{
25
+ "actionType": "reload",
26
+ "componentId": "u:instanceNav"
27
+ }]
28
+ }
29
+ }
30
+ },
31
+ {
18
32
  "type": "input-tree",
19
33
  "treeContainerClassName": "h-full",
20
34
  "name": "tree",
@@ -71,7 +85,7 @@
71
85
  "unfoldedLevel": 2,
72
86
  "source": "${options}"
73
87
  }],
74
- "id": "u:aa4f4dc5f439",
88
+ "id": "u:instanceNav",
75
89
  "api": {
76
90
  "method": "get",
77
91
  "url": "${context.rootUrl}/api/${appId}/workflow/nav",
@@ -81,7 +95,6 @@
81
95
  },
82
96
  "dsType": "api"
83
97
  }],
84
- "id": "u:3723a0a5ded0",
85
98
  "mobile": {
86
99
  "visibleOn": "false"
87
100
  }
@@ -19,6 +19,19 @@
19
19
  }
20
20
  },
21
21
  "body": [
22
+ {
23
+ "type": "button",
24
+ "label": "刷新",
25
+ "className": "instance-nav-reload hidden",
26
+ "onEvent": {
27
+ "click": {
28
+ "actions": [{
29
+ "actionType": "reload",
30
+ "componentId": "u:instanceNav"
31
+ }]
32
+ }
33
+ }
34
+ },
22
35
  {
23
36
  "type": "input-tree",
24
37
  "treeContainerClassName": "h-full",
@@ -77,7 +90,7 @@
77
90
  "source": "${options}"
78
91
  }
79
92
  ],
80
- "id": "u:aa4f4dc5f439",
93
+ "id": "u:instanceNav",
81
94
  "api": {
82
95
  "method": "get",
83
96
  "url": "${context.rootUrl}/api/${appId}/workflow/nav",
@@ -86,8 +99,7 @@
86
99
  }
87
100
  }
88
101
  }
89
- ],
90
- "id": "u:339eb21f368c"
102
+ ]
91
103
  },
92
104
  {
93
105
  "type": "wrapper",
@@ -109,7 +121,7 @@
109
121
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
110
122
  },
111
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;",
112
- "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;"
113
125
  },
114
126
  "onEvent": {
115
127
  "fetchSchemaInited": {
@@ -28,6 +28,19 @@
28
28
  }
29
29
  },
30
30
  "body": [
31
+ {
32
+ "type": "button",
33
+ "label": "刷新",
34
+ "className": "instance-nav-reload hidden",
35
+ "onEvent": {
36
+ "click": {
37
+ "actions": [{
38
+ "actionType": "reload",
39
+ "componentId": "u:instanceNav"
40
+ }]
41
+ }
42
+ }
43
+ },
31
44
  {
32
45
  "type": "input-tree",
33
46
  "name": "tree",
@@ -123,12 +136,11 @@
123
136
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
124
137
  },
125
138
  "messages": {},
126
- "trackExpression": "${_reloadKey}",
127
139
  "adaptor": "payload.data.value = window.location.pathname + decodeURIComponent(window.location.search); return payload;"
128
140
  },
129
141
  "messages": {},
130
142
  "dsType": "api",
131
- "id": "u:b22ab9089a5e"
143
+ "id": "u:instanceNav"
132
144
  }
133
145
  ],
134
146
  "id": "u:fd659f5c3657",
@@ -17,7 +17,7 @@
17
17
  "body": [
18
18
  {
19
19
  "type": "service",
20
- "id": "u:aa4f4dc5f439",
20
+ "id": "u:instanceNav",
21
21
  "className": "bg-none",
22
22
  "onEvent": {
23
23
  "@data.changed.instances": {
@@ -29,6 +29,19 @@
29
29
  }
30
30
  },
31
31
  "body": [
32
+ {
33
+ "type": "button",
34
+ "label": "刷新",
35
+ "className": "instance-nav-reload hidden",
36
+ "onEvent": {
37
+ "click": {
38
+ "actions": [{
39
+ "actionType": "reload",
40
+ "componentId": "u:instanceNav"
41
+ }]
42
+ }
43
+ }
44
+ },
32
45
  {
33
46
  "type": "input-tree",
34
47
  "name": "tree",
@@ -130,7 +143,6 @@
130
143
  "dsType": "api"
131
144
  }
132
145
  ],
133
- "id": "u:fd659f5c3657",
134
146
  "isFixedHeight": false,
135
147
  "isFixedWidth": false
136
148
  },
@@ -7,6 +7,7 @@
7
7
  "type": "grid",
8
8
  "columns": [
9
9
  {
10
+ "md": "5",
10
11
  "body": [
11
12
  {
12
13
  "type": "button",
@@ -25,6 +26,7 @@
25
26
  }
26
27
  },
27
28
  {
29
+ "md": "7",
28
30
  "name": "files",
29
31
  "type": "checkbox",
30
32
  "label": false,
@@ -86,16 +88,16 @@
86
88
  "name": "radios",
87
89
  "type": "radios",
88
90
  "label": false,
89
- "value": "210",
91
+ "value": "190",
90
92
  "className": "mr-0",
91
93
  "options": [
92
94
  {
93
95
  "label": "A4纵向",
94
- "value": "210"
96
+ "value": "190"
95
97
  },
96
98
  {
97
99
  "label": "A4横向",
98
- "value": "297"
100
+ "value": "277"
99
101
  }
100
102
  ],
101
103
  "mode": "inline",
@@ -114,7 +116,7 @@
114
116
  "name": "width",
115
117
  "type": "input-number",
116
118
  "id": "u:print-width",
117
- "value": "210",
119
+ "value": "190",
118
120
  "mode": "inline",
119
121
  "className": "w-20 mr-0",
120
122
  "min": "100",
@@ -236,9 +238,19 @@
236
238
  "width": "unset"
237
239
  },
238
240
  ".steedos-instance-related-view-wrapper .instance-form": {
239
- "width": "210mm",
241
+ "width": "190mm",
240
242
  "transition": "width 0.5s ease-in-out"
241
243
  },
244
+ ".steedos-instance-related-view-wrapper .steedos-amis-instance-view-content": {
245
+ "display": "inline-block"
246
+ },
247
+ ".steedos-amis-instance-view-body": {
248
+ "padding": "unset",
249
+ "margin": "1rem",
250
+ "display": "flex",
251
+ "flex-direction": "column",
252
+ "align-items": "center"
253
+ },
242
254
  ".steedos-global-header-root": {
243
255
  "display": "none"
244
256
  },
@@ -252,6 +264,22 @@
252
264
  ".antd-Page-toolbar": {
253
265
  "background": "#e5e5e5"
254
266
  },
267
+ ".steedos-amis-instance-view .instance-form-view .antd-Table-table thead tr th.antd-Table-operationCell": {
268
+ "border": "none !important"
269
+ },
270
+ ".antd-InputTable th": {
271
+ "border-bottom": "none !important"
272
+ },
273
+ ".steedos-input-table .antd-Form-control > .antd-Table": {
274
+ "margin-bottom": "0px !important",
275
+ "padding": "0px !important"
276
+ },
277
+ ".steedos-input-table .antd-Form-item": {
278
+ "padding": "0px !important"
279
+ },
280
+ ".antd-Page-toolbar .antd-Form-item--inline": {
281
+ "margin-right": "0.25rem"
282
+ },
255
283
  ".antd-Page-toolbar .antd-Grid": {
256
284
  "padding-top": "12px",
257
285
  "padding-left": "10px"
@@ -315,6 +343,15 @@
315
343
  },
316
344
  ".text-muted": {
317
345
  "display": "none !important"
346
+ },
347
+ ".steedos-amis-instance-view .steedos-input-table .antd-Form-item .antd-InputTable .antd-Table-content table thead tr": {
348
+ "border-bottom": "0px"
349
+ },
350
+ ".steedos-amis-instance-view .form-control .antd-Table-table tbody tr:last-child td": {
351
+ "border-right": "0px"
352
+ },
353
+ ".antd-Table-content-colDragLine": {
354
+ "display": "none !important"
318
355
  }
319
356
  },
320
357
  "wrapperCustomStyle": {}
@@ -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.6",
3
+ "version": "3.0.8",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "scripts": {