@steedos/standard-object-database 2.7.10-beta.5 → 2.7.10-beta.6

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.
@@ -2,7 +2,7 @@
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-06-02 17:45:15
4
4
  * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2024-10-10 09:44:47
5
+ * @LastEditTime: 2024-10-10 10:20:19
6
6
  * @Description:
7
7
  -->
8
8
  <html>
@@ -255,8 +255,7 @@
255
255
  return true;
256
256
  },
257
257
  beforeDelete: function(event){
258
- if(event.context.schema.type.startsWith('sfield') && event.context.schema.config.is_system){
259
- parent.toastr.warning('禁止删除系统字段', '', {
258
+ const toastConfig = {
260
259
  "closeButton": true,
261
260
  "debug": false,
262
261
  "newestOnTop": false,
@@ -272,7 +271,14 @@
272
271
  "hideEasing": "linear",
273
272
  "showMethod": "fadeIn",
274
273
  "hideMethod": "fadeOut"
275
- })
274
+ }
275
+ if(event.context.schema.type.startsWith('sfield') && event.context.schema.config.is_system){
276
+ parent.toastr.warning('禁止删除系统字段', '', toastConfig)
277
+ return event.preventDefault();
278
+ };
279
+
280
+ if(event.context.schema.type.startsWith('sfield') && event.context.schema.config.name === 'name'){
281
+ parent.toastr.warning('禁止删除名称字段', '', toastConfig)
276
282
  return event.preventDefault();
277
283
  }
278
284
  },
@@ -390,6 +390,12 @@ module.exports = {
390
390
  const groupName = bodyItem.title;
391
391
  _.each(bodyItem.body, (field)=>{
392
392
  if(_.startsWith(field.type, 'sfield-')){
393
+
394
+ if(field.config && field.config.amis){
395
+ delete field.config.amis.name
396
+ delete field.config.amis.mode
397
+ }
398
+
393
399
  fields.push(Object.assign({}, field.config, {group: groupName, sort_no, _name: field.name}));
394
400
  sort_no += 50;
395
401
  }
@@ -400,6 +406,10 @@ module.exports = {
400
406
  visible_on: bodyItem.visible_on
401
407
  })
402
408
  }else if(_.startsWith(bodyItem.type, 'sfield-')){
409
+ if(bodyItem.config && bodyItem.config.amis){
410
+ delete bodyItem.config.amis.name
411
+ delete bodyItem.config.amis.mode
412
+ }
403
413
  fields.push(Object.assign({}, bodyItem.config, {sort_no, _name: bodyItem.name}));
404
414
  sort_no += 50;
405
415
  }
@@ -467,8 +477,8 @@ module.exports = {
467
477
  // 循环需要修改的字段
468
478
  const now = new Date();
469
479
  for (const fieldName of updateFields) {
480
+ const field = _.find(fields, { name: fieldName });
470
481
  try {
471
- const field = _.find(fields, { name: fieldName });
472
482
  const id = _.find(dbFields, { name: fieldName })._id;
473
483
  const submitField = _.omit(field, ['name', '_name']);
474
484
 
@@ -484,18 +494,28 @@ module.exports = {
484
494
  }));
485
495
  log.update.success.push(fieldName);
486
496
  } catch (e) {
487
- log.update.error.push(fieldName);
497
+ log.update.error.push({
498
+ fieldName: fieldName,
499
+ fieldLabel: field.label,
500
+ message: steedosI18n.t(e.message, null, 'zh-CN')
501
+ });
488
502
  console.log(`dbFields`, fieldName, dbFields)
489
503
  console.error(`更新字段 ${fieldName} 时出错:`, e);
490
504
  }
491
505
  }
492
506
  // 循环需要删除的字段
493
507
  for (const fieldName of deleteFields) {
508
+ const field = _.find(dbFields, { name: fieldName })._id;
494
509
  try {
495
- const id = _.find(dbFields, { name: fieldName })._id;
510
+ const id = field._id;
496
511
  await object_fields.directDelete(id);
497
512
  log.delete.success.push(fieldName);
498
513
  } catch (e) {
514
+ log.delete.error.push({
515
+ fieldName: fieldName,
516
+ fieldLabel: field.label,
517
+ message: steedosI18n.t(e.message, null, 'zh-CN')
518
+ });
499
519
  log.delete.error.push(fieldName);
500
520
  console.error(`删除字段 ${fieldName} 时出错:`, e);
501
521
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-object-database",
3
- "version": "2.7.10-beta.5",
3
+ "version": "2.7.10-beta.6",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,14 +12,14 @@
12
12
  "description": "steedos package",
13
13
  "dependencies": {
14
14
  "@steedos-widgets/amis-lib": "^1.0.22",
15
- "@steedos/metadata-core": "2.7.10-beta.5",
16
- "@steedos/service-object-mixin": "2.7.10-beta.5",
17
- "@steedos/standard-objects": "2.7.10-beta.5",
15
+ "@steedos/metadata-core": "2.7.10-beta.6",
16
+ "@steedos/service-object-mixin": "2.7.10-beta.6",
17
+ "@steedos/standard-objects": "2.7.10-beta.6",
18
18
  "amis-formula": "~6.3.0",
19
19
  "clone": "^2.1.2",
20
20
  "moleculer-bullmq": "3.0.0"
21
21
  },
22
22
  "repository": {},
23
23
  "license": "MIT",
24
- "gitHead": "69c1df1a9c161c0ff640d589dbb18a40043edbb1"
24
+ "gitHead": "1f01f0093a985e6e4f3d20ca8989e178c5f71133"
25
25
  }