@steedos/service-core-objects 3.0.0-beta.15 → 3.0.0-beta.151

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 (203) hide show
  1. package/README.md +3 -3
  2. package/main/default/applications/.gitkeep +0 -0
  3. package/main/default/applications/admin.app.yml +179 -0
  4. package/main/default/client/{topic.client.js → css.client.js} +2 -1
  5. package/main/default/client/socket.client.js +118 -0
  6. package/main/default/objectTranslations/announcements.en/announcements.en.objectTranslation.yml +37 -0
  7. package/main/default/objectTranslations/announcements.zh-CN/announcements.zh-CN.objectTranslation.yml +37 -0
  8. package/main/default/objectTranslations/audit_records.en/audit_records.en.objectTranslation.yml +1 -1
  9. package/main/default/objectTranslations/base.en/base.en.objectTranslation.yml +6 -0
  10. package/main/default/objectTranslations/base.zh-CN/base.zh-CN.objectTranslation.yml +6 -0
  11. package/main/default/objectTranslations/cms_files.en/cms_files.en.objectTranslation.yml +7 -1
  12. package/main/default/objectTranslations/cms_files.zh-CN/cms_files.zh-CN.objectTranslation.yml +7 -1
  13. package/main/default/objectTranslations/company.en/company.en.objectTranslation.yml +6 -1
  14. package/main/default/objectTranslations/company.zh-CN/company.zh-CN.objectTranslation.yml +5 -0
  15. package/main/default/objectTranslations/datasources.zh-CN/datasources.zh-CN.objectTranslation.yml +1 -1
  16. package/main/default/objectTranslations/license.en/license.en.objectTranslation.yml +1 -1
  17. package/main/default/objectTranslations/logs.en/logs.en.objectTranslation.yml +1 -1
  18. package/main/default/objectTranslations/object_actions.en/object_actions.en.objectTranslation.yml +5 -0
  19. package/main/default/objectTranslations/object_actions.zh-CN/object_actions.zh-CN.objectTranslation.yml +6 -1
  20. package/main/default/objectTranslations/object_fields.en/object_fields.en.objectTranslation.yml +4 -8
  21. package/main/default/objectTranslations/object_fields.zh-CN/object_fields.zh-CN.objectTranslation.yml +4 -4
  22. package/main/default/objectTranslations/object_functions.en/object_functions.en.objectTranslation.yml +1 -5
  23. package/main/default/objectTranslations/object_functions.zh-CN/object_functions.zh-CN.objectTranslation.yml +2 -6
  24. package/main/default/objectTranslations/object_layouts.zh-CN/object_layouts.zh-CN.objectTranslation.yml +1 -1
  25. package/main/default/objectTranslations/object_listviews.en/object_listviews.en.objectTranslation.yml +3 -1
  26. package/main/default/objectTranslations/object_listviews.zh-CN/object_listviews.zh-CN.objectTranslation.yml +5 -3
  27. package/main/default/objectTranslations/object_triggers.en/object_triggers.en.objectTranslation.yml +9 -0
  28. package/main/default/objectTranslations/object_triggers.zh-CN/object_triggers.zh-CN.objectTranslation.yml +9 -0
  29. package/main/default/objectTranslations/object_validation_rules.en/object_validation_rules.en.objectTranslation.yml +3 -3
  30. package/main/default/objectTranslations/object_webhooks.en/object_webhooks.en.objectTranslation.yml +12 -6
  31. package/main/default/objectTranslations/object_webhooks.zh-CN/object_webhooks.zh-CN.objectTranslation.yml +12 -6
  32. package/main/default/objectTranslations/objects.en/objects.en.objectTranslation.yml +44 -19
  33. package/main/default/objectTranslations/objects.zh-CN/objects.zh-CN.objectTranslation.yml +59 -25
  34. package/main/default/objectTranslations/operation_logs.en/operation_logs.en.objectTranslation.yml +66 -0
  35. package/main/default/objectTranslations/operation_logs.zh-CN/operation_logs.zh-CN.objectTranslation.yml +66 -0
  36. package/main/default/objectTranslations/organizations.en/organizations.en.objectTranslation.yml +1 -1
  37. package/main/default/objectTranslations/process_delegation_rules.en/process_delegation_rules.en.objectTranslation.yml +1 -1
  38. package/main/default/objectTranslations/reports.en/reports.en.objectTranslation.yml +7 -1
  39. package/main/default/objectTranslations/reports.zh-CN/reports.zh-CN.objectTranslation.yml +7 -1
  40. package/main/default/objectTranslations/sessions.en/sessions.en.objectTranslation.yml +1 -1
  41. package/main/default/objectTranslations/settings.en/settings.en.objectTranslation.yml +10 -1
  42. package/main/default/objectTranslations/settings.zh-CN/settings.zh-CN.objectTranslation.yml +9 -0
  43. package/main/default/objectTranslations/space_users.en/space_users.en.objectTranslation.yml +18 -1
  44. package/main/default/objectTranslations/space_users.zh-CN/space_users.zh-CN.objectTranslation.yml +17 -1
  45. package/main/default/objects/_base/base.client.js +124 -124
  46. package/main/default/objects/_base/base.object.js +503 -321
  47. package/main/default/objects/_base/base.object.yml +8 -0
  48. package/main/default/objects/_base/base.recordFieldAudit.trigger.js +3 -0
  49. package/main/default/objects/_base/base.trigger.js +7 -144
  50. package/main/default/objects/announcements.object.yml +68 -0
  51. package/main/default/objects/api_keys/buttons/copy.button.yml +1 -1
  52. package/main/default/objects/apps/apps.object.yml +25 -69
  53. package/main/default/objects/apps/buttons/disable.button.js +9 -7
  54. package/main/default/objects/apps/buttons/enable.button.js +9 -7
  55. package/main/default/objects/audit_records.object.yml +2 -2
  56. package/main/default/objects/cms_files/buttons/download.button.yml +1 -1
  57. package/main/default/objects/cms_files/cms_files.object.yml +7 -6
  58. package/main/default/objects/company/buttons/updateOrgs.button.yml +3 -6
  59. package/main/default/objects/company/company.object.yml +1 -1
  60. package/main/default/objects/favorites.object.yml +65 -0
  61. package/main/default/objects/keyvalue/keyvalue.object.yml +1 -0
  62. package/main/default/objects/license.object.yml +13 -33
  63. package/main/default/objects/logs/logs.object.yml +2 -1
  64. package/main/default/objects/notifications/fields/related_to.field.yml +12 -4
  65. package/main/default/objects/object_actions/buttons/showDesign.button.js +5 -1
  66. package/main/default/objects/object_actions/fields/is_system.field.yml +1 -1
  67. package/main/default/objects/object_fields/buttons/recomputeFormulaValues.button.js +6 -2
  68. package/main/default/objects/object_fields/buttons/recomputeSummaryValues.button.js +6 -2
  69. package/main/default/objects/object_fields/buttons/standard_new.button.js +1 -1
  70. package/main/default/objects/object_fields/fields/_name.field.yml +1 -0
  71. package/main/default/objects/object_fields/fields/auto_fill_mapping.$.to.field.yml +28 -13
  72. package/main/default/objects/object_fields/fields/description.field.yml +11 -2
  73. package/main/default/objects/object_fields/fields/name.field.yml +1 -0
  74. package/main/default/objects/object_fields/fields/options.field.yml +1 -0
  75. package/main/default/objects/object_fields/fields/required.field.yml +1 -1
  76. package/main/default/objects/object_fields/fields/summary_filters.$.field.field.yml +16 -9
  77. package/main/default/objects/object_fields/fields/summary_filters.$.operation.field.yml +26 -29
  78. package/main/default/objects/object_fields/listviews/all.listview.yml +4 -2
  79. package/main/default/objects/object_fields/listviews/customize.listview.yml +3 -1
  80. package/main/default/objects/object_functions/buttons/open_api.button.yml +1 -3
  81. package/main/default/objects/object_functions/fields/script.field.yml +3 -2
  82. package/main/default/objects/object_functions/listviews/all.listview.yml +0 -1
  83. package/main/default/objects/object_functions/listviews/customize.listview.yml +0 -1
  84. package/main/default/objects/object_functions/object_functions.object.yml +1 -1
  85. package/main/default/objects/object_listviews/buttons/customize.button.js +36 -30
  86. package/main/default/objects/object_listviews/buttons/showDesign.button.js +6 -6
  87. package/main/default/objects/object_listviews/fields/adaptor.field.yml +2 -2
  88. package/main/default/objects/object_listviews/fields/crudDataFilter.field.yml +10 -0
  89. package/main/default/objects/object_listviews/fields/enable_amis_schema.field.yml +1 -0
  90. package/main/default/objects/object_listviews/fields/extra_columns.field.yml +18 -0
  91. package/main/default/objects/object_listviews/fields/requestAdaptor.field.yml +2 -2
  92. package/main/default/objects/object_listviews/object_listviews.object.yml +1 -1
  93. package/main/default/objects/object_triggers/fields/handler.field.yml +3 -2
  94. package/main/default/objects/object_webhooks/fields/fields.field.yml +1 -1
  95. package/main/default/objects/object_webhooks/object_webhooks.object.yml +2 -1
  96. package/main/default/objects/objects/buttons/custom.button.js +6 -35
  97. package/main/default/objects/objects/buttons/custom.button.yml +81 -1
  98. package/main/default/objects/objects/buttons/delete_object.button.yml +5 -4
  99. package/main/default/objects/objects/buttons/design_fields_layout.button.js +5 -2
  100. package/main/default/objects/objects/buttons/design_fields_layout.button.yml +1 -1
  101. package/main/default/objects/objects/buttons/reset.button.yml +6 -5
  102. package/main/default/objects/objects/buttons/show_object.button.js +2 -29
  103. package/main/default/objects/objects/fields/compactLayouts.field.yml +2 -2
  104. package/main/default/objects/objects/fields/enable_audit.field.yml +5 -0
  105. package/main/default/objects/objects/fields/enable_chatter.field.yml +5 -4
  106. package/main/default/objects/objects/fields/enable_dataloader.field.yml +0 -1
  107. package/main/default/objects/objects/fields/enable_enhanced_lookup.field.yml +0 -4
  108. package/main/default/objects/objects/fields/enable_events.field.yml +2 -2
  109. package/main/default/objects/objects/fields/enable_files.field.yml +1 -1
  110. package/main/default/objects/objects/fields/enable_form_tabs.field.yml +1 -2
  111. package/main/default/objects/objects/fields/enable_inline_edit.field.yml +1 -1
  112. package/main/default/objects/objects/fields/enable_instances.field.yml +2 -2
  113. package/main/default/objects/objects/fields/enable_lock_detail.field.yml +0 -1
  114. package/main/default/objects/objects/fields/enable_notes.field.yml +2 -2
  115. package/main/default/objects/objects/fields/enable_tasks.field.yml +1 -1
  116. package/main/default/objects/objects/fields/enable_tree.field.yml +0 -1
  117. package/main/default/objects/objects/fields/field_groups.field.yml +1 -1
  118. package/main/default/objects/objects/fields/in_development.field.yml +0 -1
  119. package/main/default/objects/objects/fields/is_deleted.field.yml +1 -0
  120. package/main/default/objects/objects/fields/name.field.yml +1 -4
  121. package/main/default/objects/objects/fields/table_name.field.yml +0 -1
  122. package/main/default/objects/objects/listviews/all.listview.yml +4 -1
  123. package/main/default/objects/objects/listviews/customize.listview.yml +3 -1
  124. package/main/default/objects/objects/listviews/deleted.listview.yml +3 -1
  125. package/main/default/objects/objects/listviews/metadata.listview.yml +3 -1
  126. package/main/default/objects/objects/listviews/system.listview.yml +3 -1
  127. package/main/default/objects/objects/objects.object.yml +1 -1
  128. package/main/default/objects/permission_set/buttons/copy.button.yml +114 -0
  129. package/main/default/objects/permission_set/buttons/set_permission_tabs.button.yml +166 -0
  130. package/main/default/objects/{permission_set.object.yml → permission_set/permission_set.object.yml} +1 -5
  131. package/main/default/objects/queue_import.object.yml +16 -1
  132. package/main/default/objects/reports.object.yml +125 -258
  133. package/main/default/objects/roles.object.yml +2 -5
  134. package/main/default/objects/sessions.object.yml +1 -1
  135. package/main/default/objects/space_users/buttons/clear_login_tokens.button.yml +4 -7
  136. package/main/default/objects/space_users/buttons/disable.button.yml +3 -7
  137. package/main/default/objects/space_users/buttons/enable.button.yml +3 -7
  138. package/main/default/objects/space_users/buttons/lockout.button.yml +3 -7
  139. package/main/default/objects/space_users/buttons/setPassword.button.js +12 -12
  140. package/main/default/objects/space_users/buttons/standard_edit.button.js +0 -1
  141. package/main/default/objects/space_users/buttons/unlock.button.yml +3 -7
  142. package/main/default/objects/space_users/fields/locale.field.yml +2 -1
  143. package/main/default/objects/space_users/fields/password_expired.field.yml +1 -1
  144. package/main/default/pages/about.page.amis.json +21 -4
  145. package/main/default/pages/apps_form.page.amis.json +334 -0
  146. package/main/default/pages/apps_form.page.yml +12 -0
  147. package/main/default/pages/cfs_files_record_preview.page.amis.json +8 -8
  148. package/main/default/pages/cms_files_preview.page.amis.json +29 -10
  149. package/main/default/pages/object_detail.page.amis.json +17 -11
  150. package/main/default/pages/object_fields_form.page.amis.json +1 -12
  151. package/main/default/pages/object_form.page.amis.json +1 -1
  152. package/main/default/pages/object_validation_rules_form.page.amis.json +38 -0
  153. package/main/default/pages/object_validation_rules_form.page.yml +13 -0
  154. package/main/default/pages/object_webhooks_form.page.amis.json +1 -1
  155. package/main/default/pages/organizations.page.amis.json +0 -4
  156. package/main/default/pages/space_users_list.page.amis.json +134 -19
  157. package/main/default/routes/amis_button_design.ejs +4 -1
  158. package/main/default/routes/amis_button_design.router.js +4 -3
  159. package/main/default/routes/importRecords.router.js +87 -0
  160. package/main/default/routes/notifications.router.js +113 -0
  161. package/main/default/routes/object_fields_design.ejs +24 -9
  162. package/main/default/routes/object_fields_design.router.js +5 -4
  163. package/main/default/services/app-design.service.js +2 -1
  164. package/main/default/services/notifications.service.js +190 -0
  165. package/main/default/services/spaces.service.js +1 -1
  166. package/main/default/services/users.service.js +6 -3
  167. package/main/default/tabs/admin_bull_dashboard.tab.yml +22 -0
  168. package/main/default/tabs/{admin_process_delegation_rules.tab.yml → admin_object_functions.tab.yml} +5 -8
  169. package/main/default/tabs/admin_swagger.tab.yml +22 -0
  170. package/main/default/translations/en.translation.yml +5 -4
  171. package/main/default/translations/zh-CN.translation.yml +3 -2
  172. package/main/default/triggers/objects_set_default_object_properties_trigger.trigger.yml +9 -6
  173. package/main/default/triggers/queue_import.trigger.js +16 -0
  174. package/main/default/triggers/space_users.trigger.js +3 -3
  175. package/package.json +4 -4
  176. package/package.service.js +3 -2
  177. package/public/platform.css +67 -0
  178. package/public/topic.css +17 -37
  179. package/main/default/objectTranslations/flow_positions.en/flow_positions.en.objectTranslation.yml +0 -19
  180. package/main/default/objectTranslations/flow_positions.zh-CN/flow_positions.zh-CN.objectTranslation.yml +0 -19
  181. package/main/default/objectTranslations/flow_roles.en/flow_roles.en.objectTranslation.yml +0 -11
  182. package/main/default/objectTranslations/flow_roles.zh-CN/flow_roles.zh-CN.objectTranslation.yml +0 -14
  183. package/main/default/objectTranslations/flows.en/flows.en.objectTranslation.yml +0 -317
  184. package/main/default/objectTranslations/flows.zh-CN/flows.zh-CN.objectTranslation.yml +0 -314
  185. package/main/default/objectTranslations/forms.en/forms.en.objectTranslation.yml +0 -191
  186. package/main/default/objectTranslations/forms.zh-CN/forms.zh-CN.objectTranslation.yml +0 -194
  187. package/main/default/objectTranslations/instances.en/instances.en.objectTranslation.yml +0 -155
  188. package/main/default/objectTranslations/instances.zh-CN/instances.zh-CN.objectTranslation.yml +0 -155
  189. package/main/default/objects/apps/buttons/amis_edit.button.yml +0 -39
  190. package/main/default/objects/apps/buttons/amis_new.button.yml +0 -43
  191. package/main/default/objects/flows/flows.object.yml +0 -1089
  192. package/main/default/objects/object_actions/buttons/customize.button.js +0 -33
  193. package/main/default/objects/object_actions/buttons/customize.button.yml +0 -3
  194. package/main/default/objects/object_functions/fields/is_rest.field.yml +0 -5
  195. package/main/default/objects/object_listviews/buttons/copy.button.js +0 -58
  196. package/main/default/objects/object_listviews/buttons/copy.button.yml +0 -3
  197. package/main/default/objects/object_listviews/buttons/customize.button.yml +0 -3
  198. package/main/default/objects/objects/buttons/design_field_layout.button.js +0 -28
  199. package/main/default/objects/objects/buttons/design_field_layout.button.yml +0 -5
  200. package/main/default/objects/process_definition.object.yml +0 -323
  201. package/main/default/objects/space_users/fields/zoom.field.yml +0 -16
  202. package/main/default/objects/spaces/buttons/upgrade.button.js +0 -12
  203. package/main/default/objects/spaces/buttons/upgrade.button.yml +0 -4
