@steedos/standard-object-database 2.6.1-beta.6 → 2.6.2-beta.2

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.
Files changed (57) hide show
  1. package/main/default/client/coordtransform.client.js +153 -0
  2. package/main/default/client/object_fields.client.js +149 -7
  3. package/main/default/objectTranslations/object_actions.en/object_actions.en.objectTranslation.yml +21 -0
  4. package/main/default/objectTranslations/object_actions.zh-CN/object_actions.zh-CN.objectTranslation.yml +21 -0
  5. package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +33 -2
  6. package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +38 -4
  7. package/main/default/objectTranslations/object_layouts.en/object_layouts.en.objectTranslation.yml +9 -0
  8. package/main/default/objectTranslations/object_layouts.zh-CN/object_layouts.zh-CN.objectTranslation.yml +9 -0
  9. package/main/default/objectTranslations/object_listviews.en/object_listviews.en.objectTranslation.yml +29 -1
  10. package/main/default/objectTranslations/object_listviews.zh-CN/object_listviews.zh-CN.objectTranslation.yml +27 -1
  11. package/main/default/objectTranslations/object_triggers.en/object_triggers.en.objectTranslation.yml +22 -1
  12. package/main/default/objectTranslations/object_triggers.zh-CN/object_triggers.zh-CN.objectTranslation.yml +22 -1
  13. package/main/default/objectTranslations/object_validation_rules.en/object_validation_rules.en.objectTranslation.yml +2 -0
  14. package/main/default/objectTranslations/object_validation_rules.zh-CN/object_validation_rules.zh-CN.objectTranslation.yml +2 -0
  15. package/main/default/objectTranslations/objects.en/objects.en.objectTranslation.yml +2 -0
  16. package/main/default/objectTranslations/objects.zh-CN/objects.zh-CN.objectTranslation.yml +2 -0
  17. package/main/default/objects/1.objects.observe.object.js +4 -1
  18. package/main/default/objects/16.permission_tabs.observe.object.js +44 -0
  19. package/main/default/objects/7.object_actions.observe.object.js +7 -1
  20. package/main/default/objects/object_actions.action.js +35 -4
  21. package/main/default/objects/object_actions.object.js +4 -2
  22. package/main/default/objects/object_actions.object.yml +73 -29
  23. package/main/default/objects/object_fields.object.js +33 -19
  24. package/main/default/objects/object_fields.object.yml +128 -54
  25. package/main/default/objects/object_layouts.action.js +4 -4
  26. package/main/default/objects/object_layouts.object.yml +28 -2
  27. package/main/default/objects/object_listviews.action.js +1 -1
  28. package/main/default/objects/object_listviews.object.js +3 -3
  29. package/main/default/objects/object_listviews.object.yml +67 -16
  30. package/main/default/objects/object_triggers.object.yml +13 -4
  31. package/main/default/objects/object_validation_rules.object.yml +10 -0
  32. package/main/default/objects/objects/buttons/custom.button.js +48 -0
  33. package/main/default/objects/objects/buttons/custom.button.yml +6 -0
  34. package/main/default/objects/objects.action.js +26 -3
  35. package/main/default/objects/objects.core.js +17 -1
  36. package/main/default/objects/objects.object.js +3 -2
  37. package/main/default/objects/objects.object.yml +28 -2
  38. package/main/default/objects/objects.tree.js +3 -2
  39. package/main/default/pages/design_field_layout.page.amis.json +418 -0
  40. package/main/default/pages/design_field_layout.page.yml +7 -0
  41. package/main/default/pages/object_detail.page.amis.json +6 -6
  42. package/main/default/pages/object_fields_form.page.amis.json +35 -0
  43. package/main/default/pages/object_fields_form.page.yml +12 -0
  44. package/main/default/pages/object_form.page.amis.json +31 -0
  45. package/main/default/pages/object_form.page.yml +12 -0
  46. package/main/default/routes/amis_button_design.router.js +19 -3
  47. package/main/default/routes/amis_listview_design.router.js +18 -4
  48. package/main/default/services/suggestions.service.js +4 -5
  49. package/main/default/triggers/object_actions.trigger.js +6 -2
  50. package/main/default/triggers/object_fields.trigger.js +67 -10
  51. package/main/default/triggers/object_listviews.trigger.js +27 -5
  52. package/main/default/triggers/objects.trigger.js +40 -29
  53. package/package.json +2 -2
  54. package/package.service.js +132 -3
  55. package/src/triggers/index.js +11 -0
  56. package/src/triggers/object_fields_trigger_create_index.js +58 -0
  57. package/main/default/objects/object_layouts/buttons/standard_edit.button.yml +0 -44
