@steedos-labs/plugin-workflow 3.0.12 → 3.0.14

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 (28) hide show
  1. package/AI_PLUGIN_GUIDE.md +939 -0
  2. package/README.md +24 -1
  3. package/main/default/applications/approve_workflow.app.yml +160 -3
  4. package/main/default/manager/handlers_manager.js +1 -1
  5. package/main/default/manager/instance_number_rules.js +84 -0
  6. package/main/default/manager/instance_tasks_manager.js +79 -1
  7. package/main/default/manager/uuflow_manager.js +53 -45
  8. package/main/default/objects/flows/buttons/design_form_layout.button.js +1 -3
  9. package/main/default/objects/flows/flows.object.yml +4 -3
  10. package/main/default/objects/instances/buttons/instance_reassign.button.yml +5 -4
  11. package/main/default/pages/instance_detail.page.amis.json +2 -100
  12. package/main/default/pages/instance_tasks_detail.page.amis.json +0 -100
  13. package/main/default/pages/page_instance_view.page.amis.json +1 -1
  14. package/main/default/routes/api_auto_number.router.js +233 -0
  15. package/main/default/routes/api_files.router.js +21 -0
  16. package/main/default/routes/api_have_read.router.js +20 -2
  17. package/main/default/routes/api_workflow_chart.router.js +23 -3
  18. package/main/default/routes/api_workflow_instance_upgrade.router.js +5 -0
  19. package/main/default/routes/api_workflow_nav.router.js +160 -136
  20. package/main/default/routes/api_workflow_next_step.router.js +111 -30
  21. package/main/default/routes/flow_form_design.ejs +16 -1
  22. package/main/default/services/instance.service.js +10 -1
  23. package/package.json +1 -1
  24. package/public/workflow/index.css +208 -10
  25. package/main/default/pages/instance_tasks_list.page.amis.json +0 -330
  26. package/main/default/pages/instance_tasks_list.page.yml +0 -12
  27. package/main/default/pages/instances_list.page.amis.json +0 -327
  28. package/main/default/pages/instances_list.page.yml +0 -12