@@ -1,5 +1,5 @@
1
1
  name: space_users
2
- label: User
2
+ label: Users
3
3
  description:
4
4
  fields:
5
5
  name:
@@ -167,8 +167,25 @@ actions:
167
167
  label: Verify Email
168
168
  verify_mobile:
169
169
  label: Verify Mobile
170
+ clear_login_tokens:
171
+ label: Log out all logins
170
172
  CustomLabels:
171
173
  space_users_field_profile_def_options_admin: Administrator
172
174
  space_users_field_profile_def_options_user: Employee
173
175
  space_users_field_profile_def_options_supplier: Supplier
174
176
  space_users_field_profile_def_options_customer: Customer
177
+ space_users_actions_disable_confirmText: Are you sure you want to disable this user?
178
+ space_users_actions_disable_success: The user has disabled successfully
179
+ space_users_actions_disable_failed: The user failed to disable. Please try again later
180
+ space_users_actions_enable_confirmText: Are you sure you want to enable this user?
181
+ space_users_actions_enable_success: The user has enabled successfully
182
+ space_users_actions_enable_failed: The user failed to enable. Please try again later
183
+ space_users_actions_lockout_confirmText: Are you sure you want to lockout this user?
184
+ space_users_actions_lockout_success: The user has lockouted successfully
185
+ space_users_actions_lockout_failed: The user failed to lockout. Please try again later
186
+ space_users_actions_unlock_confirmText: Are you sure you want to unlock this user?
187
+ space_users_actions_unlock_success: The user has unlocked successfully
188
+ space_users_actions_unlock_failed: The user failed to unlock. Please try again later
189
+ space_users_actions_clear_login_tokens_confirmText: After logging out of all logins, all the logged-in flowers and clients of the user need to log in again. Are you sure you want to clean it up?
190
+ space_users_actions_clear_login_tokens_success: Logging out successfully
191
+
@@ -156,7 +156,7 @@ actions:
156
156
  setPassword:
