@steedos/standard-object-database 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.
- package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +2 -2
- package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +2 -2
- package/main/default/objectTranslations/object_triggers.zh-CN/object_triggers.zh-CN.objectTranslation.yml +3 -5
- package/main/default/objects/13.permission_fields.observe.object.js +3 -0
- package/main/default/objects/14.object_fields.observe.object.js +3 -3
- package/main/default/objects/15.permission_objects.observe.object.js +5 -2
- package/main/default/objects/2.object_triggers.observe.object.js +42 -34
- package/main/default/objects/3.permission_objects.observe.object.js +39 -6
- package/main/default/objects/datasources.object.js +4 -0
- package/main/default/objects/datasources.object.yml +10 -0
- package/main/default/objects/object_actions.object.yml +16 -10
- package/main/default/objects/object_fields.object.js +1 -1
- package/main/default/objects/object_fields.object.yml +154 -62
- package/main/default/objects/object_triggers.object.yml +56 -52
- package/main/default/objects/objects.core.js +0 -28
- package/main/default/objects/objects.object.yml +1 -1
- package/main/default/pages/object_detail.page.amis.json +52 -3
- package/main/default/routes/amis_button_design.ejs +6 -5
- package/main/default/routes/amis_listview_design.router.js +1 -1
- package/main/default/services/database-objects.service.js +137 -0
- package/main/default/services/suggestions.service.js +187 -0
- package/main/default/triggers/datasources.trigger.js +16 -29
- package/main/default/triggers/object_triggers.trigger.js +78 -33
- package/package.json +2 -2
- package/main/default/objects/object_triggers.core.js +0 -58
- package/main/default/objects/object_triggers.object.js +0 -65
package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml
CHANGED
|
@@ -53,9 +53,9 @@ fields:
|
|
|
53
53
|
value: percent
|
|
54
54
|
- label: Password
|
|
55
55
|
value: password
|
|
56
|
-
- label: Lookup
|
|
56
|
+
- label: Lookup Relationship
|
|
57
57
|
value: lookup
|
|
58
|
-
- label: Master
|
|
58
|
+
- label: Master-Detail Relationship
|
|
59
59
|
value: master_detail
|
|
60
60
|
- label: Autonumber
|
|
61
61
|
value: autonumber
|
|
@@ -14,14 +14,12 @@ fields:
|
|
|
14
14
|
label: 运行时
|
|
15
15
|
help:
|
|
16
16
|
description:
|
|
17
|
-
|
|
17
|
+
isEnabled:
|
|
18
18
|
label: 已启用
|
|
19
19
|
help:
|
|
20
20
|
description:
|
|
21
|
-
|
|
22
|
-
label:
|
|
23
|
-
执行的脚本 <a target="_blank"
|
|
24
|
-
href="https://developer.steedos.com/developer/object_trigger">查看帮助</a>
|
|
21
|
+
handler:
|
|
22
|
+
label: 内容
|
|
25
23
|
help:
|
|
26
24
|
description:
|
|
27
25
|
listviews:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-08-05 14:17:44
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime: 2023-
|
|
4
|
+
* @LastEditors: sunhaolin@hotoa.com
|
|
5
|
+
* @LastEditTime: 2023-05-12 09:33:27
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const objectql = require("@steedos/objectql");
|
|
@@ -13,7 +13,7 @@ Meteor.startup(function () {
|
|
|
13
13
|
// 重置字段权限延迟10秒,防止对象服务未上线
|
|
14
14
|
setTimeout(()=>{
|
|
15
15
|
try {
|
|
16
|
-
console.log("====resetAllPermissionSetFieldPermissions====")
|
|
16
|
+
// console.log("====resetAllPermissionSetFieldPermissions====")
|
|
17
17
|
objectql.getSteedosSchema().broker.call(`permission_fields.resetAllPermissionSetFieldPermissions`, {
|
|
18
18
|
objectName: document.object
|
|
19
19
|
}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-08-05 14:17:44
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime: 2023-
|
|
4
|
+
* @LastEditors: sunhaolin@hotoa.com
|
|
5
|
+
* @LastEditTime: 2023-05-13 17:09:31
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const objectql = require("@steedos/objectql");
|
|
@@ -38,6 +38,9 @@ Meteor.startup(function () {
|
|
|
38
38
|
}
|
|
39
39
|
}).observe({
|
|
40
40
|
added: function (newDocument) {
|
|
41
|
+
if (newDocument.copy_from) { // 通过复制简档创建的对象权限,不需要重置字段权限
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
41
44
|
if (inited) {
|
|
42
45
|
return _change(newDocument);
|
|
43
46
|
}
|
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-08-05 14:17:44
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-04-21 17:06:15
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
// var objectql = require('@steedos/objectql');
|
|
9
|
+
// var triggerCore = require('./object_triggers.core.js');
|
|
3
10
|
|
|
4
|
-
Meteor.startup(function () {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
11
|
+
// Meteor.startup(function () {
|
|
12
|
+
// var _change, _remove;
|
|
13
|
+
// _change = function (document) {
|
|
14
|
+
// console.log("object_triggers===> _change");
|
|
15
|
+
// triggerCore.loadObjectTrigger(document)
|
|
16
|
+
// };
|
|
17
|
+
// _remove = function (document) {
|
|
18
|
+
// triggerCore.removeObjectTrigger(document);
|
|
19
|
+
// };
|
|
20
|
+
// var config = objectql.getSteedosConfig();
|
|
21
|
+
// if(config.tenant && config.tenant.saas){
|
|
22
|
+
// return ;
|
|
23
|
+
// }else{
|
|
24
|
+
// Creator.getCollection("object_triggers").find({is_enable: true}, {
|
|
25
|
+
// fields: {
|
|
26
|
+
// created: 0,
|
|
27
|
+
// created_by: 0,
|
|
28
|
+
// modified: 0,
|
|
29
|
+
// modified_by: 0
|
|
30
|
+
// }
|
|
31
|
+
// }).observe({
|
|
32
|
+
// added: function (newDocument) {
|
|
33
|
+
// return _change(newDocument);
|
|
34
|
+
// },
|
|
35
|
+
// changed: function (newDocument, oldDocument) {
|
|
36
|
+
// return _change(newDocument);
|
|
37
|
+
// },
|
|
38
|
+
// removed: function (oldDocument) {
|
|
39
|
+
// return _remove(oldDocument);
|
|
40
|
+
// }
|
|
41
|
+
// });
|
|
42
|
+
// }
|
|
43
|
+
// });
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-08-05 14:17:44
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-05-06 18:58:32
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
2
8
|
|
|
9
|
+
const cachers = require('@steedos/cachers');
|
|
10
|
+
const objectql = require("@steedos/objectql");
|
|
11
|
+
const _ = require('lodash');
|
|
12
|
+
let permissionObjectsLoadSetTimeoutId = null;
|
|
3
13
|
Meteor.startup(function () {
|
|
4
14
|
var _change, _remove;
|
|
5
15
|
_change = function (document) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
if(permissionObjectsLoadSetTimeoutId){
|
|
17
|
+
clearTimeout(permissionObjectsLoadSetTimeoutId);
|
|
18
|
+
permissionObjectsLoadSetTimeoutId = null;
|
|
19
|
+
}
|
|
20
|
+
permissionObjectsLoadSetTimeoutId = setTimeout(()=>{
|
|
21
|
+
objectql.getObject("permission_set").find({}).then((permissionSets)=>{
|
|
22
|
+
objectql.getObject("permission_objects").directFind({}).then((records)=>{
|
|
23
|
+
records = _.map(records, (doc)=>{
|
|
24
|
+
if(_.includes(['admin', 'user', 'customer', 'supplier'], doc.permission_set_id)){
|
|
25
|
+
doc.name = doc.permission_set_id
|
|
26
|
+
}else{
|
|
27
|
+
const record = _.find(permissionSets, (item)=>{
|
|
28
|
+
return doc.permission_set_id == item._id
|
|
29
|
+
})
|
|
30
|
+
if(record){
|
|
31
|
+
doc.name = record.name;
|
|
32
|
+
}else{
|
|
33
|
+
doc.name = _.last(doc.name.split('.')) || doc.permission_set_id;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return doc;
|
|
37
|
+
})
|
|
38
|
+
cachers.getCacher('permission_objects').set('permission_objects', _.groupBy(records, 'space'));
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}, 1000 * 3)
|
|
10
42
|
};
|
|
43
|
+
|
|
11
44
|
Creator.getCollection("permission_objects").find({}, {
|
|
12
45
|
fields: {
|
|
13
46
|
created: 0,
|
|
@@ -23,7 +56,7 @@ Meteor.startup(function () {
|
|
|
23
56
|
return _change(newDocument);
|
|
24
57
|
},
|
|
25
58
|
removed: function (oldDocument) {
|
|
26
|
-
return
|
|
59
|
+
return _change(oldDocument);
|
|
27
60
|
}
|
|
28
61
|
});
|
|
29
62
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const _ = require("underscore");
|
|
2
|
+
const lodash = require("lodash");
|
|
2
3
|
var objectql = require('@steedos/objectql');
|
|
3
4
|
var schema = objectql.getSteedosSchema();
|
|
4
5
|
const datasourceCore = require('./datasources.core');
|
|
@@ -20,6 +21,9 @@ Creator.Objects['datasources'].methods = {
|
|
|
20
21
|
testConnection: async function (req, res) {
|
|
21
22
|
var userSession = req.user
|
|
22
23
|
var recordId = req.params._id;
|
|
24
|
+
if(lodash.includes(defaultDatasourceName, recordId)){
|
|
25
|
+
return res.send({ok: 1});
|
|
26
|
+
}
|
|
23
27
|
var spaceId = userSession.spaceId
|
|
24
28
|
let doc = await objectql.getObject('datasources').findOne(recordId, {filters: `(space eq \'${spaceId}\')`});
|
|
25
29
|
if(doc){
|
|
@@ -82,6 +82,15 @@ fields:
|
|
|
82
82
|
is_enable:
|
|
83
83
|
type: boolean
|
|
84
84
|
label: Enable
|
|
85
|
+
record_permissions:
|
|
86
|
+
type: object
|
|
87
|
+
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
88
|
+
is_system:
|
|
89
|
+
type: boolean
|
|
90
|
+
label: System
|
|
91
|
+
readonly: true
|
|
92
|
+
visible_on: "{{global.mode ==='read' ? true : false}}"
|
|
93
|
+
disabled: true
|
|
85
94
|
list_views:
|
|
86
95
|
all:
|
|
87
96
|
columns:
|
|
@@ -89,6 +98,7 @@ list_views:
|
|
|
89
98
|
- name
|
|
90
99
|
- is_enable
|
|
91
100
|
- driver
|
|
101
|
+
- is_system
|
|
92
102
|
label: All
|
|
93
103
|
filter_scope: space
|
|
94
104
|
actions:
|
|
@@ -76,6 +76,7 @@ fields:
|
|
|
76
76
|
type:
|
|
77
77
|
type: select
|
|
78
78
|
sort_no: 170
|
|
79
|
+
hidden: true
|
|
79
80
|
options:
|
|
80
81
|
- label: Custom JavaScript
|
|
81
82
|
value: script
|
|
@@ -89,16 +90,16 @@ fields:
|
|
|
89
90
|
# reference_to: word_templates
|
|
90
91
|
# visible_on: "{{formData.type === 'word-print' ? true: false}}"
|
|
91
92
|
# create: false
|
|
92
|
-
todo:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
# todo:
|
|
94
|
+
# label: Execute Script
|
|
95
|
+
# sort_no: 180
|
|
96
|
+
# type: code
|
|
97
|
+
# language: javascript
|
|
98
|
+
# required: "{{formData.type != 'amis_button' ? true: false}}"
|
|
99
|
+
# # omit: true
|
|
100
|
+
# # hidden: true
|
|
101
|
+
# is_wide: true
|
|
102
|
+
# visible_on: "{{formData.type != 'amis_button' ? true: false}}"
|
|
102
103
|
amis_schema:
|
|
103
104
|
label: Amis Schema
|
|
104
105
|
sort_no: 180
|
|
@@ -108,6 +109,11 @@ fields:
|
|
|
108
109
|
is_wide: true
|
|
109
110
|
hidden: true
|
|
110
111
|
visible_on: "{{formData.type == 'amis_button' ? true: false}}"
|
|
112
|
+
form:
|
|
113
|
+
initialValues: !!js/function |
|
|
114
|
+
function(){
|
|
115
|
+
return {type: 'amis_button'}
|
|
116
|
+
}
|
|
111
117
|
paging:
|
|
112
118
|
enabled: false
|
|
113
119
|
actions:
|
|
@@ -268,7 +268,7 @@ function checkName(name){
|
|
|
268
268
|
var reg = new RegExp('^[a-z]([a-z0-9]|_(?!_))*[a-z0-9]$'); //支持表格类型的验证表达式(待优化.$.限制只能出现一次): new RegExp('^[a-z]([a-z0-9]|_(?!_))*(\\.\\$\\.\\w+)*[a-z0-9]$')
|
|
269
269
|
//TODO 撤销注释
|
|
270
270
|
if(!reg.test(name)){
|
|
271
|
-
throw new Error("
|
|
271
|
+
throw new Error("'字段名'只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符");
|
|
272
272
|
}
|
|
273
273
|
if(name.length > 50){
|
|
274
274
|
throw new Error("名称长度不能大于50个字符");
|
|
@@ -94,6 +94,91 @@ fields:
|
|
|
94
94
|
- label: 累计汇总
|
|
95
95
|
value: summary
|
|
96
96
|
sort_no: 150
|
|
97
|
+
language:
|
|
98
|
+
type: select
|
|
99
|
+
label: 语言
|
|
100
|
+
defaultValue: javascript
|
|
101
|
+
options:
|
|
102
|
+
- label: bat
|
|
103
|
+
value: bat
|
|
104
|
+
- label: c
|
|
105
|
+
value: c
|
|
106
|
+
- label: coffeescript
|
|
107
|
+
value: coffeescript
|
|
108
|
+
- label: cpp
|
|
109
|
+
value: cpp
|
|
110
|
+
- label: csharp
|
|
111
|
+
value: csharp
|
|
112
|
+
- label: css
|
|
113
|
+
value: css
|
|
114
|
+
- label: dockerfile
|
|
115
|
+
value: dockerfile
|
|
116
|
+
- label: fsharp
|
|
117
|
+
value: fsharp
|
|
118
|
+
- label: go
|
|
119
|
+
value: go
|
|
120
|
+
- label: handlebars
|
|
121
|
+
value: handlebars
|
|
122
|
+
- label: html
|
|
123
|
+
value: html
|
|
124
|
+
- label: ini
|
|
125
|
+
value: ini
|
|
126
|
+
- label: java
|
|
127
|
+
value: java
|
|
128
|
+
- label: javascript
|
|
129
|
+
value: javascript
|
|
130
|
+
- label: json
|
|
131
|
+
value: json
|
|
132
|
+
- label: less
|
|
133
|
+
value: less
|
|
134
|
+
- label: lua
|
|
135
|
+
value: lua
|
|
136
|
+
- label: markdown
|
|
137
|
+
value: markdown
|
|
138
|
+
- label: msdax
|
|
139
|
+
value: msdax
|
|
140
|
+
- label: objective-c
|
|
141
|
+
value: objective-c
|
|
142
|
+
- label: php
|
|
143
|
+
value: php
|
|
144
|
+
- label: plaintext
|
|
145
|
+
value: plaintext
|
|
146
|
+
- label: postiats
|
|
147
|
+
value: postiats
|
|
148
|
+
- label: powershell
|
|
149
|
+
value: powershell
|
|
150
|
+
- label: pug
|
|
151
|
+
value: pug
|
|
152
|
+
- label: python
|
|
153
|
+
value: python
|
|
154
|
+
- label: r
|
|
155
|
+
value: r
|
|
156
|
+
- label: razor
|
|
157
|
+
value: razor
|
|
158
|
+
- label: ruby
|
|
159
|
+
value: ruby
|
|
160
|
+
- label: sb
|
|
161
|
+
value: sb
|
|
162
|
+
- label: scss
|
|
163
|
+
value: scss
|
|
164
|
+
- label: shell
|
|
165
|
+
value: shell
|
|
166
|
+
- label: sol
|
|
167
|
+
value: sol
|
|
168
|
+
- label: sql
|
|
169
|
+
value: sql
|
|
170
|
+
- label: swift
|
|
171
|
+
value: swift
|
|
172
|
+
- label: typescript
|
|
173
|
+
value: typescript
|
|
174
|
+
- label: vb
|
|
175
|
+
value: vb
|
|
176
|
+
- label: xml
|
|
177
|
+
value: xml
|
|
178
|
+
- label: yaml
|
|
179
|
+
value: yaml
|
|
180
|
+
sort_no: 155
|
|
181
|
+
visible_on: "{{['code'].indexOf(formData.type) > -1 ? true: false}}"
|
|
97
182
|
defaultValue:
|
|
98
183
|
type: text
|
|
99
184
|
label: Default Value
|
|
@@ -110,23 +195,46 @@ fields:
|
|
|
110
195
|
visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
111
196
|
required: "{{['master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
112
197
|
sort_no: 180
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
198
|
+
amis:
|
|
199
|
+
menuTpl: "<div>${label}(${value})</div>"
|
|
200
|
+
depend_on:
|
|
201
|
+
type: lookup
|
|
202
|
+
group: Advanced
|
|
203
|
+
label: 依赖的字段
|
|
204
|
+
reference_to: object_fields
|
|
205
|
+
reference_to_field: name
|
|
206
|
+
multiple: true
|
|
207
|
+
visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
208
|
+
depend_on:
|
|
209
|
+
- object
|
|
210
|
+
filtersFunction: !<tag:yaml.org,2002:js/function> |-
|
|
211
|
+
function (filters, values) {
|
|
212
|
+
if(values && values.object){
|
|
213
|
+
return ['object', '=', values.object]
|
|
214
|
+
}else{
|
|
215
|
+
return ['_id', '=', 'no']
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
sort_no: 450
|
|
219
|
+
reference_to_field:
|
|
220
|
+
type: lookup
|
|
221
|
+
group: Advanced
|
|
222
|
+
label: 关联的字段
|
|
223
|
+
description: '默认为主键'
|
|
224
|
+
reference_to: object_fields
|
|
225
|
+
reference_to_field: name
|
|
226
|
+
visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
227
|
+
depend_on:
|
|
228
|
+
- reference_to
|
|
229
|
+
filtersFunction: !<tag:yaml.org,2002:js/function> |-
|
|
230
|
+
function (filters, values) {
|
|
231
|
+
if(values && values.reference_to){
|
|
232
|
+
return ['object', '=', values.reference_to]
|
|
233
|
+
}else{
|
|
234
|
+
return ['_id', '=', 'no']
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
sort_no: 450
|
|
130
238
|
multiple:
|
|
131
239
|
type: boolean
|
|
132
240
|
label: Multiple
|
|
@@ -163,16 +271,23 @@ fields:
|
|
|
163
271
|
sort_no: 220
|
|
164
272
|
filtersFunction:
|
|
165
273
|
label: filters Function
|
|
166
|
-
type:
|
|
167
|
-
|
|
168
|
-
visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
169
|
-
sort_no: 230
|
|
170
|
-
optionsFunction:
|
|
171
|
-
label: options Function
|
|
172
|
-
type: textarea
|
|
274
|
+
type: code
|
|
275
|
+
language: javascript
|
|
173
276
|
is_wide: true
|
|
174
277
|
visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
175
|
-
sort_no:
|
|
278
|
+
sort_no: 448
|
|
279
|
+
group: Advanced
|
|
280
|
+
amis:
|
|
281
|
+
placeholder: |-
|
|
282
|
+
function(filters, values){
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
# optionsFunction:
|
|
286
|
+
# label: options Function
|
|
287
|
+
# type: textarea
|
|
288
|
+
# is_wide: true
|
|
289
|
+
# visible_on: "{{['lookup', 'master_detail'].indexOf(formData.type) > -1 ? true: false}}"
|
|
290
|
+
# sort_no: 240
|
|
176
291
|
precision:
|
|
177
292
|
type: currency
|
|
178
293
|
label: Precision
|
|
@@ -288,6 +403,8 @@ fields:
|
|
|
288
403
|
label: Color
|
|
289
404
|
type: text
|
|
290
405
|
required: false
|
|
406
|
+
amis:
|
|
407
|
+
type: input-color
|
|
291
408
|
options.$.description:
|
|
292
409
|
label: Description
|
|
293
410
|
type: text
|
|
@@ -381,48 +498,23 @@ fields:
|
|
|
381
498
|
summary_field:
|
|
382
499
|
type: lookup
|
|
383
500
|
label: Field to Aggregate
|
|
501
|
+
reference_to: object_fields
|
|
502
|
+
reference_to_field: name
|
|
384
503
|
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
504
|
depend_on:
|
|
386
505
|
- summary_object
|
|
387
506
|
- summary_type
|
|
388
507
|
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
|
-
}
|
|
508
|
+
amis:
|
|
509
|
+
"autoComplete":
|
|
510
|
+
"method": "get"
|
|
511
|
+
"url": "${context.rootUrl}/service/api/@${summary_object}/uiSchema?summary_object=${summary_object}&summary_type=${summary_type}&term=${term}"
|
|
512
|
+
"data":
|
|
513
|
+
"summary_type": "${summary_type}"
|
|
514
|
+
"headers":
|
|
515
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
516
|
+
"sendOn": "!!this.summary_object && !!this.summary_type"
|
|
517
|
+
"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
518
|
visible_on: "{{formData.type === 'summary' && formData.summary_type !== 'count' ? true: false}}"
|
|
427
519
|
required: "{{formData.type === 'summary' && formData.summary_type !== 'count' ? true: false}}"
|
|
428
520
|
sort_no: 320
|