@steedos-labs/plugin-workflow 3.0.80 → 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.80';
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
  })
@@ -31,7 +31,7 @@ amis_schema: |-
31
31
  "visibleOn": "${deleting}",
32
32
  "body": [
33
33
  { "type": "spinner", "show": true, "size": "sm" },
34
- { "type": "tpl", "tpl": "正在删除,请稍候..." }
34
+ { "type": "tpl", "tpl": "${'CustomLabels.instance_deleting_please_wait' | t}" }
35
35
  ]
36
36
  }
37
37
  ],
@@ -36,7 +36,7 @@ amis_schema: |-
36
36
  "visibleOn": "${deleting}",
37
37
  "body": [
38
38
  { "type": "spinner", "show": true, "size": "sm" },
39
- { "type": "tpl", "tpl": "正在删除,请稍候..." }
39
+ { "type": "tpl", "tpl": "${'CustomLabels.instance_deleting_please_wait' | t}" }
40
40
  ]
41
41
  }
42
42
  ],
@@ -104,8 +104,14 @@ amis_schema: |-
104
104
  "expression": "${event.data.responseResult.responseStatus===0}"
105
105
  },
106
106
  {
107
- "actionType": "refresh",
108
- "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) {}"
109
115
  }
110
116
  ]
111
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.80",
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) {