157
157
  label: 修改密码
158
158
  disable:
159
- label: 停用
159
+ label: 禁用
160
160
  enable:
161
161
  label: 启用
162
162
  lockout:
@@ -167,8 +167,24 @@ actions:
167
167
  label: 验证邮箱
168
168
  verify_mobile:
169
169
  label: 验证手机
170
+ clear_login_tokens:
171
+ label: 注销所有登录
170
172
  CustomLabels:
171
173
  space_users_field_profile_def_options_admin: 管理员
172
174
  space_users_field_profile_def_options_user: 员工
173
175
  space_users_field_profile_def_options_supplier: 供应商
174
176
  space_users_field_profile_def_options_customer: 客户
177
+ space_users_actions_disable_confirmText: 确定要禁用此用户吗?
178
+ space_users_actions_disable_success: 用户已禁用
179
+ space_users_actions_disable_failed: 用户禁用失败,请稍后再试
180
+ space_users_actions_enable_confirmText: 确定要启用此用户吗?
181
+ space_users_actions_enable_success: 用户已启用
182
+ space_users_actions_enable_failed: 用户启用失败,请稍后再试
183
+ space_users_actions_lockout_confirmText: 确定要锁定此用户吗?
184
+ space_users_actions_lockout_success: 用户已锁定
185
+ space_users_actions_lockout_failed: 用户锁定失败,请稍后再试
186
+ space_users_actions_unlock_confirmText: 确定要解锁此用户吗?
187
+ space_users_actions_unlock_success: 用户已解锁
188
+ space_users_actions_unlock_failed: 用户解锁失败,请稍后再试
189
+ space_users_actions_clear_login_tokens_confirmText: 注销所有登录后,用户所有已登录的流程器、客户端都需要重新登录。 确定要清理吗?
190
+ space_users_actions_clear_login_tokens_success: 注销成功
@@ -41,7 +41,7 @@ Steedos.StandardObjects = {
41
41
  if (permissions) {
42
42
  return permissions["allowDelete"];
43
43
  }
44
- return perms["false"];
44
+ return false;
45
45
  }