@@ -52,7 +52,7 @@ fields:
52
52
  value: infinite
53
53
  description:
54
54
  columns:
55
- label: 显示的列
55
+ label: 电脑端显示的列
56
56
  help:
57
57
  description:
58
58
  columns.$:
@@ -146,15 +146,41 @@ fields:
146
146
  description:
147
147
  sort_no:
148
148
  label: 排序号
149
+ is_enable:
150
+ label: 启用
151
+ crud_mode:
152
+ label: 显示模式
153
+ help:
154
+ options:
155
+ - label: 表格
156
+ value: table
157
+ - label: 卡片
158
+ value: cards
159
+ description:
149
160
  enable_amis_schema:
150
161
  label: 使用 amis自定义列表
151
162
  amis_schema:
152
163
  label: Amis Schema
164
+ requestAdaptor:
165
+ label: 发送适配器
166
+ help: "函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。"
167
+ description:
168
+ adaptor:
169
+ label: 接收适配器
170
+ help: "函数签名: (payload, response, api) => payload"
171
+ description:
153
172
  groups:
154
173
  advanced: 高级
174
+ show_columns: 显示列
175
+ sort: 排序
176
+ filters: 过滤
177
+ search_term: 搜索项
178
+ data_interface: 数据接口
155
179
  listviews:
156
180
  all:
157
181
  label: 全部
182
+ customize:
183
+ label: 自定义
158
184
  actions:
159
185
  customize:
160
186
  label: 自定义
@@ -6,7 +6,7 @@ fields:
6
6
  label: Name
7
7
  help:
8
8
  description:
9
- object:
9
+ listenTo:
10
10
  label: Object
11
11
  help:
12
12
  description:
@@ -14,6 +14,21 @@ fields:
14
14
  label: Execution Time Option
15
15
  help:
16
16
  description:
17
+ options:
18
+ - label: "Before adding a new record"
19
+ value: "beforeInsert"
20
+ - label: "After adding a new record"
21
+ value: "afterInsert"
22
+ - label: "Before modifying a record"
23
+ value: "beforeUpdate"
24
+ - label: "After modifying a record"
25
+ value: "afterUpdate"
26
+ - label: "Before deleting a record"
27
+ value: "beforeDelete"
28
+ - label: "After deleting a record"
29
+ value: "afterDelete"
30
+ - label: "Before checking the records"
31
+ value: "beforeFind"
17
32
  is_enable:
18
33
  label: Enable
19
34
  help:
@@ -25,6 +40,12 @@ fields:
25
40
  Help</a>
26
41
  help:
27
42
  description:
43
+ is_system:
44
+ label: System
45
+ help:
46
+ description:
28
47
  listviews:
29
48
  all:
30
49
  label: All Triggers
50
+ customize:
51
+ label: Customize
@@ -6,7 +6,7 @@ fields:
6
6
  label: 名称
7
7
  help:
8
8
  description:
9
- object:
9
+ listenTo:
10
10
  label: 所属对象
11
11
  help:
12
12
  description:
@@ -14,6 +14,21 @@ fields:
14
14
  label: 运行时
15
15
  help:
16
16
  description:
17
+ options:
18
+ - label: "新增记录之前"
19
+ value: "beforeInsert"
20
+ - label: "新增记录之后"
21
+ value: "afterInsert"
22
+ - label: "修改记录之前"
23
+ value: "beforeUpdate"
24
+ - label: "修改记录之后"
25
+ value: "afterUpdate"
26
+ - label: "删除记录之前"
27
+ value: "beforeDelete"
28
+ - label: "删除记录之后"
29
+ value: "afterDelete"
30
+ - label: "查询记录之前"
31
+ value: "beforeFind"
17
32
  isEnabled:
18
33
  label: 已启用
19
34
  help:
@@ -22,6 +37,12 @@ fields:
22
37
  label: 内容
23
38
  help:
24
39
  description:
40
+ is_system:
41
+ label: 系统
42
+ help:
43
+ description:
25
44
  listviews:
26
45
  all:
27
46
  label: 所有
47
+ customize:
48
+ label: 自定义
@@ -35,6 +35,8 @@ fields:
35
35
  listviews:
36
36
  all:
37
37
  label: All Object Validation Rules
38
+ customize:
39
+ label: Customize
38
40
  CustomLabels:
