@steedos/service-plugin-amis 2.5.0-beta.8 → 2.5.0

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.
@@ -2,538 +2,560 @@
2
2
  "type": "page",
3
3
  "body": [
4
4
  {
5
- "type": "form",
6
- "mode": "normal",
7
- "persistData": false,
8
- "promptPageLeave": true,
9
- "name": "form_edit_${recordId}",
10
- "debug": false,
11
- "title": "",
12
- "api": {
13
- "method": "post",
14
- "url": "${context.rootUrl}/graphql",
15
- "data": {
16
- "objectName": "${objectName}",
17
- "$": "$$",
18
- "recordId": "${recordId}",
19
- "modalName": "${modalName}"
20
- },
21
- "requestAdaptor": "const formData = api.data.$;\nconst objectName = api.data.objectName;\nconst fieldsName = Object.keys(formData);\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.columns = lodash.map(formData.columns, (item) => {\n return { field: item };\n});\n\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1]};\n});\n\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nlet query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", doc: {__saveData}){_id}}`;\n};\ndelete formData._id;\nlet __saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
22
- "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
23
- "responseData": {
24
- "recordId": "${record._id}"
25
- },
26
- "headers": {
27
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
28
- }
29
- },
30
- "initApi": {
31
- "method": "post",
32
- "url": "${context.rootUrl}/graphql?rf=1653731141728",
33
- "cache": 100,
34
- "adaptor": "const recordId = api.body.recordId;\nvar data;\nif (recordId) {\n console.log('recordId==>', recordId)\n data = payload.data.data[0] || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.columns = lodash.map(data.columns, 'field');\n data.sort = lodash.map(data.sort, (item) => {\n return `${item.field_name}:${item.order || 'asc'}`\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n // TODO:字段默认值后期添加\n if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;",
35
- "data": {
36
- "recordId": "${recordId}",
37
- "defaultData": "${defaultData}",
38
- "query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,requestAdaptor,adaptor,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,searchable_fields,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
39
- },
40
- "replaceData": false,
41
- "responseData": {
42
- "&": "$$"
43
- },
44
- "headers": {
45
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
46
- }
47
- },
48
- "initFetch": true,
5
+ "type": "service",
49
6
  "body": [
50
7
  {
51
- "type": "fieldSet",
52
- "title": "通用",
53
- "en-US": {
54
- "title": "Common"
8
+ "type": "form",
9
+ "mode": "normal",
10
+ "persistData": false,
11
+ "promptPageLeave": true,
12
+ "name": "form_edit_${recordId}",
13
+ "debug": false,
14
+ "title": "",
15
+ "api": {
16
+ "method": "post",
17
+ "url": "${context.rootUrl}/graphql",
18
+ "data": {
19
+ "objectName": "${objectName}",
20
+ "$": "$$",
21
+ "recordId": "${recordId}",
22
+ "modalName": "${modalName}"
23
+ },
24
+ "requestAdaptor": "const formData = api.data.$;\nconst objectName = api.data.objectName;\nconst fieldsName = Object.keys(formData);\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.columns = lodash.map(formData.columns, (item) => {\n return { field: item };\n});\n\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1]};\n});\n\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nlet query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: ${objectName}__update(id: \"${formData.recordId}\", doc: {__saveData}){_id}}`;\n};\ndelete formData._id;\nlet __saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
25
+ "adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;\n}\nreturn payload;",
26
+ "responseData": {
27
+ "recordId": "${record._id}"
28
+ },
29
+ "headers": {
30
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
31
+ },
32
+ "messages": {}
55
33
  },
