@steedos/service-pages 3.0.0-beta.8 → 3.0.0-beta.80
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/client/page.render.client.js +0 -3
- package/main/default/objects/pages/buttons/customPage.button.js +1 -4
- package/main/default/objects/pages/buttons/deploy.button.js +1 -4
- package/main/default/objects/pages/buttons/disable.button.yml +183 -0
- package/main/default/objects/pages/buttons/enable.button.yml +42 -0
- package/main/default/objects/pages/buttons/showDesign.button.js +0 -6
- package/main/default/objects/pages/buttons/viewPage.button.js +3 -2
- package/main/default/routes/page_design.ejs +2 -2
- package/main/default/services/page.service.js +3 -1
- package/main/default/triggers/api_name.js +9 -5
- package/package.json +2 -2
- package/main/default/objects/pages/buttons/disable.button.js +0 -36
- package/main/default/objects/pages/buttons/enable.button.js +0 -31
|
@@ -322,12 +322,9 @@
|
|
|
322
322
|
this.containerList = [];
|
|
323
323
|
this.pageName = null;
|
|
324
324
|
return this.autorun(function(computation) {
|
|
325
|
-
// console.log('autorun=====>computation:', computation)
|
|
326
|
-
// Session.get("record_id");
|
|
327
325
|
var container, e, lastData, ref, ref1, ref2, regions, schema, updateProps, updatePropsData;
|
|
328
326
|
if(self.data.regions){
|
|
329
327
|
regions = self.data.regions();
|
|
330
|
-
// console.log('regions====>', regions, this.lastRegions);
|
|
331
328
|
updateProps = true;
|
|
332
329
|
if (regions.objectName !== ((ref = this.lastRegions) != null ? ref.objectName : void 0)) {
|
|
333
330
|
updateProps = false;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
module.exports = {
|
|
9
9
|
customPage: function (object_name, record_id) {
|
|
10
|
-
$(document.body).addClass('loading');
|
|
11
10
|
let url = `/service/api/page/customPage`;
|
|
12
11
|
let options = {
|
|
13
12
|
type: 'post',
|
|
@@ -17,15 +16,13 @@ module.exports = {
|
|
|
17
16
|
SteedosUI.notification.success({
|
|
18
17
|
message: '页面已自定义。'
|
|
19
18
|
});
|
|
20
|
-
|
|
21
|
-
$(document.body).removeClass('loading');
|
|
19
|
+
navigate("/app/admin/pages/view/" + data._id)
|
|
22
20
|
},
|
|
23
21
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
24
22
|
SteedosUI.notification.error({
|
|
25
23
|
message: '操作失败',
|
|
26
24
|
description: t(XMLHttpRequest.responseJSON.error),
|
|
27
25
|
});
|
|
28
|
-
$(document.body).removeClass('loading');
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
28
|
Steedos.authRequest(url, options);
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
module.exports = {
|
|
9
9
|
deploy: function (object_name, record_id) {
|
|
10
|
-
$(document.body).addClass('loading');
|
|
11
10
|
let url = `/service/api/page/deploy`;
|
|
12
11
|
let options = {
|
|
13
12
|
type: 'post',
|
|
@@ -18,15 +17,13 @@ module.exports = {
|
|
|
18
17
|
message: '页面已发布。'
|
|
19
18
|
});
|
|
20
19
|
SteedosUI.reloadRecord(object_name, record_id);
|
|
21
|
-
|
|
22
|
-
$(document.body).removeClass('loading');
|
|
20
|
+
window.location.reload();
|
|
23
21
|
},
|
|
24
22
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
25
23
|
SteedosUI.notification.error({
|
|
26
24
|
message: '操作失败',
|
|
27
25
|
description: t(XMLHttpRequest.responseJSON.error),
|
|
28
26
|
});
|
|
29
|
-
$(document.body).removeClass('loading');
|
|
30
27
|
}
|
|
31
28
|
};
|
|
32
29
|
Steedos.authRequest(url, options);
|
|
@@ -1,6 +1,189 @@
|
|
|
1
1
|
name: disable
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "禁用",
|
|
9
|
+
"id": "u:disable",
|
|
10
|
+
"visibleOn": "${is_active && !is_system}",
|
|
11
|
+
"actionType": "ajax",
|
|
12
|
+
"api": {
|
|
13
|
+
"url": "${context.rootUrl}/service/api/page/disable",
|
|
14
|
+
"method": "post",
|
|
15
|
+
"requestAdaptor": "var recordId = context.recordId;\napi.data = {\n pageId: recordId\n}",
|
|
16
|
+
"adaptor": "",
|
|
17
|
+
"messages": {
|
|
18
|
+
"success": "页面已禁用。",
|
|
19
|
+
"failed": "操作失败"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"editorState": "default"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"regions": [
|
|
26
|
+
"body"
|
|
27
|
+
],
|
|
28
|
+
"data": {
|
|
29
|
+
"context": {},
|
|
30
|
+
"dataComponentId": "",
|
|
31
|
+
"record_id": "",
|
|
32
|
+
"record": {},
|
|
33
|
+
"permissions": {}
|
|
34
|
+
},
|
|
35
|
+
"bodyClassName": "p-0",
|
|
36
|
+
"dsType": "api",
|
|
37
|
+
"asideResizor": false,
|
|
38
|
+
"editorState": "default",
|
|
39
|
+
"pullRefresh": {
|
|
40
|
+
"disabled": true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
amis_schema__: |-
|
|
45
|
+
{
|
|
46
|
+
"type": "service",
|
|
47
|
+
"body": [
|
|
48
|
+
{
|
|
49
|
+
"type": "button",
|
|
50
|
+
"label": "拒绝",
|
|
51
|
+
"id": "u:reject",
|
|
52
|
+
"onEvent": {
|
|
53
|
+
"click": {
|
|
54
|
+
"weight": 0,
|
|
55
|
+
"actions": [
|
|
56
|
+
{
|
|
57
|
+
"actionType": "confirmDialog",
|
|
58
|
+
"dialog": {
|
|
59
|
+
"type": "dialog",
|
|
60
|
+
"title": "拒绝数据",
|
|
61
|
+
"body": [
|
|
62
|
+
{
|
|
63
|
+
"type": "form",
|
|
64
|
+
"title": "拒绝理由",
|
|
65
|
+
"id": "u:reject_form",
|
|
66
|
+
"mode": "normal",
|
|
67
|
+
"body": [
|
|
68
|
+
{
|
|
69
|
+
"type": "textarea",
|
|
70
|
+
"name": "comment",
|
|
71
|
+
"description": "请填写拒绝理由",
|
|
72
|
+
"required": true,
|
|
73
|
+
"id": "u:6669c9012efd"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "tpl",
|
|
77
|
+
"tpl": "确定要拒绝该填写任务中的数据吗?",
|
|
78
|
+
"id": "u:ddf84582ce78"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"actions": [
|
|
82
|
+
{
|
|
83
|
+
"type": "submit",
|
|
84
|
+
"label": "提交",
|
|
85
|
+
"primary": true
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"feat": "Insert"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"onEvent": {
|
|
92
|
+
"confirm": {
|
|
93
|
+
"actions": [
|
|
94
|
+
{
|
|
95
|
+
"actionType": "validate",
|
|
96
|
+
"componentId": "u:reject_form"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"actionType": "custom",
|
|
100
|
+
"script": "// 之前主动触发表单校验是因为dialog confirm事件执行完成后才会触发,这里判断校验失败就中断后续动作\nevent.data.comment = event.data.comment;\nif (event.data.validateResult && event.data.validateResult.error) { \n event.stopPropagation();\n}\n\n\n",
|
|
101
|
+
"args": {}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"actionType": "ajax",
|
|
105
|
+
"ignoreError": false,
|
|
106
|
+
"outputVar": "responseResult",
|
|
107
|
+
"options": {},
|
|
108
|
+
"api": {
|
|
109
|
+
"url": "${context.rootUrl}/api/builder6/b6_collect/actions/reject",
|
|
110
|
+
"method": "post",
|
|
111
|
+
"requestAdaptor": "var targets = [{\n id: context._id\n}];\napi.data = {\n targets,\n comment: context.comment\n}",
|
|
112
|
+
"adaptor": "",
|
|
113
|
+
"messages": {
|
|
114
|
+
"success": "已拒绝该填写任务中的数据!",
|
|
115
|
+
"failed": "很抱歉,提交过程中出现问题。请稍后重试或联系技术支持!"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"actionType": "broadcast",
|
|
121
|
+
"args": {
|
|
122
|
+
"eventName": "@data.changed.b6_collect"
|
|
123
|
+
},
|
|
124
|
+
"data": {
|
|
125
|
+
"objectName": "b6_collect",
|
|
126
|
+
"displayAs": "${displayAs}",
|
|
127
|
+
"recordId": "notEmpty"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"actionType": "confirmDialog",
|
|
134
|
+
"actions": [
|
|
135
|
+
{
|
|
136
|
+
"type": "button",
|
|
137
|
+
"actionType": "cancel",
|
|
138
|
+
"label": "取消",
|
|
139
|
+
"id": "u:6d0b193270fb"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"type": "button",
|
|
143
|
+
"actionType": "confirm",
|
|
144
|
+
"label": "确定",
|
|
145
|
+
"primary": true,
|
|
146
|
+
"id": "u:da420989ec0f"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"showCloseButton": true,
|
|
150
|
+
"closeOnOutside": false,
|
|
151
|
+
"closeOnEsc": false,
|
|
152
|
+
"showErrorMsg": true,
|
|
153
|
+
"showLoading": true,
|
|
154
|
+
"draggable": false,
|
|
155
|
+
"id": "u:e84a743c78f2"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"editorState": "default"
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"regions": [
|
|
165
|
+
"body"
|
|
166
|
+
],
|
|
167
|
+
"data": {
|
|
168
|
+
"context": {},
|
|
169
|
+
"dataComponentId": "",
|
|
170
|
+
"record_id": "",
|
|
171
|
+
"record": {},
|
|
172
|
+
"permissions": {}
|
|
173
|
+
},
|
|
174
|
+
"id": "u:627b94b32af8",
|
|
175
|
+
"bodyClassName": "p-0",
|
|
176
|
+
"dsType": "api",
|
|
177
|
+
"asideResizor": false,
|
|
178
|
+
"editorState": "default",
|
|
179
|
+
"pullRefresh": {
|
|
180
|
+
"disabled": true
|
|
181
|
+
},
|
|
182
|
+
"definitions": {}
|
|
183
|
+
}
|
|
2
184
|
is_enable: true
|
|
3
185
|
label: 禁用
|
|
4
186
|
'on': record_only
|
|
187
|
+
type: amis_button
|
|
5
188
|
visible: true
|
|
6
189
|
sort: 100
|
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
name: enable
|
|
2
|
+
amis_schema: |-
|
|
3
|
+
{
|
|
4
|
+
"type": "service",
|
|
5
|
+
"body": [
|
|
6
|
+
{
|
|
7
|
+
"type": "button",
|
|
8
|
+
"label": "启用",
|
|
9
|
+
"id": "u:enable",
|
|
10
|
+
"visibleOn": "${!is_active && !record.is_system}",
|
|
11
|
+
"actionType": "ajax",
|
|
12
|
+
"api": {
|
|
13
|
+
"url": "${context.rootUrl}/service/api/page/enable",
|
|
14
|
+
"method": "post",
|
|
15
|
+
"requestAdaptor": "var recordId = context.recordId;\napi.data = {\n pageId: recordId\n}",
|
|
16
|
+
"adaptor": "",
|
|
17
|
+
"messages": {
|
|
18
|
+
"success": "页面已启用。",
|
|
19
|
+
"failed": "操作失败"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"editorState": "default"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"regions": [
|
|
26
|
+
"body"
|
|
27
|
+
],
|
|
28
|
+
"data": {
|
|
29
|
+
"context": {},
|
|
30
|
+
"dataComponentId": "",
|
|
31
|
+
"record_id": "",
|
|
32
|
+
"record": {},
|
|
33
|
+
"permissions": {}
|
|
34
|
+
},
|
|
35
|
+
"bodyClassName": "p-0",
|
|
36
|
+
"dsType": "api",
|
|
37
|
+
"asideResizor": false,
|
|
38
|
+
"editorState": "default",
|
|
39
|
+
"pullRefresh": {
|
|
40
|
+
"disabled": true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
2
43
|
is_enable: true
|
|
3
44
|
label: 启用
|
|
4
45
|
'on': record_only
|
|
46
|
+
type: amis_button
|
|
5
47
|
visible: true
|
|
6
48
|
sort: 100
|
|
@@ -8,12 +8,6 @@ module.exports = {
|
|
|
8
8
|
perms = {};
|
|
9
9
|
if (record_permissions) {
|
|
10
10
|
perms = record_permissions;
|
|
11
|
-
} else {
|
|
12
|
-
record = Creator.getObjectRecord(object_name, record_id);
|
|
13
|
-
record_permissions = Creator.getRecordPermissions(object_name, record, Meteor.userId());
|
|
14
|
-
if (record_permissions) {
|
|
15
|
-
perms = record_permissions;
|
|
16
|
-
}
|
|
17
11
|
}
|
|
18
12
|
return perms["allowEdit"];
|
|
19
13
|
}
|
|
@@ -16,7 +16,8 @@ module.exports = {
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
viewPageVisible: function (object_name, record_id, permission, data) {
|
|
19
|
-
var record = data && data.record;
|
|
20
|
-
return record && record.type === 'app';
|
|
19
|
+
// var record = data && data.record;
|
|
20
|
+
// return record && record.type === 'app';
|
|
21
|
+
return false;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -142,13 +142,13 @@
|
|
|
142
142
|
|
|
143
143
|
if (objectName && pageType === "record") {
|
|
144
144
|
const record = await axios.get(
|
|
145
|
-
`${rootUrl}/api/
|
|
145
|
+
`${rootUrl}/api/v1/${objectName}?$sort=modified&$top=1`,
|
|
146
146
|
{
|
|
147
147
|
withCredentials: true,
|
|
148
148
|
headers: { Authorization: `Bearer ${tenantId},${authToken}` },
|
|
149
149
|
}
|
|
150
150
|
);
|
|
151
|
-
const value = record?.data?.
|
|
151
|
+
const value = record?.data?.items;
|
|
152
152
|
if (value?.length > 0) {
|
|
153
153
|
schema.data.recordId = value[0]._id;
|
|
154
154
|
}
|
|
@@ -3,7 +3,9 @@ const metadataAPI = require('@steedos/metadata-api');
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
4
|
// 使用变量,存储所有资产
|
|
5
5
|
const ASSETS = {};
|
|
6
|
-
const ENV_ASSETS = process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS
|
|
6
|
+
const ENV_ASSETS = process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS
|
|
7
|
+
? process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS.split(",")
|
|
8
|
+
: []
|
|
7
9
|
module.exports = {
|
|
8
10
|
name: "page",
|
|
9
11
|
mixins: [],
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
const objectql = require('@steedos/objectql');
|
|
2
2
|
async function isSpaceUnique(spaceId, object_name, doc, name, _id){
|
|
3
|
-
const
|
|
4
|
-
filters.push(['space', '=', spaceId])
|
|
5
|
-
filters.push(['name', '=', name || doc.name])
|
|
3
|
+
const query = {space: spaceId, name: name || doc.name};
|
|
6
4
|
if(_id){
|
|
7
|
-
|
|
5
|
+
query._id = {
|
|
6
|
+
'$ne': _id
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const datasource = objectql.getDataSource('default');
|
|
10
|
+
const adapter = datasource.adapter
|
|
11
|
+
await adapter.connect()
|
|
12
|
+
const collection = adapter.collection(object_name);
|
|
13
|
+
const count = await collection.countDocuments(query)
|
|
10
14
|
if(count > 0)
|
|
11
15
|
return false
|
|
12
16
|
return true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-pages",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.80",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "32e451dcb9225c8968200081644d507bb67ebe17",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"clone": "^2.1.2",
|
|
14
14
|
"ejs": "^3.1.8"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: baozhoutao@steedos.com
|
|
3
|
-
* @Date: 2022-03-29 19:19:01
|
|
4
|
-
* @Description:
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
disable: function (object_name, record_id) {
|
|
8
|
-
$(document.body).addClass('loading');
|
|
9
|
-
let url = `/service/api/page/disable`;
|
|
10
|
-
let options = {
|
|
11
|
-
type: 'post',
|
|
12
|
-
async: true,
|
|
13
|
-
data: JSON.stringify({ pageId: record_id }),
|
|
14
|
-
success: function (data) {
|
|
15
|
-
SteedosUI.notification.success({
|
|
16
|
-
message: '页面已禁用。'
|
|
17
|
-
});
|
|
18
|
-
SteedosUI.reloadRecord(object_name, record_id);
|
|
19
|
-
FlowRouter.reload();
|
|
20
|
-
$(document.body).removeClass('loading');
|
|
21
|
-
},
|
|
22
|
-
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
23
|
-
SteedosUI.notification.error({
|
|
24
|
-
message: '操作失败',
|
|
25
|
-
description: t(XMLHttpRequest.responseJSON.error),
|
|
26
|
-
});
|
|
27
|
-
$(document.body).removeClass('loading');
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
Steedos.authRequest(url, options);
|
|
31
|
-
},
|
|
32
|
-
disableVisible: function (object_name, record_id, permission, data) {
|
|
33
|
-
var record = data && data.record;
|
|
34
|
-
return record && record.is_active && !record.is_system
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: baozhoutao@steedos.com
|
|
3
|
-
* @Date: 2022-03-29 19:19:01
|
|
4
|
-
* @Description:
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
enable: function (object_name, record_id) {
|
|
8
|
-
$(document.body).addClass('loading');
|
|
9
|
-
let url = `/service/api/page/enable`;
|
|
10
|
-
let options = {
|
|
11
|
-
type: 'post',
|
|
12
|
-
async: true,
|
|
13
|
-
data: JSON.stringify({ pageId: record_id }),
|
|
14
|
-
success: function (data) {
|
|
15
|
-
toastr.success('页面已启用。');
|
|
16
|
-
SteedosUI.reloadRecord(object_name, record_id);
|
|
17
|
-
FlowRouter.reload();
|
|
18
|
-
$(document.body).removeClass('loading');
|
|
19
|
-
},
|
|
20
|
-
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
21
|
-
toastr.error(t(XMLHttpRequest.responseJSON.error))
|
|
22
|
-
$(document.body).removeClass('loading');
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
Steedos.authRequest(url, options);
|
|
26
|
-
},
|
|
27
|
-
enableVisible: function (object_name, record_id, permission, data) {
|
|
28
|
-
var record = data && data.record;
|
|
29
|
-
return record && !record.is_active && !record.is_system
|
|
30
|
-
}
|
|
31
|
-
}
|