@steedos/service-core-objects 3.0.7-beta.1 → 3.0.7-beta.3

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,16 @@
1
+ name: lookup
2
+ columns:
3
+ - name
4
+ label: Lookup Users
5
+ filter_scope: space
6
+ filters:
7
+ - - user_accepted
8
+ - '='
9
+ - true
10
+ sort:
11
+ - - sort_no
12
+ - desc
13
+ - - name
14
+ - asc
15
+ extra_columns:
16
+ - sort_no
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-core-objects",
3
- "version": "3.0.7-beta.1",
3
+ "version": "3.0.7-beta.3",
4
4
  "main": "package.service.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,7 +9,7 @@
9
9
  "steedos"
10
10
  ],
11
11
  "dependencies": {
12
- "@steedos/service-package-loader": "3.0.7-beta.1",
12
+ "@steedos/service-package-loader": "3.0.7-beta.3",
13
13
  "bcryptjs": "^3.0.3",
14
14
  "json2xls": "^0.1.2",
15
15
  "lodash": "^4.17.21"
@@ -17,5 +17,5 @@
17
17
  "description": "steedos package",
18
18
  "repository": {},
19
19
  "license": "MIT",
20
- "gitHead": "00bf759c06e2afa2dd043377addd7c95d9ea8a99"
20
+ "gitHead": "ef6ed92d244835fae9ca3436e7be6f9eb362ffdd"
21
21
  }
