@steedos/service-plugin-amis 2.3.0-beta.5 → 2.3.0-beta.7

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.
@@ -4,6 +4,18 @@
4
4
  .steedos .creator-content-wrapper .steedos-page .page-header-wrapper{
5
5
  display: none;
6
6
  }
7
+ .ant-modal.absolute .ant-modal-content{
8
+ /*使用绝对定位显示弹出窗口时,内层content最大高度不用限制*/
9
+ max-height: unset;
10
+ }
11
+ .page-form-object_layouts .steedos-amis-form .antd-Collapse .antd-Table-table .antd-Form--normal{
12
+ /*格式内的单元格空白太多*/
13
+ display: block!important;
14
+ }
15
+ .page-form-object_layouts .antd-Table .antd-Field--quickEditable .antd-PlainField{
16
+ /*快速编辑只读状态时编辑按钮不应该换行显示*/
17
+ display: inline;
18
+ }
7
19
  </style>`);
8
20
  $("head").append(styleCss);
9
21
  } catch (error) {
@@ -17,7 +17,7 @@
17
17
  "recordId": "${recordId}",
18
18
  "modalName": "${modalName}"
19
19
  },
20
- "requestAdaptor": "\n \n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n \n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId){\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
20
+ "requestAdaptor": "\n \n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.sort_order_options;\n delete formData.buttons_options;\n delete formData.fields_options;\n delete formData.field_groups_options;\n delete formData.related_lists_options;\n delete formData.related_object_fields_options;\n\n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId){\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
21
21
  "responseData": {
22
22
  "recordId": "${record._id}"
23
23
  },
@@ -46,7 +46,8 @@
46
46
  "required": true,
47
47
  "type": "input-text",
48
48
  "className": "col-span-2 m-0",
49
- "labelClassName": "text-left"
49
+ "labelClassName": "text-left",
50
+ "id": "u:211102f479e9"
50
51
  },
51
52
  {
52
53
  "name": "label",
@@ -54,7 +55,8 @@
54
55
  "required": true,
55
56
  "type": "input-text",
56
57
  "className": "col-span-2 m-0",
57
- "labelClassName": "text-left"
58
+ "labelClassName": "text-left",
59
+ "id": "u:1b3e658c6a5e"
58
60
  },
59
61
  {
60
62
  "name": "object_name",
@@ -72,7 +74,8 @@
72
74
  "label": "Object"
73
75
  },
74
76
  "checkAll": false,
75
- "searchable": true
77
+ "searchable": true,
78
+ "id": "u:4e769995f638"
76
79
  },
77
80
  {
78
81
  "name": "profiles",
@@ -96,20 +99,21 @@
96
99
  "adaptor": ""
97
100
  },
98
101
  "valueField": "name",
99
- "searchable": true
102
+ "searchable": true,
103
+ "id": "u:3c65447a8a6e"
100
104
  },
101
105
  {
102
106
  "type": "service",
103
107
  "body": [
104
108
  {
105
109
  "type": "panel",
106
- "title": "操作",
110
+ "title": "按钮",
107
111
  "body": [
108
112
  {
109
113
  "name": "buttons",
110
- "label": "操作",
114
+ "label": "按钮",
111
115
  "type": "crud",
112
- "strictMode": false,
116
+ "strictMode": true,
113
117
  "affixHeader": false,
114
118
  "editable": true,
115
119
  "addable": false,
@@ -117,36 +121,19 @@
117
121
  "draggable": false,
118
122
  "columns": [
119
123
  {
120
- "name": "button_name",
124
+ "name": "index",
125
+ "label": "序号",
126
+ "type": "static",
127
+ "value": "${index + 1}",
128
+ "className": "w-10",
129
+ "id": "u:c59784421c37"
130
+ },
131
+ {
132
+ "name": "button_name_label",
121
133
  "label": "名称",
122
- "quickEdit": {
123
- "type": "select",
124
- "joinValues": false,
125
- "extractValue": true,
126
- "labelField": "label",
127
- "valueField": "value",
128
- "className": "m-0",
129
- "labelClassName": "text-left",
130
- "source": "${buttons_options}",
131
- "mode": "inline",
132
- "onEvent": {
133
- "change": {
134
- "actions": [
135
- {
136
- "actionType": "setValue",
137
- "args": {
138
- "value": "${event.data|quickEidtSaveForButton:button_name}"
139
- },
140
- "componentId": "object-layout-form"
141
- }
142
- ]
143
- }
144
- },
145
- "searchable": true
146
- },
147
- "affixFooter": false,
148
- "placeholder": "-",
149
- "className": "popOver"
134
+ "type": "tpl",
135
+ "tpl": "${buttons_options|filter:value:equals:button_name|pick:label}",
136
+ "id": "u:302f8fadccd3"
150
137
  },
151
138
  {
152
139
  "name": "visible_on",
@@ -155,7 +142,6 @@
155
142
  "type": "input-text",
156
143
  "className": "m-0",
157
144
  "labelClassName": "text-left",
158
- "mode": "inline",
159
145
  "onEvent": {
160
146
  "change": {
161
147
  "actions": [
@@ -170,7 +156,8 @@
170
156
  }
171
157
  },
172
158
  "tpl": "<b><%=data.visible_on%></b>"
173
- }
159
+ },
160
+ "id": "u:3c35211aa1a0"
174
161
  }
175
162
  ],
176
163
  "className": "col-span-2 m-0",
@@ -181,7 +168,7 @@
181
168
  "type": "action",
182
169
  "actionType": "dialog",
183
170
  "dialog": {
184
- "title": "选择操作",
171
+ "title": "选择按钮",
185
172
  "body": [
186
173
  {
187
174
  "type": "transfer",
@@ -213,10 +200,12 @@
213
200
  }
214
201
  }
215
202
  },
216
- "label": "选择操作"
203
+ "label": "选择按钮",
204
+ "id": "u:1ac8afc8a9bb"
217
205
  }
218
206
  ],
219
- "source": "${buttons}"
207
+ "source": "${buttons}",
208
+ "id": "u:a5d43b752494"
220
209
  }
221
210
  ],
222
211
  "id": "u:1c6f542c9215",
@@ -232,10 +221,11 @@
232
221
  "api": {
233
222
  "method": "get",
234
223
  "url": "/service/api/amis-metadata-objects/objects/${object_name}/actions/options",
235
- "adaptor": "// 把”选择操作“弹出窗口中设置的操作转为主表单buttons字段值格式\namis.registerFilter('convertDataForButtons', function (input) {\n let pickedButtons = input.picked_buttons || [];\n const superButtons = _.keyBy(input.__super.buttons, 'button_name');\n if (typeof pickedButtons === \"string\") {\n pickedButtons = pickedButtons.split(\",\");\n }\n const convertedButtons = pickedButtons.map(function (key) {\n return superButtons[key] || {\n button_name: key\n }\n });\n return {\n buttons: convertedButtons\n }\n});\n\n// 操作列表每一列数据变量时立即同步值到表单中\namis.registerFilter('quickEidtSaveForButton', function (input, prop_name) {\n const currentPropValue = input.value;\n const rowValue = input.__super;\n const formValue = input.__super.__super.__super;\n const button_name = rowValue.button_name;\n rowValue[prop_name] = currentPropValue;\n let newButtons = formValue.buttons.map(function (item) {\n if (item.button_name == button_name) {\n return Object.assign({}, item, rowValue);\n }\n else {\n return item;\n }\n });\n return {\n buttons: newButtons\n }\n});\n\n// 清空主表单buttons字段值\namis.registerFilter('clearButtons', function (input) {\n return {\n buttons: []\n }\n});\n\n\n// 新建页面布局时初始化buttons默认值,字段值是CRUD表格控件渲染,新建页面布局时,不会自动填充到form中,需要手动填充\namis.registerFilter('initDefaultButtons', function (input) {\n const superValues = this.data.__super || {};\n if (superValues.recordId) {\n // 编辑记录本来就会初始化相关字段值,不需要再初始化\n return;\n }\n return {\n buttons: superValues.buttons,\n }\n});\n\nlet data = payload.data;\ndata.buttons_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n",
224
+ "adaptor": "// 把”选择按钮“弹出窗口中设置的按钮转为主表单buttons字段值格式\namis.registerFilter('convertDataForButtons', function (input) {\n let pickedButtons = input.picked_buttons || [];\n const superButtons = _.keyBy(input.__super.buttons, 'button_name');\n if (typeof pickedButtons === \"string\") {\n pickedButtons = pickedButtons.split(\",\");\n }\n const convertedButtons = pickedButtons.map(function (key) {\n return superButtons[key] || {\n button_name: key\n }\n });\n return {\n buttons: convertedButtons\n }\n});\n\n// 按钮列表每一列数据变量时立即同步值到表单中\namis.registerFilter('quickEidtSaveForButton', function (input, prop_name) {\n const currentPropValue = input.value;\n const rowValue = input.__super;\n const formValue = input.__super.__super.__super;\n const button_name = rowValue.button_name;\n rowValue[prop_name] = currentPropValue;\n let newButtons = formValue.buttons.map(function (item) {\n if (item.button_name == button_name) {\n return Object.assign({}, item, rowValue);\n }\n else {\n return item;\n }\n });\n return {\n buttons: newButtons\n }\n});\n\n// 清空主表单buttons字段值\namis.registerFilter('clearButtons', function (input) {\n return {\n buttons: []\n }\n});\n\n\n// 新建页面布局时初始化buttons默认值,字段值是CRUD表格控件渲染,新建页面布局时,不会自动填充到form中,需要手动填充\namis.registerFilter('initDefaultButtons', function (input) {\n const superValues = this.data.__super || {};\n if (superValues.recordId) {\n // 编辑记录本来就会初始化相关字段值,不需要再初始化\n return;\n }\n return {\n buttons: superValues.buttons,\n }\n});\n\nlet data = payload.data;\ndata.buttons_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n",
236
225
  "sendOn": "!!this.object_name"
237
226
  },
238
- "className": "col-span-2 m-0"
227
+ "className": "col-span-2 m-0",
228
+ "affixFooter": false
239
229
  },
240
230
  {
241
231
  "type": "service",
@@ -248,7 +238,7 @@
248
238
  "name": "fields",
249
239
  "required": true,
250
240
  "type": "crud",
251
- "strictMode": false,
241
+ "strictMode": true,
252
242
  "affixHeader": false,
253
243
  "editable": true,
254
244
  "addable": false,
@@ -256,30 +246,19 @@
256
246
  "draggable": false,
257
247
  "columns": [
258
248
  {
259
- "name": "field_name",
260
- "quickEdit": {
261
- "type": "select",
262
- "source": "${fields_options}",
263
- "mode": "inline",
264
- "onEvent": {
265
- "change": {
266
- "actions": [
267
- {
268
- "actionType": "setValue",
269
- "args": {
270
- "value": "${event.data|quickEidtSaveForField:field_name}"
271
- },
272
- "componentId": "object-layout-form"
273
- }
274
- ]
275
- }
276
- },
277
- "searchable": true
278
- },
279
- "affixFooter": false,
280
- "placeholder": "-",
281
- "className": "popOver",
282
- "label": "字段"
249
+ "name": "index",
250
+ "className": "w-10",
251
+ "label": "序号",
252
+ "type": "static",
253
+ "value": "${index + 1}",
254
+ "id": "u:d1c2922699d3"
255
+ },
256
+ {
257
+ "name": "field_name_label",
258
+ "label": "字段",
259
+ "type": "tpl",
260
+ "tpl": "${fields_options|filter:value:equals:field_name|pick:label}",
261
+ "id": "u:b95c69a1cd84"
283
262
  },
284
263
  {
285
264
  "name": "is_readonly",
@@ -302,18 +281,18 @@
302
281
  }
303
282
  ]
304
283
  }
305
- }
306
- }
284
+ },
285
+ "id": "u:8cb44f3db16c"
286
+ },
287
+ "id": "u:5081e6e1af55"
307
288
  },
308
289
  {
309
290
  "name": "is_required",
310
291
  "label": "必填",
311
292
  "quickEdit": {
293
+ "mode": "inline",
312
294
  "type": "checkbox",
313
- "tpl": null,
314
295
  "className": "m-0",
315
- "labelClassName": "text-left",
316
- "mode": "inline",
317
296
  "onEvent": {
318
297
  "change": {
319
298
  "actions": [
@@ -326,17 +305,22 @@
326
305
  }
327
306
  ]
328
307
  }
329
- }
330
- }
308
+ },
309
+ "tpl": null,
310
+ "labelClassName": "text-left",
311
+ "id": "u:bbd1c15b6504"
312
+ },
313
+ "id": "u:e54afb5cc05c"
331
314
  },
332
315
  {
333
316
  "name": "group",
334
317
  "label": "分组",
335
318
  "quickEdit": {
336
- "mode": "inline",
337
319
  "type": "select",
338
- "inputClassName": "w-xs",
339
320
  "className": "m-0",
321
+ "source": "${field_groups|pick:group_name}",
322
+ "checkAll": false,
323
+ "selectFirst": false,
340
324
  "onEvent": {
341
325
  "change": {
342
326
  "actions": [
@@ -357,11 +341,10 @@
357
341
  ]
358
342
  }
359
343
  },
360
- "source": "${field_groups|pick:group_name}",
361
- "checkAll": false,
362
- "selectFirst": false,
363
- "searchable": true
364
- }
344
+ "searchable": true,
345
+ "clearable": true
346
+ },
347
+ "id": "u:e532b1949676"
365
348
  },
366
349
  {
367
350
  "name": "visible_on",
@@ -371,7 +354,6 @@
371
354
  "tpl": "<b><%=data.visible_on%></b>",
372
355
  "className": "m-0",
373
356
  "labelClassName": "text-left",
374
- "mode": "inline",
375
357
  "onEvent": {
376
358
  "change": {
377
359
  "actions": [
@@ -386,13 +368,14 @@
386
368
  }
387
369
  }
388
370
  },
389
- "breakpoint": "*"
371
+ "breakpoint": "*",
372
+ "id": "u:e3618b8b4c52"
390
373
  }
391
374
  ],
392
375
  "className": "col-span-2 m-0",
393
376
  "labelClassName": "text-left",
394
377
  "source": "${fields}",
395
- "footable": true,
378
+ "footable": false,
396
379
  "headerToolbar": [
397
380
  {
398
381
  "type": "action",
@@ -430,7 +413,8 @@
430
413
  }
431
414
  }
432
415
  },
433
- "label": "选择字段"
416
+ "label": "选择字段",
417
+ "id": "u:853b890ab524"
434
418
  },
435
419
  {
436
420
  "type": "action",
@@ -476,9 +460,11 @@
476
460
  },
477
461
  "type": "dialog"
478
462
  },
479
- "label": "设置分组"
463
+ "label": "设置分组",
464
+ "id": "u:ec9931ea883c"
480
465
  }
481
- ]
466
+ ],
467
+ "id": "u:22121edc42b1"
482
468
  }
483
469
  ],
484
470
  "id": "u:acfaf85221b7",
@@ -525,7 +511,7 @@
525
511
  {
526
512
  "name": "related_lists",
527
513
  "type": "crud",
528
- "strictMode": false,
514
+ "strictMode": true,
529
515
  "affixHeader": false,
530
516
  "editable": true,
531
517
  "addable": true,
@@ -533,46 +519,25 @@
533
519
  "draggable": false,
534
520
  "columns": [
535
521
  {
536
- "name": "related_field_fullname",
522
+ "name": "index",
523
+ "label": "序号",
524
+ "className": "w-10",
525
+ "type": "static",
526
+ "value": "${index + 1}",
527
+ "id": "u:a2f05dc83cd4"
528
+ },
529
+ {
530
+ "name": "related_field_fullname_label",
537
531
  "label": "子表名称",
538
- "quickEdit": {
539
- "type": "select",
540
- "joinValues": false,
541
- "extractValue": true,
542
- "labelField": "label",
543
- "valueField": "value",
544
- "className": "m-0",
545
- "labelClassName": "text-left",
546
- "checkAll": false,
547
- "mode": "inline",
548
- "source": "${related_lists_options}",
549
- "onEvent": {
550
- "change": {
551
- "actions": [
552
- {
553
- "actionType": "setValue",
554
- "args": {
555
- "value": "${event.data|quickEidtSaveForRelatedList:related_field_fullname}"
556
- },
557
- "componentId": "object-layout-form"
558
- }
559
- ]
560
- }
561
- },
562
- "searchable": true
563
- },
564
- "placeholder": "-",
565
- "affixFooter": false,
566
- "className": "popOver"
532
+ "type": "tpl",
533
+ "tpl": "${related_lists_options|filter:value:equals:related_field_fullname|pick:label}",
534
+ "id": "u:5204fc0fbe1c"
567
535
  },
568
536
  {
569
537
  "name": "label",
570
538
  "label": "显示标题",
571
539
  "quickEdit": {
572
- "labelRemark": "默认为对象名称",
573
540
  "type": "input-text",
574
- "className": "m-0",
575
- "labelClassName": "text-left",
576
541
  "mode": "inline",
577
542
  "onEvent": {
578
543
  "change": {
@@ -586,16 +551,24 @@
586
551
  }
587
552
  ]
588
553
  }
589
- }
590
- }
554
+ },
555
+ "labelRemark": "默认为对象名称",
556
+ "className": "m-0",
557
+ "labelClassName": "text-left",
558
+ "id": "u:5b30f2a71830"
559
+ },
560
+ "id": "u:1267e4351d66"
591
561
  },
592
562
  {
593
563
  "name": "field_names",
594
564
  "label": "显示的字段",
595
565
  "quickEdit": {
596
566
  "type": "transfer-picker",
597
- "mode": "inline",
598
- "source": "/service/api/amis-metadata-objects/objects/${related_field_fullname|split:.|first}/fields/options",
567
+ "source": {
568
+ "method": "get",
569
+ "url": "/service/api/amis-metadata-objects/objects/${related_field_fullname|split:.|first}/fields/options",
570
+ "cache": 60000
571
+ },
599
572
  "searchable": true,
600
573
  "onEvent": {
601
574
  "change": {
@@ -612,16 +585,18 @@
612
585
  },
613
586
  "joinValues": false,
614
587
  "extractValue": true
615
- }
588
+ },
589
+ "type": "tpl",
590
+ "tpl": "<%= data.related_object_fields_options && data.related_object_fields_options[data.related_field_fullname] ? data.related_object_fields_options[data.related_field_fullname].filter(function(item){ return data.field_names && data.field_names.indexOf(item.value) > -1;}).map(function(item){return item.label}) : data.field_names%>",
591
+ "id": "u:ce65d4020107"
616
592
  },
617
593
  {
618
594
  "name": "sort_field_name",
619
595
  "label": "排序字段",
620
596
  "quickEdit": {
621
597
  "type": "transfer-picker",
622
- "source": "/service/api/amis-metadata-objects/objects/${related_field_fullname|split:.|first}/fields/options",
623
- "mode": "inline",
624
- "searchable": true,
598
+ "joinValues": false,
599
+ "extractValue": true,
625
600
  "onEvent": {
626
601
  "change": {
627
602
  "actions": [
@@ -635,36 +610,22 @@
635
610
  ]
636
611
  }
637
612
  },
638
- "joinValues": false,
639
- "extractValue": true
613
+ "source": {
614
+ "method": "get",
615
+ "url": "/service/api/amis-metadata-objects/objects/${related_field_fullname|split:.|first}/fields/options",
616
+ "cache": 60000
617
+ },
618
+ "searchable": true
640
619
  },
641
- "breakpoint": "*"
620
+ "tpl": "<%= data.related_object_fields_options && data.related_object_fields_options[data.related_field_fullname] ? data.related_object_fields_options[data.related_field_fullname].filter(function(item){ return data.sort_field_name && data.sort_field_name.indexOf(item.value) > -1;}).map(function(item){return item.label}) : data.sort_field_name%>",
621
+ "id": "u:3dbee6a855c4"
642
622
  },
643
623
  {
644
624
  "name": "sort_order",
645
625
  "label": "排序方式",
646
626
  "quickEdit": {
647
- "type": "select",
648
- "joinValues": false,
649
- "options": [
650
- {
651
- "label": "正序",
652
- "value": "asc"
653
- },
654
- {
655
- "label": "倒序",
656
- "value": "desc"
657
- }
658
- ],
659
- "extractValue": true,
660
- "clearable": true,
661
- "labelField": "label",
662
- "valueField": "value",
663
- "tpl": null,
664
- "value": "\"asc\"",
665
627
  "className": "m-0",
666
628
  "labelClassName": "text-left",
667
- "mode": "inline",
668
629
  "onEvent": {
669
630
  "change": {
670
631
  "actions": [
@@ -677,9 +638,20 @@
677
638
  }
678
639
  ]
679
640
  }
680
- }
641
+ },
642
+ "joinValues": false,
643
+ "extractValue": true,
644
+ "clearable": true,
645
+ "labelField": "label",
646
+ "valueField": "value",
647
+ "mode_": "inline",
648
+ "source": "${sort_order_options}",
649
+ "type": "select"
681
650
  },
682
- "breakpoint": "*"
651
+ "breakpoint": "*",
652
+ "type": "tpl",
653
+ "tpl": "${sort_order_options|filter:value:equals:sort_order|pick:label}",
654
+ "id": "u:13cb3d304615"
683
655
  },
684
656
  {
685
657
  "name": "filters",
@@ -689,7 +661,6 @@
689
661
  "tpl": "<b><%=data.filters%></b>",
690
662
  "className": "col-span-2 m-0",
691
663
  "labelClassName": "text-left",
692
- "mode": "inline",
693
664
  "onEvent": {
694
665
  "change": {
695
666
  "actions": [
@@ -704,17 +675,16 @@
704
675
  }
705
676
  }
706
677
  },
707
- "breakpoint": "*"
678
+ "breakpoint": "*",
679
+ "id": "u:e4c367804b67"
708
680
  },
709
681
  {
710
682
  "name": "visible_on",
711
683
  "label": "显示条件",
712
684
  "quickEdit": {
713
685
  "type": "textarea",
714
- "tpl": "<b><%=data.visible_on%></b>",
715
686
  "className": "m-0",
716
687
  "labelClassName": "text-left",
717
- "mode": "inline",
718
688
  "onEvent": {
719
689
  "change": {
720
690
  "actions": [
@@ -727,9 +697,11 @@
727
697
  }
728
698
  ]
729
699
  }
730
- }
700
+ },
701
+ "tpl": "<b><%=data.visible_on%></b>"
731
702
  },
732
- "breakpoint": "*"
703
+ "breakpoint": "*",
704
+ "id": "u:1e1dc52d7c33"
733
705
  },
734
706
  {
735
707
  "name": "page_size",
@@ -739,7 +711,6 @@
739
711
  "precision": 0,
740
712
  "className": "m-0",
741
713
  "labelClassName": "text-left",
742
- "mode": "inline",
743
714
  "onEvent": {
744
715
  "change": {
745
716
  "actions": [
@@ -754,7 +725,8 @@
754
725
  }
755
726
  }
756
727
  },
757
- "breakpoint": "*"
728
+ "breakpoint": "*",
729
+ "id": "u:f9bbd9567bbd"
758
730
  }
759
731
  ],
760
732
  "className": "col-span-2 m-0",
@@ -796,12 +768,16 @@
796
768
  }
797
769
  }
798
770
  },
799
- "label": "选择子表"
771
+ "label": "选择子表",
772
+ "id": "u:b9a5d3b611d7"
800
773
  }
801
774
  ],
802
775
  "source": "${related_lists}",
803
- "footable": true,
804
- "columnsTogglable": false
776
+ "footable": false,
777
+ "columnsTogglable": true,
778
+ "messages": {},
779
+ "tableClassName": "min-w-max",
780
+ "id": "u:95aea10231d3"
805
781
  }
806
782
  ],
807
783
  "id": "u:2d4c3fe14984",
@@ -818,11 +794,13 @@
818
794
  "method": "get",
819
795
  "url": "/service/api/amis-metadata-objects/objects/${object_name}/relatedLists/options",
820
796
  "sendOn": "!!this.object_name",
821
- "adaptor": "// 把”选择子表“弹出窗口中设置的子表转为主表单related_lists字段值格式\namis.registerFilter('convertDataForRelatedLists', function (input) {\n let pickedRelateds = input.picked_related_lists || [];\n const superRelateds = _.keyBy(input.__super.related_lists, 'related_field_fullname');\n if (typeof pickedRelateds === \"string\") {\n pickedRelateds = pickedRelateds.split(\",\");\n }\n const convertedRelateds = pickedRelateds.map(function (key) {\n return superRelateds[key] || {\n related_field_fullname: key,\n sort_order: \"asc\"\n }\n });\n return {\n related_lists: convertedRelateds\n }\n});\n\n// 字段列表每一列数据变量时立即同步值到表单中\namis.registerFilter('quickEidtSaveForRelatedList', function (input, prop_name) {\n const currentPropValue = input.value;\n const rowValue = this.data;\n delete rowValue.event;\n const formValue = rowValue.__super.__super;\n const related_field_fullname = rowValue.related_field_fullname;\n rowValue[prop_name] = currentPropValue;\n let newRelatedLists = formValue.related_lists.map(function (item) {\n if (item.related_field_fullname == related_field_fullname) {\n if (prop_name === \"related_field_fullname\") {\n // 直接在表格上变更子表选项的话,清除其他属性值\n return {\n related_field_fullname: currentPropValue,\n sort_order: \"asc\"\n }\n }\n else {\n return Object.assign({}, item, rowValue);\n }\n }\n else {\n return item;\n }\n });\n return {\n related_lists: newRelatedLists\n }\n});\n\n// 清空主表单fields字段值\namis.registerFilter('clearRelatedLists', function (input) {\n return {\n related_lists: []\n }\n});\n\n// 新建页面布局时初始化related_lists默认值,字段值是CRUD表格控件渲染,新建页面布局时,不会自动填充到form中,需要手动填充\namis.registerFilter('initDefaultRelatedLists', function (input) {\n const superValues = this.data.__super || {};\n if (superValues.recordId) {\n // 编辑记录本来就会初始化相关字段值,不需要再初始化\n return;\n }\n return {\n related_lists: superValues.related_lists,\n }\n});\n\nlet data = payload.data;\ndata.related_lists_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n"
797
+ "adaptor": "// 把”选择子表“弹出窗口中设置的子表转为主表单related_lists字段值格式\namis.registerFilter('convertDataForRelatedLists', function (input) {\n let pickedRelateds = input.picked_related_lists || [];\n const superRelateds = _.keyBy(input.__super.related_lists, 'related_field_fullname');\n if (typeof pickedRelateds === \"string\") {\n pickedRelateds = pickedRelateds.split(\",\");\n }\n const convertedRelateds = pickedRelateds.map(function (key) {\n return superRelateds[key] || {\n related_field_fullname: key,\n sort_order: \"asc\"\n }\n });\n return {\n related_lists: convertedRelateds\n }\n});\n\n// 字段列表每一列数据变量时立即同步值到表单中\namis.registerFilter('quickEidtSaveForRelatedList', function (input, prop_name) {\n const currentPropValue = input.value;\n const rowValue = this.data;\n delete rowValue.event;\n const formValue = rowValue.__super.__super;\n const related_field_fullname = rowValue.related_field_fullname;\n rowValue[prop_name] = currentPropValue;\n let newRelatedLists = formValue.related_lists.map(function (item) {\n if (item.related_field_fullname == related_field_fullname) {\n if (prop_name === \"related_field_fullname\") {\n // 直接在表格上变更子表选项的话,清除其他属性值\n return {\n related_field_fullname: currentPropValue,\n sort_order: \"asc\"\n }\n }\n else {\n return Object.assign({}, item, rowValue);\n }\n }\n else {\n return item;\n }\n });\n const newFormDoc = {\n related_lists: newRelatedLists\n };\n if (prop_name === \"field_names\" || prop_name === \"sort_field_name\") { \n // 修改子表显示字段和排序字段时把变更后的字段值显示为label\n const currentOptions = {};\n currentOptions[related_field_fullname] = input.options;\n newFormDoc.related_object_fields_options = Object.assign({}, formValue.related_object_fields_options, currentOptions);\n }\n return newFormDoc;\n});\n\n// 清空主表单fields字段值\namis.registerFilter('clearRelatedLists', function (input) {\n return {\n related_lists: []\n }\n});\n\n// 新建页面布局时初始化related_lists默认值,字段值是CRUD表格控件渲染,新建页面布局时,不会自动填充到form中,需要手动填充\namis.registerFilter('initDefaultRelatedLists', function (input) {\n const superValues = this.data.__super || {};\n if (superValues.recordId) {\n // 编辑记录本来就会初始化相关字段值,不需要再初始化\n return;\n }\n return {\n related_lists: superValues.related_lists,\n }\n});\n\nlet data = payload.data;\ndata.related_lists_options = data.options;\ndelete data.options\npayload.data = data;\nreturn payload;\n"
822
798
  },
823
- "className": "col-span-2 m-0"
799
+ "className": "col-span-2 m-0",
800
+ "affixFooter": false
824
801
  }
825
- ]
802
+ ],
803
+ "id": "u:4b4c1d86aa40"
826
804
  }
827
805
  ],
828
806
  "panelClassName": "m-0",
@@ -834,13 +812,15 @@
834
812
  "actionType": "",
835
813
  "level": "default",
836
814
  "block": false,
837
- "onClick": "SteedosUI.getRef(props.data.__super.modalName).close();"
815
+ "onClick": "SteedosUI.getRef(props.data.__super.modalName).close();",
816
+ "id": "u:bf2587b53d64"
838
817
  },
839
818
  {
840
819
  "type": "button",
841
820
  "label": "保存",
842
821
  "actionType": "submit",
843
- "level": "info"
822
+ "level": "info",
823
+ "id": "u:08afd6e53cab"
844
824
  }
845
825
  ],
846
826
  "actionsClassName": "p-sm b-t b-light text-center",
@@ -870,6 +850,18 @@
870
850
  }
871
851
  ]
872
852
  }
853
+ },
854
+ "data": {
855
+ "sort_order_options": [
856
+ {
857
+ "label": "正序",
858
+ "value": "asc"
859
+ },
860
+ {
861
+ "label": "倒序",
862
+ "value": "desc"
863
+ }
864
+ ]
873
865
  }
874
866
  }
875
867
  ],
@@ -879,11 +871,16 @@
879
871
  "data": {
880
872
  "objectName": "object_layouts",
881
873
  "context": {
882
- "rootUrl": "http://127.0.0.1:5800"
874
+ "rootUrl": "http://127.0.0.1:5800",
875
+ "tenantId": "hKdnwE55WcnWveYxS",
876
+ "userId": "62ede4f62161e377e35de58c",
877
+ "authToken": "20ec4d08e58513a09df7a5a5f2f5fb40d52e3e1722de92970a16be9d3db27dc50be21a5c8e9cab1caa7932"
883
878
  }
884
879
  },
885
880
  "bodyClassName": "p-0",
886
881
  "name": "page_edit_${recordId}",
887
882
  "initApi": null,
888
- "initFetch": null
883
+ "initFetch": null,
884
+ "className": "page-form-object_layouts",
885
+ "id": "u:3b0de7e88def"
889
886
  }
@@ -312,7 +312,10 @@ module.exports = {
312
312
  type: "detail",
313
313
  }
314
314
  */
315
- relatedLists = relatedLists.concat(_.union(object.details, object.lookup_details));
315
+ const relationsInfo = await object.getRelationsInfo();
316
+ const details = relationsInfo && relationsInfo.details;
317
+ const lookupDetails = relationsInfo && relationsInfo.lookup_details;
318
+ relatedLists = relatedLists.concat(_.union(details, lookupDetails));
316
319
 
317
320
  if(objectConfig.enable_tasks){
318
321
  relatedLists.push("tasks.related_to")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.3.0-beta.5",
3
+ "version": "2.3.0-beta.7",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "node .scripts/build.tailwind.js"
@@ -10,5 +10,5 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "gitHead": "36b9f5a9327378379ed8f1ca3d790f08c35625a9"
13
+ "gitHead": "5d38049fe2c3d47860b31a73ea850a78049627ea"
14
14
  }