@@ -1,327 +0,0 @@
1
- {
2
- "type": "page",
3
- "body": [
4
- {
5
- "type": "service",
6
- "className": "h-full",
7
- "body": [
8
- {
9
- "type": "wrapper",
10
- "size": "none",
11
- "className": "flex flex-1 overflow-hidden h-full",
12
- "body": [
13
- {
14
- "type": "wrapper",
15
- "size": "none",
16
- "className": "instances-sidebar-wrapper flex-shrink-0 min-w-[240px] overflow-y-auto m-0 lg:order-first lg:flex lg:flex-col bg-white border-r",
17
- "body": [
18
- {
19
- "type": "service",
20
- "id": "u:instanceNav",
21
- "className": "bg-none",
22
- "onEvent": {
23
- "@data.changed.instances": {
24
- "actions": [
25
- {
26
- "actionType": "reload"
27
- }
28
- ]
29
- }
30
- },
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
- },
45
- {
46
- "type": "input-tree",
47
- "name": "tree",
48
- "treeContainerClassName": "h-full",
49
- "className": "instance-box-tree h-full w-full p-0",
50
- "id": "u:9f3dd961ca12",
51
- "stacked": true,
52
- "multiple": false,
53
- "enableNodePath": false,
54
- "hideRoot": true,
55
- "showIcon": true,
56
- "initiallyOpen": false,
57
- "virtualThreshold": 100000,
58
- "value": "${value}",
59
- "size": "md",
60
- "onEvent": {
61
- "change": {
62
- "actions": [
63
- {
64
- "actionType": "setValue",
65
- "componentId": "instances_list_service",
66
- "args": {
67
- "value": {
68
- "isFlowDataDone": false
69
- }
70
- }
71
- },
72
- {
73
- "actionType": "custom",
74
- "script": "if (window.innerWidth < 768) { document.querySelector('.instances-customPage').classList.remove('instances-sidebar-open'); }\n//获取上一次的flowId和categoryId\nconst lastFlowId = event.data.flowId;\nconst lastCategoryId = event.data.categoryId;\n//从value中获取最新的flowId\nvar flowIdRegex = /&flowId=([^&]+)/;\nvar flowIdMatch = event.data.value.match(flowIdRegex);\nconst flowId = flowIdMatch && flowIdMatch.length > 0 ? flowIdMatch[1] : \"\";\n//从value中获取最新的categoryId\nvar categoryIdRegex = /&categoryId=([^&]+)/;\nvar categoryIdMatch = event.data.value.match(categoryIdRegex);\nconst categoryId = categoryIdMatch && categoryIdMatch.length > 0 ? categoryIdMatch[1] : \"\";\n//获取上一次的listname和最新的listname\nconst lastListName = event.data.listName;\nconst listName = event.data.value.split('?')[0].split('instances/grid/')[1];\n//切换流程时清除过滤条件\nif (lastListName == \"monitor\" && listName == \"monitor\" && (flowId != lastFlowId || categoryId != lastCategoryId)) {\n listViewPropsStoreKey = window.location.pathname + \"/crud\";\n sessionStorage.removeItem(listViewPropsStoreKey);\n sessionStorage.removeItem(listViewPropsStoreKey + \"/query\");\n}"
75
- },
76
- {
77
- "actionType": "setValue",
78
- "componentId": "instances_list_service",
79
- "args": {
80
- "value": {
81
- "additionalFilters": [
82
- "${event.data.options.name}",
83
- "=",
84
- "${event.data.options.value}"
85
- ]
86
- }
87
- },
88
- "expression": "${event.data.options.level>=10}"
89
- },
90
- {
91
- "args": {
92
- "link": "${event.data.value}",
93
- "blank": false
94
- },
95
- "actionType": "link"
96
- }
97
- ]
98
- }
99
- },
100
- "menuTpl": {
101
- "type": "wrapper",
102
- "className": "flex flex-row p-0 m-0",
103
- "body": [
104
- {
105
- "type": "tpl",
106
- "className": "flex-1 w-6/12",
107
- "tpl": "${label}",
108
- "id": "u:9dee51f00db4"
109
- },
110
- {
111
- "type": "tpl",
112
- "className": "-mx-11 ",
113
- "tpl": "",
114
- "badge": {
115
- "className": "h-0",
116
- "offset": [
117
- -20,
118
- 12
119
- ],
120
- "mode": "text",
121
- "text": "${tag | toInt}",
122
- "overflowCount": 999
123
- },
124
- "id": "u:2329cd1fecc2"
125
- }
126
- ],
127
- "id": "u:545154bcc334"
128
- },
129
- "unfoldedLevel": 2,
130
- "source": "${options}"
131
- }
132
- ],
133
- "api": {
134
- "method": "get",
135
- "url": "${context.rootUrl}/api/${appId}/workflow/nav",
136
- "headers": {
137
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
138
- },
139
- "messages": {},
140
- "adaptor": "payload.data.value = window.location.pathname + decodeURIComponent(window.location.search); return payload;"
141
- },
142
- "messages": {},
143
- "dsType": "api"
144
- }
145
- ],
146
- "isFixedHeight": false,
147
- "isFixedWidth": false
148
- },
149
- {
150
- "type": "button",
151
- "className": "instances-sidebar-overlay",
152
- "id": "u:773b1d00aab2",
153
- "visibleOn": "${isMobile}",
154
- "body": [],
155
- "onEvent": {
156
- "click": {
157
- "actions": [
158
- {
159
- "actionType": "custom",
160
- "script": "document.querySelector('.instances-customPage').classList.toggle('instances-sidebar-open');"
161
- }
162
- ]
163
- }
164
- }
165
- },
166
- {
167
- "type": "wrapper",
168
- "size": "none",
169
- "className": "flex-1 focus:outline-none lg:order-last",
170
- "body": [
171
- {
172
- "type": "steedos-object-listview",
173
- "objectApiName": "instances",
174
- "columnsTogglable": false,
175
- "filterVisible": true,
176
- "visibleOn": "${!!!flowId}",
177
- "showHeader": true,
178
- "id": "u:d29cef0d1007",
179
- "showDisplayAs": true,
180
- "hiddenColumnOperation": true,
181
- "formFactor": "LARGE",
182
- "headerToolbarItems": [
183
- {
184
- "type": "button",
185
- "label": "",
186
- "align": "left",
187
- "icon": "fa fa-bars",
188
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
189
- "onEvent": {
190
- "click": {
191
- "actions": [
192
- {
193
- "actionType": "custom",
194
- "script": "document.querySelector('.instances-customPage').classList.toggle('instances-sidebar-open');"
195
- }
196
- ]
197
- }
198
- },
199
- "id": "u:6f237cc36419"
200
- }
201
- ],
202
- "listName": "completed",
203
- "rebuildOn": "${flowId || categoryId}",
204
- "adaptor": "//在列表上加流程表单字段时,group和user需要特殊处理\nif (api.body.self.listName == \"monitor\") {\n _.each(payload.data.rows, function (item, index) {\n if (item.values) {\n const form_fields = api.body.self.form_fields;\n _.each(item.values, function (field, field_code) {\n const form_field = _.find(form_fields, { code: field_code });\n if (form_field && form_field.type == \"group\") {\n if (form_field.is_multiselect) {\n item.values[field_code] = field && field.length > 0 ? _.map(field, 'fullname').toString() : \"\";\n } else {\n item.values[field_code] = field ? field.fullname : \"\";\n }\n } else if (form_field && form_field.type == \"user\") {\n if (form_field.is_multiselect) {\n item.values[field_code] = field && field.length > 0 ? _.map(field, 'name').toString() : \"\";\n } else {\n item.values[field_code] = field ? field.name : \"\";\n }\n }\n })\n }\n })\n}\n",
205
- "crudDataFilter": "if (data && data.flowId && (data.listName == 'inbox' || 'monitor') && window.innerWidth > 768) {\r\n var api = {\r\n url: \"${context.rootUrl}/graphql\",\r\n method: \"post\",\r\n dataType: \"json\",\r\n data: {\r\n \"query\": '{flow: flows__findOne(id:\"' + data.flowId + '\"){form__expand{current}}}'\r\n },\r\n headers: {\r\n Authorization:\r\n \"Bearer ${context.tenantId},${context.authToken}\",\r\n },\r\n };\r\n return env.fetcher(api).then((result) => {\r\n if (result.data && result.data.flow && result.data.flow.form__expand.current.fields && result.data.flow.form__expand.current.fields.length > 0) {\r\n let fields = result.data.flow.form__expand.current.fields;\r\n fields.forEach(function (field) {\r\n if (field.is_list_display && data.display !== 'split') {\r\n crud.columns.push({\r\n \"name\": \"values.\" + field.code,\r\n \"label\": field.name || field.code,\r\n \"width\": \"unset\",\r\n \"type\": \"text\",\r\n \"className\": \" whitespace-nowrap\",\r\n \"static\": true,\r\n \"options\": null\r\n });\r\n }\r\n })\r\n let schemaApiService = data._scoped.parent.getComponentById(\"instances_list_service\");\r\n schemaApiService && schemaApiService.setData({ form_fields: fields, isFlowDataDone: true });\r\n // crud.api.sendOn = \"this.isFlowDataDone\";\r\n }\r\n return crud;\r\n });\r\n} else {\r\n let schemaApiService = data._scoped.parent.getComponentById(\"instances_list_service\");\r\n schemaApiService && schemaApiService.setData({ isFlowDataDone: true });\r\n // crud.api.sendOn = \"this.isFlowDataDone\";\r\n return crud;\r\n}\r\n"
206
- },
207
- {
208
- "type": "service",
209
- "visibleOn": "${!!flowId && listName == 'monitor'}",
210
- "schemaApi": {
211
- "url": "/graphql?flowId=${flowId}&categoryId=${categoryId}",
212
- "method": "post",
213
- "data": {
214
- "query": "{flow: flows__findOne(id:\"${flowId}\"){form__expand{current}}}"
215
- },
216
- "adaptor": "const schema = window.SteedosWorkflow.Instance.getListViewSchema(payload.data.flow); return schema;"
217
- },
218
- "id": "u:30c21a4ee7cb",
219
- "dsType": "api"
220
- }
221
- ],
222
- "id": "u:ca495ec221e7"
223
- }
224
- ],
225
- "id": "u:9526a450d59b"
226
- }
227
- ],
228
- "id": "instances_list_service",
229
- "onEvent": {
230
- "@data.changed.steedos_keyvalues": {
231
- "actions": [
232
- {
233
- "actionType": "broadcast",
234
- "args": {
235
- "eventName": "@data.changed.instances"
236
- },
237
- "data": {
238
- "objectName": "instances",
239
- "recordId": "reload"
240
- }
241
- }
242
- ]
243
- }
244
- },
245
- "data": {
246
- "isMobile": "${window:innerWidth <= 768}",
247
- "isFlowDataDone": false
248
- },
249
- "dsType": "api"
250
- }
251
- ],
252
- "regions": [
253
- "body"
254
- ],
255
- "data": {
256
- "objectName": "instances",
257
- "initialValues": {},
258
- "title": "",
259
- "context": {}
260
- },
261
- "id": "u:b7167e2fcaf0",
262
- "name": "page_instances_list",
263
- "bodyClassName": "p-0",
264
- "asideResizor": false,
265
- "pullRefresh": {
266
- "disabled": true
267
- },
268
- "className": {
269
- "instances-customPage h-full": true,
270
- "instances-list-mobile": "${window:innerWidth < 768}",
271
- "instances-list-pc instances-sidebar-open": "${window:innerWidth > 768}"
272
- },
273
- "style": {},
274
- "dsType": "api",
275
- "css": {
276
- ".instances-customPage.instances-list-mobile .instances-sidebar-wrapper": {
277
- "z-index": "601",
278
- "top": "50px",
279
- "left": "0px",
280
- "bottom": "0px",
281
- "position": "fixed",
282
- "margin": "0px"
283
- },
284
- ".instances-customPage.instances-list-mobile .instances-sidebar-overlay": {
285
- "z-index": "600",
286
- "position": "fixed",
287
- "bottom": "0px",
288
- "right": "0px",
289
- "left": "0px",
290
- "top": "50px",
291
- "display": "none"
292
- },
293
- ".instances-customPage.instances-list-mobile.instances-sidebar-open .instances-sidebar-overlay": {
294
- "display": "block"
295
- },
296
- ".instances-customPage .instances-sidebar-wrapper": {
297
- "transition": "0.5s ease transform",
298
- "will-change": "transform",
299
- "transform": "translate(-100%,0)",
300
- "-webkit-transform": "translate(-100%,0)",
301
- "-moz-transform": "translate(-100%,0)",
302
- "-ms-transform": "translate(-100%,0)",
303
- "-o-transform": "translate(-100%,0)"
304
- },
305
- ".instances-customPage.instances-sidebar-open .instances-sidebar-wrapper": {
306
- "transform": "translate(0,0)",
307
- "-webkit-transform": "translate(0,0)",
308
- "-moz-transform": "translate(0,0)",
309
- "-ms-transform": "translate(0,0)",
310
- "-o-transform": "translate(0,0)"
311
- },
312
- ".instances-customPage.instances-list-pc .instances-sidebar-wrapper": {
313
- "min-width": "0px",
314
- "width": "0px"
315
- },
316
- ".instances-customPage.instances-list-pc.instances-sidebar-open .instances-sidebar-wrapper": {
317
- "min-width": "240px"
318
- }
319
- },
320
- "themeCss": {
321
- "baseControlClassName": {
322
- "padding-and-margin:default": {
323
- "padding": "${displayAs == 'grid'?'':'0px'}"
324
- }
325
- }
326
- }
327
- }
@@ -1,12 +0,0 @@
1
- name: instances_list
2
- is_active: true
3
- label: 审批单列表
4
- object_name: instances
5
- pageAssignments:
6
- - type: orgDefault
7
- page: instances_list
8
- desktop: true
9
- mobile: true
10
- render_engine: amis
11
- type: list
12
- widgets: []