56
- "collapsable": true,
34
+ "initFetch": true,
57
35
  "body": [
58
36
  {
59
- "name": "label",
60
- "label": "显示名称",
61
- "required": true,
62
- "type": "input-text",
63
- "className": "m-0",
64
- "labelClassName": "text-left",
37
+ "type": "fieldSet",
38
+ "title": "通用",
65
39
  "en-US": {
66
- "label": "Label"
40
+ "title": "Common"
67
41
  },
68
- "id": "u:a45229ed29f8"
69
- },
70
- {
71
- "name": "name",
72
- "label": "API 名称",
73
- "labelRemark": "API 名称只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符",
74
- "required": false,
75
- "type": "input-text",
76
- "className": "m-0",
77
- "labelClassName": "text-left",
78
- "en-US": {
79
- "label": "API Name",
80
- "labelRemark": "Can only contain lowercase letters and numbers, must start with a letter,cannot end with an underscore character or contain two consecutive underscore characters"
81
- },
82
- "id": "u:ff927884ec36"
83
- },
84
- {
85
- "name": "object_name",
86
- "label": "对象",
87
- "required": true,
88
- "type": "select",
89
- "joinValues": false,
90
- "extractValue": true,
91
- "labelField": "label",
92
- "valueField": "value",
93
- "autoComplete": {
94
- "method": "get",
95
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
96
- "headers": {
97
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
98
- }
99
- },
100
- "className": "m-0",
101
- "labelClassName": "text-left",
102
- "checkAll": false,
103
- "searchable": true,
104
- "source": {
105
- "method": "get",
106
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
107
- "headers": {
108
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
42
+ "collapsable": true,
43
+ "body": [
44
+ {
45
+ "name": "label",
46
+ "label": "显示名称",
47
+ "required": true,
48
+ "type": "input-text",
49
+ "className": "m-0",
50
+ "labelClassName": "text-left",
51
+ "en-US": {
52
+ "label": "Label"
53
+ },
54
+ "id": "u:a45229ed29f8"
55
+ },
56
+ {
57
+ "name": "name",
58
+ "label": "API 名称",
59
+ "labelRemark": "API 名称只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符",
60
+ "required": false,
61
+ "type": "input-text",
62
+ "className": "m-0",
63
+ "labelClassName": "text-left",
64
+ "en-US": {
65
+ "label": "API Name",
66
+ "labelRemark": "Can only contain lowercase letters and numbers, must start with a letter,cannot end with an underscore character or contain two consecutive underscore characters"
67
+ },
68
+ "id": "u:ff927884ec36"
69
+ },
70
+ {
71
+ "name": "object_name",
72
+ "label": "对象",
73
+ "required": true,
74
+ "type": "select",
75
+ "joinValues": false,
76
+ "extractValue": true,
77
+ "labelField": "label",
78
+ "valueField": "value",
79
+ "autoComplete": {
80
+ "method": "get",
81
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
82
+ "headers": {
83
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
84
+ }
85
+ },
86
+ "className": "m-0",
87
+ "labelClassName": "text-left",
88
+ "checkAll": false,
89
+ "searchable": true,
90
+ "source": {
91
+ "method": "get",
92
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
93
+ "headers": {
94
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
95
+ }
96
+ },
97
+ "en-US": {
98
+ "label": "Object"
99
+ },
100
+ "id": "u:1427b8edc8f5",
101
+ "multiple": false
102
+ },
103
+ {
104
+ "name": "filter_scope",
105
+ "label": "过滤范围",
106
+ "required": true,
107
+ "type": "select",
108
+ "joinValues": false,
109
+ "extractValue": true,
110
+ "labelField": "label",
111
+ "valueField": "value",
112
+ "options": [
113
+ {
114
+ "label": "我的",
115
+ "value": "mine",
116
+ "en-US": {
117
+ "label": "Mine"
118
+ }
119
+ },
120
+ {
121
+ "label": "工作区",
122
+ "value": "space",
123
+ "en-US": {
124
+ "label": "Space"
125
+ }
126
+ }
127
+ ],
128
+ "value": "space",
129
+ "className": "m-0",
130
+ "labelClassName": "text-left",
131
+ "en-US": {
132
+ "label": "Filter Scope"
133
+ },
134
+ "id": "u:5f00b15822d5"
135
+ },
136
+ {
137
+ "name": "shared",
138
+ "type": "checkbox",
139
+ "tpl": null,
140
+ "className": "m-0",
141
+ "labelClassName": "text-left",
142
+ "option": "共享视图到工作区",
143
+ "en-US": {
144
+ "option": "Shared to All Users"
145
+ },
146
+ "id": "u:3ba5090f7fd0"
147
+ },
148
+ {
149
+ "name": "show_count",
150
+ "type": "checkbox",
151
+ "tpl": null,
152
+ "className": "m-0",
153
+ "labelClassName": "text-left",
154
+ "option": "显示条目数",
155
+ "en-US": {
156
+ "option": "Show Record Count"
157
+ },
158
+ "id": "u:811f0c5d03ad"
159
+ },
160
+ {
161
+ "name": "sort_no",
162
+ "label": "排序号",
163
+ "type": "input-number",
164
+ "precision": 0,
165
+ "className": "m-0",
166
+ "labelClassName": "text-left",
167
+ "en-US": {
168
+ "label": "Sort NO."
169
+ },
170
+ "id": "u:25a6ee957503"
171
+ },
172
+ {
173
+ "label": "显示的列",
174
+ "type": "transfer",
175
+ "name": "columns",
176
+ "options": [],
177
+ "multiple": true,
178
+ "id": "u:92c0b3cccca0",
179
+ "required": true,
180
+ "placeholder": "-",
181
+ "className": "col-span-2 m-0",
182
+ "visibleOn": "!!this.object_name",
183
+ "checkAll": false,
184
+ "searchable": true,
185
+ "sortable": true,
186
+ "en-US": {
187
+ "label": "Columns"
188
+ },
189
+ "source": {
190
+ "method": "get",
191
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
192
+ "headers": {
193
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
194
+ },
195
+ "requestAdaptor": "",
196
+ "adaptor": "",
197
+ "sendOn": "!!this.object_name"
198
+ },
199
+ "joinValues": false,
200
+ "extractValue": true
109
201
  }
110
- },
111
- "en-US": {
112
- "label": "Object"
113
- },
114
- "id": "u:1427b8edc8f5"
202
+ ],
203
+ "id": "u:7f7b2d3ea064"
115
204
  },
116
205
  {
117
- "name": "filter_scope",
118
- "label": "过滤范围",
119
- "required": true,
120
- "type": "select",
121
- "joinValues": false,
122
- "extractValue": true,
123
- "labelField": "label",
124
- "valueField": "value",
125
- "options": [
206
+ "type": "fieldSet",
207
+ "title": "过滤",
208
+ "collapsable": true,
209
+ "body": [
126
210
  {
127
- "label": "我的",
128
- "value": "mine",
211
+ "label": "默认过滤字段",
212
+ "type": "transfer",
213
+ "name": "filter_fields",
214
+ "options": [],
215
+ "id": "u:ea994ad5816d",
216
+ "source": {
217
+ "method": "get",
218
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
219
+ "headers": {
220
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
221
+ },
222
+ "data": null,
223
+ "requestAdaptor": "",
224
+ "adaptor": "",
225
+ "sendOn": "!!this.object_name"
226
+ },
227
+ "visibleOn": "false && !!this.object_name",
228
+ "className": "col-span-2 m-0",
229
+ "searchable": true,
230
+ "sortable": true,
231
+ "joinValues": false,
232
+ "extractValue": true,
129
233
  "en-US": {
130
- "label": "Mine"
234
+ "label": "Default Filter Fields"
235
+ },
236
+ "multiple": true
237
+ },
238
+ {
239
+ "type": "radios",
240
+ "label": "过滤器配置方式",
241
+ "name": "_filters_type_controller",
242
+ "options": [
243
+ {
244
+ "label": "条件组合",
245
+ "value": "conditions"
246
+ },
247
+ {
248
+ "label": "js脚本",
249
+ "value": "function"
250
+ }
251
+ ],
252
+ "id": "u:318671bc196c",
253
+ "joinValues": true,
254
+ "className": "col-span-2 m-0",
255
+ "language": "javascript",
256
+ "visibleOn": "false",
257
+ "en-US": {
258
+ "label": "Controller"
131
259
  }
132
260
  },
133
261
  {
134
- "label": "工作区",
135
- "value": "space",
262
+ "type": "condition-builder",
263
+ "label": "条件组件",
264
+ "name": "_filters_conditions",
265
+ "description": "",
266
+ "id": "u:a9f2232e30d7",
267
+ "source": {
268
+ "method": "get",
269
+ "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
270
+ "dataType": "json",
271
+ "headers": {
272
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
273
+ }
274
+ },
275
+ "disabled": false,
276
+ "className": "col-span-2 m-0",
277
+ "visibleOn": "!!this.object_name",
278
+ "labelClassName": "",
136
279
  "en-US": {
137
- "label": "Space"
280
+ "label": "Filters Conditions"
138
281
  }
282
+ },
283
+ {
284
+ "type": "editor",
285
+ "label": "js脚本",
286
+ "name": "_filters_function",
287
+ "id": "u:84714ec9abba",
288
+ "visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
289
+ "className": "col-span-2 m-0",
290
+ "labelClassName": "hidden"
139
291
  }
140
292
  ],
141
- "value": "space",
142
- "className": "m-0",
143
- "labelClassName": "text-left",
144
- "en-US": {
145
- "label": "Filter Scope"
146
- },
147
- "id": "u:5f00b15822d5"
148
- },
149
- {
150
- "name": "shared",
151
- "type": "checkbox",
152
- "tpl": null,
153
- "className": "m-0",
154
- "labelClassName": "text-left",
155
- "option": "共享视图到工作区",
293
+ "visibleOn": "!!this.object_name",
294
+ "collapsed": true,
156
295
  "en-US": {
157
- "option": "Shared to All Users"
296
+ "title": "Filter"
158
297
  },
159
- "id": "u:3ba5090f7fd0"
298
+ "id": "u:7d4a03469ab2"
160
299
  },
161
300
  {
162
- "name": "show_count",
163
- "type": "checkbox",
164
- "tpl": null,
165
- "className": "m-0",
166
- "labelClassName": "text-left",
167
- "option": "显示条目数",
301
+ "type": "fieldSet",
302
+ "title": "排序",
303
+ "collapsable": true,
304
+ "body": [
305
+ {
306
+ "label": "默认排序规则",
307
+ "type": "tabs-transfer",
308
+ "name": "sort",
309
+ "options": [],
310
+ "id": "u:32f3e4e73115",
311
+ "strictMode": true,
312
+ "source": {
313
+ "method": "get",
314
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
315
+ "headers": {
316
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
317
+ },
318
+ "data": null,
319
+ "requestAdaptor": "",
320
+ "adaptor": "",
321
+ "sendOn": "!!this.object_name"
322
+ },
323
+ "visibleOn": "!!this.object_name",
324
+ "sortable": true,
325
+ "className": "col-span-2 m-0",
326
+ "searchable": true,
327
+ "checkAll": false,
328
+ "clearValueOnHidden": false,
329
+ "joinValues": false,
330
+ "extractValue": true,
331
+ "en-US": {
332
+ "label": "Default Sort Order"
333
+ },
334
+ "multiple": true
335
+ }
336
+ ],
337
+ "visibleOn": "!!this.object_name",
338
+ "collapsed": true,
168
339
  "en-US": {
169
- "option": "Show Record Count"
340
+ "title": "Order"
170
341
  },
171
- "id": "u:811f0c5d03ad"
342
+ "id": "u:82b56e7d9639"
172
343
  },
173
344
  {
174
- "name": "sort_no",
175
- "label": "排序号",
176
- "type": "input-number",
177
- "precision": 0,
178
- "className": "m-0",
179
- "labelClassName": "text-left",
345
+ "type": "fieldSet",
346
+ "title": "手机端",
347
+ "collapsable": true,
348
+ "body": [
349
+ {
350
+ "label": "手机端显示的列",
351
+ "type": "transfer",
352
+ "name": "mobile_columns",
353
+ "options": [],
354
+ "id": "u:e80d9f58dfd0",
355
+ "selectMode": "list",
356
+ "searchable": true,
357
+ "searchApi": "",
358
+ "sortable": true,
359
+ "mode": "normal",
360
+ "searchResultMode": "list",
361
+ "joinValues": false,
362
+ "extractValue": true,
363
+ "source": {
364
+ "method": "get",
365
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
366
+ "headers": {
367
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
368
+ },
369
+ "data": null,
370
+ "requestAdaptor": "",
371
+ "adaptor": "",
372
+ "sendOn": "!!this.object_name"
373
+ },
374
+ "visibleOn": "!!this.object_name",
375
+ "className": "col-span-2 m-0",
376
+ "en-US": {
377
+ "label": "Mobile Columns"
378
+ },
379
+ "multiple": true
380
+ }
381
+ ],
382
+ "collapsed": true,
383
+ "visibleOn": "!!this.object_name",
180
384
  "en-US": {
181
- "label": "Sort NO."
385
+ "title": "Mobile"
182
386
  },
183
- "id": "u:25a6ee957503"
387
+ "id": "u:51174159a42e"
184
388
  },
185
389
  {
186
- "label": "显示的列",
187
- "type": "transfer",
188
- "name": "columns",
189
- "options": [],
190
- "multiple": true,
191
- "id": "u:92c0b3cccca0",
192
- "required": true,
193
- "placeholder": "-",
194
- "source": {
195
- "method": "get",
196
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
197
- "headers": {
198
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
199
- },
200
- "data": null,
201
- "requestAdaptor": "",
202
- "adaptor": "",
203
- "sendOn": "!!this.object_name"
204
- },
205
- "className": "col-span-2 m-0",
390
+ "type": "fieldSet",
391
+ "title": "搜索项",
392
+ "collapsable": true,
393
+ "body": [
394
+ {
395
+ "label": "默认可搜索字段",
396
+ "type": "transfer",
397
+ "name": "searchable_fields",
398
+ "options": [],
399
+ "selectMode": "list",
400
+ "searchable": true,
401
+ "searchApi": "",
402
+ "sortable": true,
403
+ "mode": "normal",
404
+ "searchResultMode": "list",
405
+ "joinValues": false,
406
+ "extractValue": true,
407
+ "source": {
408
+ "method": "get",
409
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
410
+ "headers": {
411
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
412
+ },
413
+ "data": null,
414
+ "requestAdaptor": "",
415
+ "adaptor": "",
416
+ "sendOn": "!!this.object_name"
417
+ },
418
+ "visibleOn": "!!this.object_name",
419
+ "className": "col-span-2 m-0",
420
+ "en-US": {
421
+ "label": "searchable fields"
422
+ },
423
+ "multiple": true,
424
+ "id": "u:adb91066539e"
425
+ }
426
+ ],
427
+ "collapsed": true,
206
428
  "visibleOn": "!!this.object_name",
207
- "checkAll": false,
208
- "searchable": true,
209
- "sortable": true,
210
- "joinValues": false,
211
- "extractValue": true,
212
- "en-US": {
213
- "label": "Columns"
214
- }
215
- }
216
- ],
217
- "id": "u:7f7b2d3ea064"
218
- },
219
- {
220
- "type": "fieldSet",
221
- "title": "过滤",
222
- "collapsable": true,
223
- "body": [
224
- {
225
- "label": "默认过滤字段",
226
- "type": "transfer",
227
- "name": "filter_fields",
228
- "options": [],
229
- "id": "u:ea994ad5816d",
230
- "source": {
231
- "method": "get",
232
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
233
- "headers": {
234
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
235
- },
236
- "data": null,
237
- "requestAdaptor": "",
238
- "adaptor": "",
239
- "sendOn": "!!this.object_name"
240
- },
241
- "visibleOn": "false && !!this.object_name",
242
- "className": "col-span-2 m-0",
243
- "searchable": true,
244
- "sortable": true,
245
- "joinValues": false,
246
- "extractValue": true,
247
429
  "en-US": {
248
- "label": "Default Filter Fields"
430
+ "title": "searchable"
249
431
  },
250
- "multiple": true
432
+ "id": "u:bcdec77c787b"
251
433
  },
252
434
  {
253
- "type": "radios",
254
- "label": "过滤器配置方式",
255
- "name": "_filters_type_controller",
256
- "options": [
435
+ "type": "fieldSet",
436
+ "title": "数据接口",
437
+ "description": "获取列表数据的 api",
438
+ "collapsable": true,
439
+ "body": [
257
440
  {
258
- "label": "条件组合",
259
- "value": "conditions"
441
+ "type": "editor",
442
+ "name": "requestAdaptor",
443
+ "label": "发送适配器",
444
+ "required": false,
445
+ "language": "javascript",
446
+ "description": "函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。",
447
+ "className": "col-span-2 m-1",
448
+ "labelClassName": "text-left",
449
+ "id": "u:a0cbe76b01bd"
260
450
  },
261
451
  {
262
- "label": "js脚本",
263
- "value": "function"
452
+ "type": "editor",
453
+ "name": "adaptor",
454
+ "label": "接收适配器",
455
+ "required": false,
456
+ "language": "javascript",
457
+ "description": "函数签名: (payload, response, api) => payload",
458
+ "className": "col-span-2 m-1",
459
+ "labelClassName": "text-left",
460
+ "id": "u:fe199993059a"
264
461
  }
265
462
  ],
266
- "id": "u:318671bc196c",
267
- "joinValues": true,
268
- "className": "col-span-2 m-0",
269
- "language": "javascript",
270
- "visibleOn": "false",
271
- "en-US": {
272
- "label": "Controller"
273
- }
274
- },
275
- {
276
- "type": "condition-builder",
277
- "label": "条件组件",
278
- "name": "_filters_conditions",
279
- "description": "",
280
- "id": "u:a9f2232e30d7",
281
- "source": {
282
- "method": "get",
283
- "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
284
- "dataType": "json",
285
- "headers": {
286
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
287
- }
288
- },
289
- "disabled": false,
290
- "className": "col-span-2 m-0",
463
+ "collapsed": true,
291
464
  "visibleOn": "!!this.object_name",
292
- "labelClassName": "",
293
465
  "en-US": {
294
- "label": "Filters Conditions"
295
- }
466
+ "title": "API"
467
+ },
468
+ "id": "u:0521ee7143ab"
296
469
  },
297
470
  {
298
- "type": "editor",
299
- "label": "js脚本",
300
- "name": "_filters_function",
301
- "id": "u:84714ec9abba",
302
- "visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
303
- "className": "col-span-2 m-0",
304
- "labelClassName": "hidden"
305
- }
306
- ],
307
- "visibleOn": "!!this.object_name",
308
- "collapsed": true,
309
- "en-US": {
310
- "title": "Filter"
311
- },
312
- "id": "u:7d4a03469ab2"
313
- },
314
- {
315
- "type": "fieldSet",
316
- "title": "排序",
317
- "collapsable": true,
318
- "body": [
319
- {
320
- "label": "默认排序规则",
321
- "type": "tabs-transfer",
322
- "name": "sort",
323
- "options": [],
324
- "id": "u:32f3e4e73115",
325
- "strictMode": true,
326
- "source": {
327
- "method": "get",
328
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
329
- "headers": {
330
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
471
+ "type": "fieldSet",
472
+ "title": "高级",
473
+ "collapsable": true,
474
+ "body": [
475
+ {
476
+ "name": "enable_amis_schema",
477
+ "type": "checkbox",
478
+ "tpl": null,
479
+ "className": "m-0",
480
+ "labelClassName": "text-left",
481
+ "option": "使用 amis自定义列表",
482
+ "en-US": {
483
+ "option": "Enable amis_schema"
484
+ },
485
+ "id": "u:55ca7f7b7eb7"
331
486
  },
332
- "data": null,
333
- "requestAdaptor": "",
334
- "adaptor": "",
335
- "sendOn": "!!this.object_name"
336
- },
487
+ {
488
+ "type": "editor",
489
+ "name": "amis_schema",
490
+ "label": "Amis Schema",
491
+ "required": false,
492
+ "language": "json",
493
+ "className": "col-span-2 m-1",
494
+ "labelClassName": "text-left",
495
+ "clearValueOnHidden": false,
496
+ "hidden": true,
497
+ "id": "u:d219f7b6d06f"
498
+ }
499
+ ],
500
+ "collapsed": true,
337
501
  "visibleOn": "!!this.object_name",
338
- "sortable": true,
339
- "className": "col-span-2 m-0",
340
- "searchable": true,
341
- "checkAll": false,
342
- "clearValueOnHidden": false,
343
- "joinValues": false,
344
- "extractValue": true,
345
502
  "en-US": {
346
- "label": "Default Sort Order"
503
+ "title": "Advanced"
347
504
  },
348
- "multiple": true
505
+ "id": "u:9c349b88563b"
349
506
  }
350
507
  ],
351
- "visibleOn": "!!this.object_name",
352
- "collapsed": true,
353
- "en-US": {
354
- "title": "Order"
355
- },
356
- "id": "u:82b56e7d9639"
357
- },
358
- {
359
- "type": "fieldSet",
360
- "title": "手机端",
361
- "collapsable": true,
362
- "body": [
363
- {
364
- "label": "手机端显示的列",
365
- "type": "transfer",
366
- "name": "mobile_columns",
367
- "options": [],
368
- "id": "u:e80d9f58dfd0",
369
- "selectMode": "list",
370
- "searchable": true,
371
- "searchApi": "",
372
- "sortable": true,
373
- "mode": "normal",
374
- "searchResultMode": "list",
375
- "joinValues": false,
376
- "extractValue": true,
377
- "source": {
378
- "method": "get",
379
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
380
- "headers": {
381
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
382
- },
383
- "data": null,
384
- "requestAdaptor": "",
385
- "adaptor": "",
386
- "sendOn": "!!this.object_name"
387
- },
388
- "visibleOn": "!!this.object_name",
389
- "className": "col-span-2 m-0",
390
- "en-US": {
391
- "label": "Mobile Columns"
392
- },
393
- "multiple": true
508
+ "panelClassName": "m-0",
509
+ "bodyClassName": "p-4",
510
+ "actions": false,
511
+ "actionsClassName": "p-sm b-t b-light text-center",
512
+ "className": "steedos-amis-form",
513
+ "language": "javascript",
514
+ "id": "listview_form",
515
+ "onEvent": {
516
+ "submitSucc": {
517
+ "weight": 0,
518
+ "actions": [
519
+ {
520
+ "actionType": "broadcast",
521
+ "args": {
522
+ "eventName": "@data.changed.object_listviews"
523
+ },
524
+ "data": {
525
+ "objectName": "object_listviews"
526
+ }
527
+ }
528
+ ]
394
529
  }
395
- ],
396
- "collapsed": true,
397
- "visibleOn": "!!this.object_name",
398
- "en-US": {
399
- "title": "Mobile"
400
530
  },
401
- "id": "u:51174159a42e"
531
+ "hiddenOn": "${editFormInited != true}"
532
+ }
533
+ ],
534
+ "id": "u:28ff1b544088",
535
+ "api": {
536
+ "method": "post",
537
+ "url": "${context.rootUrl}/graphql?rf=1653731141728",
538
+ "cache": 100,
539
+ "adaptor": "const recordId = api.body.recordId;\nvar data;\nif (recordId) {\n data = payload.data.data[0] || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.columns = lodash.map(data.columns, 'field');\n data.sort = lodash.map(data.sort, (item) => {\n return `${item.field_name}:${item.order || 'asc'}`\n });\n data.mobile_columns = lodash.map(data.mobile_columns, 'field');\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const defaultData = api.body.defaultData;\n let defaultValues = {};\n // TODO:字段默认值后期添加\n if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){\n data = Object.assign({}, defaultValues, defaultData)\n }\n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions;\nreturn payload;",
540
+ "data": {
541
+ "recordId": "${recordId}",
542
+ "defaultData": "${defaultData}",
543
+ "query": "{data:object_listviews(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,label,name,object_name,requestAdaptor,adaptor,filter_scope,shared,show_count,columns,filter_fields,sort,filters,filter_logic,mobile_columns,searchable_fields,sort_no,created,created_by:created_by__expand{_id,name},modified,modified_by:modified_by__expand{_id,name},enable_amis_schema,amis_schema,_display{shared,show_count,created,modified}}}"
402
544
  },
403
- {
404
- "type": "fieldSet",
405
- "title": "搜索项",
406
- "collapsable": true,
407
- "body": [
408
- {
409
- "label": "默认可搜索字段",
410
- "type": "transfer",
411
- "name": "searchable_fields",
412
- "options": [],
413
- "selectMode": "list",
414
- "searchable": true,
415
- "searchApi": "",
416
- "sortable": true,
417
- "mode": "normal",
418
- "searchResultMode": "list",
419
- "joinValues": false,
420
- "extractValue": true,
421
- "source": {
422
- "method": "get",
423
- "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
424
- "headers": {
425
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
426
- },
427
- "data": null,
428
- "requestAdaptor": "",
429
- "adaptor": "",
430
- "sendOn": "!!this.object_name"
431
- },
432
- "visibleOn": "!!this.object_name",
433
- "className": "col-span-2 m-0",
434
- "en-US": {
435
- "label": "searchable fields"
436
- },
437
- "multiple": true
438
- }
439
- ],
440
- "collapsed": true,
441
- "visibleOn": "!!this.object_name",
442
- "en-US": {
443
- "title": "searchable"
444
- }
545
+ "replaceData": false,
546
+ "responseData": {
547
+ "editFormInited": true,
548
+ "&": "$$"
445
549
  },
446
- {
447
- "type": "fieldSet",
448
- "title": "数据接口",
449
- "description": "获取列表数据的 api",
450
- "collapsable": true,
451
- "body": [
452
- {
453
- "type": "editor",
454
- "name": "requestAdaptor",
455
- "label": "发送适配器",
456
- "required": false,
457
- "language": "javascript",
458
- "description": "函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。",
459
- "className": "col-span-2 m-1",
460
- "labelClassName": "text-left"
461
- },
462
- {
463
- "type": "editor",
464
- "name": "adaptor",
465
- "label": "接收适配器",
466
- "required": false,
467
- "language": "javascript",
468
- "description": "函数签名: (payload, response, api) => payload",
469
- "className": "col-span-2 m-1",
470
- "labelClassName": "text-left"
471
- }
472
- ],
473
- "collapsed": true,
474
- "visibleOn": "!!this.object_name",
475
- "en-US": {
476
- "title": "API"
477
- }
550
+ "headers": {
551
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
478
552
  },
479
- {
480
- "type": "fieldSet",
481
- "title": "高级",
482
- "collapsable": true,
483
- "body": [
484
- {
485
- "name": "enable_amis_schema",
486
- "type": "checkbox",
487
- "tpl": null,
488
- "className": "m-0",
489
- "labelClassName": "text-left",
490
- "option": "使用 amis自定义列表",
491
- "en-US": {
492
- "option": "Enable amis_schema"
493
- }
494
- },
495
- {
496
- "type": "editor",
497
- "name": "amis_schema",
498
- "label": "Amis Schema",
499
- "required": false,
500
- "language": "json",
501
- "className": "col-span-2 m-1",
502
- "labelClassName": "text-left",
503
- "clearValueOnHidden": false,
504
- "hidden": true
505
- }
506
- ],
507
- "collapsed": true,
508
- "visibleOn": "!!this.object_name",
509
- "en-US": {
510
- "title": "Advanced"
511
- }
512
- }
513
- ],
514
- "panelClassName": "m-0",
515
- "bodyClassName": "p-4",
516
- "actions": false,
517
- "actionsClassName": "p-sm b-t b-light text-center",
518
- "className": "steedos-amis-form",
519
- "language": "javascript",
520
- "id": "listview_form",
521
- "onEvent": {
522
- "submitSucc": {
523
- "weight": 0,
524
- "actions": [
525
- {
526
- "actionType": "broadcast",
527
- "args": {
528
- "eventName": "@data.changed.object_listviews"
529
- },
530
- "data": {
531
- "objectName": "object_listviews"
532
- }
533
- }
534
- ]
535
- }
536
- }
553
+ "messages": {}
554
+ },
555
+ "data": {
556
+ "editFormInited": false
557
+ },
558
+ "messages": {}
537
559
  }
538
560
  ],
539
561
  "regions": [