@steedos/standard-object-database 2.4.8-beta.6 → 2.4.9-beta.1
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,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-03-30 17:55:29
|
|
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 = {};
|
|
@@ -151,6 +151,7 @@
|
|
|
151
151
|
if (data) {
|
|
152
152
|
if (data.type === 'builder.loadContent') {
|
|
153
153
|
loadPage().then((content)=>{
|
|
154
|
+
console.log("loadPage====", content)
|
|
154
155
|
comp.messageFrame('builder.contentChanged', { AmisSchema : content } )
|
|
155
156
|
})
|
|
156
157
|
}
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.9-beta.1",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"description": "steedos package",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@steedos-widgets/amis-lib": "^1.0.22"
|
|
15
|
-
},
|
|
16
13
|
"repository": {},
|
|
17
14
|
"license": "MIT",
|
|
18
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "c2fb22f5c8ac953ebfd9c30a9fd448f5191f58b8"
|
|
19
16
|
}
|
|
@@ -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
|
-
}
|