39
41
  object_validation_rules_field_error_display_field:
40
42
  object_validation_rules_field_error_display_field_inlineHelpText:
@@ -29,6 +29,8 @@ fields:
29
29
  listviews:
30
30
  all:
31
31
  label: 所有
32
+ customize:
33
+ label: 自定义
32
34
  CustomLabels:
33
35
  object_validation_rules_field_error_display_field: 错误位置
34
36
  object_validation_rules_field_error_display_field_inlineHelpText: >-
@@ -212,6 +212,8 @@ actions:
212
212
  label: Preview
213
213
  copy_odata:
214
214
  label: Copy OData URL
215
+ createDefaultRecordView:
216
+ label: Create Default Page Layout
215
217
  CustomLabels:
216
218
  objects_field_datasource_defaultValue: Default data source
217
219
  objects_field_datasource_meteor: Meteor
@@ -209,6 +209,8 @@ actions:
209
209
  label: 预览
210
210
  copy_odata:
211
211
  label: 复制OData网址
212
+ createDefaultRecordView:
213
+ label: 创建默认页面布局
212
214
  CustomLabels:
213
215
  objects_field_datasource_defaultValue: 默认数据源
214
216
  objects_field_datasource_meteor: Meteor
@@ -2,7 +2,7 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-06-23 17:58:55
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2022-07-05 11:26:24
5
+ * @LastEditTime: 2023-12-05 10:35:52
6
6
  * @Description:
7
7
  */
8
8
  var objectql = require('@steedos/objectql');
@@ -53,6 +53,9 @@ Meteor.startup(function () {
53
53
  }
54
54
  },
55
55
  removed: function (oldDocument) {
56
+ if(oldDocument.is_system){
57
+ objectCore.removeObjectConfig(oldDocument.name)
58
+ }
56
59
  return _removeServerObjects(oldDocument);
57
60
  }
58
61
  });
@@ -0,0 +1,44 @@
1
+ /*
2
+ * @Author: 孙浩林 sunhaolin@steedos.com
3
+ * @Date: 2023-06-28 16:15:36
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2023-06-28 18:59:40
6
+ * @FilePath: /project-template/Users/sunhaolin/Documents/GitHub/steedos-platform-2.3/services/standard-object-database/main/default/objects/16.permission_tabs.observe.object.js
7
+ * @Description:
8
+ */
9
+ const objectql = require("@steedos/objectql");
10
+ const objectName = "permission_tabs";
11
+ const SERVICE_NAME = `~database-permission_tabs`;
12
+ Meteor.startup(function () {
13
+ var _change, _remove, inited = false;
14
+ _change = function (document) {
15
+ objectql.registerPermissionTabs.register(broker, SERVICE_NAME, document)
16
+ };
17
+ _remove = function (document) {
18
+ objectql.registerPermissionTabs.remove(broker, SERVICE_NAME, document)
19
+ };
20
+ Creator.getCollection(objectName).find({}, {
21
+ fields: {
22
+ created: 0,
23
+ created_by: 0,
24
+ modified: 0,
25
+ modified_by: 0
26
+ }
27
+ }).observe({
28
+ added: function (newDocument) {
29
+ if (inited) {
30
+ return _change(newDocument);
31
+ }
32
+ },
33
+ changed: function (newDocument, oldDocument) {
34
+ if (newDocument.name != oldDocument.name) {
35
+ _remove(oldDocument)
36
+ }
37
+ return _change(newDocument);
38
+ },
39
+ removed: function (oldDocument) {
40
+ return _remove(oldDocument);
41
+ }
42
+ });
43
+ inited = true;
44
+ });
@@ -2,11 +2,12 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-08-05 14:17:44
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-06-27 09:32:45
5
+ * @LastEditTime: 2023-12-05 11:04:22
6
6
  * @Description:
7
7
  */
8
8
  var objectql = require('@steedos/objectql');
9
9
  var objectCore = require('./objects.core.js');
10
+ const register = require('@steedos/metadata-registrar');
10
11
  var lodash = require('lodash');
