@steedos/standard-object-database 2.5.0-beta.1 → 2.5.0-beta.11
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.
- package/main/default/objects/object_fields.object.yml +14 -39
- package/main/default/objects/object_layouts/buttons/standard_edit.button.yml +1 -1
- package/main/default/objects/object_listviews.object.yml +11 -74
- package/main/default/objects/objects/buttons/delete_object.button.yml +9 -6
- package/main/default/objects/objects.core.js +27 -25
- package/main/default/pages/object_detail.page.amis.json +41 -39
- package/main/default/routes/amis_button_design.ejs +1 -0
- package/main/default/routes/amis_listview_design.ejs +8 -6
- package/main/default/routes/amis_listview_design.router.js +3 -1
- package/main/default/routes/listview.router.js +2 -34
- package/main/default/triggers/object_fields.trigger.js +2 -2
- package/main/default/triggers/object_listviews.trigger.js +8 -1
- package/package.json +2 -2
- package/main/default/objects/object_listviews/buttons/amis_buttons.button.yml +0 -53
|
@@ -381,48 +381,23 @@ fields:
|
|
|
381
381
|
summary_field:
|
|
382
382
|
type: lookup
|
|
383
383
|
label: Field to Aggregate
|
|
384
|
+
reference_to: object_fields
|
|
385
|
+
reference_to_field: name
|
|
384
386
|
inlineHelpText: If the field type is a 'Roll-Up Summary' and the 'Roll-Up Type' is not COUNT, this field must be filled in, Only fields that aggregate number, currency, date, and datetime types are supported.
|
|
385
387
|
depend_on:
|
|
386
388
|
- summary_object
|
|
387
389
|
- summary_type
|
|
388
390
|
defaultIcon: service_contract
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if(
|
|
399
|
-
return [];
|
|
400
|
-
}
|
|
401
|
-
if(values.summary_type === "sum" || values.summary_type === "avg"){
|
|
402
|
-
/*sum/avg类型可以汇总数值、金额、百分比字段*/
|
|
403
|
-
options = options.filter(function(option){
|
|
404
|
-
var optionFieldType = fields[option.value] && fields[option.value].type;
|
|
405
|
-
if(["formula", "summary"].indexOf(optionFieldType) > -1){
|
|
406
|
-
/*要聚合的字段为公式或汇总字段时,按其字段数据类型判断是否支持聚合*/
|
|
407
|
-
optionFieldType = fields[option.value].data_type;
|
|
408
|
-
}
|
|
409
|
-
return ["number", "currency", "percent"].indexOf(optionFieldType) > -1
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
else{
|
|
413
|
-
/*min、max类型可以汇总数值、金额、百分比、日期、日期时间字段*/
|
|
414
|
-
options = options.filter(function(option){
|
|
415
|
-
var optionFieldType = fields[option.value] && fields[option.value].type;
|
|
416
|
-
if(["formula", "summary"].indexOf(optionFieldType) > -1){
|
|
417
|
-
/*要聚合的字段为公式或汇总字段时,按其字段数据类型判断是否支持聚合*/
|
|
418
|
-
optionFieldType = fields[option.value].data_type;
|
|
419
|
-
}
|
|
420
|
-
return ["number", "currency", "percent", "date", "datetime"].indexOf(optionFieldType) > -1
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
return options;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
391
|
+
amis:
|
|
392
|
+
"autoComplete":
|
|
393
|
+
"method": "get"
|
|
394
|
+
"url": "${context.rootUrl}/service/api/@${summary_object}/uiSchema?summary_object=${summary_object}&summary_type=${summary_type}&term=${term}"
|
|
395
|
+
"data":
|
|
396
|
+
"summary_type": "${summary_type}"
|
|
397
|
+
"headers":
|
|
398
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
399
|
+
"sendOn": "!!this.summary_object && !!this.summary_type"
|
|
400
|
+
"adaptor": "const summary_type = api.body.summary_type;\nconst term = api.query.term;\nlet fields = payload.fields;\nlet options = [];\nif (fields) {\n if (summary_type && summary_type !== \"count\") {\n if (summary_type === \"sum\" || summary_type === \"avg\") {\n /*sum/avg类型可以汇总数值、金额、百分比字段*/\n _.forEach(fields, (value, key) => {\n let fieldType = value.type;\n if ([\"formula\", \"summary\"].indexOf(fieldType) > -1) {\n /*要聚合的字段为公式或汇总字段时,按其字段数据类型判断是否支持聚合*/\n fieldType = value.data_type;\n }\n if ([\"number\", \"currency\", \"percent\"].indexOf(fieldType) > -1) {\n options.push({ label: value.label, value: value.name });\n }\n })\n }\n else {\n /*min、max类型可以汇总数值、金额、百分比、日期、日期时间字段*/\n _.forEach(fields, (value, key) => {\n let fieldType = value.type;\n if ([\"formula\", \"summary\"].indexOf(fieldType) > -1) {\n /*要聚合的字段为公式或汇总字段时,按其字段数据类型判断是否支持聚合*/\n fieldType = value.data_type;\n }\n if ([\"number\", \"currency\", \"percent\", \"date\", \"datetime\"].indexOf(fieldType) > -1) {\n options.push({ label: value.label, value: value.name });\n }\n })\n }\n }\n if (term) {\n options = _.filter(options, (item) => {\n return item.label.toLowerCase().indexOf(term.toLowerCase()) > -1;\n })\n }\n}\npayload = {\n data: { options: options },\n msg: \"\",\n status: 0\n}\nreturn payload;"
|
|
426
401
|
visible_on: "{{formData.type === 'summary' && formData.summary_type !== 'count' ? true: false}}"
|
|
427
402
|
required: "{{formData.type === 'summary' && formData.summary_type !== 'count' ? true: false}}"
|
|
428
403
|
sort_no: 320
|
|
@@ -433,7 +408,7 @@ fields:
|
|
|
433
408
|
is_wide: true
|
|
434
409
|
depend_on:
|
|
435
410
|
- summary_object
|
|
436
|
-
visible_on: "{{formData.type === 'summary' ? true: false}}"
|
|
411
|
+
visible_on: "{{formData.type === 'summary' && global.mode !='read' ? true: false}}"
|
|
437
412
|
sort_no: 330
|
|
438
413
|
summary_filters.$:
|
|
439
414
|
label: Filter Criteria
|
|
@@ -600,7 +575,7 @@ list_views:
|
|
|
600
575
|
columns:
|
|
601
576
|
- label
|
|
602
577
|
- name
|
|
603
|
-
-
|
|
578
|
+
- group
|
|
604
579
|
- type
|
|
605
580
|
- object
|
|
606
581
|
- sort_no
|
|
@@ -12,7 +12,7 @@ amis_schema: |-
|
|
|
12
12
|
"actions": [
|
|
13
13
|
{
|
|
14
14
|
"actionType": "custom",
|
|
15
|
-
"script": "const appId = null;\nconst page = Steedos.Page.getPage('form', appId, null, null, \"object_layouts\");\nif (page && page.schema) {\n const pageSchema = JSON.parse(page.schema);\n let formSchema = pageSchema.body[0];\n // 设置form的canAccessSuperData属性防止弹出窗口从父级取字段默认值\n formSchema.canAccessSuperData = false;\n // 设置form的wrapWithPanel属性隐藏其底部保存取消按钮\n formSchema.wrapWithPanel = false;\n formSchema.className = \"steedos-amis-form\";\n const title = \"编辑 页面布局\";\n doAction({\n \"actionType\": \"dialog\",\n \"dialog\": {\n \"type\": \"dialog\",\n \"title\": title,\n \"body\": [
|
|
15
|
+
"script": "const appId = null;\nconst page = Steedos.Page.getPage('form', appId, null, null, \"object_layouts\");\nif (page && page.schema) {\n const pageSchema = JSON.parse(page.schema);\n let formSchema = pageSchema.body[0];\n // 设置form的canAccessSuperData属性防止弹出窗口从父级取字段默认值\n formSchema.canAccessSuperData = false;\n // 设置form的wrapWithPanel属性隐藏其底部保存取消按钮\n formSchema.wrapWithPanel = false;\n formSchema.className = \"steedos-amis-form\";\n const title = \"编辑 页面布局\";\n doAction({\n \"actionType\": \"dialog\",\n \"dialog\": {\n \"type\": \"dialog\",\n \"title\": title,\n \"body\": [formSchema],\n \"size\": \"lg\"\n }\n });\n}"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"weight": 0
|
|
@@ -13,7 +13,6 @@ fields:
|
|
|
13
13
|
type: text
|
|
14
14
|
searchable: true
|
|
15
15
|
index: true
|
|
16
|
-
required: true
|
|
17
16
|
inlineHelpText: Can only contain lowercase letters and numbers, must start with a letter, cannot end with an underscore character or contain two consecutive underscore characters
|
|
18
17
|
object_name:
|
|
19
18
|
label: Object
|
|
@@ -78,18 +77,8 @@ fields:
|
|
|
78
77
|
required: true
|
|
79
78
|
depend_on:
|
|
80
79
|
- object_name
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!(values != null ? values.object_name : void 0)) {
|
|
84
|
-
values.object_name = Session.get("object_name");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if(values.object_name && !_.isString(values.object_name)){
|
|
88
|
-
values.object_name = values.object_name.name
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0, true);
|
|
92
|
-
}
|
|
80
|
+
reference_to: object_fields
|
|
81
|
+
reference_to_field: name
|
|
93
82
|
columns.$.width:
|
|
94
83
|
label: Width
|
|
95
84
|
type: text
|
|
@@ -104,16 +93,8 @@ fields:
|
|
|
104
93
|
is_wide: true
|
|
105
94
|
depend_on:
|
|
106
95
|
- object_name
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!(values != null ? values.object_name : void 0)) {
|
|
110
|
-
values.object_name = Session.get("object_name");
|
|
111
|
-
}
|
|
112
|
-
if(values.object_name && !_.isString(values.object_name)){
|
|
113
|
-
values.object_name = values.object_name.name
|
|
114
|
-
}
|
|
115
|
-
return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0);
|
|
116
|
-
}
|
|
96
|
+
reference_to: object_fields
|
|
97
|
+
reference_to_field: name
|
|
117
98
|
sort:
|
|
118
99
|
label: Default Sort Order
|
|
119
100
|
type: grid
|
|
@@ -127,32 +108,8 @@ fields:
|
|
|
127
108
|
sort.$.field_name:
|
|
128
109
|
label: Field Name
|
|
129
110
|
type: lookup
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var _object, _options, fields, icon;
|
|
133
|
-
if(values.object_name && !_.isString(values.object_name)){
|
|
134
|
-
values.object_name = values.object_name.name
|
|
135
|
-
}
|
|
136
|
-
_options = [];
|
|
137
|
-
_object = Creator.getObject(values != null ? values.object_name : void 0);
|
|
138
|
-
fields = Creator.getFields(values != null ? values.object_name : void 0);
|
|
139
|
-
icon = _object.icon;
|
|
140
|
-
|
|
141
|
-
_.forEach(fields, function (f) {
|
|
142
|
-
var label;
|
|
143
|
-
|
|
144
|
-
if (!_object.fields[f].hidden) {
|
|
145
|
-
label = _object.fields[f].label;
|
|
146
|
-
return _options.push({
|
|
147
|
-
label: label || f,
|
|
148
|
-
value: f,
|
|
149
|
-
icon: icon
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
return _options;
|
|
155
|
-
}
|
|
111
|
+
reference_to: object_fields
|
|
112
|
+
reference_to_field: name
|
|
156
113
|
sort.$.order:
|
|
157
114
|
label: Sort Order
|
|
158
115
|
type: select
|
|
@@ -167,7 +124,7 @@ fields:
|
|
|
167
124
|
type: code
|
|
168
125
|
is_wide: true
|
|
169
126
|
hidden: false
|
|
170
|
-
readonly:
|
|
127
|
+
readonly: false
|
|
171
128
|
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
172
129
|
depend_on:
|
|
173
130
|
- object_name
|
|
@@ -240,18 +197,8 @@ fields:
|
|
|
240
197
|
type: lookup
|
|
241
198
|
multiple: false
|
|
242
199
|
is_wide: false
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (!(values != null ? values.object_name : void 0)) {
|
|
246
|
-
values.object_name = Session.get("object_name");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if(values.object_name && !_.isString(values.object_name)){
|
|
250
|
-
values.object_name = values.object_name.name
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0, true);
|
|
254
|
-
}
|
|
200
|
+
reference_to: object_fields
|
|
201
|
+
reference_to_field: name
|
|
255
202
|
searchable_fields:
|
|
256
203
|
label: Searchable Fields
|
|
257
204
|
type: grid
|
|
@@ -267,18 +214,8 @@ fields:
|
|
|
267
214
|
type: lookup
|
|
268
215
|
multiple: false
|
|
269
216
|
is_wide: false
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (!(values != null ? values.object_name : void 0)) {
|
|
273
|
-
values.object_name = Session.get("object_name");
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if(values.object_name && !_.isString(values.object_name)){
|
|
277
|
-
values.object_name = values.object_name.name
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return Creator.getObjectFieldOptions(values != null ? values.object_name : void 0, true);
|
|
281
|
-
}
|
|
217
|
+
reference_to: object_fields
|
|
218
|
+
reference_to_field: name
|
|
282
219
|
sort_no:
|
|
283
220
|
label: Sort no
|
|
284
221
|
type: number
|
|
@@ -29,7 +29,7 @@ amis_schema: |-
|
|
|
29
29
|
"showCloseButton": true,
|
|
30
30
|
"data": {
|
|
31
31
|
"&": "$$",
|
|
32
|
-
"
|
|
32
|
+
"recordId": "${recordId}"
|
|
33
33
|
},
|
|
34
34
|
"onEvent": {
|
|
35
35
|
"confirm": {
|
|
@@ -43,9 +43,9 @@ amis_schema: |-
|
|
|
43
43
|
"method": "post",
|
|
44
44
|
"data": {
|
|
45
45
|
"&": "$$",
|
|
46
|
-
"
|
|
46
|
+
"recordId": "${recordId}"
|
|
47
47
|
},
|
|
48
|
-
"requestAdaptor": "
|
|
48
|
+
"requestAdaptor": "const recordId = api.data.recordId; \napi.data = {\n query: `\n mutation{\n objects__delete(id: \"${recordId}\")\n }\n `\n}",
|
|
49
49
|
"headers": {
|
|
50
50
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
51
51
|
}
|
|
@@ -55,12 +55,15 @@ amis_schema: |-
|
|
|
55
55
|
"actionType": "ajax"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
"
|
|
58
|
+
"actionType": "broadcast",
|
|
59
59
|
"args": {
|
|
60
|
-
"
|
|
60
|
+
"eventName": "@data.changed.objects"
|
|
61
61
|
},
|
|
62
|
-
"
|
|
62
|
+
"data": {
|
|
63
|
+
"objectName": "objects",
|
|
64
|
+
"__deletedRecord": true
|
|
63
65
|
}
|
|
66
|
+
}
|
|
64
67
|
]
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -225,22 +225,24 @@ function loadObject(doc, oldDoc) {
|
|
|
225
225
|
objectql.loadObjectLazyListenners(doc.name);
|
|
226
226
|
objectql.loadObjectLazyButtons(doc.name);
|
|
227
227
|
//获取到继承后的对象
|
|
228
|
-
const _doc = objectql.getObjectConfig(doc.name);
|
|
228
|
+
// const _doc = objectql.getObjectConfig(doc.name);
|
|
229
|
+
// console.log(`loadObject===>`, doc.name)
|
|
229
230
|
objectql.getSteedosSchema().metadataRegister.addObjectConfig(DB_OBJECT_SERVICE_NAME, originalObject).then(function(res){
|
|
230
231
|
if(res){
|
|
231
|
-
datasource.setObject(doc.name, _doc);
|
|
232
|
-
try {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
} catch (error) {
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
if (!oldDoc || (oldDoc && oldDoc.is_enable === false && doc.is_enable)) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
232
|
+
// datasource.setObject(doc.name, _doc);
|
|
233
|
+
// try {
|
|
234
|
+
// if (!datasourceName || datasourceName == defaultDatasourceName) {
|
|
235
|
+
// Creator.Objects[doc.name] = _doc;
|
|
236
|
+
// Creator.loadObjects(_doc, _doc.name);
|
|
237
|
+
// }
|
|
238
|
+
// } catch (error) {
|
|
239
|
+
// console.log('error', error);
|
|
240
|
+
// }
|
|
241
|
+
// if (!oldDoc || (oldDoc && oldDoc.is_enable === false && doc.is_enable)) {
|
|
242
|
+
// loadObjectTriggers(doc);
|
|
243
|
+
// loadObjectPermission(doc);
|
|
244
|
+
// }
|
|
245
|
+
|
|
244
246
|
objectql.getSteedosSchema().broker.broadcast("$packages.statisticsActivatedPackages", {});
|
|
245
247
|
}
|
|
246
248
|
})
|
|
@@ -342,7 +344,7 @@ function reloadObject(changeLog){
|
|
|
342
344
|
return
|
|
343
345
|
}
|
|
344
346
|
//获取到最新的对象
|
|
345
|
-
const object = objectql.
|
|
347
|
+
const object = objectql.getOriginalObjectConfig(objectName);
|
|
346
348
|
|
|
347
349
|
let _mf = _.max(_.values(object.fields), function (field) { return field.sort_no; });
|
|
348
350
|
if(_mf && object.name){
|
|
@@ -355,18 +357,18 @@ function reloadObject(changeLog){
|
|
|
355
357
|
if(deleted.actions.length == 0){
|
|
356
358
|
deleted.actions = null;
|
|
357
359
|
}
|
|
358
|
-
|
|
360
|
+
// console.log(`reloadObject===>`, object.name)
|
|
359
361
|
objectql.getSteedosSchema().metadataRegister.addObjectConfig(DB_OBJECT_SERVICE_NAME, Object.assign({}, object, {isMain:false, __deleted: deleted})).then(function(res){
|
|
360
362
|
if(res){
|
|
361
|
-
datasource.setObject(object.name, object);
|
|
362
|
-
try {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
} catch (error) {
|
|
368
|
-
|
|
369
|
-
}
|
|
363
|
+
// datasource.setObject(object.name, object);
|
|
364
|
+
// try {
|
|
365
|
+
// if(!objectDataSourceName || objectDataSourceName == defaultDatasourceName){
|
|
366
|
+
// Creator.Objects[object.name] = object;
|
|
367
|
+
// Creator.loadObjects(object, object.name);
|
|
368
|
+
// }
|
|
369
|
+
// } catch (error) {
|
|
370
|
+
// console.log('error', error);
|
|
371
|
+
// }
|
|
370
372
|
objectql.getSteedosSchema().broker.broadcast("$packages.statisticsActivatedPackages", {});
|
|
371
373
|
}
|
|
372
374
|
})
|
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"type": "
|
|
2
|
+
"type": "steedos-record-service",
|
|
3
3
|
"body": [
|
|
4
4
|
{
|
|
5
5
|
"type": "steedos-record-detail-header",
|
|
6
|
+
"id": "u:bc56cf9d43bc",
|
|
6
7
|
"label": "标题面板",
|
|
7
8
|
"objectApiName": "${objectName}",
|
|
8
|
-
"recordId": "${recordId}"
|
|
9
|
-
"onEvent": {
|
|
10
|
-
"recordLoaded": {
|
|
11
|
-
"actions": [
|
|
12
|
-
{
|
|
13
|
-
"actionType": "setValue",
|
|
14
|
-
"args": {
|
|
15
|
-
"value": {
|
|
16
|
-
"recordLoaded": true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"actionType": "reload",
|
|
22
|
-
"data": {
|
|
23
|
-
"name": "${record.label}",
|
|
24
|
-
"record": "${record}",
|
|
25
|
-
"recordLoaded": true
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"id": "u:bc56cf9d43bc"
|
|
9
|
+
"recordId": "${recordId}"
|
|
32
10
|
},
|
|
33
11
|
{
|
|
34
12
|
"type": "tabs",
|
|
@@ -41,9 +19,9 @@
|
|
|
41
19
|
"label": "对象表单",
|
|
42
20
|
"mode": "read",
|
|
43
21
|
"objectApiName": "${objectName}",
|
|
44
|
-
"recordId": "${recordId}",
|
|
45
22
|
"labelAlign": "left",
|
|
46
|
-
"id": "u:4eb5fa6f6fad"
|
|
23
|
+
"id": "u:4eb5fa6f6fad",
|
|
24
|
+
"recordId": "${recordId}"
|
|
47
25
|
}
|
|
48
26
|
],
|
|
49
27
|
"id": "u:b2fbc13aabb8"
|
|
@@ -54,10 +32,11 @@
|
|
|
54
32
|
{
|
|
55
33
|
"type": "steedos-object-related-listview",
|
|
56
34
|
"objectApiName": "objects",
|
|
57
|
-
"recordId": "${recordId}",
|
|
58
35
|
"relatedObjectApiName": "object_fields",
|
|
59
36
|
"id": "u:6bef459155bd",
|
|
60
|
-
"top": 2000
|
|
37
|
+
"top": 2000,
|
|
38
|
+
"recordId": "${recordId}",
|
|
39
|
+
"relatedKey": "object"
|
|
61
40
|
}
|
|
62
41
|
],
|
|
63
42
|
"id": "u:f1a52545b642"
|
|
@@ -68,10 +47,10 @@
|
|
|
68
47
|
{
|
|
69
48
|
"type": "steedos-object-related-listview",
|
|
70
49
|
"objectApiName": "objects",
|
|
71
|
-
"recordId": "${recordId}",
|
|
72
50
|
"relatedObjectApiName": "object_listviews",
|
|
73
51
|
"id": "u:c415f75c5557",
|
|
74
|
-
"perPage": 20
|
|
52
|
+
"perPage": 20,
|
|
53
|
+
"recordId": "${recordId}"
|
|
75
54
|
}
|
|
76
55
|
],
|
|
77
56
|
"id": "u:df900c5f2119"
|
|
@@ -82,24 +61,39 @@
|
|
|
82
61
|
{
|
|
83
62
|
"type": "steedos-object-related-listview",
|
|
84
63
|
"objectApiName": "objects",
|
|
85
|
-
"recordId": "${recordId}",
|
|
86
64
|
"relatedObjectApiName": "object_actions",
|
|
87
65
|
"perPage": 20,
|
|
88
|
-
"id": "u:e1a8b77a140c"
|
|
66
|
+
"id": "u:e1a8b77a140c",
|
|
67
|
+
"recordId": "${recordId}"
|
|
89
68
|
}
|
|
90
69
|
],
|
|
91
70
|
"id": "u:d75b105f6d02"
|
|
92
71
|
},
|
|
72
|
+
{
|
|
73
|
+
"title": "对象页面",
|
|
74
|
+
"body": [
|
|
75
|
+
{
|
|
76
|
+
"type": "steedos-object-related-listview",
|
|
77
|
+
"objectApiName": "objects",
|
|
78
|
+
"relatedObjectApiName": "pages",
|
|
79
|
+
"relatedKey": "object_name",
|
|
80
|
+
"perPage": 20,
|
|
81
|
+
"id": "u:e1a8b77a140c2",
|
|
82
|
+
"recordId": "${recordId}"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"id": "u:d75b105f6d042"
|
|
86
|
+
},
|
|
93
87
|
{
|
|
94
88
|
"title": "页面布局",
|
|
95
89
|
"body": [
|
|
96
90
|
{
|
|
97
91
|
"type": "steedos-object-related-listview",
|
|
98
92
|
"objectApiName": "objects",
|
|
99
|
-
"recordId": "${recordId}",
|
|
100
93
|
"relatedObjectApiName": "object_layouts",
|
|
101
94
|
"id": "u:ed9559f8aa86",
|
|
102
|
-
"perPage": 20
|
|
95
|
+
"perPage": 20,
|
|
96
|
+
"recordId": "${recordId}"
|
|
103
97
|
}
|
|
104
98
|
],
|
|
105
99
|
"id": "u:ee4ab13a92e6"
|
|
@@ -178,11 +172,19 @@
|
|
|
178
172
|
"contentClassName": "bg-white"
|
|
179
173
|
}
|
|
180
174
|
],
|
|
181
|
-
"
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
"objectApiName": "${objectName}",
|
|
176
|
+
"data": {
|
|
177
|
+
"objectName": "objects",
|
|
178
|
+
"recordId": "space_users",
|
|
179
|
+
"context": {
|
|
180
|
+
"rootUrl": "http://127.0.0.1:5800",
|
|
181
|
+
"tenantId": "hKdnwE55WcnWveYxS",
|
|
182
|
+
"userId": "62ede4f62161e377e35de58c",
|
|
183
|
+
"authToken": "b6475c5536a26d23d3db84e96536e08e82e1e726380cdd5cb09fc977e1d6e57c08fb23d7a1090006189d3d"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
184
186
|
"id": "page_objects_record_detail",
|
|
185
187
|
"name": "page_objects_record_detail",
|
|
186
188
|
"bodyClassName": "",
|
|
187
189
|
"className": "object-detail-page"
|
|
188
|
-
}
|
|
190
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-06-02 17:45:15
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2023-04-09 12:15:18
|
|
6
6
|
* @Description:
|
|
7
7
|
-->
|
|
8
8
|
<html>
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
const initialContent = {
|
|
38
38
|
type: "service",
|
|
39
39
|
bodyClassName: 'p-0',
|
|
40
|
-
regions: [
|
|
41
|
-
"body"
|
|
42
|
-
]
|
|
43
40
|
};
|
|
44
41
|
|
|
45
42
|
if (id) {
|
|
@@ -69,7 +66,10 @@
|
|
|
69
66
|
let schema = button?.amis_schema ;
|
|
70
67
|
if(!schema){
|
|
71
68
|
schema = Object.assign({}, initialContent, {body: [
|
|
72
|
-
|
|
69
|
+
{
|
|
70
|
+
"type": "steedos-object-table",
|
|
71
|
+
"objectApiName": "${objectName}"
|
|
72
|
+
}
|
|
73
73
|
]});
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
|
|
89
89
|
schema.data.app_id = '';
|
|
90
90
|
schema.data.tab_id = '';
|
|
91
|
-
schema.data.
|
|
91
|
+
schema.data.objectName = '<%=object_name%>';
|
|
92
92
|
schema.data.dataComponentId = '';
|
|
93
93
|
schema.data.record_id = '';
|
|
94
94
|
schema.data.record = {};
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
delete schema.data.context.tenantId;
|
|
123
123
|
delete schema.data.context.authToken;
|
|
124
124
|
delete schema.data.context.user;
|
|
125
|
+
delete schema.data.context.rootUrl;
|
|
125
126
|
}
|
|
126
127
|
return await axios.post(
|
|
127
128
|
`${rootUrl}/graphql`,
|
|
@@ -151,6 +152,7 @@
|
|
|
151
152
|
if (data) {
|
|
152
153
|
if (data.type === 'builder.loadContent') {
|
|
153
154
|
loadPage().then((content)=>{
|
|
155
|
+
console.log("loadPage====", content)
|
|
154
156
|
comp.messageFrame('builder.contentChanged', { AmisSchema : content } )
|
|
155
157
|
})
|
|
156
158
|
}
|
|
@@ -10,6 +10,7 @@ const ejs = require('ejs');
|
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const _ = require('lodash');
|
|
12
12
|
const path = require('path');
|
|
13
|
+
const objectql = require('@steedos/objectql');
|
|
13
14
|
|
|
14
15
|
router.get('/api/amisListviewDesign', core.requireAuthentication, async function (req, res) {
|
|
15
16
|
try {
|
|
@@ -27,7 +28,7 @@ router.get('/api/amisListviewDesign', core.requireAuthentication, async function
|
|
|
27
28
|
const retUrl = __meteor_runtime_config__.ROOT_URL + `/app/admin/object_listviews/view/${req.query.id}`
|
|
28
29
|
const steedosBuilderUrl = process.env.STEEDOS_BUILDER_URL || 'https://builder.steedos.cn';
|
|
29
30
|
const builderHost = `${steedosBuilderUrl}/amis?${assetUrl}retUrl=${retUrl}`;
|
|
30
|
-
|
|
31
|
+
const record = await objectql.getObject('object_listviews').findOne(req.query.id);
|
|
31
32
|
// let data = fs.readFileSync(__dirname+'/design.html', 'utf8');
|
|
32
33
|
// res.send(data.replace('SteedosBuilderHost',steedosBuilderHost).replace('DataContext', JSON.stringify(dataContext)));
|
|
33
34
|
|
|
@@ -40,6 +41,7 @@ router.get('/api/amisListviewDesign', core.requireAuthentication, async function
|
|
|
40
41
|
userId: userSession.userId,
|
|
41
42
|
authToken: userSession.authToken,
|
|
42
43
|
id: req.query.id,
|
|
44
|
+
object_name: record?.object_name
|
|
43
45
|
}
|
|
44
46
|
const options = {}
|
|
45
47
|
ejs.renderFile(filename, data, options, function(err, str){
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-08-05 14:20:24
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime: 2023-03-
|
|
4
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5
|
+
* @LastEditTime: 2023-03-29 23:32:35
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const express = require('express');
|
|
@@ -25,36 +25,4 @@ router.post('/api/listview/filters', core.requireAuthentication, async function
|
|
|
25
25
|
res.status(200).send(record);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
router.post('/api/listview/:id/amis-schema/clear', core.requireAuthentication, async function (req, res) {
|
|
29
|
-
const { id } = req.params;
|
|
30
|
-
const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: "" });
|
|
31
|
-
res.status(200).send(record);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
router.post('/api/listview/:id/amis-schema/reset', core.requireAuthentication, async function (req, res) {
|
|
35
|
-
try {
|
|
36
|
-
const userSession = req.user;
|
|
37
|
-
const { id } = req.params;
|
|
38
|
-
const listviews = await objectql.getObject('object_listviews').directFind({filters: [['_id', '=', id]],fields: ["object_name", "name"]});
|
|
39
|
-
let listview;
|
|
40
|
-
if(listviews && listviews.length > 0){
|
|
41
|
-
listview = listviews[0];
|
|
42
|
-
}
|
|
43
|
-
else{
|
|
44
|
-
res.status(500).send(`The listview for id "${id}" Not found`);
|
|
45
|
-
}
|
|
46
|
-
const AmisLib = require('@steedos-widgets/amis-lib');
|
|
47
|
-
AmisLib.setUISchemaFunction(async function(objectName, force){
|
|
48
|
-
return await getUISchema(objectName, userSession);
|
|
49
|
-
});
|
|
50
|
-
let schema = await AmisLib.getListviewInitSchema(listview.object_name, listview.name);
|
|
51
|
-
const record = await objectql.getObject('object_listviews').directUpdate(id, { amis_schema: JSON.stringify(schema, null, 4) });
|
|
52
|
-
res.status(200).send(record);
|
|
53
|
-
|
|
54
|
-
} catch (error) {
|
|
55
|
-
res.status(500).send(error.message);
|
|
56
|
-
console.error(error);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
28
|
exports.default = router;
|
|
@@ -222,7 +222,7 @@ module.exports = {
|
|
|
222
222
|
objectName = filters._id.split('.')[0];
|
|
223
223
|
}
|
|
224
224
|
if(objectName){
|
|
225
|
-
let fields = await InternalData.getObjectFields(objectName, this.userId);
|
|
225
|
+
let fields = await InternalData.getObjectFields(objectName, this.userId, filters.name ? true : false);
|
|
226
226
|
if(fields){
|
|
227
227
|
_.each(fields, (field)=>{
|
|
228
228
|
this.data.values.push(Object.assign({_id: `${objectName}.${field.name}`}, field))
|
|
@@ -254,7 +254,7 @@ module.exports = {
|
|
|
254
254
|
objectName = filters._id.split('.')[0];
|
|
255
255
|
}
|
|
256
256
|
if(objectName){
|
|
257
|
-
let fields = await InternalData.getObjectFields(objectName, this.userId);
|
|
257
|
+
let fields = await InternalData.getObjectFields(objectName, this.userId, true);
|
|
258
258
|
if(fields){
|
|
259
259
|
_.each(fields, (field)=>{
|
|
260
260
|
this.data.values.push(Object.assign({_id: `${objectName}.${field.name}`}, field))
|
|
@@ -21,12 +21,19 @@ const getInternalListviews = async function(sourceListviews, filters, is_system)
|
|
|
21
21
|
|
|
22
22
|
module.exports = {
|
|
23
23
|
beforeInsert: async function () {
|
|
24
|
+
if (!this.doc.name) {
|
|
25
|
+
this.doc.name = 'listview_' + this.doc._id.toLowerCase();
|
|
26
|
+
}
|
|
24
27
|
await util.checkAPIName(this.object_name, 'name', this.doc.name, undefined, [['is_system','!=', true], ['object_name','=', this.doc.object_name]]);
|
|
25
|
-
|
|
26
28
|
},
|
|
27
29
|
beforeUpdate: async function () {
|
|
28
30
|
const oldDoc = await objectql.getObject(this.object_name).findOne(this.id)
|
|
29
31
|
let name = oldDoc.name,object_name = oldDoc.object_name;
|
|
32
|
+
|
|
33
|
+
if (!this.doc.name) {
|
|
34
|
+
this.doc.name = 'listview_' + this.id.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
if(_.has(this.doc, 'name')){
|
|
31
38
|
name = this.doc.name
|
|
32
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.5.0-beta.
|
|
3
|
+
"version": "2.5.0-beta.11",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
},
|
|
16
16
|
"repository": {},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "72a894aab5a9d4e277d0464decda0ba39f2f50bb"
|
|
19
19
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
name: amis_buttons
|
|
2
|
-
amis_schema: |-
|
|
3
|
-
{
|
|
4
|
-
"type": "service",
|
|
5
|
-
"body": [
|
|
6
|
-
{
|
|
7
|
-
"type": "button",
|
|
8
|
-
"label": "重置",
|
|
9
|
-
"id": "u:76144dacd93c",
|
|
10
|
-
"onEvent": {
|
|
11
|
-
"click": {
|
|
12
|
-
"actions": [
|
|
13
|
-
{
|
|
14
|
-
"args": {
|
|
15
|
-
"api": {
|
|
16
|
-
"url": "${context.rootUrl}/api/listview/${record_id}/amis-schema/reset",
|
|
17
|
-
"method": "post",
|
|
18
|
-
"headers": {
|
|
19
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"messages": {
|
|
23
|
-
"success": "Amis Schema重置成功!",
|
|
24
|
-
"failed": "Amis Schema重置失败!"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"actionType": "ajax"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"tooltip": "重置列表视图Amis Schema",
|
|
33
|
-
"tooltipPlacement": "top",
|
|
34
|
-
"className": ""
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
"regions": [
|
|
38
|
-
"body"
|
|
39
|
-
],
|
|
40
|
-
"data": {
|
|
41
|
-
"context": "${context}"
|
|
42
|
-
},
|
|
43
|
-
"id": "u:9a37e91e4b8d",
|
|
44
|
-
"bodyClassName": "p-0"
|
|
45
|
-
}
|
|
46
|
-
is_enable: true
|
|
47
|
-
label: AmisSchema
|
|
48
|
-
'on': record_only
|
|
49
|
-
type: amis_button
|
|
50
|
-
visible: !!js/function |
|
|
51
|
-
function (object_name, record_id, record_permissions, record) {
|
|
52
|
-
return Creator.baseObject.actions.standard_edit.visible() && !record.is_system && record.enable_amis_schema;
|
|
53
|
-
}
|