@steedos/standard-object-database 2.6.8-beta.1 → 2.6.8-beta.4
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/object_fields.client.js +40 -1
- package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +17 -1
- package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +17 -1
- package/main/default/objects/object_fields.object.yml +98 -2
- package/main/default/objects/objects.action.js +3 -0
- package/main/default/pages/object_fields_form.page.amis.json +18 -2
- package/main/default/pages/object_form.page.amis.json +7 -2
- package/main/default/services/object_fields.service.js +249 -0
- package/package.json +4 -4
|
@@ -209,4 +209,43 @@ Steedos.ObjectFieldManager.getSummaryFiltersOperation = function(field_type) {
|
|
|
209
209
|
operations.push(optionals.equal, optionals.unequal);
|
|
210
210
|
}
|
|
211
211
|
return operations;
|
|
212
|
-
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
(function () {
|
|
215
|
+
try {
|
|
216
|
+
var styleCss = $(`<style>
|
|
217
|
+
.defaultValue_field div:first-child{
|
|
218
|
+
flex-grow: 1;
|
|
219
|
+
}
|
|
220
|
+
.defaultValue_field .defaultValue_field_formula{
|
|
221
|
+
// margin: 4px;
|
|
222
|
+
}
|
|
223
|
+
.defaultValue_field .defaultValue_field_formula .antd-Form-label{
|
|
224
|
+
visibility: visible;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.defaultValue_field .defaultValue_field_formula_visible{
|
|
228
|
+
flex-grow: 1;
|
|
229
|
+
}
|
|
230
|
+
.defaultValue_field .defaultValue_field_formula_visible .antd-Form-label .antd-TplField{
|
|
231
|
+
visibility: visible;
|
|
232
|
+
}
|
|
233
|
+
.defaultValue_field .defaultValue_field_hidden{
|
|
234
|
+
display: none;
|
|
235
|
+
}
|
|
236
|
+
.defaultValue_field .defaultValue_field_formula_hidden{
|
|
237
|
+
flex-grow: 0;
|
|
238
|
+
}
|
|
239
|
+
.defaultValue_field .defaultValue_field_formula_hidden .antd-Form-label{
|
|
240
|
+
display: none;
|
|
241
|
+
}
|
|
242
|
+
.defaultValue_field .defaultValue_field_formula_hidden .antd-FormulaPicker-input{
|
|
243
|
+
display: none;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
</style>`);
|
|
247
|
+
$("head").append(styleCss);
|
|
248
|
+
} catch (error) {
|
|
249
|
+
console.log(error);
|
|
250
|
+
}
|
|
251
|
+
})();
|
package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml
CHANGED
|
@@ -29,7 +29,7 @@ fields:
|
|
|
29
29
|
value: text
|
|
30
30
|
- label: Textarea
|
|
31
31
|
value: textarea
|
|
32
|
-
- label:
|
|
32
|
+
- label: Rich text
|
|
33
33
|
value: html
|
|
34
34
|
- label: Code
|
|
35
35
|
value: code
|
|
@@ -163,6 +163,22 @@ fields:
|
|
|
163
163
|
label: Description
|
|
164
164
|
help:
|
|
165
165
|
description:
|
|
166
|
+
auto_fill_mapping:
|
|
167
|
+
label: Auto Fill Mapping
|
|
168
|
+
help: When the data is selected, the field values in the reference object are automatically filled into the current form field according to the following mapping.
|
|
169
|
+
description:
|
|
170
|
+
auto_fill_mapping.$:
|
|
171
|
+
label: Auto Fill Mapping
|
|
172
|
+
help:
|
|
173
|
+
description:
|
|
174
|
+
auto_fill_mapping.$.from:
|
|
175
|
+
label: From:Fields in object that reference to
|
|
176
|
+
help:
|
|
177
|
+
description:
|
|
178
|
+
auto_fill_mapping.$.to:
|
|
179
|
+
label: To:Fields in the current form
|
|
180
|
+
help:
|
|
181
|
+
description:
|
|
166
182
|
autonumber_enable_modify:
|
|
167
183
|
label: Allow modification of numbers
|
|
168
184
|
help:
|
|
@@ -30,7 +30,7 @@ fields:
|
|
|
30
30
|
value: text
|
|
31
31
|
- label: 长文本
|
|
32
32
|
value: textarea
|
|
33
|
-
- label:
|
|
33
|
+
- label: 富文本
|
|
34
34
|
value: html
|
|
35
35
|
- label: 代码
|
|
36
36
|
value: code
|
|
@@ -155,6 +155,22 @@ fields:
|
|
|
155
155
|
label: 描述
|
|
156
156
|
help:
|
|
157
157
|
description:
|
|
158
|
+
auto_fill_mapping:
|
|
159
|
+
label: 自动填充规则
|
|
160
|
+
help: 选择数据后,将按以下映射关系将引用对象中的字段值自动填充到当前表单字段中。
|
|
161
|
+
description:
|
|
162
|
+
auto_fill_mapping.$:
|
|
163
|
+
label: 自动填充规则
|
|
164
|
+
help:
|
|
165
|
+
description:
|
|
166
|
+
auto_fill_mapping.$.from:
|
|
167
|
+
label: 从:引用对象中的字段
|
|
168
|
+
help:
|
|
169
|
+
description:
|
|
170
|
+
auto_fill_mapping.$.to:
|
|
171
|
+
label: 填充到:当前表单字段
|
|
172
|
+
help:
|
|
173
|
+
description:
|
|
158
174
|
autonumber_enable_modify:
|
|
159
175
|
label: 允许修改编号
|
|
160
176
|
help:
|
|
@@ -199,9 +199,49 @@ fields:
|
|
|
199
199
|
amis:
|
|
200
200
|
disabledOn: "${is_system == true}"
|
|
201
201
|
defaultValue:
|
|
202
|
-
type:
|
|
202
|
+
type: object
|
|
203
|
+
blackbox: true
|
|
203
204
|
label: Default Value
|
|
204
205
|
sort_no: 160
|
|
206
|
+
visible_on: "{{['autonumber','formula','summary','image','file'].indexOf(formData.type) > -1 ? false: true}}"
|
|
207
|
+
amis:
|
|
208
|
+
type: service
|
|
209
|
+
className:
|
|
210
|
+
antd-Form-item: true
|
|
211
|
+
antd-Form-item--normal: true
|
|
212
|
+
m-0: true
|
|
213
|
+
"md:border-b": global.mode === "read"
|
|
214
|
+
defaultValue_field: true
|
|
215
|
+
flex: true
|
|
216
|
+
schemaApi:
|
|
217
|
+
url: "${context.rootUrl}/service/api/object_fields/defaultValue/schema"
|
|
218
|
+
method: post
|
|
219
|
+
data:
|
|
220
|
+
object: ${object}
|
|
221
|
+
name: ${name}
|
|
222
|
+
options: ${options}
|
|
223
|
+
type: ${type}
|
|
224
|
+
reference_to: ${reference_to}
|
|
225
|
+
multiple: ${multiple}
|
|
226
|
+
filtersFunction: ${filtersFunction}
|
|
227
|
+
reference_to_field: ${reference_to_field}
|
|
228
|
+
mode: ${global.mode}
|
|
229
|
+
scale: ${scale}
|
|
230
|
+
_id: ${_id}
|
|
231
|
+
trackExpression: "${object},${options},${type},${reference_to},${reference_to_field},${multiple},${filtersFunction},${_id},${scale}"
|
|
232
|
+
headers:
|
|
233
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
234
|
+
# sendOn: "!!this.type"
|
|
235
|
+
onEvent:
|
|
236
|
+
fetchSchemaInited:
|
|
237
|
+
weight: 0
|
|
238
|
+
actions:
|
|
239
|
+
- actionType: "setValue"
|
|
240
|
+
componentId: "service_detail_page"
|
|
241
|
+
args:
|
|
242
|
+
value:
|
|
243
|
+
defaultValue: "${event.data.body[0].value}"
|
|
244
|
+
expression: "global.mode ==='read' && event.data.body[0].value"
|
|
205
245
|
group:
|
|
206
246
|
type: text
|
|
207
247
|
label: Group
|
|
@@ -448,6 +488,14 @@ fields:
|
|
|
448
488
|
amis:
|
|
449
489
|
showIndex: true
|
|
450
490
|
disabledOn: "${is_system == true}"
|
|
491
|
+
enableDialog: false
|
|
492
|
+
columns:
|
|
493
|
+
- label
|
|
494
|
+
- value
|
|
495
|
+
- name: color
|
|
496
|
+
width: 170
|
|
497
|
+
- name: description
|
|
498
|
+
width: 300
|
|
451
499
|
options.$:
|
|
452
500
|
label: Options
|
|
453
501
|
blackbox: true
|
|
@@ -468,6 +516,52 @@ fields:
|
|
|
468
516
|
label: Description
|
|
469
517
|
type: text
|
|
470
518
|
required: false
|
|
519
|
+
auto_fill_mapping:
|
|
520
|
+
type: table
|
|
521
|
+
label: Auto Fill Mapping
|
|
522
|
+
is_wide: true
|
|
523
|
+
inlineHelpText: When the data is selected, the field values in the reference object are automatically filled into the current form field according to the following mapping.
|
|
524
|
+
visible_on: "{{(formData.type === 'lookup' || formData.type === 'master_detail') && formData.reference_to && !!!formData.multiple}}"
|
|
525
|
+
sort_no: 280
|
|
526
|
+
amis:
|
|
527
|
+
enableDialog: false
|
|
528
|
+
disabledOn: "${is_system == true}"
|
|
529
|
+
auto_fill_mapping.$:
|
|
530
|
+
label: Auto Fill Mapping
|
|
531
|
+
blackbox: true
|
|
532
|
+
type: object
|
|
533
|
+
auto_fill_mapping.$.from:
|
|
534
|
+
label: From:Fields in object that reference to
|
|
535
|
+
type: lookup
|
|
536
|
+
reference_to: object_fields
|
|
537
|
+
reference_to_field: name
|
|
538
|
+
required: true
|
|
539
|
+
depend_on:
|
|
540
|
+
- reference_to
|
|
541
|
+
filtersFunction: !<tag:yaml.org,2002:js/function> |-
|
|
542
|
+
function (filters, values) {
|
|
543
|
+
if(values && values.reference_to){
|
|
544
|
+
return ['object', '=', values.reference_to]
|
|
545
|
+
}else{
|
|
546
|
+
return ['_id', '=', 'no']
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
auto_fill_mapping.$.to:
|
|
550
|
+
label: To:Fields in the current form
|
|
551
|
+
type: lookup
|
|
552
|
+
reference_to: object_fields
|
|
553
|
+
reference_to_field: name
|
|
554
|
+
required: true
|
|
555
|
+
depend_on:
|
|
556
|
+
- object
|
|
557
|
+
filtersFunction: !<tag:yaml.org,2002:js/function> |-
|
|
558
|
+
function (filters, values) {
|
|
559
|
+
if(values && values.object){
|
|
560
|
+
return ['object', '=', values.object]
|
|
561
|
+
}else{
|
|
562
|
+
return ['_id', '=', 'no']
|
|
563
|
+
}
|
|
564
|
+
}
|
|
471
565
|
formula_blank_value:
|
|
472
566
|
type: select
|
|
473
567
|
label: Blank Field Handling
|
|
@@ -586,7 +680,7 @@ fields:
|
|
|
586
680
|
sort_no: 320
|
|
587
681
|
summary_filters:
|
|
588
682
|
label: Filter Criteria
|
|
589
|
-
type: '
|
|
683
|
+
type: 'table'
|
|
590
684
|
inlineHelpText: Only records meeting certain criteria should be included in the calculation, all records should be included in the calculation while the criteria is empty.
|
|
591
685
|
is_wide: true
|
|
592
686
|
depend_on:
|
|
@@ -595,6 +689,8 @@ fields:
|
|
|
595
689
|
sort_no: 330
|
|
596
690
|
amis:
|
|
597
691
|
disabledOn: "${is_system == true}"
|
|
692
|
+
inlineEditMode: true
|
|
693
|
+
showIndex: true
|
|
598
694
|
summary_filters.$:
|
|
599
695
|
label: Filter Criteria
|
|
600
696
|
blackbox: true
|
|
@@ -177,6 +177,9 @@ module.exports = {
|
|
|
177
177
|
if(!record){
|
|
178
178
|
record = Creator.odata.get("objects", record_id, "is_deleted");
|
|
179
179
|
}
|
|
180
|
+
if(record.is_system){
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
180
183
|
if(record && !record.is_deleted){
|
|
181
184
|
return Creator.baseObject.actions.standard_delete.visible.apply(this, arguments);
|
|
182
185
|
}
|
|
@@ -9,8 +9,24 @@
|
|
|
9
9
|
"className": "",
|
|
10
10
|
"enableTabs": true,
|
|
11
11
|
"mode": "edit",
|
|
12
|
-
"layout": "
|
|
13
|
-
"
|
|
12
|
+
"layout": "horizontal",
|
|
13
|
+
"onEvent": {
|
|
14
|
+
"change": {
|
|
15
|
+
"actions": [
|
|
16
|
+
{
|
|
17
|
+
"actionType": "setValue",
|
|
18
|
+
"args": {
|
|
19
|
+
"value": {
|
|
20
|
+
"defaultValue": ""
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"expression": "${!!event.data.defaultValue_formula}"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"initApiAdaptor": "const defaultValue_field_value = payload.data.defaultValue; if(defaultValue_field_value && _.isString(defaultValue_field_value) && defaultValue_field_value.indexOf('{')>-1 ){ payload.data.defaultValue_formula = defaultValue_field_value; delete payload.data.defaultValue; } return payload;",
|
|
29
|
+
"apiRequestAdaptor": "if(formData.defaultValue_formula){ formData.defaultValue = formData.defaultValue_formula } __saveData = JSON.stringify(JSON.stringify(formData)); api.data = {query: query.replace('{__saveData}', __saveData)}; api.data.query = api.data.query.replace('object_fields__update', 'object_fields__upsert')",
|
|
14
30
|
"submitSuccActions": [
|
|
15
31
|
{
|
|
16
32
|
"actionType": "custom",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"className": "",
|
|
11
11
|
"enableTabs": true,
|
|
12
12
|
"mode": "edit",
|
|
13
|
-
"layout": "
|
|
13
|
+
"layout": "horizontal",
|
|
14
14
|
"apiRequestAdaptor": "console.log('api.data.query===', api.data.query);api.data.query = api.data.query.replace('objects__update', 'objects__upsert')",
|
|
15
15
|
"submitSuccActions": [
|
|
16
16
|
{
|
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
"position": "top-right"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
]
|
|
24
|
+
],
|
|
25
|
+
"fieldsExtend": {
|
|
26
|
+
"compactLayouts": {
|
|
27
|
+
"label": ""
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
],
|
|
27
32
|
"data": {
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description: 提供action_field_updates(字段更新对象)需要的数据接口
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const register = require("@steedos/metadata-registrar");
|
|
6
|
+
const steedosI18n = require("@steedos/i18n");
|
|
7
|
+
const _ = require("lodash");
|
|
8
|
+
const clone = require("clone");
|
|
9
|
+
|
|
10
|
+
// 默认值字段代码:services/standard-object-database/main/default/services/object_fields.service.js
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
name: "object_fields",
|
|
14
|
+
mixins: [],
|
|
15
|
+
/**
|
|
16
|
+
* Settings
|
|
17
|
+
*/
|
|
18
|
+
settings: {
|
|
19
|
+
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Dependencies
|
|
24
|
+
*/
|
|
25
|
+
dependencies: [],
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Actions
|
|
29
|
+
*/
|
|
30
|
+
actions: {
|
|
31
|
+
getDefaultValueSchema: {
|
|
32
|
+
// 需要传 objectName, targetObject(非必填), field_name 参数进来。
|
|
33
|
+
rest: {
|
|
34
|
+
method: "POST",
|
|
35
|
+
path: "/defaultValue/schema"
|
|
36
|
+
},
|
|
37
|
+
async handler(ctx) {
|
|
38
|
+
const data = await this.getDefaultValueSchema(ctx);
|
|
39
|
+
return { status: 0, msg: "", data: data }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Events
|
|
46
|
+
*/
|
|
47
|
+
events: {
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Methods
|
|
53
|
+
*/
|
|
54
|
+
methods: {
|
|
55
|
+
/* defaultValue 字段使用*/
|
|
56
|
+
getDefaultValueSchema: {
|
|
57
|
+
async handler(ctx) {
|
|
58
|
+
// console.log('ctx==>', ctx);
|
|
59
|
+
const userSession = ctx.meta.user;
|
|
60
|
+
const lng = userSession.language || 'zh-CN';
|
|
61
|
+
const type = ctx.params.type || 'text';
|
|
62
|
+
const objectName = ctx.params.object;
|
|
63
|
+
const fieldName = ctx.params.name;
|
|
64
|
+
const reference_to = ctx.params.reference_to;
|
|
65
|
+
const options = ctx.params.options;
|
|
66
|
+
const multiple = ctx.params.multiple;
|
|
67
|
+
const filtersFunction = ctx.params.filtersFunction;
|
|
68
|
+
const reference_to_field = ctx.params.reference_to_field || '_id';
|
|
69
|
+
const _id = ctx.params._id;
|
|
70
|
+
const mode = ctx.params.mode;
|
|
71
|
+
const scale = ctx.params.scale;
|
|
72
|
+
// const mode = global.mode;
|
|
73
|
+
|
|
74
|
+
const partialType = ['text','textarea','html','code','markdown','boolean','toggle','date','datetime','time','password','url','email','color','location'];
|
|
75
|
+
// const fieldType = partialType.indexOf(type) > -1 ? type : 'text';
|
|
76
|
+
|
|
77
|
+
let targetField = null;
|
|
78
|
+
let NAME_FIELD_KEY = null;
|
|
79
|
+
if (mode === 'read') {
|
|
80
|
+
const objectConfig = await register.getObjectConfig(objectName);
|
|
81
|
+
NAME_FIELD_KEY = objectConfig.NAME_FIELD_KEY || 'name';
|
|
82
|
+
targetField = objectConfig.fields[fieldName];
|
|
83
|
+
}
|
|
84
|
+
// console.log('targetField==>', targetField);
|
|
85
|
+
const value = (targetField && targetField.defaultValue) || '';
|
|
86
|
+
const translatedLabel = lng === 'zh-CN' ? "默认值" : 'DefaultValue';
|
|
87
|
+
let defaultValue_schema = {
|
|
88
|
+
"type": "text",
|
|
89
|
+
"name": "defaultValue",
|
|
90
|
+
"label": translatedLabel,
|
|
91
|
+
"labelClassName": "text-left"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if(partialType.indexOf(type) > -1){
|
|
95
|
+
defaultValue_schema.type = type;
|
|
96
|
+
}else if(type === 'select' && options){
|
|
97
|
+
defaultValue_schema.type = type;
|
|
98
|
+
defaultValue_schema.options = options;
|
|
99
|
+
defaultValue_schema.multiple = multiple;
|
|
100
|
+
}else if(['lookup','master_detail'].includes(type) && reference_to){
|
|
101
|
+
defaultValue_schema.type = type;
|
|
102
|
+
defaultValue_schema.reference_to = reference_to;
|
|
103
|
+
defaultValue_schema.multiple = multiple;
|
|
104
|
+
defaultValue_schema.filtersFunction = filtersFunction;
|
|
105
|
+
defaultValue_schema.reference_to_field = reference_to_field;
|
|
106
|
+
} else if(['number','currency','percent'].includes(type)){
|
|
107
|
+
defaultValue_schema.type = type;
|
|
108
|
+
defaultValue_schema.scale = scale;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let steedos_field = {
|
|
112
|
+
type:'steedos-field',
|
|
113
|
+
name:'defaultValue',
|
|
114
|
+
clearValueOnHidden: true,
|
|
115
|
+
fieldName: 'defaultValue',
|
|
116
|
+
field: defaultValue_schema,
|
|
117
|
+
value: value,
|
|
118
|
+
readonly: mode === 'read' ? true : false
|
|
119
|
+
};
|
|
120
|
+
if(mode === 'read'){
|
|
121
|
+
const baseFieldConfig = {
|
|
122
|
+
"name": "defaultValue",
|
|
123
|
+
"label": translatedLabel,
|
|
124
|
+
"labelClassName": "text-left",
|
|
125
|
+
"clearValueOnHidden": true,
|
|
126
|
+
"fieldName": "defaultValue"
|
|
127
|
+
}
|
|
128
|
+
if(_.isString(value) && value.indexOf('{')>-1){
|
|
129
|
+
// 只读时值是公式就显示公式
|
|
130
|
+
steedos_field = {
|
|
131
|
+
"type": "control",
|
|
132
|
+
"label": translatedLabel,
|
|
133
|
+
"body": {
|
|
134
|
+
"name": "defaultValue",
|
|
135
|
+
"label": translatedLabel,
|
|
136
|
+
"labelClassName": "text-left",
|
|
137
|
+
"type": "tpl",
|
|
138
|
+
"tpl": value.indexOf('$') > -1 ? "\\"+value : value
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}else if(['number','currency','percent'].includes(type)){
|
|
142
|
+
steedos_field = {
|
|
143
|
+
...baseFieldConfig,
|
|
144
|
+
"type": "static-tpl",
|
|
145
|
+
"tpl": `<div>${value}</div>`,
|
|
146
|
+
"className": "m-1 md:border-b steedos-static-tpl-readonly",
|
|
147
|
+
"quickEdit": false,
|
|
148
|
+
}
|
|
149
|
+
}else if(['date','datetime','time'].includes(type)){
|
|
150
|
+
let fieldTypeConfig ={};
|
|
151
|
+
if(type==='date'){
|
|
152
|
+
fieldTypeConfig = {
|
|
153
|
+
"type": "input-date",
|
|
154
|
+
"inputFormat": "YYYY-MM-DD",
|
|
155
|
+
"format": "YYYY-MM-DDT00:00:00.000[Z]",
|
|
156
|
+
"className": "m-1 steedos-input-date-edit",
|
|
157
|
+
}
|
|
158
|
+
}else if(type==='datetime'){
|
|
159
|
+
fieldTypeConfig = {
|
|
160
|
+
"type": "input-datetime",
|
|
161
|
+
"inputFormat": "YYYY-MM-DD HH:mm",
|
|
162
|
+
"format": "YYYY-MM-DDTHH:mm:ss.SSSZ",
|
|
163
|
+
"className": "m-1 steedos-input-datetime-edit",
|
|
164
|
+
}
|
|
165
|
+
}else if(type==='time'){
|
|
166
|
+
fieldTypeConfig = {
|
|
167
|
+
"type": "input-time",
|
|
168
|
+
"inputFormat": "HH:mm",
|
|
169
|
+
"format": "1970-01-01THH:mm:00.000[Z]",
|
|
170
|
+
"className": "m-1 steedos-input-time-edit",
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
steedos_field = {
|
|
174
|
+
...baseFieldConfig,
|
|
175
|
+
...fieldTypeConfig,
|
|
176
|
+
value: value,
|
|
177
|
+
static: true
|
|
178
|
+
}
|
|
179
|
+
}else if(['boolean'].includes(type)){
|
|
180
|
+
steedos_field = {
|
|
181
|
+
...baseFieldConfig,
|
|
182
|
+
value: value,
|
|
183
|
+
"type": "static",
|
|
184
|
+
"tpl": `${value}`,
|
|
185
|
+
"className": "m-1 md:border-b steedos-static-readonly"
|
|
186
|
+
}
|
|
187
|
+
}else if(['lookup','master_detail'].includes(type)){
|
|
188
|
+
// console.log('t==>', type, reference_to, NAME_FIELD_KEY, targetField)
|
|
189
|
+
if(value && value.length && _.isString(reference_to)){
|
|
190
|
+
const query = {
|
|
191
|
+
fields: [NAME_FIELD_KEY],
|
|
192
|
+
filters: [reference_to_field, '=', value]
|
|
193
|
+
}
|
|
194
|
+
const res = await this.broker.call(
|
|
195
|
+
'objectql.find',
|
|
196
|
+
{
|
|
197
|
+
objectName: reference_to,
|
|
198
|
+
query
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
// console.log('res==>', res, reference_to, NAME_FIELD_KEY, targetField);
|
|
202
|
+
const tpl = _.map(res, NAME_FIELD_KEY).join('、')
|
|
203
|
+
steedos_field = {
|
|
204
|
+
"type": "control",
|
|
205
|
+
"label": translatedLabel,
|
|
206
|
+
"body": {
|
|
207
|
+
"name": "defaultValue",
|
|
208
|
+
"label": translatedLabel,
|
|
209
|
+
"labelClassName": "text-left",
|
|
210
|
+
"type": "tpl",
|
|
211
|
+
"tpl": tpl
|
|
212
|
+
},
|
|
213
|
+
value: value
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
let body = [
|
|
219
|
+
steedos_field
|
|
220
|
+
]
|
|
221
|
+
if(mode === 'edit'){
|
|
222
|
+
body[0].field.amis = {
|
|
223
|
+
// disabledOn: "!!this.defaultValue_formula",
|
|
224
|
+
"className": {
|
|
225
|
+
"defaultValue_field_hidden": "!this.defaultValue && (!this.defaultValue || '').toString() && !!this.defaultValue_formula"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
body.push({
|
|
229
|
+
"name": "defaultValue_formula",
|
|
230
|
+
"label": translatedLabel,
|
|
231
|
+
"evalMode": false,
|
|
232
|
+
"type": "input-formula",
|
|
233
|
+
"placeholder": "公式",
|
|
234
|
+
// "disabledOn": "!!this.defaultValue && !!this.defaultValue.toString()",
|
|
235
|
+
"className": {
|
|
236
|
+
"defaultValue_field_formula": true,
|
|
237
|
+
"defaultValue_field_formula_visible": "!!this.defaultValue_formula",
|
|
238
|
+
"defaultValue_field_formula_hidden": "(!!this.defaultValue && !!this.defaultValue.toString()) || (!this.defaultValue && !this.defaultValue_formula)"
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
// console.log('body==>', body);
|
|
243
|
+
return {
|
|
244
|
+
body
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-object-database",
|
|
3
|
-
"version": "2.6.8-beta.
|
|
3
|
+
"version": "2.6.8-beta.4",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"description": "steedos package",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@steedos-widgets/amis-lib": "^1.0.22",
|
|
15
|
-
"@steedos/metadata-core": "2.6.8-beta.
|
|
16
|
-
"@steedos/standard-objects": "2.6.8-beta.
|
|
15
|
+
"@steedos/metadata-core": "2.6.8-beta.4",
|
|
16
|
+
"@steedos/standard-objects": "2.6.8-beta.4"
|
|
17
17
|
},
|
|
18
18
|
"repository": {},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "8a12f13e28a5b7faab37c00a5e894bffda4c5c91"
|
|
21
21
|
}
|