11
12
  Meteor.startup(function () {
12
13
  var _change, _remove, inited = false;
@@ -48,6 +49,11 @@ Meteor.startup(function () {
48
49
  },
49
50
  removed: function (oldDocument) {
50
51
  if(inited){
52
+ const objConfig = register.getOriginalObjectConfig(oldDocument.object);
53
+ if(objConfig && objConfig.actions[oldDocument.name]){
54
+ return _change(Object.assign(objConfig.actions[oldDocument.name], {_previousName: oldDocument.name}));
55
+ }
56
+
51
57
  return _remove(oldDocument);
52
58
  }
53
59
  }
@@ -2,16 +2,16 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-09-21 18:19:06
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-03-01 10:15:14
5
+ * @LastEditTime: 2023-10-16 13:58:08
6
6
  * @Description:
7
7
  */
8
8
  module.exports = {
9
9
  showDesign: function (object_name, record_id) {
10
- document.location = Steedos.absoluteUrl(`/api/amisButtonDesign?id=${record_id}&object=${this.record.record.object}&assetUrls=${Builder.settings.assetUrls}`);
10
+ document.location = Steedos.absoluteUrl(`/api/amisButtonDesign?id=${record_id}&object=${this.record.record.object}&assetUrls=${Builder.settings.assetUrls}&locale=${Builder.settings.locale}`);
11
11
  },
12
- showDesignVisible: function (object_name, record_id, record_permissions) {
12
+ showDesignVisible: function (object_name, record_id, record_permissions, data) {
13
13
  var perms;
14
- var record = Creator.getObjectRecord(object_name, record_id);
14
+ var record = (data && data.record) || Creator.getObjectRecord(object_name, record_id);
15
15
  if(record.type === 'amis_button'){
16
16
  perms = {};
17
17
  if (record_permissions) {
@@ -25,5 +25,36 @@ module.exports = {
25
25
  return perms["allowEdit"];
26
26
  }
27
27
  return false;
28
+ },
29
+ customize: function (object_name, record_id, fields) {
30
+ var doc = Creator.odata.get(object_name, record_id);
31
+ var newDoc = {}
32
+ _.each(Creator.getObject(object_name).fields, function(v, k){
33
+ if(_.has(doc, k)){
34
+ newDoc[k] = doc[k]
35
+ }
36
+ })
37
+ delete newDoc.is_system;
38
+
39
+ let docName = doc.name
40
+ let docObjectName = doc.object
41
+
42
+ Creator.odata.insert(object_name, Object.assign(newDoc, {name: docName, object: docObjectName}), function(result, error){
43
+ if(result){
44
+ if(Session.get("object_name") === 'object_actions'){
45
+ FlowRouter.go(`/app/-/${object_name}/view/${result._id}`)
46
+ }else{
47
+ href = Creator.getObjectUrl(object_name, result._id);
48
+ window.open(href,'_blank','width=800, height=600, left=50, top= 50, toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes')
49
+ }
50
+ }
51
+ });
52
+ },
53
+ customizeVisible: function(object_name, record_id, record_permissions, data){
54
+ var record = data && data.record;
55
+ if(!record){
56
+ record = {}
57
+ }
58
+ return Creator.baseObject.actions.standard_new.visible() && record.is_system && record.type == 'amis_button';
28
59
  }
29
60
  }
@@ -76,7 +76,7 @@ function allowChangeObject(){
76
76
  }
77
77
  }
78
78
 
79
- Creator.Objects.object_actions.triggers = {
79
+ const triggers = {
80
80
  // "after.insert.server.object_actions": {
81
81
  // on: "server",
82
82
  // when: "after.insert",
@@ -149,4 +149,6 @@ Creator.Objects.object_actions.triggers = {
149
149
  }
150
150
  }
151
151
  }
152
- }
152
+ }
153
+
154
+ Creator.Objects.object_actions.triggers = Object.assign(Creator.Objects.object_actions.triggers || {}, triggers);
@@ -46,38 +46,57 @@ fields:
46
46
  required: true
47
47
  showIcon: false
48
48
  sort_no: 160
49
- optionsFunction: !<tag:yaml.org,2002:js/function> |-
50
- function () {
51
- return [{
52
- label: "显示在列表右上角",
53
- value: "list",
54
- icon: "contact_list"
55
- }, {
56
- label: "显示在记录查看页右上角,以及列表视图中每项的下拉菜单中",
57
- value: "record",
58
- icon: "contact_list"
59
- }, {
60
- label: "显示在记录查看页右上角的“更多”下拉菜单中,以及列表视图中每项的下拉菜单中",
61
- value: "record_more",
62
- icon: "lead_list"
63
- }, {
64
- label: "显示在列表视图中每项的下拉菜单中",
65
- value: "list_item",
66
- icon: "action_list_component"
67
- }, {
68
- label: "显示在记录查看页右上角",
69
- value: "record_only",
70
- icon: "contract"
71
- }, {
72
- label: "显示在记录查看页右上角的“更多”下拉菜单中",
73
- value: "record_only_more",
74
- icon: "lead_list"
75
- }];
76
- }
49
+ options:
50
+ - label: 显示在列表右上角
51
+ value: list
52
+ icon: contact_list
53
+ - label: 显示在记录查看页右上角,以及列表视图中每项的下拉菜单中
54
+ value: record
55
+ icon: contact_list
56
+ - label: 显示在记录查看页右上角的“更多”下拉菜单中,以及列表视图中每项的下拉菜单中
57
+ value: record_more
58
+ icon: lead_list
59
+ - label: 显示在列表视图中每项的下拉菜单中
60
+ value: list_item
61
+ icon: action_list_component
62
+ - label: 显示在记录查看页右上角
63
+ value: record_only
64
+ icon: contract
65
+ - label: 显示在记录查看页右上角的“更多”下拉菜单中
66
+ value: record_only_more
67
+ icon: lead_list
68
+ # optionsFunction: !<tag:yaml.org,2002:js/function> |-
69
+ # function () {
70
+ # return [{
71
+ # label: "显示在列表右上角",
72
+ # value: "list",
73
+ # icon: "contact_list"
74
+ # }, {
75
+ # label: "显示在记录查看页右上角,以及列表视图中每项的下拉菜单中",
76
+ # value: "record",
77
+ # icon: "contact_list"
78
+ # }, {
79
+ # label: "显示在记录查看页右上角的“更多”下拉菜单中,以及列表视图中每项的下拉菜单中",
80
+ # value: "record_more",
81
+ # icon: "lead_list"
82
+ # }, {
83
+ # label: "显示在列表视图中每项的下拉菜单中",
84
+ # value: "list_item",
85
+ # icon: "action_list_component"
86
+ # }, {
87
+ # label: "显示在记录查看页右上角",
88
+ # value: "record_only",
89
+ # icon: "contract"
90
+ # }, {
91
+ # label: "显示在记录查看页右上角的“更多”下拉菜单中",
92
+ # value: "record_only_more",
93
+ # icon: "lead_list"
94
+ # }];
95
+ # }
77
96
  type:
78
97
  type: select
79
98
  sort_no: 170
80
- hidden: true
99
+ visible_on: "${false}"
81
100
  options:
82
101
  - label: Custom JavaScript
83
102
  value: script
@@ -110,6 +129,14 @@ fields:
110
129
  is_wide: true
111
130
  hidden: true
112
131
  visible_on: "{{formData.type == 'amis_button' ? true: false}}"
132
+ is_system:
133
+ type: boolean
134
+ label: 系统
135
+ # omit: true
136
+ readonly: true
137
+ visible_on: "{{global.mode ==='read' ? true : false}}"
138
+ disabled: true
139
+ sort_no: 500
113
140
  form:
114
141
  initialValues: !!js/function |
115
142
  function(){
@@ -121,6 +148,9 @@ actions:
121
148
  showDesign:
122
149
  label: 设计器
123
150
  on: record_only
151
+ customize:
152
+ label: 自定义
153
+ on: record_only
124
154
  list_views:
125
155
  all:
126
156
  columns:
@@ -130,8 +160,22 @@ list_views:
130
160
  - 'on'
131
161
  - is_enable
132
162
  - modified
163
+ - is_system
133
164
  label: All
134
165
  filter_scope: space
166
+ customize:
167
+ columns:
168
+ - label
169
+ - name
170
+ - object
171
+ - 'on'
172
+ - is_enable
173
+ - modified
174
+ - is_system
175
+ label: 自定义
176
+ filters:
177
+ - ["is_system","<>",true]
178
+ filter_scope: space
135
179
  permission_set:
136
180
  user:
137
181
  allowCreate: false
@@ -3,6 +3,19 @@ var objectql = require('@steedos/objectql');
3
3
  var clone = require('clone');
4
4
  var objectCore = require('./objects.core.js');
5
5
 
6
+ const objectFieldsFind = function (filter) {
7
+ return objectql.wrapAsync(async function () {
8
+ return await objectql.getObject('object_fields').find(this.filter);
9
+ }, { filter: filter })
10
+ }
11
+
12
+
13
+ const getRecords = function (objectName) {
14
+ return objectql.wrapAsync(async function () {
15
+ return await objectql.getObject(this.objectName).directFind({fields:["_id"], top: 1});
16
+ }, { objectName: objectName })
17
+ }
18
+
6
19
  const MAX_MASTER_DETAIL_LEAVE = objectql.MAX_MASTER_DETAIL_LEAVE;
7
20
 
8
21
  function canRemoveNameFileld(doc){
@@ -105,20 +118,18 @@ function _syncToObject(doc, event) {
105
118
  };
106
119
 
107
120
  function isRepeatedName(doc, name) {
108
- var other;
109
- other = Creator.getCollection("object_fields").find({
110
- object: doc.object,
111
- space: doc.space,
112
- _id: {
113
- $ne: doc._id
114
- },
115
- name: name || doc.name
116
- }, {
117
- fields: {
118
- _id: 1
119
- }
121
+ var other = objectFieldsFind({
122
+ filters: [[
123
+ 'object', '=', doc.object
124
+ ], [
125
+ 'space', '=', doc.space
126
+ ], [
127
+ '_id', '!=', doc._id
128
+ ], [
129
+ 'name', '=', name || doc.name
130
+ ]]
120
131
  });
121
- if (other.count() > 0) {
132
+ if (other.length > 0) {
122
133
  return true;
123
134
  }
124
135
  return false;
@@ -238,7 +249,7 @@ function checkMasterDetailTypeField(doc, oldReferenceTo) {
238
249
 
239
250
  function onChangeName(oldName, newDoc){
240
251
  var newName = newDoc.name
241
- Creator.getCollection("object_listviews").direct.find({space: newDoc.space, object_name: newDoc.object}, {fields: {_id:1, columns: 1}}).forEach(function(view){
252
+ Creator.getCollection("object_listviews").direct.find({space: newDoc.space, object_name: newDoc.object}, {fields: {_id:1, columns: 1, name: 1}}).forEach(function(view){
242
253
  if(_.isArray(view.columns)){
243
254
  var columns = [];
244
255
  _.each(view.columns, function(column){
@@ -258,7 +269,8 @@ function onChangeName(oldName, newDoc){
258
269
  columns.push(column)
259
270
  }
260
271
  });
261
- Creator.getCollection("object_listviews").update({_id: view._id}, {$set: {columns: columns}});
272
+ // 由于 https://github.com/steedos/steedos-platform/issues/4655 改动, 修改列表视图的时候, 必须要传入name, 否则会报错
273
+ Creator.getCollection("object_listviews").update({_id: view._id}, {$set: {name: view.name, columns: columns}});
262
274
  }
263
275
  })
264
276
  }
@@ -427,11 +439,11 @@ var triggers = {
427
439
  }
428
440
  });
429
441
  if (object) {
430
- object_documents = Creator.getCollection(object.name).find();
431
- if ((modifier != null ? (ref6 = modifier.$set) != null ? ref6.reference_to : void 0 : void 0) && doc.reference_to !== _reference_to && object_documents.count() > 0) {
442
+ object_documents = getRecords(object.name);
443
+ if ((modifier != null ? (ref6 = modifier.$set) != null ? ref6.reference_to : void 0 : void 0) && doc.reference_to !== _reference_to && object_documents.length > 0) {
432
444
  throw new Meteor.Error(500, `对象${object.label}中已经有记录,不能修改reference_to字段`);
433
445
  }
434
- if ((modifier != null ? (ref7 = modifier.$unset) != null ? ref7.reference_to : void 0 : void 0) && doc.reference_to !== _reference_to && object_documents.count() > 0) {
446
+ if ((modifier != null ? (ref7 = modifier.$unset) != null ? ref7.reference_to : void 0 : void 0) && doc.reference_to !== _reference_to && object_documents.length > 0) {
435
447
  throw new Meteor.Error(500, `对象${object.label}中已经有记录,不能修改reference_to字段`);
436
448
  }
437
449
  }
@@ -453,6 +465,7 @@ var triggers = {
453
465
  if(!allowChangeObject()){
454
466
  throw new Meteor.Error(500, "华炎云服务不包含自定义业务对象的功能,请部署私有云版本");
455
467
  }
468
+
456
469
  checkName(doc._name);
457
470
  if(['name','owner','parent','children'].indexOf(doc._name)>-1){
458
471
  doc.name = doc._name;
@@ -463,8 +476,9 @@ var triggers = {
463
476
  if(doc.name === 'name' || doc.is_name){
464
477
  checkNameField({type: doc.type})
465
478
  }
466
-
479
+ console.log('insert', doc)
467
480
  if (isRepeatedName(doc)) {
481
+
468
482
  throw new Meteor.Error(doc.name, "字段名不能重复");
469
483
  }
470
484