@@ -1,552 +0,0 @@
1
- {
2
- "type": "page",
3
- "title": "Welcome to Steedos",
4
- "body": [
5
- {
6
- "type": "service",
7
- "body": [
8
- {
9
- "type": "service",
10
- "id": "service_field_design",
11
- "body": [
12
- {
13
- "type": "form",
14
- "title": "",
15
- "body": [
16
- {
17
- "type": "panel",
18
- "header": {
19
- "type": "flex",
20
- "id": "u:b2c8374e93fe",
21
- "items": [
22
- {
23
- "type": "tpl",
24
- "tpl": "<p><h4><strong>设计字段布局</strong></h4> ${designObjectLabel}<span style=\"color: rgb(149, 165, 166);\"> ${designObjectName}</span></p>",
25
- "id": "u:4c7bef616400"
26
- },
27
- {
28
- "type": "flex",
29
- "id": "u:1bfde03380f8",
30
- "items": [
31
- {
32
- "type": "button",
33
- "id": "u:ec9931ea883c",
34
- "actionType": "dialog",
35
- "dialog": {
36
- "type": "dialog",
37
- "title": "设置分组",
38
- "size": "lg",
39
- "data": {
40
- "&": "$$",
41
- "groups": "${groups|filter:is_default:isFalse|filter:is_hidden:isFalse}",
42
- "designObjectName": "${designObjectName}",
43
- "__updateDone": false
44
- },
45
- "body": [
46
- {
47
- "type": "form",
48
- "mode": "normal",
49
- "onEvent": {
50
- "change": {
51
- "actions": [
52
- {
53
- "actionType": "setValue",
54
- "componentId": "steedos-set-group",
55
- "args": {
56
- "value": {
57
- "__updateDone": true
58
- }
59
- }
60
- }
61
- ]
62
- }
63
- },
64
- "body": [
65
- {
66
- "type": "service",
67
- "body": [
68
- {
69
- "type": "steedos-input-table",
70
- "enableDialog": false,
71
- "input-table": {
72
- "onEvent": {
73
- "change": {
74
- "actions": [
75
- {
76
- "actionType": "setValue",
77
- "componentId": "steedos-set-group",
78
- "args": {
79
- "value": {
80
- "__updateDone": false
81
- }
82
- }
83
- }
84
- ]
85
- }
86
- }
87
- },
88
- "fields": [
89
- {
90
- "name": "group_name",
91
- "label": "名称",
92
- "type": "text",
93
- "id": "u:31952daa443c"
94
- },
95
- {
96
- "name": "visible_on",
97
- "label": "显示条件",
98
- "type": "text",
99
- "amis": {
100
- "type": "input-formula",
101
- "name": "formula",
102
- "evalMode": false,
103
- "variableMode": "tabs",
104
- "variables": "${variables}"
105
- },
106
- "id": "u:8d7551abcd28",
107
- "value": null
108
- },
109
- {
110
- "name": "collapsed",
111
- "label": "默认折叠",
112
- "type": "boolean"
113
- }
114
- ],
115
- "columns": [
116
- {
117
- "name": "group_name"
118
- },
119
- {
120
- "name": "visible_on"
121
- },
122
- {
123
- "name": "collapsed",
124
- "width": 50
125
- }
126
- ],
127
- "name": "groups",
128
- "addable": true,
129
- "editable": true,
130
- "removable": true,
131
- "draggable": false,
132
- "id": "u:776ec89804c0",
133
- "label": "",
134
- "visibleOn": "${variables}"
135
- }
136
- ],
137
- "api": {
138
- "method": "get",
139
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${designObjectName}/fields/options",
140
- "adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.data.options)}};return payload;",
141
- "cache": 30000,
142
- "headers": {
143
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
144
- }
145
- }
146
- }
147
- ]
148
- }
149
- ],
150
- "actions": [
151
- {
152
- "type": "action",
153
- "label": "取消",
154
- "actionType": "cancel"
155
- },
156
- {
157
- "type": "action",
158
- "label": "确认",
159
- "level": "primary",
160
- "onEvent": {
161
- "click": {
162
- "actions": [
163
- {
164
- "actionType": "custom",
165
- "script": "///整理分组数据\nconst defaultGroupName = \"未分组\";\nconst hiddenGroupName = \"隐藏\";\nlet setting_groups = _.cloneDeep(event.data.groups);\nif (!_.find(setting_groups, { is_default: true })) {\n setting_groups.unshift({\n \"id\": \"default-group\",\n \"group_name\": defaultGroupName,\n \"visible_on\": \"\",\n \"is_default\": true\n })\n}\nif (!_.find(setting_groups, { is_hidden: true })) {\n setting_groups.push({\n id: \"hidden-group\",\n group_name: hiddenGroupName,\n visible_on: \"\",\n is_hidden: true\n });\n}\nsetting_groups.forEach(function (group) {\n if (!group.id) {\n group.id = window.BuilderAmisObject.AmisLib.uuidv4();\n }\n if (/\\$\\{.+\\}/.test(group.visible_on)) {\n group.visible_on = group.visible_on.replaceAll('${', '\\\\${');\n }\n})\n\n//整理字段与分组关系的数据\nlet design_field = {};\nlet oldGroup = _.cloneDeep(event.data.design_field);\nsetting_groups.forEach(function (group) {\n if (_.has(oldGroup, group.id)) {\n design_field[group.id] = oldGroup[group.id];\n oldGroup = _.omit(oldGroup, group.id);\n } else {\n design_field[group.id] = [];\n }\n})\n//当有分组被删除时,会进入以下if,将该分组下所有字段放入未分组中\nif (oldGroup && !_.isEmpty(oldGroup)) {\n _.forEach(oldGroup, function (value, key) {\n design_field[\"default-group\"] = _.unionBy(design_field[\"default-group\"], value);\n });\n}\n\n//未分组 放在所有分组开头,隐藏 放在所有分组最后\nconst defaultGroup = design_field['default-group'];\nconst hiddenGroup = design_field['hidden-group'];\ndelete design_field['default-group'];\ndelete design_field['hidden-group'];\ndesign_field = _.merge({ 'default-group': defaultGroup }, design_field, { 'hidden-group': hiddenGroup });\n\n//根据design_field调整groups顺序,设置分组与保存时需要groups按照顺序\nconst keys = _.keys(design_field);\nsetting_groups = _.sortBy(setting_groups, function (group) { return _.findIndex(keys, function (key) { return key == group.id }) });\n\ndoAction({\n actionType: 'setValue',\n componentId: 'form_field_design',\n args: {\n value: {\n groups: setting_groups,\n design_field\n }\n }\n});"
166
- },
167
- {
168
- "actionType": "closeDialog"
169
- }
170
- ]
171
- }
172
- },
173
- "disabledOn": "${!__updateDone}"
174
- }
175
- ],
176
- "id": "steedos-set-group",
177
- "closeOnEsc": false,
178
- "closeOnOutside": false,
179
- "showCloseButton": true,
180
- "showErrorMsg": true,
181
- "showLoading": true
182
- },
183
- "label": "设置分组",
184
- "className": "",
185
- "disabledOn": "${!__changeDone}"
186
- },
187
- {
188
- "type": "button",
189
- "label": "新增字段",
190
- "actionType": "dialog",
191
- "id": "u:5857ae729799",
192
- "visible": false,
193
- "dialog": {
194
- "type": "dialog",
195
- "title": "新增字段",
196
- "data": {
197
- "appId": "${appId}",
198
- "global": "${global}",
199
- "context": "${context}",
200
- "designObjectName": "${designObjectName}",
201
- "_master": "${_master}"
202
- },
203
- "body": [
204
- {
205
- "type": "steedos-object-form",
206
- "label": "对象表单",
207
- "objectApiName": "object_fields",
208
- "recordId": "",
209
- "mode": "edit",
210
- "defaultData": {
211
- "object": "${designObjectName}"
212
- },
213
- "fieldsExtend": {
214
- "object": {
215
- "amis": {
216
- "disabledOn": "true"
217
- }
218
- },
219
- "group": {
220
- "amis": {
221
- "hidden": true
222
- }
223
- }
224
- },
225
- "fields": "",
226
- "id": "u:b71796d3cb8c",
227
- "className": "mb-4",
228
- "enableTabs": true,
229
- "tabsMode": "line"
230
- }
231
- ],
232
- "showCloseButton": true,
233
- "showErrorMsg": true,
234
- "showLoading": true,
235
- "closeOnEsc": false,
236
- "dataMapSwitch": false,
237
- "size": "lg",
238
- "id": "u:066b3884bdd8"
239
- }
240
- },
241
- {
242
- "type": "button",
243
- "label": "保存",
244
- "actionType": "submit",
245
- "id": "u:d9039421ea6b",
246
- "target": "form_field_design",
247
- "level": "primary",
248
- "disabledOn": "${!__changeDone}"
249
- }
250
- ]
251
- }
252
- ],
253
- "style": {
254
- "position": "static",
255
- "flexWrap": "nowrap",
256
- "justifyContent": "space-between",
257
- "alignItems": "baseline"
258
- },
259
- "isFixedHeight": false,
260
- "isFixedWidth": false
261
- },
262
- "body": [
263
- {
264
- "type": "steedos-board",
265
- "id": "steedos_field_deign",
266
- "columns": 2,
267
- "name": "design_field",
268
- "boardSource": "${groups}",
269
- "boardClassName": "bg-gray-50 p-2 ",
270
- "header": {
271
- "className": ""
272
- },
273
- "boardHeader": {
274
- "type": "tpl",
275
- "tpl": "${group_name}",
276
- "id": "u:76d9a6c7d401"
277
- },
278
- "cardClassName": "p-1 bg-white border w-full rounded shadow",
279
- "cardSchema": {
280
- "type": "card",
281
- "body": [
282
- {
283
- "type": "tpl",
284
- "tpl": "<p><strong>${label}</strong> ${designObjectLabel}<span style=\"color: rgb(149, 165, 166);\">${_name}</span></p>",
285
- "className": "w-4/5",
286
- "inline": true
287
- },
288
- {
289
- "type": "action",
290
- "className": "w-4/5 mr-7",
291
- "label": "",
292
- "id": "steedos-field-edit-button",
293
- "icon": "fa fa-pencil",
294
- "level": "link",
295
- "actionType": "dialog",
296
- "dialog": {
297
- "title": "编辑字段",
298
- "body": [
299
- {
300
- "type": "service",
301
- "body": {
302
- "type": "steedos-object-form",
303
- "label": "对象表单",
304
- "objectApiName": "object_fields",
305
- "recordId": "${_id}",
306
- "mode": "edit",
307
- "defaultData": {
308
- "object": "${designObjectName}"
309
- },
310
- "fields": [
311
- "label",
312
- "readonly",
313
- "is_wide",
314
- "visible_on"
315
- ],
316
- "fieldsExtend": {
317
- "label": {
318
- "is_wide": true,
319
- "group": ""
320
- },
321
- "readonly": {
322
- "group": ""
323
- },
324
- "is_wide": {
325
- "group": ""
326
- },
327
- "visible_on": {
328
- "group": "",
329
- "amis": {
330
- "type": "input-formula",
331
- "name": "formula",
332
- "evalMode": false,
333
- "variableMode": "tabs",
334
- "variables": "${variables}",
335
- "visibleOn": "${variables}",
336
- "id": "u:618105d5bfad"
337
- }
338
- }
339
- },
340
- "id": "u:b71796d3cb8c",
341
- "className": "mb-4",
342
- "apiRequestAdaptor": "api.data.query = api.data.query.replace('object_fields__update', 'object_fields__upsert')",
343
- "onEvent": {
344
- "submitSucc": {
345
- "weight": 0,
346
- "actions": [
347
- {
348
- "actionType": "custom",
349
- "script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
350
- }
351
- ]
352
- }
353
- }
354
- },
355
- "api": {
356
- "method": "get",
357
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${designObjectName}/fields/options",
358
- "adaptor": "payload = {data: {variables: SteedosUI.getFormulaVariables(payload.data.options)}};return payload;",
359
- "cache": 30000,
360
- "headers": {
361
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
362
- }
363
- }
364
- }
365
-
366
- ],
367
- "type": "dialog",
368
- "data": {
369
- "appId": "${appId}",
370
- "global": "${global}",
371
- "context": "${context}",
372
- "designObjectName": "${designObjectName}",
373
- "_master": "${_master}",
374
- "_id": "${_id}"
375
- },
376
- "showCloseButton": true,
377
- "showErrorMsg": true,
378
- "showLoading": true,
379
- "closeOnEsc": false,
380
- "dataMapSwitch": false,
381
- "size": "md",
382
- "id": "u:066b3884bdd8"
383
- },
384
- "size": "xs"
385
- }
386
- ],
387
- "bodyClassName": "h-7 flex justify-between items-center p-0 pl-10 my-2",
388
- "toolbar": [],
389
- "className": "mb-0 border-0 bg-none card",
390
- "id": "u:296298da1bef"
391
- },
392
- "cardSource": "${fields}",
393
- "vertical": true,
394
- "value": "${fieldForGroup}",
395
- "onEvent": {
396
- "change": {
397
- "actions": [
398
- {
399
- "actionType": "setValue",
400
- "componentId": "service_field_design",
401
- "args": {
402
- "value": {
403
- "__changeDone": false
404
- }
405
- }
406
- }
407
- ]
408
- }
409
- }
410
- }
411
- ],
412
- "className": "Panel--default max-w-4xl m-auto",
413
- "id": "u:3a90104cb6b4"
414
- }
415
- ],
416
- "id": "form_field_design",
417
- "api": {
418
- "url": "${context.rootUrl}/graphql",
419
- "method": "post",
420
- "dataType": "json",
421
- "headers": {
422
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
423
- },
424
- "requestAdaptor": "var graphqlOrder = \"\";\nvar field_groups = _.cloneDeep(api.data.groups);\n//先修改字段,使系统对象自行自定义\n//根据design_field,修改对象字段的sort_no与groups\nvar index = 1;\nconst defaultGroupId = _.find(field_groups, { 'is_default': true })?.id;\nconst hiddenGroupId = _.find(field_groups, { 'is_hidden': true })?.id;\n_.forEach(api.data.design_field, function (items, key) {\n let group = _.find(field_groups, { 'id': key }).group_name;\n if (key == defaultGroupId || key == hiddenGroupId) {\n group = null;\n }\n _.forEach(items, function (item) {\n const field = _.find(api.data.fields, { 'id': item });\n //如果是在隐藏分组里的字段,就给visible_on属性赋予{{false}};如果不在隐藏分组里,就判断来自数据库内的visible_on属性是不是{{false}},是就清除,不是就保持不变\n const visible_on = key == hiddenGroupId ? \"{{false}}\" : (field.attr_visible_on == \"{{false}}\" ? \"{{true}}\" : field.attr_visible_on);\n let docJson = {\n sort_no: index * 10,\n group, visible_on\n }\n if (field.id == field._id && field.is_system) {\n docJson = {\n object: api.data.$self.designObjectName,\n type: field.type,\n _name: field._name,\n label: field.label,\n sort_no: index * 10,\n group,\n visible_on,\n is_system: field.is_system\n }\n }\n if (key != hiddenGroupId) {\n docJson.hidden = false;\n }\n let itemOrder = 'upsert' + index + ':object_fields__upsert(id:\"' + item + '\" , doc:' + JSON.stringify(JSON.stringify(docJson)) + '){_id}\\n';\n graphqlOrder += itemOrder;\n index++;\n })\n})\n\n//根据groups,修改对象的字段分组field_groups\n_.remove(field_groups, { is_default: true });\n_.remove(field_groups, { is_hidden: true });\nconst keys = _.keys(api.data.design_field);\nfield_groups = _.sortBy(field_groups, function (group) { return _.findIndex(keys, function (key) { return key == group.id }) });\nfield_groups = field_groups.map(function (group) {\n return _.omit(group, 'id');\n})\nconst groupOrder = 'upsert0:objects__upsert(id:\"' + api.data.$self.designObjectId + '\" , doc:' + JSON.stringify(JSON.stringify({ field_groups, name: api.data.$self.designObjectName })) + ') {_id}';\ngraphqlOrder += groupOrder;\n\n\ngraphqlOrder = 'mutation {' + graphqlOrder + '}';\nreturn {\n ...api,\n data: {\n query: graphqlOrder\n }\n}",
425
- "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[\n 0\n ].message) : payload.errors[\n 0\n ].message;\n}\nreturn payload;",
426
- "messages": {},
427
- "data": {
428
- "design_field": "${design_field}",
429
- "groups": "${groups}",
430
- "fields": "${fields}",
431
- "$self": "$$"
432
- }
433
- },
434
- "visibleOn": "${dataInitialed}",
435
- "wrapWithPanel": false,
436
- "name": "form_field_design",
437
- "onEvent": {
438
- "submitSucc": {
439
- "weight": 0,
440
- "actions": [
441
- {
442
- "actionType": "custom",
443
- "script": "setTimeout(() => {\n doAction({\n \"actionType\": \"broadcast\",\n \"args\": {\n \"eventName\": \"@data.changed.object_fields\"\n }\n });\n}, 500);\n\n\n"
444
- }
445
- ]
446
- },
447
- "change": {
448
- "actions": [
449
- {
450
- "actionType": "setValue",
451
- "componentId": "service_field_design",
452
- "args": {
453
- "value": {
454
- "__changeDone": true
455
- }
456
- }
457
- }
458
- ]
459
- }
460
- }
461
- }
462
- ],
463
- "api": {
464
- "method": "post",
465
- "url": "${context.rootUrl}/graphql?designObjectId=${designObjectId}",
466
- "data": {
467
- "query": "{fields:object_fields(filters: [[\"object\",\"=\",\"${designObjectName}\"]],sort: \"sort_no asc\"){_id,label,_name,group,type,sort_no,modified,is_wide,is_system,hidden,visible_on,recordPermissions: _permissions{allowEdit}}}",
468
- "field_groups": "${field_groups}",
469
- "dataInitialed": "${dataInitialed}",
470
- "designObjectName": "${designObjectName}",
471
- "eventData": "${eventData}",
472
- "fieldForGroup": "${fieldForGroup}"
473
- },
474
- "headers": {
475
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
476
- },
477
- "messages": {},
478
- "requestAdaptor": "",
479
- "adaptor": "//筛选出可编辑的字段\nvar oldFields = _.filter(payload.data.fields, function (obj) { return obj.recordPermissions.allowEdit; });\n//将group为空的字段分为未分组的组中,将系统字段的_id改为对象名.字段名\noldFields = _.map(oldFields, function (obj) {\n obj.originId = obj._id;\n if (obj.hidden || obj.visible_on == \"{{false}}\") {\n obj.group = \"隐藏\";\n }else if (obj.group === null) {\n obj.group = \"未分组\";\n }\n if (obj.is_system) {\n obj._id = api.data.designObjectName + \".\" + obj._name;\n }\n return obj;\n});\n\n//整合出字段的属性集合\nconst fields = oldFields.map((field) => {\n return {\n \"id\": field._id,//用与steedos-board组件的关系分辨\n \"_name\": field._name,\n \"label\": field.label,\n \"_id\": field.originId,//用于打开steedos-object-form\n \"columnSpan\": field.is_wide ? 2 : 1,\n \"is_system\": field.is_system,\n \"type\": field.type,\n \"attr_visible_on\": field.visible_on\n }\n})\n\n//去重并去除隐藏和未分组\nlet newArray = _.reject(_.uniqBy(oldFields, \"group\"), function(obj) {\n return obj.group == \"隐藏\" || obj.group == \"未分组\";\n});\n//从字段的group属性中,整合出字段分组的属性集合\nlet field_groups = _.map(newArray, function (obj) {\n return {\n \"id\": window.BuilderAmisObject.AmisLib.uuidv4(), \n \"group_name\": obj.group,\n \"visible_on\": \"\"\n };\n});\n\n//合并对象上的field_groups与字段上的group\nlet groups = _.unionBy(api.data.field_groups, field_groups, 'group_name');\n\n//判断是否第一次调用接口,不是的话(说明是触发了datachange事件),返回fields与fieldUpdateData;目前新增与删除都不支持\nif (api.data.dataInitialed) {\n const eventData = api.data.eventData;\n let fieldUpdateData = \"\";\n const fieldForGroup = api.data.fieldForGroup;\n let fieldForGroupLength = 0;\n _.forIn(fieldForGroup, function (value, key) {\n fieldForGroupLength += value.length;\n });\n if (fieldForGroupLength < fields.length) {\n fieldUpdateData = {\n type: \"insert\",\n id: eventData.result.data.recordId\n }\n } else if (fieldForGroupLength > fields.length) {\n fieldUpdateData = {\n type: \"delete\",\n id: eventData._id\n }\n }\n return payload = {\n data: {\n fields,\n fieldUpdateData\n }\n }\n}\n\n//整合字段与分组的关系\nconst oldFieldsInGroups = _.groupBy(oldFields, \"group\");\nlet fieldForGroup = _.mapValues(_.groupBy(groups, \"id\"), function (group,key) {\n if (oldFieldsInGroups[group[0].group_name]) {\n return _.map(oldFieldsInGroups[group[0].group_name], function (obj) {\n return obj._id;\n });\n } else {\n return [];\n }\n});\n\n//未分组 放在所有分组开头,隐藏 放在所有分组最后\nconst defaultGroupId = _.find(groups, { 'is_default': true }).id;\nconst hiddenGroupId = _.find(groups, { 'is_hidden': true }).id;\nconst defaultGroup = fieldForGroup[defaultGroupId];\nconst hiddenGroup = fieldForGroup[hiddenGroupId];\ndelete fieldForGroup[defaultGroupId];\ndelete fieldForGroup[hiddenGroupId];\nfieldForGroup = _.merge({ [defaultGroupId]: defaultGroup }, fieldForGroup, { [hiddenGroupId]: hiddenGroup });\n\n//根据fieldForGroup调整groups顺序,设置分组与保存时需要groups按照顺序\nconst keys = _.keys(fieldForGroup);\ngroups = _.sortBy(groups, function (group) { return _.findIndex(keys, function (key) { return key == group.id }) });\n\nreturn payload = {\n data: {\n fields,\n groups,\n fieldForGroup,\n dataInitialed: true\n }\n};",
480
- "sendOn": "!!this.designObjectId"
481
- },
482
- "messages": {},
483
- "onEvent": {
484
- "fetchInited": {
485
- "actions": [
486
- {
487
- "actionType": "custom",
488
- "script": "//新增或删除时才会触发,目前暂不支持\nconst fieldForGroup = context.props.data.fieldForGroup;\nconst fieldUpdateData = event.data.fieldUpdateData;\nif (fieldUpdateData && fieldUpdateData.type == \"delete\") {\n _.forIn(fieldForGroup, function (group, group_name) {\n _.remove(group, function (field) {\n return field === fieldUpdateData.id;\n })\n });\n} else if (fieldUpdateData && fieldUpdateData.type == \"insert\") {\n fieldForGroup[\"未分组\"].push(fieldUpdateData.id);\n}\n// doAction({\n// actionType: 'setValue',\n// componentId: \"service_field_design\",\n// args: {\n// value: { fieldForGroup }\n// }\n// });\n\ndoAction({\n actionType: 'setValue',\n componentId: \"form_field_design\",\n args: {\n value: { design_field:fieldForGroup }\n }\n});\n\n",
489
- "expression": "${event.data.fieldUpdateData}"
490
- }
491
- ]
492
- }
493
- },
494
- "initFetch": false,
495
- "data": {
496
- "eventData": "",
497
- "__changeDone": true
498
- }
499
- }
500
- ],
501
- "id": "u:02f594329e1e",
502
- "api": {
503
- "method": "post",
504
- "url": "${context.rootUrl}/graphql",
505
- "data": {
506
- "query": "{objects(filters: [[\"name\",\"=\",\"${designObjectName}\"]]){_id,name,label,field_groups}}"
507
- },
508
- "headers": {
509
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
510
- },
511
- "messages": {},
512
- "requestAdaptor": "",
513
- "adaptor": "const field_groups = payload.data.objects[0] && _.map(payload.data.objects[0].field_groups, function (obj) {\n return {\n \"id\": window.BuilderAmisObject.AmisLib.uuidv4(), //唯一性id\n \"group_name\": obj.group_name,\n \"visible_on\": obj.visible_on,\n \"collapsed\": obj.collapsed\n }\n});\nfield_groups.unshift({\n id: \"hidden-group\",\n group_name: \"隐藏\",\n visible_on: \"\",\n is_hidden: true\n});\nfield_groups.unshift({\n id: \"default-group\",\n group_name: \"未分组\",\n visible_on: \"\",\n is_default: true\n});\n\n\n\nconst designObjectId = payload.data.objects[0] && payload.data.objects[0]._id;\nreturn payload = {\n data: {\n field_groups,\n designObjectId,\n designObjectLabel: payload.data.objects[0] && payload.data.objects[0].label,\n _master: {\n recordId: designObjectId\n }\n }\n}"
514
- },
515
- "messages": {},
516
- "onEvent": {
517
- "@data.changed.object_fields": {
518
- "actions": [
519
- {
520
- "actionType": "reload",
521
- "data": {
522
- "eventData": "${event.data}"
523
- },
524
- "componentId": "service_field_design"
525
- }
526
- ]
527
- }
528
- }
529
- }
530
- ],
531
- "regions": [
532
- "body"
533
- ],
534
- "data": {
535
- "initialValues": {},
536
- "appId": "builder",
537
- "title": "",
538
- "context": "${context}",
539
- "dataInitialed": false
540
- },
541
- "id": "u:993ee4316643",
542
- "css": {
543
- ".antd-TplField p": {
544
- "margin": "0.625rem 0.625rem"
545
- }
546
- },
547
- "className": "steedos-design-field",
548
- "asideResizor": false,
549
- "pullRefresh": {
550
- "disabled": true
551
- }
552
- }
@@ -1,7 +0,0 @@
1
- name: design_field_layout
2
- is_active: true
3
- label: 设计字段布局
4
- pageAssignments: []
5
- render_engine: amis
6
- type: app
7
- widgets: []