46
46
  },
47
47
  standard_delete_many:{
@@ -52,128 +52,127 @@ Steedos.StandardObjects = {
52
52
  return permissions && permissions["allowDelete"];
53
53
  }
54
54
  },
55
- // standard_approve:{
56
- // visible: function (object_name, record_id, record_permissions, props) {
57
- // return false;
58
- // // if (!Session.get("record_id")) {
59
- // // /*只在详细界面显示这个action*/
60
- // // return false;
61
- // // }
62
- // // var object_workflow, record;
63
- // // if (record_permissions && !record_permissions["allowEdit"]) {
64
- // // return false;
65
- // // }
66
- // // record = props.record;
67
- // // // record_permissions = Creator.getRecordPermissions(object_name, record, Meteor.userId());
68
- // // // if (record_permissions && !record_permissions["allowEdit"]) {
69
- // // // return false;
70
- // // // }
71
- // // object_workflow = _.find(Creator.object_workflows, function (ow) {
72
- // // return ow.object_name === object_name && (!ow.sync_direction || ow.sync_direction == 'both' || ow.sync_direction == 'obj_to_ins');
73
- // // });
74
- // // if (!object_workflow) {
75
- // // return false;
76
- // // }
77
- // // if (record && record.instances && record.instances.length > 0) {
78
- // // return false;
79
- // // }else if(record && !_.has(record,'instances') ){
80
- // // // 如果record存在,且record的instances字段不存在,则再查询一次
81
- // // var queryResult = Steedos.authRequest("/graphql", {
82
- // // type: 'POST',
83
- // // async: false,
84
- // // data: JSON.stringify({
85
- // // query: `{record:${object_name}__findOne(id: "${record_id}"){instances}}`
86
- // // }),
87
- // // contentType: 'application/json',
88
- // // error: function () { }
89
- // // });
90
- // // var recordDoc = queryResult && queryResult.data && queryResult.data.record;
91
- // // if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
92
- // // return false;
93
- // // }
94
- // // }
95
- // // return true;
96
- // }
97
- // },
98
- // standard_view_instance:{
99
- // visible: function (object_name, record_id, record_permissions, props) {
100
- // if (!Session.get("record_id")) {
101
- // /*只在详细界面显示这个action*/
102
- // return false;
103
- // }
104
- // var record = props.record;
105
- // if (record && !_.isEmpty(record.instances)) {
106
- // return true;
107
- // }else if(record && !_.has(record,'instances') ){
108
- // // 如果record存在且record的instances字段不存在,则再查询一次
109
- // var queryResult = Steedos.authRequest("/graphql", {
110
- // type: 'POST',
111
- // async: false,
112
- // data: JSON.stringify({
113
- // query: `{record:${object_name}__findOne(id: "${record_id}"){instances}}`
114
- // }),
115
- // contentType: 'application/json',
116
- // error: function () { }
117
- // });
118
- // var recordDoc = queryResult && queryResult.data && queryResult.data.record;
119
- // if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
120
- // return true;
121
- // }
122
- // }
123
- // return false;
124
- // },
125
- // todo: function () {
126
- // console.log(this)
127
- // var record = this.record.record;
128
- // var data, instanceId, uobj, url;
129
- // if (!record.instances || !record.instances[0]) {
130
- // // 如果record存在且record的instances字段不存在,则再查询一次
131
- // var queryResult = Steedos.authRequest("/graphql", {
132
- // type: 'POST',
133
- // async: false,
134
- // data: JSON.stringify({
135
- // query: `{record:${this.object_name}__findOne(id: "${this.record_id}"){instances}}`
136
- // }),
137
- // contentType: 'application/json',
138
- // error: function () { }
139
- // });
140
- // var recordDoc = queryResult && queryResult.data && queryResult.data.record;
141
- // if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
142
- // instanceId = recordDoc.instances[0]._id;
143
- // }
144
- // } else {
145
- // instanceId = record.instances[0]._id;
146
- // }
147
- // if (!instanceId) {
148
- // console.error('instanceId not exists');
149
- // return;
150
- // }
151
- // Steedos.authRequest(Steedos.absoluteUrl(`api/workflow/instance/check_is_removed/${instanceId}`), {
152
- // type: 'POST',
153
- // async: false,
154
- // data: JSON.stringify({
155
- // objectName: this.object_name,
156
- // recordId: this.record_id
157
- // }),
158
- // contentType: 'application/json',
159
- // success: function (res) {
160
- // Steedos.openWindow(Steedos.absoluteUrl(`api/workflow/instance/${instanceId}`))
161
- // },
162
- // error: function (res) {
163
- // // toastr.error('未找到申请单,可能已被删除,请重新发起审批。');
164
- // FlowRouter.reload();
165
- // }
166
- // });
167
- // }
168
- // },
169
- // standard_submit_for_approval:{
170
- // visible: function (object_name, record_id) {
171
- // return Steedos.ProcessManager.allowSubmit(object_name, record_id);
172
- // },
173
- // todo: function (object_name, record_id) {
174
- // Steedos.ProcessManager.submit(object_name, record_id);
175
- // }
176
- // },
55
+ standard_approve:{
56
+ visible: function (object_name, record_id, record_permissions, props) {
57
+ if (!record_id) {
58
+ /*只在详细界面显示这个action*/
59
+ return false;
60
+ }
61
+ var object_workflow, record;
62
+ if (record_permissions && !record_permissions["allowEdit"]) {
63
+ return false;
64
+ }
65
+ record = props.record;
66
+ // record_permissions = Creator.getRecordPermissions(object_name, record, Meteor.userId());
67
+ // if (record_permissions && !record_permissions["allowEdit"]) {
68
+ // return false;
69
+ // }
70
+ object_workflow = _.find(Steedos.object_workflows, function (ow) {
71
+ return ow.object_name === object_name && (!ow.sync_direction || ow.sync_direction == 'both' || ow.sync_direction == 'obj_to_ins');
72
+ });
73
+ if (!object_workflow) {
74
+ return false;
75
+ }
76
+ if (record && record.instances && record.instances.length > 0) {
77
+ return false;
78
+ }else if(record && !_.has(record,'instances') ){
79
+ // 如果record存在,且recordinstances字段不存在,则再查询一次
80
+ var queryResult = Steedos.authRequest("/graphql", {
81
+ type: 'POST',
82
+ async: false,
83
+ data: JSON.stringify({
84
+ query: `{record:${object_name}__findOne(id: "${record_id}"){instances}}`
85
+ }),
86
+ contentType: 'application/json',
87
+ error: function () { }
88
+ });
89
+ var recordDoc = queryResult && queryResult.data && queryResult.data.record;
90
+ if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
91
+ return false;
92
+ }
93
+ }
94
+ return true;
95
+ }
96
+ },
97
+ standard_view_instance:{
98
+ visible: function (object_name, record_id, record_permissions, props) {
99
+ if (!record_id) {
100
+ /*只在详细界面显示这个action*/
101
+ return false;
102
+ }
103
+ var record = props.record;
104
+ if (record && !_.isEmpty(record.instances)) {
105
+ return true;
106
+ }else if(record && !_.has(record,'instances') ){
107
+ // 如果record存在且recordinstances字段不存在,则再查询一次
108
+ var queryResult = Steedos.authRequest("/graphql", {
109
+ type: 'POST',
110
+ async: false,
111
+ data: JSON.stringify({
112
+ query: `{record:${object_name}__findOne(id: "${record_id}"){instances}}`
113
+ }),
114
+ contentType: 'application/json',
115
+ error: function () { }
116
+ });
117
+ var recordDoc = queryResult && queryResult.data && queryResult.data.record;
118
+ if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
119
+ return true;
120
+ }
121
+ }
122
+ return false;
123
+ },
124
+ todo: function () {
125
+ console.log(this)
126
+ var record = this.record.record;
127
+ var data, instanceId, uobj, url;
128
+ if (!record.instances || !record.instances[0]) {
129
+ // 如果record存在且recordinstances字段不存在,则再查询一次
130
+ var queryResult = Steedos.authRequest("/graphql", {
131
+ type: 'POST',
132
+ async: false,
133
+ data: JSON.stringify({
134
+ query: `{record:${this.object_name}__findOne(id: "${this.record_id}"){instances}}`
135
+ }),
136
+ contentType: 'application/json',
137
+ error: function () { }
138
+ });
139
+ var recordDoc = queryResult && queryResult.data && queryResult.data.record;
140
+ if (recordDoc && recordDoc.instances && recordDoc.instances.length > 0) {
141
+ instanceId = recordDoc.instances[0]._id;
142
+ }
143
+ } else {
144
+ instanceId = record.instances[0]._id;
145
+ }
146
+ if (!instanceId) {
147
+ console.error('instanceId not exists');
148
+ return;
149
+ }
150
+ Steedos.authRequest(Steedos.absoluteUrl(`api/workflow/instance/check_is_removed/${instanceId}`), {
151
+ type: 'POST',
152
+ async: false,
153
+ data: JSON.stringify({
154
+ objectName: this.object_name,
155
+ recordId: this.record_id
156
+ }),
157
+ contentType: 'application/json',
158
+ success: function (res) {
159
+ Steedos.openWindow(Steedos.absoluteUrl(`api/workflow/instance/${instanceId}`))
160
+ },
161
+ error: function (res) {
162
+ // toastr.error('未找到申请单,可能已被删除,请重新发起审批。');
163
+ FlowRouter.reload();
164
+ }
165
+ });
166
+ }
167
+ },
168
+ standard_submit_for_approval:{
169
+ visible: function (object_name, record_id) {
170
+ return Steedos.ProcessManager.allowSubmit(object_name, record_id);
171
+ },
172
+ // todo: function (object_name, record_id) {
173
+ // Steedos.ProcessManager.submit(object_name, record_id);
174
+ // }
175
+ },
177
176
  standard_import_data:{
178
177
  visible: function(objectName){
179
178
  var allowCreate = Steedos.Object.base.actions.standard_new.visible.apply(this, arguments);
@@ -202,7 +201,8 @@ Steedos.StandardObjects = {
202
201
  }
203
202
  window._hasImportTemplates[objectName] = false;
204
203
  return false;
205
- }
204
+ },
205
+ todo: function(object_name){}
206
206
  },
207
207
  standard_export_excel:{
208
208
  visible: function(objectName, record_id, record_permissions, props){