@steedos/standard-object-database 2.7.10-beta.5 → 2.7.10-beta.8
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
|
|
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
|
-
|
|
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
|
},
|
|
@@ -2,6 +2,7 @@ var _ = require("underscore");
|
|
|
2
2
|
var objectql = require('@steedos/objectql');
|
|
3
3
|
var clone = require('clone');
|
|
4
4
|
var objectCore = require('./objects.core.js');
|
|
5
|
+
var lodash = require('lodash');
|
|
5
6
|
|
|
6
7
|
const objectFieldsFind = function (filter) {
|
|
7
8
|
return objectql.wrapAsync(async function () {
|
|
@@ -31,7 +32,7 @@ function getFieldName(objectName, fieldName, spaceId, oldFieldName){
|
|
|
31
32
|
if(object && object.datasource && object.datasource != 'default'){
|
|
32
33
|
return fieldName;
|
|
33
34
|
}else{
|
|
34
|
-
if(
|
|
35
|
+
if(!lodash.includes(['name', 'owner', 'created', 'created_by', 'modified', 'modified_by'], fieldName) ){
|
|
35
36
|
return objectql._makeNewFieldName(fieldName, spaceId, oldFieldName);
|
|
36
37
|
}else{
|
|
37
38
|
return fieldName
|
|
@@ -470,7 +471,7 @@ var triggers = {
|
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
checkName(doc._name);
|
|
473
|
-
if(['name','owner','parent','children'].indexOf(doc._name)>-1){
|
|
474
|
+
if(['name','owner','parent','children'].indexOf(doc._name)>-1 || doc._name && doc.is_system){
|
|
474
475
|
doc.name = doc._name;
|
|
475
476
|
}else{
|
|
476
477
|
doc.name = getFieldName(doc.object,doc._name,doc.space);
|
|
@@ -322,6 +322,7 @@ let objectTriggers = {
|
|
|
322
322
|
object: doc.name,
|
|
323
323
|
owner: userId,
|
|
324
324
|
_name: "created",
|
|
325
|
+
name: "created",
|
|
325
326
|
label: "创建时间",
|
|
326
327
|
space: doc.space,
|
|
327
328
|
type: "datetime",
|
|
@@ -335,6 +336,7 @@ let objectTriggers = {
|
|
|
335
336
|
object: doc.name,
|
|
336
337
|
owner: userId,
|
|
337
338
|
_name: "created_by",
|
|
339
|
+
name: "created_by",
|
|
338
340
|
label: "创建人",
|
|
339
341
|
space: doc.space,
|
|
340
342
|
type: "lookup",
|
|
@@ -348,6 +350,7 @@ let objectTriggers = {
|
|
|
348
350
|
object: doc.name,
|
|
349
351
|
owner: userId,
|
|
350
352
|
_name: "modified",
|
|
353
|
+
name: "modified",
|
|
351
354
|
label: "修改时间",
|
|
352
355
|
space: doc.space,
|
|
353
356
|
type: "datetime",
|
|
@@ -361,9 +364,9 @@ let objectTriggers = {
|
|
|
361
364
|
object: doc.name,
|
|
362
365
|
owner: userId,
|
|
363
366
|
_name: "modified_by",
|
|
367
|
+
name: "modified_by",
|
|
364
368
|
label: "修改人",
|
|
365
369
|
space: doc.space,
|
|
366
|
-
space: doc.space,
|
|
367
370
|
type: "lookup",
|
|
368
371
|
reference_to: 'users',
|
|
369
372
|
group: '',
|
|
@@ -390,7 +390,13 @@ module.exports = {
|
|
|
390
390
|
const groupName = bodyItem.title;
|
|
391
391
|
_.each(bodyItem.body, (field)=>{
|
|
392
392
|
if(_.startsWith(field.type, 'sfield-')){
|
|
393
|
-
|
|
393
|
+
|
|
394
|
+
if(field.config && field.config.amis){
|
|
395
|
+
delete field.config.amis.name
|
|
396
|
+
delete field.config.amis.mode
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
fields.push(Object.assign({}, field.config, {group: groupName, sort_no, _name: field.config.name}));
|
|
394
400
|
sort_no += 50;
|
|
395
401
|
}
|
|
396
402
|
})
|
|
@@ -400,7 +406,11 @@ module.exports = {
|
|
|
400
406
|
visible_on: bodyItem.visible_on
|
|
401
407
|
})
|
|
402
408
|
}else if(_.startsWith(bodyItem.type, 'sfield-')){
|
|
403
|
-
|
|
409
|
+
if(bodyItem.config && bodyItem.config.amis){
|
|
410
|
+
delete bodyItem.config.amis.name
|
|
411
|
+
delete bodyItem.config.amis.mode
|
|
412
|
+
}
|
|
413
|
+
fields.push(Object.assign({}, bodyItem.config, {sort_no, _name: bodyItem.config.name}));
|
|
404
414
|
sort_no += 50;
|
|
405
415
|
}
|
|
406
416
|
})
|
|
@@ -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(
|
|
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 =
|
|
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.
|
|
3
|
+
"version": "2.7.10-beta.8",
|
|
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.
|
|
16
|
-
"@steedos/service-object-mixin": "2.7.10-beta.
|
|
17
|
-
"@steedos/standard-objects": "2.7.10-beta.
|
|
15
|
+
"@steedos/metadata-core": "2.7.10-beta.8",
|
|
16
|
+
"@steedos/service-object-mixin": "2.7.10-beta.8",
|
|
17
|
+
"@steedos/standard-objects": "2.7.10-beta.8",
|
|
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": "
|
|
24
|
+
"gitHead": "24923482078f878e7ffd0fda727dca0ab68f1adb"
|
|
25
25
|
}
|
package/package.service.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 1985-10-26 16:15:00
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2024-10-
|
|
5
|
+
* @LastEditTime: 2024-10-10 15:58:37
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
"use strict";
|
|
@@ -169,7 +169,7 @@ module.exports = {
|
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
const tab_items = app.tab_items || {};
|
|
172
|
-
tab_items[`object_${obj.name}`] = {
|
|
172
|
+
tab_items[`object_${obj.name.replace(/__c$/, "")}`] = {
|
|
173
173
|
group: groupId
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -273,7 +273,7 @@ module.exports = {
|
|
|
273
273
|
fullPath: "/service/api/apps/create_by_design"
|
|
274
274
|
},
|
|
275
275
|
async handler(ctx) {
|
|
276
|
-
const { code, name } = ctx.params;
|
|
276
|
+
const { code, name, icon } = ctx.params;
|
|
277
277
|
const userSession = ctx.meta.user;
|
|
278
278
|
|
|
279
279
|
if(!code || !name){
|
|
@@ -288,7 +288,7 @@ module.exports = {
|
|
|
288
288
|
mobile : true,
|
|
289
289
|
visible : true,
|
|
290
290
|
showSidebar : true,
|
|
291
|
-
icon_slds : "account",
|
|
291
|
+
icon_slds : icon || "account",
|
|
292
292
|
}, userSession);
|
|
293
293
|
}
|
|
294
294
|
},
|