@steedos/standard-object-database 2.7.10-beta.4 → 2.7.10-beta.5
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/objects/objects/buttons/design_field_layout.button.yml +2 -1
- package/main/default/objects/objects/buttons/design_fields_layout.button.yml +2 -3
- package/main/default/routes/object_fields_design.ejs +70 -2
- package/main/default/services/object_fields.service.js +20 -6
- package/package.json +5 -5
- package/package.service.js +1 -1
|
@@ -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-
|
|
5
|
+
* @LastEditTime: 2024-10-10 09:44:47
|
|
6
6
|
* @Description:
|
|
7
7
|
-->
|
|
8
8
|
<html>
|
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
<script src="/unpkg.com/axios@0.26.1/dist/axios.min.js"></script>
|
|
12
12
|
<script src="https://unpkg.steedos.cn/flowbite@2.3.0/dist/flowbite.min.js"></script>
|
|
13
13
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
14
|
+
<link href="/toast/toastr.min.css" rel="stylesheet" />
|
|
15
|
+
<script src="/jquery.min.js" ></script>
|
|
16
|
+
<script src="/toast/toastr.min.js"></script>
|
|
17
|
+
<style>
|
|
18
|
+
#toast-container.toast-bottom-center>div, #toast-container.toast-top-center>div {
|
|
19
|
+
width: 450px;
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
14
23
|
</head>
|
|
15
24
|
|
|
16
25
|
<body>
|
|
@@ -185,7 +194,7 @@
|
|
|
185
194
|
|
|
186
195
|
}
|
|
187
196
|
|
|
188
|
-
|
|
197
|
+
const result = await axios.post(
|
|
189
198
|
`${rootUrl}/service/api/object_fields/amis/design/schema?oid=${oid}`,
|
|
190
199
|
{
|
|
191
200
|
withCredentials: true,
|
|
@@ -199,6 +208,43 @@
|
|
|
199
208
|
// handle error
|
|
200
209
|
console.log(error);
|
|
201
210
|
});
|
|
211
|
+
const actionNames = ['insert', 'update', 'delete'];
|
|
212
|
+
|
|
213
|
+
toastr.options = {
|
|
214
|
+
"closeButton": true,
|
|
215
|
+
"debug": false,
|
|
216
|
+
"newestOnTop": false,
|
|
217
|
+
"progressBar": false,
|
|
218
|
+
"positionClass": "toast-top-center",
|
|
219
|
+
"preventDuplicates": false,
|
|
220
|
+
"onclick": null,
|
|
221
|
+
"showDuration": "300",
|
|
222
|
+
"hideDuration": "1000",
|
|
223
|
+
"timeOut": "5000",
|
|
224
|
+
"extendedTimeOut": "1000",
|
|
225
|
+
"showEasing": "swing",
|
|
226
|
+
"hideEasing": "linear",
|
|
227
|
+
"showMethod": "fadeIn",
|
|
228
|
+
"hideMethod": "fadeOut"
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
actionNames.forEach(function(actionName){
|
|
232
|
+
const actionData = result.data.data[actionName];
|
|
233
|
+
let actionLabel = '';
|
|
234
|
+
if(actionName === 'insert'){
|
|
235
|
+
actionLabel = '新增';
|
|
236
|
+
}else if(actionName === 'update'){
|
|
237
|
+
actionLabel = '更新';
|
|
238
|
+
}else if(actionName === 'delete'){
|
|
239
|
+
actionLabel = '删除';
|
|
240
|
+
}
|
|
241
|
+
if(actionData.error && actionData.error.length > 0){
|
|
242
|
+
actionData.error.forEach((error)=>{
|
|
243
|
+
toastr.warning(error.message, `${actionLabel}字段「${error.fieldLabel}(${error.fieldName})」失败:`);
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
return result;
|
|
202
248
|
};
|
|
203
249
|
window.addEventListener('message', function (event) {
|
|
204
250
|
const { data } = event;
|
|
@@ -208,6 +254,28 @@
|
|
|
208
254
|
onDndAccept: function(event){
|
|
209
255
|
return true;
|
|
210
256
|
},
|
|
257
|
+
beforeDelete: function(event){
|
|
258
|
+
if(event.context.schema.type.startsWith('sfield') && event.context.schema.config.is_system){
|
|
259
|
+
parent.toastr.warning('禁止删除系统字段', '', {
|
|
260
|
+
"closeButton": true,
|
|
261
|
+
"debug": false,
|
|
262
|
+
"newestOnTop": false,
|
|
263
|
+
"progressBar": false,
|
|
264
|
+
"positionClass": "toast-top-center",
|
|
265
|
+
"preventDuplicates": false,
|
|
266
|
+
"onclick": null,
|
|
267
|
+
"showDuration": "300",
|
|
268
|
+
"hideDuration": "1000",
|
|
269
|
+
"timeOut": "5000",
|
|
270
|
+
"extendedTimeOut": "1000",
|
|
271
|
+
"showEasing": "swing",
|
|
272
|
+
"hideEasing": "linear",
|
|
273
|
+
"showMethod": "fadeIn",
|
|
274
|
+
"hideMethod": "fadeOut"
|
|
275
|
+
})
|
|
276
|
+
return event.preventDefault();
|
|
277
|
+
}
|
|
278
|
+
},
|
|
211
279
|
onInit: function(){
|
|
212
280
|
// 创建一个新的 style 元素
|
|
213
281
|
var style = document.createElement('style');
|
|
@@ -315,7 +315,15 @@ module.exports = {
|
|
|
315
315
|
_.map(objectFields, (objectField)=>{
|
|
316
316
|
if(!objectField.group){
|
|
317
317
|
objectField.group = '通用'
|
|
318
|
-
}
|
|
318
|
+
};
|
|
319
|
+
delete objectField.owner;
|
|
320
|
+
delete objectField.space;
|
|
321
|
+
delete objectField.created;
|
|
322
|
+
delete objectField.modified;
|
|
323
|
+
delete objectField.created_by;
|
|
324
|
+
delete objectField.modified_by;
|
|
325
|
+
delete objectField.company_id;
|
|
326
|
+
delete objectField.company_ids;
|
|
319
327
|
})
|
|
320
328
|
|
|
321
329
|
return {
|
|
@@ -326,12 +334,13 @@ module.exports = {
|
|
|
326
334
|
data: {
|
|
327
335
|
objectName
|
|
328
336
|
},
|
|
329
|
-
className: "steedos-amis-form steedos-field-layout-page
|
|
337
|
+
className: "steedos-amis-form steedos-field-layout-page",
|
|
330
338
|
body: _.map(_.groupBy(_.orderBy(objectFields, function(o) { return o.sort_no || 100 }), 'group'), (items, groupName)=>{
|
|
331
339
|
const group = getGroup(groupName)
|
|
332
340
|
return {
|
|
333
341
|
type: 'steedos-field-group',
|
|
334
342
|
title: group.group_name,
|
|
343
|
+
collapsable: true,
|
|
335
344
|
collapsed: group.collapsed,
|
|
336
345
|
visible_on: group.visible_on,
|
|
337
346
|
body: _.map(items, (field)=>{
|
|
@@ -423,10 +432,11 @@ module.exports = {
|
|
|
423
432
|
|
|
424
433
|
// 循环需要增加的字段
|
|
425
434
|
for (const fieldName of insertFields) {
|
|
435
|
+
const newId = await object_fields._makeNewID();
|
|
436
|
+
const now = new Date();
|
|
437
|
+
const field = _.find(fields, { name: fieldName });
|
|
426
438
|
try {
|
|
427
|
-
|
|
428
|
-
const now = new Date();
|
|
429
|
-
const field = _.find(fields, { name: fieldName });
|
|
439
|
+
|
|
430
440
|
const doc = Object.assign({}, field, {
|
|
431
441
|
_id: newId,
|
|
432
442
|
owner: userSession.userId,
|
|
@@ -445,7 +455,11 @@ module.exports = {
|
|
|
445
455
|
await object_fields.directInsert(doc);
|
|
446
456
|
log.insert.success.push(fieldName);
|
|
447
457
|
} catch (e) {
|
|
448
|
-
log.insert.error.push(
|
|
458
|
+
log.insert.error.push({
|
|
459
|
+
fieldName: fieldName,
|
|
460
|
+
fieldLabel: field.label,
|
|
461
|
+
message: steedosI18n.t(e.message, null, 'zh-CN')
|
|
462
|
+
});
|
|
449
463
|
console.error(`新增字段 ${fieldName} 时出错:`, e);
|
|
450
464
|
}
|
|
451
465
|
}
|
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.5",
|
|
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.5",
|
|
16
|
+
"@steedos/service-object-mixin": "2.7.10-beta.5",
|
|
17
|
+
"@steedos/standard-objects": "2.7.10-beta.5",
|
|
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": "69c1df1a9c161c0ff640d589dbb18a40043edbb1"
|
|
25
25
|
}
|