@steedos-labs/plugin-workflow 3.0.79 → 3.0.81

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.
@@ -1,5 +1,5 @@
1
1
  waitForThing(window, 'antd').then(function(){
2
- var v = '3.0.79';
2
+ var v = '3.0.81';
3
3
  loadJs('/amis-renderer/amis-renderer.js?v=' + v);
4
4
  loadCss('/amis-renderer/amis-renderer.css?v=' + v)
5
5
  })
@@ -9,45 +9,125 @@ amis_schema: |-
9
9
  "id": "u:instance_delete",
10
10
  "onEvent": {
11
11
  "click": {
12
+ "weight": 0,
12
13
  "actions": [
13
14
  {
14
- "args": {
15
- "api": {
16
- "url": "/api/workflow/v2/remove",
17
- "method": "post",
18
- "requestAdaptor": "api.data = {\n instance: {\n _id: context.context._id\n }\n}\n\nreturn api;",
19
- "data": {
20
- "record_id": "$record_id"
15
+ "actionType": "dialog",
16
+ "dialog": {
17
+ "type": "dialog",
18
+ "title": "${'CustomLabels.alert_info' | t}",
19
+ "body": [
20
+ {
21
+ "type": "tpl",
22
+ "tpl": "${'CustomLabels.confirm_delete' | t}",
23
+ "wrapperComponent": "",
24
+ "inline": false,
25
+ "visibleOn": "${!deleting}",
26
+ "id": "u:0c42a6d112ab"
27
+ },
28
+ {
29
+ "type": "wrapper",
30
+ "className": "flex items-center gap-2 text-gray-600",
31
+ "visibleOn": "${deleting}",
32
+ "body": [
33
+ { "type": "spinner", "show": true, "size": "sm" },
34
+ { "type": "tpl", "tpl": "${'CustomLabels.instance_deleting_please_wait' | t}" }
35
+ ]
21
36
  }
22
- },
23
- "messages": {}
24
- },
25
- "actionType": "ajax"
26
- },
27
- {
28
- "ignoreError": false,
29
- "actionType": "custom",
30
- "script": "try { sessionStorage.removeItem('flowId'); sessionStorage.removeItem('categoryId'); } catch(e) {} SteedosWorkflow.Instance.changed=false; navigate('/app/approve_workflow/instances/view/none?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=')"
31
- },
32
- {
33
- "actionType": "wait",
34
- "args": {
35
- "time": 500
36
- }
37
- },
38
- {
39
- "actionType": "custom",
40
- "script":"window.$('.list-view-btn-reload').click()"
41
- },
42
- {
43
- "actionType": "custom",
44
- "script":"window.postMessage({ type: 'approval-tree-menu:reload' }, '*')"
45
- }
46
- ],
47
- "weight": 0
37
+ ],
38
+ "showCloseButton": true,
39
+ "showErrorMsg": true,
40
+ "showLoading": true,
41
+ "closeOnEsc": false,
42
+ "className": "app-popover",
43
+ "id": "u:42923ccc1c7f",
44
+ "actions": [
45
+ {
46
+ "type": "button",
47
+ "label": "${'Cancel' | t}",
48
+ "onEvent": {
49
+ "click": {
50
+ "actions": [
51
+ {
52
+ "actionType": "closeDialog"
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ "id": "u:452a4266d210"
58
+ },
59
+ {
60
+ "type": "button",
61
+ "label": "${'OK' | t}",
62
+ "level": "danger",
63
+ "id": "u:fa92a7ba67ee",
64
+ "loadingOn": "${deleting}",
65
+ "onEvent": {
66
+ "click": {
67
+ "actions": [
68
+ {
69
+ "actionType": "setValue",
70
+ "componentId": "u:42923ccc1c7f",
71
+ "args": { "value": { "deleting": true } }
72
+ },
73
+ {
74
+ "actionType": "ajax",
75
+ "outputVar": "deleteResult",
76
+ "args": {
77
+ "options": {},
78
+ "messages": {},
79
+ "api": {
80
+ "url": "/api/workflow/v2/remove",
81
+ "method": "post",
82
+ "requestAdaptor": "api.data = {\n instance: {\n _id: context.context._id\n }\n}\n\nreturn api;",
83
+ "data": {
84
+ "record_id": "$record_id"
85
+ }
86
+ }
87
+ }
88
+ },
89
+ {
90
+ "actionType": "setValue",
91
+ "componentId": "u:42923ccc1c7f",
92
+ "args": { "value": { "deleting": false } }
93
+ },
94
+ {
95
+ "actionType": "closeDialog",
96
+ "expression": "${event.data.deleteResult.responseStatus===0}"
97
+ },
98
+ {
99
+ "ignoreError": false,
100
+ "actionType": "custom",
101
+ "expression": "${event.data.deleteResult.responseStatus===0}",
102
+ "script": "try { sessionStorage.removeItem('flowId'); sessionStorage.removeItem('categoryId'); } catch(e) {}\ntry { if (window.SteedosWorkflow && window.SteedosWorkflow.Instance) { window.SteedosWorkflow.Instance.changed = false; } } catch(e) {}\nvar params = new URLSearchParams(window.location.search);\nvar sideListviewId = params.get('side_listview_id') || 'draft';\nvar appId = (event.data && event.data.appId) || 'approve_workflow';\nnavigate('/app/' + appId + '/instances/view/none?side_object=instances&side_listview_id=' + sideListviewId + '&additionalFilters=&flowId=&categoryId=');"
103
+ },
104
+ {
105
+ "actionType": "wait",
106
+ "expression": "${event.data.deleteResult.responseStatus===0}",
107
+ "args": {
108
+ "time": 500
109
+ }
110
+ },
111
+ {
112
+ "actionType": "custom",
113
+ "expression": "${event.data.deleteResult.responseStatus===0}",
114
+ "script": "try { window.$('.list-view-btn-reload').click(); } catch(e) {}"
115
+ },
116
+ {
117
+ "actionType": "custom",
118
+ "expression": "${event.data.deleteResult.responseStatus===0}",
119
+ "script": "try { window.postMessage({ type: 'approval-tree-menu:reload' }, '*'); } catch(e) {}"
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ }
125
+ ]
126
+ }
127
+ }
128
+ ]
48
129
  }
49
130
  },
50
- "confirmText": "${'CustomLabels.confirm_delete' | t}",
51
131
  "hiddenOn": "(window.Builder && window.Builder.settings && window.Builder.settings.STEEDOS_PUBLIC_WORKFLOW_READONLY === 'true') || !(record.box == 'draft' || (record.box == 'monitor' && context.user.is_space_admin) \n || (_.includes(record.flow.perms.users_can_admin, context.user.userId) \n || _.intersection(record.flow.perms.orgs_can_admin, context.user.organizations_parents) > 0)\n || (record.box == 'inbox' && record.state == 'draft' && record.forward_from_instance))"
52
132
  }
53
133
  ],
@@ -64,4 +144,4 @@ label: 删除
64
144
  'on': record_only
65
145
  type: amis_button
66
146
  visible: true
67
- sort: 2500
147
+ sort: 2500
@@ -27,7 +27,17 @@ amis_schema: |-
27
27
  "tpl": "${'CustomLabels.confirm_delete' | t}",
28
28
  "wrapperComponent": "",
29
29
  "inline": false,
30
+ "visibleOn": "${!deleting}",
30
31
  "id": "u:0c42a6d112aa"
32
+ },
33
+ {
34
+ "type": "wrapper",
35
+ "className": "flex items-center gap-2 text-gray-600",
36
+ "visibleOn": "${deleting}",
37
+ "body": [
38
+ { "type": "spinner", "show": true, "size": "sm" },
39
+ { "type": "tpl", "tpl": "${'CustomLabels.instance_deleting_please_wait' | t}" }
40
+ ]
31
41
  }
32
42
  ],
33
43
  "showCloseButton": true,
@@ -54,9 +64,15 @@ amis_schema: |-
54
64
  {
55
65
  "type": "button",
56
66
  "label": "${'OK' | t}",
67
+ "loadingOn": "${deleting}",
57
68
  "onEvent": {
58
69
  "click": {
59
70
  "actions": [
71
+ {
72
+ "actionType": "setValue",
73
+ "componentId": "u:42923ccc1c7e",
74
+ "args": { "value": { "deleting": true } }
75
+ },
60
76
  {
61
77
  "actionType": "ajax",
62
78
  "outputVar": "responseResult",
@@ -78,13 +94,24 @@ amis_schema: |-
78
94
  }
79
95
  }
80
96
  },
97
+ {
98
+ "actionType": "setValue",
99
+ "componentId": "u:42923ccc1c7e",
100
+ "args": { "value": { "deleting": false } }
101
+ },
81
102
  {
82
103
  "actionType": "closeDialog",
83
104
  "expression": "${event.data.responseResult.responseStatus===0}"
84
105
  },
85
106
  {
86
- "actionType": "refresh",
87
- "expression": "${event.data.responseResult.responseStatus===0}"
107
+ "actionType": "custom",
108
+ "expression": "${event.data.responseResult.responseStatus===0}",
109
+ "script": "try { window.$('.list-view-btn-reload').click(); } catch(e) {}"
110
+ },
111
+ {
112
+ "actionType": "custom",
113
+ "expression": "${event.data.responseResult.responseStatus===0}",
114
+ "script": "try { window.postMessage({ type: 'approval-tree-menu:reload' }, '*'); } catch(e) {}"
88
115
  }
89
116
  ]
90
117
  }
@@ -5,3 +5,4 @@ CustomApplications:
5
5
  CustomLabels:
6
6
  approval_workflow: Workflow
7
7
  flows_tabs_form: Form
8
+ instance_deleting_please_wait: Deleting, please wait...
@@ -1,3 +1,4 @@
1
1
  CustomLabels:
2
2
  flows_tabs_form: 表单
3
- approval_workflow: 审批
3
+ approval_workflow: 审批
4
+ instance_deleting_please_wait: 正在删除,请稍候...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.79",
3
+ "version": "3.0.81",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -140,6 +140,118 @@ module.exports = {
140
140
  * Service started lifecycle event handler
141
141
  */
142
142
  async started(ctx) {
143
+ // 注册 app_launcher widgets: 待审核、已审核
144
+ try {
145
+ const widgetsObj = this.getObject('widgets');
146
+ const existingWidgets = await widgetsObj.directFind({
147
+ filters: [['type', '=', 'amis-app_launcher'], ['name', 'startsWith', 'workflow_']]
148
+ });
149
+
150
+ const inboxSchema = {
151
+ type: 'wrapper',
152
+ size: 'none',
153
+ className: 'bg-white rounded-xl shadow-sm px-6 py-5 mb-0',
154
+ body: [
155
+ {
156
+ type: 'flex',
157
+ className: 'mb-2 items-center',
158
+ items: [
159
+ { type: 'tpl', tpl: '<h3 class="text-base font-medium m-0">待审核</h3>', className: 'flex-1' },
160
+ { type: 'link', href: '/app/approve_workflow/instance_tasks/grid/inbox', body: '查看全部 →', className: 'text-xs text-gray-400' }
161
+ ]
162
+ },
163
+ {
164
+ type: 'crud',
165
+ mode: 'table',
166
+ affixHeader: false,
167
+ autoFillHeight: { height: 240 },
168
+ api: {
169
+ method: 'post',
170
+ url: '/graphql',
171
+ data: {
172
+ query: '{ instance_tasks(filters: [[\"handler\",\"=\",\"${context.userId}\"],[\"is_finished\",\"=\",false],[\"is_hidden\",\"!=\",true]], top: 10, sort: \"modified desc\") { _id instance_name submitter_name modified } }'
173
+ },
174
+ adaptor: 'return { data: { items: payload.data && payload.data.instance_tasks || [], total: payload.data && payload.data.instance_tasks && payload.data.instance_tasks.length || 0 } };'
175
+ },
176
+ headerToolbar: [],
177
+ footerToolbar: [],
178
+ columnsTogglable: false,
179
+ columns: [
180
+ { name: 'instance_name', label: '标题', className: 'text-sm' },
181
+ { name: 'submitter_name', label: '提交人', className: 'text-sm text-gray-500', width: 100 },
182
+ { name: 'modified', label: '时间', type: 'datetime', format: 'MM-DD HH:mm', className: 'text-xs text-gray-400', width: 100 },
183
+ { type: 'operation', label: '操作', width: 60, buttons: [{ type: 'button', label: '查看', level: 'link', className: 'text-sm p-0', onEvent: { click: { actions: [{ actionType: 'url', args: { url: '/app/approve_workflow/instance_tasks/view/${_id}', blank: true } }] } } }] }
184
+ ]
185
+ }
186
+ ]
187
+ };
188
+
189
+ // const outboxSchema = {
190
+ // type: 'wrapper',
191
+ // size: 'none',
192
+ // className: 'bg-white rounded-xl shadow-sm px-6 py-5 mb-0',
193
+ // body: [
194
+ // {
195
+ // type: 'flex',
196
+ // className: 'mb-2 items-center',
197
+ // items: [
198
+ // { type: 'tpl', tpl: '<h3 class="text-base font-medium m-0">已审核</h3>', className: 'flex-1' },
199
+ // { type: 'link', href: '/app/approve_workflow/instance_tasks/grid/outbox', body: '查看全部 →', className: 'text-xs text-gray-400' }
200
+ // ]
201
+ // },
202
+ // {
203
+ // type: 'crud',
204
+ // mode: 'table',
205
+ // affixHeader: false,
206
+ // autoFillHeight: { height: 240 },
207
+ // api: {
208
+ // method: 'post',
209
+ // url: '/graphql',
210
+ // data: {
211
+ // query: '{ instance_tasks(filters: [["handler","=","${context.userId}"],["is_finished","=",true],["is_latest_approve","=",true],["type","!=","draft"],["is_hidden","!=",true]], top: 10, sort: "modified desc") { _id instance_name submitter_name modified } }'
212
+ // },
213
+ // adaptor: 'return { data: { items: payload.data && payload.data.instance_tasks || [], total: payload.data && payload.data.instance_tasks && payload.data.instance_tasks.length || 0 } };'
214
+ // },
215
+ // headerToolbar: [],
216
+ // footerToolbar: [],
217
+ // columnsTogglable: false,
218
+ // onEvent: {
219
+ // rowClick: {
220
+ // actions: [
221
+ // {
222
+ // actionType: 'url',
223
+ // args: { url: '/app/approve_workflow/instance_tasks/view/${event.data.item._id}', blank: true }
224
+ // }
225
+ // ]
226
+ // }
227
+ // },
228
+ // columns: [
229
+ // { name: 'instance_name', label: '标题', className: 'text-sm' },
230
+ // { name: 'submitter_name', label: '提交人', className: 'text-sm text-gray-500', width: 100 },
231
+ // { name: 'modified', label: '时间', type: 'datetime', format: 'MM-DD HH:mm', className: 'text-xs text-gray-400', width: 100 },
232
+ // { type: 'operation', label: '操作', width: 60, buttons: [{ type: 'button', label: '查看', level: 'link', className: 'text-sm p-0', onEvent: { click: { actions: [{ actionType: 'url', args: { url: '/app/approve_workflow/instance_tasks/view/${_id}', blank: true } }] } } }] }
233
+ // ]
234
+ // }
235
+ // ]
236
+ // };
237
+
238
+ const inboxWidget = existingWidgets.find(w => w.name === 'workflow_inbox');
239
+ if (inboxWidget) {
240
+ await widgetsObj.directUpdate(inboxWidget._id, { schema: inboxSchema, label: '待审核', sort: 10 });
241
+ } else {
242
+ await widgetsObj.directInsert({ name: 'workflow_inbox', type: 'amis-app_launcher', label: '待审核', sort: 10, schema: inboxSchema });
243
+ }
244
+
245
+ // const outboxWidget = existingWidgets.find(w => w.name === 'workflow_outbox');
246
+ // if (outboxWidget) {
247
+ // await widgetsObj.directUpdate(outboxWidget._id, { schema: outboxSchema, label: '已审核', sort: 20 });
248
+ // } else {
249
+ // await widgetsObj.directInsert({ name: 'workflow_outbox', type: 'amis-app_launcher', label: '已审核', sort: 20, schema: outboxSchema });
250
+ // }
251
+ } catch (error) {
252
+ console.error('Failed to register app_launcher widgets:', error.message);
253
+ }
254
+
143
255
  if((process.env.STEEDOS_CRON_ENABLED === true || process.env.STEEDOS_CRON_ENABLED === 'true')){
144
256
 
145
257
  if (process.env.STEEDOS_CRON_INSTANCERECORDQUEUE_INTERVAL) {