@steedos-widgets/amis-lib 1.2.9-beta.1 → 1.2.10
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/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1223 -785
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1224 -787
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1220 -782
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +44 -1
- package/dist/types/lib/converter/amis/header.d.ts +77 -4
- package/dist/types/lib/converter/amis/index.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/export_excel.d.ts +32 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/columns.d.ts +83 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +112 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/delete.d.ts +43 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/filters.d.ts +68 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +116 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/rename.d.ts +47 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/share.d.ts +34 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/sort.d.ts +69 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +509 -0
- package/dist/types/lib/converter/amis/tpl.d.ts +1 -0
- package/dist/types/lib/converter/amis/util.d.ts +1 -1
- package/dist/types/lib/objects.d.ts +36 -2
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -408,11 +408,28 @@
|
|
|
408
408
|
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
+
/*
|
|
412
|
+
* @Author: baozhoutao@steedos.com
|
|
413
|
+
* @Date: 2022-07-20 16:29:22
|
|
414
|
+
* @LastEditors: Please set LastEditors
|
|
415
|
+
* @LastEditTime: 2023-05-18 15:22:51
|
|
416
|
+
* @Description:
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
function getContrastColor(bgColor) {
|
|
420
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
421
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
422
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
423
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
424
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
425
|
+
return brightness < 128 ? "#ffffff" : "#000000";
|
|
426
|
+
}
|
|
427
|
+
|
|
411
428
|
/*
|
|
412
429
|
* @Author: baozhoutao@steedos.com
|
|
413
430
|
* @Date: 2022-05-23 09:53:08
|
|
414
|
-
* @LastEditors:
|
|
415
|
-
* @LastEditTime: 2023-
|
|
431
|
+
* @LastEditors: Please set LastEditors
|
|
432
|
+
* @LastEditTime: 2023-05-18 16:34:39
|
|
416
433
|
* @Description:
|
|
417
434
|
*/
|
|
418
435
|
|
|
@@ -465,6 +482,21 @@
|
|
|
465
482
|
function getSelectTpl(field){
|
|
466
483
|
return `<div>\${_display.${field.name}}</div>`
|
|
467
484
|
}
|
|
485
|
+
function getSelectMap(selectOptions){
|
|
486
|
+
let map = {};
|
|
487
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
488
|
+
const optionValue = option.value + '';
|
|
489
|
+
if(option.color){
|
|
490
|
+
const background = option.color.charAt(0) === '#' ? option.color : '#'+option.color;
|
|
491
|
+
const color = getContrastColor(background);
|
|
492
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
493
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
494
|
+
}else {
|
|
495
|
+
map[optionValue] = option.label;
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
return map;
|
|
499
|
+
}
|
|
468
500
|
|
|
469
501
|
function getNameTplUrl(field, ctx){
|
|
470
502
|
if(ctx.objectName === 'cms_files'){
|
|
@@ -2264,7 +2296,7 @@
|
|
|
2264
2296
|
return listButtons;
|
|
2265
2297
|
};
|
|
2266
2298
|
|
|
2267
|
-
const getObjectRelatedListButtons =
|
|
2299
|
+
const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
2268
2300
|
// const buttons = getButtons(uiSchema, ctx);
|
|
2269
2301
|
// const relatedListButtons = _.filter(buttons, (button) => {
|
|
2270
2302
|
// if(button.objectName === 'cms_files'){
|
|
@@ -2551,6 +2583,67 @@
|
|
|
2551
2583
|
}
|
|
2552
2584
|
};
|
|
2553
2585
|
|
|
2586
|
+
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
2587
|
+
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
2588
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2589
|
+
return {
|
|
2590
|
+
"type": "button",
|
|
2591
|
+
"icon": "fa fa-angle-down",
|
|
2592
|
+
"onEvent": {
|
|
2593
|
+
"click": {
|
|
2594
|
+
"actions": [
|
|
2595
|
+
{
|
|
2596
|
+
"actionType": "drawer",
|
|
2597
|
+
"drawer": {
|
|
2598
|
+
"type": "drawer",
|
|
2599
|
+
"title": "操作",
|
|
2600
|
+
"body": [
|
|
2601
|
+
{
|
|
2602
|
+
"type": "button-group",
|
|
2603
|
+
"vertical": true,
|
|
2604
|
+
"tiled": true,
|
|
2605
|
+
"buttons": [
|
|
2606
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2607
|
+
return {
|
|
2608
|
+
type: 'steedos-object-button',
|
|
2609
|
+
name: button.name,
|
|
2610
|
+
objectName: button.objectName,
|
|
2611
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2612
|
+
className: `button_${button.name} w-full`
|
|
2613
|
+
}
|
|
2614
|
+
})
|
|
2615
|
+
],
|
|
2616
|
+
"btnLevel": "enhance",
|
|
2617
|
+
"className": "w-full",
|
|
2618
|
+
"btnClassName": "w-full",
|
|
2619
|
+
"size": "lg"
|
|
2620
|
+
}
|
|
2621
|
+
],
|
|
2622
|
+
"position": "bottom",
|
|
2623
|
+
"closeOnOutside": true,
|
|
2624
|
+
"resizable": false,
|
|
2625
|
+
"className": "buttons-drawer",
|
|
2626
|
+
"bodyClassName": "m-none p-none",
|
|
2627
|
+
"actions": []
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
]
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
}else {
|
|
2635
|
+
return ___default["default"].map(buttons, (button) => {
|
|
2636
|
+
return {
|
|
2637
|
+
type: 'steedos-object-button',
|
|
2638
|
+
name: button.name,
|
|
2639
|
+
objectName: button.objectName,
|
|
2640
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2641
|
+
className: `button_${button.name}`
|
|
2642
|
+
}
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2554
2647
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2555
2648
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2556
2649
|
return {
|
|
@@ -2719,6 +2812,7 @@
|
|
|
2719
2812
|
}
|
|
2720
2813
|
}
|
|
2721
2814
|
}
|
|
2815
|
+
filterForm.reset();
|
|
2722
2816
|
listView.handleFilterSubmit(removedValues);
|
|
2723
2817
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2724
2818
|
return n.props.type === "service";
|
|
@@ -3164,6 +3258,7 @@
|
|
|
3164
3258
|
"rightIcon": "fa fa-caret-down",
|
|
3165
3259
|
"size": "sm",
|
|
3166
3260
|
"hideCaret": true,
|
|
3261
|
+
"closeOnClick": true,
|
|
3167
3262
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
3168
3263
|
"buttons": listViewButtonOptions
|
|
3169
3264
|
}
|
|
@@ -3348,12 +3443,47 @@
|
|
|
3348
3443
|
"type": "grid",
|
|
3349
3444
|
"columns": [
|
|
3350
3445
|
{
|
|
3351
|
-
"body": {
|
|
3446
|
+
"body": [{
|
|
3447
|
+
"type": "service",
|
|
3448
|
+
"onEvent": {
|
|
3449
|
+
"@history_paths.changed": {
|
|
3450
|
+
"actions": [
|
|
3451
|
+
{
|
|
3452
|
+
"actionType": "reload"
|
|
3453
|
+
}
|
|
3454
|
+
]
|
|
3455
|
+
}
|
|
3456
|
+
},
|
|
3457
|
+
"body":[{
|
|
3458
|
+
"type": "button",
|
|
3459
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
3460
|
+
"className":"flex mr-4",
|
|
3461
|
+
"onEvent": {
|
|
3462
|
+
"click": {
|
|
3463
|
+
"actions": [
|
|
3464
|
+
{
|
|
3465
|
+
"actionType": "custom",
|
|
3466
|
+
"script": "Steedos.goBack()"
|
|
3467
|
+
}
|
|
3468
|
+
]
|
|
3469
|
+
}
|
|
3470
|
+
},
|
|
3471
|
+
"body": [
|
|
3472
|
+
{
|
|
3473
|
+
"type": "steedos-icon",
|
|
3474
|
+
"category": "utility",
|
|
3475
|
+
"name": "back",
|
|
3476
|
+
"colorVariant": "default",
|
|
3477
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
3478
|
+
}
|
|
3479
|
+
]
|
|
3480
|
+
}]
|
|
3481
|
+
},{
|
|
3352
3482
|
"type": "tpl",
|
|
3353
3483
|
"className": "block",
|
|
3354
3484
|
// "tpl": `<img class='slds-icon slds-icon_container slds-icon-standard-${standardIcon}' src='\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg'>`
|
|
3355
3485
|
"tpl":`<svg class="slds-icon slds-icon_container slds-icon-standard-${standardIcon} slds-page-header__icon" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
3356
|
-
},
|
|
3486
|
+
}],
|
|
3357
3487
|
"md": "auto",
|
|
3358
3488
|
"className": "",
|
|
3359
3489
|
"columnClassName": "flex justify-center items-center"
|
|
@@ -3440,18 +3570,9 @@
|
|
|
3440
3570
|
* @param {*} relatedObjectSchema 相关对象UISchema
|
|
3441
3571
|
* @returns amisSchema
|
|
3442
3572
|
*/
|
|
3443
|
-
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel) {
|
|
3573
|
+
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel, ctx) {
|
|
3444
3574
|
const { icon, label } = relatedObjectSchema;
|
|
3445
|
-
|
|
3446
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
3447
|
-
return {
|
|
3448
|
-
type: 'steedos-object-button',
|
|
3449
|
-
name: button.name,
|
|
3450
|
-
objectName: button.objectName,
|
|
3451
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3452
|
-
className: `button_${button.name}`
|
|
3453
|
-
}
|
|
3454
|
-
});
|
|
3575
|
+
let amisButtonsSchema = getObjectRecordDetailRelatedListButtonsSchemas(relatedObjectSchema, {formFactor: ctx.formFactor});
|
|
3455
3576
|
const reg = new RegExp('_', 'g');
|
|
3456
3577
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3457
3578
|
const recordRelatedListHeader = {
|
|
@@ -3524,83 +3645,44 @@
|
|
|
3524
3645
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
3525
3646
|
}
|
|
3526
3647
|
|
|
3527
|
-
const
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3648
|
+
const getExportExcelToolbarButtonSchema = ()=>{
|
|
3649
|
+
return {
|
|
3650
|
+
"type": "button",
|
|
3651
|
+
"icon": "fa fa-download",
|
|
3652
|
+
"align": "right",
|
|
3653
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3654
|
+
"tooltipPlacement": "bottom",
|
|
3655
|
+
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
3656
|
+
"tooltip": "导出Excel",
|
|
3657
|
+
"onEvent": {
|
|
3658
|
+
"click": {
|
|
3659
|
+
"weight": 0,
|
|
3660
|
+
"actions": [
|
|
3661
|
+
{
|
|
3662
|
+
"args": {
|
|
3663
|
+
"api": {
|
|
3664
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
3665
|
+
"method": "get",
|
|
3666
|
+
"messages": {},
|
|
3667
|
+
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
3668
|
+
"data": {
|
|
3669
|
+
"uiSchema": "${uiSchema}",
|
|
3670
|
+
"listName": "${listName}"
|
|
3671
|
+
},
|
|
3672
|
+
"headers": {
|
|
3673
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
},
|
|
3677
|
+
"actionType": "download"
|
|
3678
|
+
}
|
|
3679
|
+
]
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3543
3682
|
}
|
|
3544
|
-
];
|
|
3545
|
-
return {
|
|
3546
|
-
"type": "dropdown-button",
|
|
3547
|
-
"icon": "fa fa-table-columns",
|
|
3548
|
-
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3549
|
-
"align": "right",
|
|
3550
|
-
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
3551
|
-
"buttons": [
|
|
3552
|
-
{
|
|
3553
|
-
"label": "显示为",
|
|
3554
|
-
"children": buttons
|
|
3555
|
-
}
|
|
3556
|
-
]
|
|
3557
|
-
};
|
|
3558
3683
|
};
|
|
3559
3684
|
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
const onFieldsFilterToggleScript = `
|
|
3564
|
-
const scope = event.context.scoped;
|
|
3565
|
-
const filterForm = scope.getComponents().find(function(n){
|
|
3566
|
-
return n.props.type === "form";
|
|
3567
|
-
});
|
|
3568
|
-
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3569
|
-
return n.props.type === "service";
|
|
3570
|
-
});
|
|
3571
|
-
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3572
|
-
let resizeWindow = function(){
|
|
3573
|
-
//触发amis crud 高度重算
|
|
3574
|
-
setTimeout(()=>{
|
|
3575
|
-
window.dispatchEvent(new Event("resize"))
|
|
3576
|
-
}, 500);
|
|
3577
|
-
}
|
|
3578
|
-
let isMobile = Steedos.isMobile();
|
|
3579
|
-
if(filterService.props.data.showFieldsFilter){
|
|
3580
|
-
if(isMobile){
|
|
3581
|
-
// 手机上只能通过取消按钮来关闭搜索栏
|
|
3582
|
-
return;
|
|
3583
|
-
}
|
|
3584
|
-
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3585
|
-
direction: "down",
|
|
3586
|
-
name: "btn_filter_form_cancel"
|
|
3587
|
-
});
|
|
3588
|
-
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3589
|
-
resizeWindow();
|
|
3590
|
-
});
|
|
3591
|
-
}
|
|
3592
|
-
else{
|
|
3593
|
-
filterService.setData({showFieldsFilter: true});
|
|
3594
|
-
resizeWindow();
|
|
3595
|
-
if(isMobile){
|
|
3596
|
-
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
3597
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3598
|
-
crudService && crudService.setData({showFieldsFilter: true});
|
|
3599
|
-
}
|
|
3600
|
-
}
|
|
3601
|
-
`;
|
|
3602
|
-
|
|
3603
|
-
function getExportApiRequestAdaptorScript(){
|
|
3685
|
+
function requestAdaptor$1(){
|
|
3604
3686
|
return `
|
|
3605
3687
|
// 获取列表视图的属性
|
|
3606
3688
|
let uiSchema = api.body.uiSchema;
|
|
@@ -3654,667 +3736,1101 @@ else{
|
|
|
3654
3736
|
`
|
|
3655
3737
|
}
|
|
3656
3738
|
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
const isMobile = window.innerWidth < 768;
|
|
3660
|
-
if(isMobile){
|
|
3661
|
-
showDisplayAs = false;
|
|
3662
|
-
}
|
|
3663
|
-
if(formFactor === 'SMALL'){
|
|
3664
|
-
const onReloadScript = `
|
|
3665
|
-
const scope = event.context.scoped;
|
|
3666
|
-
var listView = scope.parent.getComponents().find(function(n){
|
|
3667
|
-
return n.props.type === "crud";
|
|
3668
|
-
});
|
|
3669
|
-
listView.handleChangePage(1);
|
|
3670
|
-
`;
|
|
3671
|
-
return [
|
|
3672
|
-
// "bulkActions",
|
|
3673
|
-
...(headerToolbarItems || []),
|
|
3674
|
-
hiddenCount ? {} :{
|
|
3675
|
-
"type": "tpl",
|
|
3676
|
-
"tpl": "${count} 个项目"
|
|
3677
|
-
},
|
|
3678
|
-
{
|
|
3679
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
3739
|
+
const getNewListviewButtonSchema = ()=>{
|
|
3740
|
+
return {
|
|
3680
3741
|
"type": "button",
|
|
3681
|
-
"
|
|
3682
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3683
|
-
"label": "",
|
|
3684
|
-
"icon": "fa fa-sync",
|
|
3685
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
3742
|
+
"label": "新建",
|
|
3686
3743
|
"onEvent": {
|
|
3687
3744
|
"click": {
|
|
3745
|
+
"weight": 0,
|
|
3688
3746
|
"actions": [
|
|
3689
3747
|
{
|
|
3690
|
-
"
|
|
3691
|
-
|
|
3748
|
+
"dialog": {
|
|
3749
|
+
"type": "dialog",
|
|
3750
|
+
"title": "新建 列表视图",
|
|
3751
|
+
"data": {
|
|
3752
|
+
"&": "$$",
|
|
3753
|
+
"all": "${uiSchema.list_views.all}",
|
|
3754
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3755
|
+
"appId": "${appId}",
|
|
3756
|
+
"global": "${global}",
|
|
3757
|
+
"targetObjectName": "${objectName}",
|
|
3758
|
+
},
|
|
3759
|
+
"body": [
|
|
3760
|
+
{
|
|
3761
|
+
"type": "steedos-object-form",
|
|
3762
|
+
"label": "对象表单",
|
|
3763
|
+
"objectApiName": "object_listviews",
|
|
3764
|
+
"recordId": "",
|
|
3765
|
+
"mode": "edit",
|
|
3766
|
+
"defaultData": {
|
|
3767
|
+
"&": "${list_view}",
|
|
3768
|
+
"name":"",
|
|
3769
|
+
"label":"",
|
|
3770
|
+
"filters":"",
|
|
3771
|
+
"shared":false
|
|
3772
|
+
},
|
|
3773
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
3774
|
+
"fields": fields$1(),
|
|
3775
|
+
"onEvent": {
|
|
3776
|
+
"submitSucc": {
|
|
3777
|
+
"weight": 0,
|
|
3778
|
+
"actions": [
|
|
3779
|
+
{
|
|
3780
|
+
"args": {
|
|
3781
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3782
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3783
|
+
"blank": false
|
|
3784
|
+
},
|
|
3785
|
+
"actionType": "url",
|
|
3786
|
+
}
|
|
3787
|
+
]
|
|
3788
|
+
}
|
|
3789
|
+
},
|
|
3790
|
+
"messages": {
|
|
3791
|
+
"success": "成功",
|
|
3792
|
+
"failed": "失败"
|
|
3793
|
+
},
|
|
3794
|
+
}
|
|
3795
|
+
],
|
|
3796
|
+
"showCloseButton": true,
|
|
3797
|
+
"showErrorMsg": true,
|
|
3798
|
+
"showLoading": true,
|
|
3799
|
+
"closeOnEsc": false,
|
|
3800
|
+
"dataMapSwitch": false,
|
|
3801
|
+
"size": "lg"
|
|
3802
|
+
},
|
|
3803
|
+
"actionType": "dialog"
|
|
3692
3804
|
}
|
|
3693
3805
|
]
|
|
3694
3806
|
}
|
|
3695
|
-
}
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
};
|
|
3810
|
+
|
|
3811
|
+
function fields$1(){
|
|
3812
|
+
return [
|
|
3813
|
+
"label",
|
|
3814
|
+
"name",
|
|
3815
|
+
"object_name",
|
|
3816
|
+
"filter_scope",
|
|
3817
|
+
"show_count",
|
|
3818
|
+
"columns.$.field",
|
|
3819
|
+
"columns.$.width",
|
|
3820
|
+
"sort.$.field_name",
|
|
3821
|
+
"sort.$.order",
|
|
3822
|
+
"filters",
|
|
3823
|
+
"mobile_columns.$.field",
|
|
3824
|
+
"searchable_fields.$.field",
|
|
3825
|
+
"is_system",
|
|
3826
|
+
"shared"
|
|
3827
|
+
]
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
function fieldsExtend$4(){
|
|
3831
|
+
return {
|
|
3832
|
+
"label": {
|
|
3833
|
+
"is_wide": true
|
|
3834
|
+
},
|
|
3835
|
+
"name": {
|
|
3836
|
+
"amis": {
|
|
3837
|
+
"hidden": true
|
|
3838
|
+
}
|
|
3839
|
+
},
|
|
3840
|
+
"object_name": {
|
|
3841
|
+
"amis": {
|
|
3842
|
+
"hidden": true
|
|
3843
|
+
}
|
|
3844
|
+
},
|
|
3845
|
+
"filter_scope": {
|
|
3846
|
+
"amis": {
|
|
3847
|
+
"hidden": true
|
|
3848
|
+
}
|
|
3849
|
+
},
|
|
3850
|
+
"columns": {
|
|
3851
|
+
"amis": {
|
|
3852
|
+
"hidden": true
|
|
3853
|
+
}
|
|
3854
|
+
},
|
|
3855
|
+
"filter_fields": {
|
|
3856
|
+
"amis": {
|
|
3857
|
+
"hidden": true
|
|
3858
|
+
}
|
|
3859
|
+
},
|
|
3860
|
+
"scrolling_mode": {
|
|
3861
|
+
"amis": {
|
|
3862
|
+
"hidden": true
|
|
3863
|
+
}
|
|
3864
|
+
},
|
|
3865
|
+
"sort": {
|
|
3866
|
+
"amis": {
|
|
3867
|
+
"hidden": true
|
|
3868
|
+
}
|
|
3869
|
+
},
|
|
3870
|
+
"show_count": {
|
|
3871
|
+
"amis": {
|
|
3872
|
+
"hidden": true
|
|
3873
|
+
}
|
|
3874
|
+
},
|
|
3875
|
+
"type": {
|
|
3876
|
+
"amis": {
|
|
3877
|
+
"hidden": true
|
|
3878
|
+
}
|
|
3879
|
+
},
|
|
3880
|
+
"shared": {
|
|
3881
|
+
"amis": {
|
|
3882
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
const getCopyListviewButtonSchema = ()=>{
|
|
3889
|
+
return {
|
|
3700
3890
|
"type": "button",
|
|
3701
|
-
"
|
|
3702
|
-
"offset": [
|
|
3703
|
-
-5,
|
|
3704
|
-
1
|
|
3705
|
-
],
|
|
3706
|
-
"size":8,
|
|
3707
|
-
"animation": true,
|
|
3708
|
-
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
3709
|
-
},
|
|
3710
|
-
"align": "right",
|
|
3711
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3891
|
+
"label": "复制",
|
|
3712
3892
|
"onEvent": {
|
|
3713
3893
|
"click": {
|
|
3894
|
+
"weight": 0,
|
|
3714
3895
|
"actions": [
|
|
3715
3896
|
{
|
|
3716
|
-
"
|
|
3717
|
-
|
|
3897
|
+
"dialog": {
|
|
3898
|
+
"type": "dialog",
|
|
3899
|
+
"title": "复制 列表视图",
|
|
3900
|
+
"data": {
|
|
3901
|
+
"&": "$$",
|
|
3902
|
+
"listName": "${listName}",
|
|
3903
|
+
"targetObjectName": "${objectName}",
|
|
3904
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3905
|
+
"appId": "${appId}",
|
|
3906
|
+
"global": "${global}"
|
|
3907
|
+
},
|
|
3908
|
+
"body": [
|
|
3909
|
+
{
|
|
3910
|
+
"type": "steedos-object-form",
|
|
3911
|
+
"label": "对象表单",
|
|
3912
|
+
"objectApiName": "object_listviews",
|
|
3913
|
+
"recordId": "",
|
|
3914
|
+
"mode": "edit",
|
|
3915
|
+
"defaultData": {
|
|
3916
|
+
"&": "${list_view}",
|
|
3917
|
+
"name":"",
|
|
3918
|
+
"label": "${list_view.label} 的副本",
|
|
3919
|
+
"shared":false
|
|
3920
|
+
},
|
|
3921
|
+
"fieldsExtend": fieldsExtend$3(),
|
|
3922
|
+
"fields": fields(),
|
|
3923
|
+
"onEvent": {
|
|
3924
|
+
"submitSucc": {
|
|
3925
|
+
"weight": 0,
|
|
3926
|
+
"actions": [
|
|
3927
|
+
{
|
|
3928
|
+
"args": {
|
|
3929
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3930
|
+
"blank": false
|
|
3931
|
+
},
|
|
3932
|
+
"actionType": "url",
|
|
3933
|
+
}
|
|
3934
|
+
]
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
],
|
|
3939
|
+
"showCloseButton": true,
|
|
3940
|
+
"showErrorMsg": true,
|
|
3941
|
+
"showLoading": true,
|
|
3942
|
+
"closeOnEsc": false,
|
|
3943
|
+
"dataMapSwitch": false,
|
|
3944
|
+
"size": "lg"
|
|
3945
|
+
},
|
|
3946
|
+
"actionType": "dialog"
|
|
3718
3947
|
}
|
|
3719
3948
|
]
|
|
3720
3949
|
}
|
|
3721
3950
|
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3951
|
+
}
|
|
3952
|
+
};
|
|
3953
|
+
|
|
3954
|
+
function fields(){
|
|
3955
|
+
return [
|
|
3956
|
+
"label",
|
|
3957
|
+
"name",
|
|
3958
|
+
"object_name",
|
|
3959
|
+
"filter_scope",
|
|
3960
|
+
"show_count",
|
|
3961
|
+
"columns.$.field",
|
|
3962
|
+
"columns.$.width",
|
|
3963
|
+
"sort.$.field_name",
|
|
3964
|
+
"sort.$.order",
|
|
3965
|
+
"filters",
|
|
3966
|
+
"mobile_columns.$.field",
|
|
3967
|
+
"searchable_fields.$.field",
|
|
3968
|
+
"is_system",
|
|
3969
|
+
"shared"
|
|
3724
3970
|
]
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
"
|
|
3741
|
-
}
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
"
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3973
|
+
function fieldsExtend$3(){
|
|
3974
|
+
return {
|
|
3975
|
+
"label": {
|
|
3976
|
+
"is_wide": true
|
|
3977
|
+
},
|
|
3978
|
+
"name": {
|
|
3979
|
+
"is_wide": true,
|
|
3980
|
+
"amis": {
|
|
3981
|
+
"hidden": true
|
|
3982
|
+
}
|
|
3983
|
+
},
|
|
3984
|
+
"object_name": {
|
|
3985
|
+
"amis": {
|
|
3986
|
+
"hidden": true
|
|
3987
|
+
}
|
|
3988
|
+
},
|
|
3989
|
+
"filter_scope": {
|
|
3990
|
+
"amis": {
|
|
3991
|
+
"hidden": true
|
|
3992
|
+
}
|
|
3993
|
+
},
|
|
3994
|
+
"columns": {
|
|
3995
|
+
"amis": {
|
|
3996
|
+
"hidden": true
|
|
3997
|
+
}
|
|
3998
|
+
},
|
|
3999
|
+
"filter_fields": {
|
|
4000
|
+
"amis": {
|
|
4001
|
+
"hidden": true
|
|
4002
|
+
}
|
|
4003
|
+
},
|
|
4004
|
+
"scrolling_mode": {
|
|
4005
|
+
"amis": {
|
|
4006
|
+
"hidden": true
|
|
4007
|
+
}
|
|
4008
|
+
},
|
|
4009
|
+
"sort": {
|
|
4010
|
+
"amis": {
|
|
4011
|
+
"hidden": true
|
|
4012
|
+
}
|
|
4013
|
+
},
|
|
4014
|
+
"show_count": {
|
|
4015
|
+
"amis": {
|
|
4016
|
+
"hidden": true
|
|
4017
|
+
}
|
|
4018
|
+
},
|
|
4019
|
+
"type": {
|
|
4020
|
+
"amis": {
|
|
4021
|
+
"hidden": true
|
|
4022
|
+
}
|
|
4023
|
+
},
|
|
4024
|
+
"shared": {
|
|
4025
|
+
"amis": {
|
|
4026
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
const getRenameListviewButtonSchema = ()=>{
|
|
4033
|
+
return {
|
|
3749
4034
|
"type": "button",
|
|
3750
|
-
"label": "",
|
|
3751
|
-
"
|
|
3752
|
-
"align": "right",
|
|
3753
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3754
|
-
"tooltipPlacement": "bottom",
|
|
3755
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
3756
|
-
"tooltip": "导出Excel",
|
|
4035
|
+
"label": "重命名",
|
|
4036
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3757
4037
|
"onEvent": {
|
|
3758
4038
|
"click": {
|
|
3759
4039
|
"weight": 0,
|
|
3760
4040
|
"actions": [
|
|
3761
4041
|
{
|
|
3762
|
-
"
|
|
3763
|
-
"
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
"
|
|
3767
|
-
"
|
|
3768
|
-
"
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
"
|
|
4042
|
+
"dialog": {
|
|
4043
|
+
"type": "dialog",
|
|
4044
|
+
"title": "重命名 列表视图",
|
|
4045
|
+
"data": {
|
|
4046
|
+
"targetObjectName": "${objectName}",
|
|
4047
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4048
|
+
"appId": "${appId}"
|
|
4049
|
+
},
|
|
4050
|
+
"body": [
|
|
4051
|
+
{
|
|
4052
|
+
"type": "steedos-object-form",
|
|
4053
|
+
"label": "对象表单",
|
|
4054
|
+
"objectApiName": "object_listviews",
|
|
4055
|
+
"recordId": "${recordId}",
|
|
4056
|
+
"mode": "edit",
|
|
4057
|
+
"fields": [
|
|
4058
|
+
"label"
|
|
4059
|
+
],
|
|
4060
|
+
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4061
|
+
"onEvent": {
|
|
4062
|
+
"submitSucc": {
|
|
4063
|
+
"weight": 0,
|
|
4064
|
+
"actions": [
|
|
4065
|
+
{
|
|
4066
|
+
"args": {
|
|
4067
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4068
|
+
"blank": false
|
|
4069
|
+
},
|
|
4070
|
+
"actionType": "url",
|
|
4071
|
+
},
|
|
4072
|
+
]
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
3774
4075
|
}
|
|
3775
|
-
|
|
4076
|
+
],
|
|
4077
|
+
"showCloseButton": true,
|
|
4078
|
+
"showErrorMsg": true,
|
|
4079
|
+
"showLoading": true,
|
|
4080
|
+
"size": "lg"
|
|
3776
4081
|
},
|
|
3777
|
-
"actionType": "
|
|
4082
|
+
"actionType": "dialog"
|
|
3778
4083
|
}
|
|
3779
4084
|
]
|
|
3780
4085
|
}
|
|
3781
4086
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
4087
|
+
}
|
|
4088
|
+
};
|
|
4089
|
+
|
|
4090
|
+
const getSetListviewShareButtonSchema = ()=>{
|
|
4091
|
+
return {
|
|
3786
4092
|
"type": "button",
|
|
3787
|
-
"
|
|
3788
|
-
"
|
|
4093
|
+
"label": "共享设置",
|
|
4094
|
+
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
3789
4095
|
"onEvent": {
|
|
3790
4096
|
"click": {
|
|
4097
|
+
"weight": 0,
|
|
3791
4098
|
"actions": [
|
|
3792
4099
|
{
|
|
3793
|
-
"
|
|
3794
|
-
|
|
4100
|
+
"dialog": {
|
|
4101
|
+
"type": "dialog",
|
|
4102
|
+
"title": "共享设置",
|
|
4103
|
+
"data": {
|
|
4104
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4105
|
+
},
|
|
4106
|
+
"body": [
|
|
4107
|
+
{
|
|
4108
|
+
"type": "steedos-object-form",
|
|
4109
|
+
"label": "对象表单",
|
|
4110
|
+
"objectApiName": "object_listviews",
|
|
4111
|
+
"recordId": "${recordId}",
|
|
4112
|
+
"mode": "edit",
|
|
4113
|
+
"fields": [
|
|
4114
|
+
"shared"
|
|
4115
|
+
]
|
|
4116
|
+
}
|
|
4117
|
+
],
|
|
4118
|
+
"showCloseButton": true,
|
|
4119
|
+
"showErrorMsg": true,
|
|
4120
|
+
"showLoading": true,
|
|
4121
|
+
"closeOnEsc": false,
|
|
4122
|
+
"dataMapSwitch": false,
|
|
4123
|
+
"size": "md"
|
|
4124
|
+
},
|
|
4125
|
+
"actionType": "dialog"
|
|
3795
4126
|
}
|
|
3796
4127
|
]
|
|
3797
4128
|
}
|
|
3798
4129
|
}
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
"
|
|
3805
|
-
"
|
|
3806
|
-
"
|
|
3807
|
-
"
|
|
3808
|
-
{
|
|
3809
|
-
"
|
|
3810
|
-
"
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
|
|
4133
|
+
const getSetListviewFiltersButtonSchema = ()=>{
|
|
4134
|
+
return {
|
|
4135
|
+
"type": "button",
|
|
4136
|
+
"label": "过滤设置",
|
|
4137
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4138
|
+
"onEvent": {
|
|
4139
|
+
"click": {
|
|
4140
|
+
"weight": 0,
|
|
4141
|
+
"actions": [
|
|
3811
4142
|
{
|
|
3812
|
-
"
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
"
|
|
3816
|
-
"
|
|
3817
|
-
"
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
4143
|
+
"dialog": {
|
|
4144
|
+
"type": "dialog",
|
|
4145
|
+
"title": "过滤设置",
|
|
4146
|
+
"data": {
|
|
4147
|
+
"targetObjectName": "${objectName}",
|
|
4148
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4149
|
+
"listName": "${listName}",
|
|
4150
|
+
"appId": "${appId}"
|
|
4151
|
+
},
|
|
4152
|
+
"body": [
|
|
4153
|
+
{
|
|
4154
|
+
"type": "steedos-object-form",
|
|
4155
|
+
"label": "对象表单",
|
|
4156
|
+
"objectApiName": "object_listviews",
|
|
4157
|
+
"recordId": "${recordId}",
|
|
4158
|
+
"mode": "edit",
|
|
4159
|
+
"fields": [
|
|
4160
|
+
"filters"
|
|
4161
|
+
],
|
|
4162
|
+
"initApiAdaptor": initApiAdaptor$2(),
|
|
4163
|
+
"apiRequestAdaptor": apiRequestAdaptor$2(),
|
|
4164
|
+
"fieldsExtend": fieldsExtend$2(),
|
|
4165
|
+
"onEvent": {
|
|
4166
|
+
"submitSucc": {
|
|
4167
|
+
"weight": 0,
|
|
4168
|
+
"actions": [
|
|
3831
4169
|
{
|
|
3832
|
-
"
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
"recordId": "",
|
|
3836
|
-
"mode": "edit",
|
|
3837
|
-
"defaultData": {
|
|
3838
|
-
"&": "${list_view}",
|
|
3839
|
-
"name":"",
|
|
3840
|
-
"label":"",
|
|
3841
|
-
"filters":"",
|
|
3842
|
-
"shared":false
|
|
3843
|
-
},
|
|
3844
|
-
"fieldsExtend": "{\n \"label\": {\n \"is_wide\": true\n },\n \"name\": {\n \"is_wide\": true,\n \"amis\": {\n \"hidden\": true\n }\n },\n \"object_name\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_scope\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"columns\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"filter_fields\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"scrolling_mode\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"sort\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"show_count\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"type\": {\n \"amis\": {\n \"hidden\": true\n }\n },\n \"shared\":{\n \"amis\":{\n \"visibleOn\":\"${global.user.is_space_admin}\"\n }\n}\n}",
|
|
3845
|
-
"fields": [
|
|
3846
|
-
"label",
|
|
3847
|
-
"name",
|
|
3848
|
-
"object_name",
|
|
3849
|
-
"filter_scope",
|
|
3850
|
-
"show_count",
|
|
3851
|
-
"columns.$.field",
|
|
3852
|
-
"columns.$.width",
|
|
3853
|
-
"sort.$.field_name",
|
|
3854
|
-
"sort.$.order",
|
|
3855
|
-
"filters",
|
|
3856
|
-
"mobile_columns.$.field",
|
|
3857
|
-
"searchable_fields.$.field",
|
|
3858
|
-
"is_system",
|
|
3859
|
-
"shared"
|
|
3860
|
-
],
|
|
3861
|
-
"onEvent": {
|
|
3862
|
-
"submitSucc": {
|
|
3863
|
-
"weight": 0,
|
|
3864
|
-
"actions": [
|
|
3865
|
-
{
|
|
3866
|
-
"args": {
|
|
3867
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3868
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3869
|
-
"blank": false
|
|
3870
|
-
},
|
|
3871
|
-
"actionType": "url",
|
|
3872
|
-
}
|
|
3873
|
-
]
|
|
3874
|
-
}
|
|
3875
|
-
},
|
|
3876
|
-
"messages": {
|
|
3877
|
-
"success": "成功",
|
|
3878
|
-
"failed": "失败"
|
|
4170
|
+
"args": {
|
|
4171
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4172
|
+
"blank": false
|
|
3879
4173
|
},
|
|
4174
|
+
"actionType": "url",
|
|
3880
4175
|
}
|
|
3881
|
-
]
|
|
3882
|
-
|
|
3883
|
-
"showErrorMsg": true,
|
|
3884
|
-
"showLoading": true,
|
|
3885
|
-
"closeOnEsc": false,
|
|
3886
|
-
"dataMapSwitch": false,
|
|
3887
|
-
"size": "lg"
|
|
3888
|
-
},
|
|
3889
|
-
"actionType": "dialog"
|
|
4176
|
+
]
|
|
4177
|
+
}
|
|
3890
4178
|
}
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
"label"
|
|
4001
|
-
],
|
|
4002
|
-
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4003
|
-
"onEvent": {
|
|
4004
|
-
"submitSucc": {
|
|
4005
|
-
"weight": 0,
|
|
4006
|
-
"actions": [
|
|
4007
|
-
{
|
|
4008
|
-
"args": {
|
|
4009
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4010
|
-
"blank": false
|
|
4011
|
-
},
|
|
4012
|
-
"actionType": "url",
|
|
4013
|
-
},
|
|
4014
|
-
]
|
|
4015
|
-
}
|
|
4016
|
-
}
|
|
4017
|
-
}
|
|
4018
|
-
],
|
|
4019
|
-
"showCloseButton": true,
|
|
4020
|
-
"showErrorMsg": true,
|
|
4021
|
-
"showLoading": true,
|
|
4022
|
-
"size": "lg"
|
|
4023
|
-
},
|
|
4024
|
-
"actionType": "dialog"
|
|
4025
|
-
}
|
|
4026
|
-
]
|
|
4027
|
-
}
|
|
4028
|
-
}
|
|
4029
|
-
},
|
|
4030
|
-
{
|
|
4031
|
-
"type": "button",
|
|
4032
|
-
"label": "共享设置",
|
|
4033
|
-
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
4034
|
-
"onEvent": {
|
|
4035
|
-
"click": {
|
|
4036
|
-
"weight": 0,
|
|
4037
|
-
"actions": [
|
|
4038
|
-
{
|
|
4039
|
-
"dialog": {
|
|
4040
|
-
"type": "dialog",
|
|
4041
|
-
"title": "共享设置",
|
|
4042
|
-
"data": {
|
|
4043
|
-
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4044
|
-
},
|
|
4045
|
-
"body": [
|
|
4046
|
-
{
|
|
4047
|
-
"type": "steedos-object-form",
|
|
4048
|
-
"label": "对象表单",
|
|
4049
|
-
"objectApiName": "object_listviews",
|
|
4050
|
-
"recordId": "${recordId}",
|
|
4051
|
-
"mode": "edit",
|
|
4052
|
-
"fields": [
|
|
4053
|
-
"shared"
|
|
4054
|
-
]
|
|
4055
|
-
}
|
|
4056
|
-
],
|
|
4057
|
-
"showCloseButton": true,
|
|
4058
|
-
"showErrorMsg": true,
|
|
4059
|
-
"showLoading": true,
|
|
4060
|
-
"closeOnEsc": false,
|
|
4061
|
-
"dataMapSwitch": false,
|
|
4062
|
-
"size": "md"
|
|
4063
|
-
},
|
|
4064
|
-
"actionType": "dialog"
|
|
4065
|
-
}
|
|
4066
|
-
]
|
|
4067
|
-
}
|
|
4068
|
-
}
|
|
4069
|
-
},
|
|
4070
|
-
{
|
|
4071
|
-
"type": "button",
|
|
4072
|
-
"label": "过滤设置",
|
|
4073
|
-
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4074
|
-
"onEvent": {
|
|
4075
|
-
"click": {
|
|
4076
|
-
"weight": 0,
|
|
4077
|
-
"actions": [
|
|
4078
|
-
{
|
|
4079
|
-
"dialog": {
|
|
4080
|
-
"type": "dialog",
|
|
4081
|
-
"title": "过滤设置",
|
|
4082
|
-
"data": {
|
|
4083
|
-
"targetObjectName": "${objectName}",
|
|
4084
|
-
"objectName": "${objectName}",
|
|
4085
|
-
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4086
|
-
"listName": "${listName}",
|
|
4087
|
-
"appId": "${appId}"
|
|
4088
|
-
},
|
|
4089
|
-
"body": [
|
|
4090
|
-
{
|
|
4091
|
-
"type": "steedos-object-form",
|
|
4092
|
-
"label": "对象表单",
|
|
4093
|
-
"objectApiName": "object_listviews",
|
|
4094
|
-
"recordId": "${recordId}",
|
|
4095
|
-
"mode": "edit",
|
|
4096
|
-
"fields": [
|
|
4097
|
-
"filters"
|
|
4098
|
-
],
|
|
4099
|
-
"initApiRequestAdaptor": "",
|
|
4100
|
-
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet data_tmp;\nif (recordId_tmp) {\n data_tmp = payload.data;\n // 数据格式转换\n if (data_tmp) {\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n try {\n data_tmp.filters = JSON.parse(data_tmp.filters);\n } catch (e) { }\n }\n\n if (data_tmp.filters && lodash.isString(data_tmp.filters)) {\n data_tmp._filters_type_controller = 'function';\n } else {\n data_tmp._filters_type_controller = 'conditions'\n }\n\n if (data_tmp._filters_type_controller === 'conditions') {\n data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);\n data_tmp.filters = data_tmp._filters_conditions;\n } else {\n data_tmp._filters_function = data_tmp.filters;\n }\n }\n}\nfor (key in data_tmp) {\n if (data_tmp[key] === null) {\n delete data_tmp[key];\n }\n}\npayload.data = Object.assign(payload.data, data_tmp);\ndelete payload.extensions;",
|
|
4101
|
-
"apiRequestAdaptor": "const recordId = api.body.recordId;\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData.filters);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n// 字符串拼接(不支持ES6``语法)\nquery = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';\nif (api.body.recordId) {\n query = 'mutation{record: ' + objectName + '__update(id: \"' + recordId + '\", doc: {__saveData}){_id}}';\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\napi.data = { query: query.replace('{__saveData}', __saveData) };\n",
|
|
4102
|
-
"fieldsExtend": "{\"filters\": {\n \"visible_on\": \"true\",\n \"amis\": {\n \"type\": \"condition-builder\",\n \"label\": \"条件组件\",\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${objectName}\",\n \"dataType\": \"json\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
4103
|
-
"onEvent": {
|
|
4104
|
-
"submitSucc": {
|
|
4105
|
-
"weight": 0,
|
|
4106
|
-
"actions": [
|
|
4107
|
-
{
|
|
4108
|
-
"args": {
|
|
4109
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4110
|
-
"blank": false
|
|
4111
|
-
},
|
|
4112
|
-
"actionType": "url",
|
|
4113
|
-
}
|
|
4114
|
-
]
|
|
4115
|
-
}
|
|
4116
|
-
}
|
|
4117
|
-
}
|
|
4118
|
-
],
|
|
4119
|
-
"showCloseButton": true,
|
|
4120
|
-
"showErrorMsg": true,
|
|
4121
|
-
"showLoading": true,
|
|
4122
|
-
"closeOnEsc": false,
|
|
4123
|
-
"dataMapSwitch": false,
|
|
4124
|
-
"size": "lg"
|
|
4125
|
-
},
|
|
4126
|
-
"actionType": "dialog"
|
|
4127
|
-
}
|
|
4128
|
-
]
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
4131
|
-
},
|
|
4179
|
+
}
|
|
4180
|
+
],
|
|
4181
|
+
"showCloseButton": true,
|
|
4182
|
+
"showErrorMsg": true,
|
|
4183
|
+
"showLoading": true,
|
|
4184
|
+
"closeOnEsc": false,
|
|
4185
|
+
"dataMapSwitch": false,
|
|
4186
|
+
"size": "lg"
|
|
4187
|
+
},
|
|
4188
|
+
"actionType": "dialog"
|
|
4189
|
+
}
|
|
4190
|
+
]
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
|
|
4197
|
+
function initApiAdaptor$2(){
|
|
4198
|
+
return `
|
|
4199
|
+
const recordId_tmp = api.body.recordId;
|
|
4200
|
+
let data_tmp;
|
|
4201
|
+
if (recordId_tmp) {
|
|
4202
|
+
data_tmp = payload.data;
|
|
4203
|
+
// 数据格式转换
|
|
4204
|
+
if (data_tmp) {
|
|
4205
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4206
|
+
try {
|
|
4207
|
+
data_tmp.filters = JSON.parse(data_tmp.filters);
|
|
4208
|
+
} catch (e) { }
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4212
|
+
data_tmp._filters_type_controller = 'function';
|
|
4213
|
+
} else {
|
|
4214
|
+
data_tmp._filters_type_controller = 'conditions'
|
|
4215
|
+
}
|
|
4216
|
+
|
|
4217
|
+
if (data_tmp._filters_type_controller === 'conditions') {
|
|
4218
|
+
data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);
|
|
4219
|
+
data_tmp.filters = data_tmp._filters_conditions;
|
|
4220
|
+
} else {
|
|
4221
|
+
data_tmp._filters_function = data_tmp.filters;
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
for (key in data_tmp) {
|
|
4226
|
+
if (data_tmp[key] === null) {
|
|
4227
|
+
delete data_tmp[key];
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
payload.data = Object.assign(payload.data, data_tmp);
|
|
4231
|
+
delete payload.extensions;
|
|
4232
|
+
return payload;
|
|
4233
|
+
`
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
function apiRequestAdaptor$2(){
|
|
4237
|
+
return `
|
|
4238
|
+
const recordId = api.body.recordId;
|
|
4239
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
4240
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData.filters);
|
|
4241
|
+
} else {
|
|
4242
|
+
formData.filters = formData._filters_function || null;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
delete formData._filters_type_controller;
|
|
4246
|
+
delete formData._filters_conditions;
|
|
4247
|
+
delete formData._filters_function;
|
|
4248
|
+
|
|
4249
|
+
query = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';
|
|
4250
|
+
if (api.body.recordId) {
|
|
4251
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4252
|
+
};
|
|
4253
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4254
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4255
|
+
return api;
|
|
4256
|
+
`
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
function fieldsExtend$2(){
|
|
4260
|
+
return {
|
|
4261
|
+
"filters": {
|
|
4262
|
+
"visible_on": "true",
|
|
4263
|
+
"amis": {
|
|
4264
|
+
"type": "condition-builder",
|
|
4265
|
+
"label": "条件组件1",
|
|
4266
|
+
"source": {
|
|
4267
|
+
"method": "get",
|
|
4268
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
|
|
4269
|
+
"dataType": "json",
|
|
4270
|
+
"headers": {
|
|
4271
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4279
|
+
const getSetListviewColumnsButtonSchema = ()=>{
|
|
4280
|
+
return {
|
|
4281
|
+
"type": "button",
|
|
4282
|
+
"label": "显示的列",
|
|
4283
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4284
|
+
"onEvent": {
|
|
4285
|
+
"click": {
|
|
4286
|
+
"weight": 0,
|
|
4287
|
+
"actions": [
|
|
4132
4288
|
{
|
|
4133
|
-
"
|
|
4134
|
-
"
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
"
|
|
4138
|
-
"
|
|
4139
|
-
"
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4289
|
+
"args": {},
|
|
4290
|
+
"dialog": {
|
|
4291
|
+
"type": "dialog",
|
|
4292
|
+
"title": "显示的列",
|
|
4293
|
+
"data": {
|
|
4294
|
+
"&": "$$",
|
|
4295
|
+
"targetObjectName": "${objectName}",
|
|
4296
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4297
|
+
"listName": "${listName}",
|
|
4298
|
+
"appId": "${appId}"
|
|
4299
|
+
},
|
|
4300
|
+
"body": [
|
|
4301
|
+
{
|
|
4302
|
+
"type": "steedos-object-form",
|
|
4303
|
+
"label": "对象表单",
|
|
4304
|
+
"objectApiName": "object_listviews",
|
|
4305
|
+
"recordId": "${recordId}",
|
|
4306
|
+
"mode": "edit",
|
|
4307
|
+
"fieldsExtend": fieldsExtend$1(),
|
|
4308
|
+
"initApiAdaptor": initApiAdaptor$1(),
|
|
4309
|
+
"apiRequestAdaptor": apiRequestAdaptor$1(),
|
|
4310
|
+
"fields": [
|
|
4311
|
+
"columns",
|
|
4312
|
+
"mobile_columns"
|
|
4313
|
+
],
|
|
4314
|
+
"onEvent": {
|
|
4315
|
+
"submitSucc": {
|
|
4316
|
+
"weight": 0,
|
|
4317
|
+
"actions": [
|
|
4154
4318
|
{
|
|
4155
|
-
"
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
"
|
|
4160
|
-
"fieldsExtend": "{\n \"columns\": {\n \"amis\": {\n \"type\": \"transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/fields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n },\n \"mobile_columns\": {\n \"group\": \"手机端\",\n \"amis\": {\n \"type\": \"transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/fields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
4161
|
-
"initApiAdaptor": "const recordId_tmp = api.body.recordId;\nlet columns_tmp = {}, mobile_columns_tmp = {};\nif (recordId_tmp) {\n columns_tmp = payload.data.columns;\n mobile_columns_tmp = payload.data.mobile_columns;\n if (columns_tmp) {\n columns_tmp = lodash.map(columns_tmp, 'field');\n }\n if (mobile_columns_tmp) {\n mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');\n }\n}\npayload.data.columns = columns_tmp;\npayload.data.mobile_columns = mobile_columns_tmp;\n\ndelete payload.extensions;\nreturn payload;",
|
|
4162
|
-
"apiRequestAdaptor": "const formData_tmp = api.body.$;\nconst objectName_tmp = api.body.objectName;\nconst recordId_tmp = api.body.recordId;\n\nif (typeof formData_tmp.columns == 'string') {\n formData_tmp.columns = formData_tmp.columns?.split(',');\n}\nif (typeof formData_tmp.mobile_columns == 'string') {\n formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');\n}\n\n// 数据格式转换\nformData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {\n return { field: item };\n});\nformData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {\n return { field: item };\n});\n\n// 字符串拼接(不支持ES6语法)\nlet query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';\nif (api.body.recordId) {\n query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: \"' + recordId_tmp +'\", doc: {__saveData}){_id}}';\n};\ndelete formData_tmp._id;\nlet __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));\napi.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };\n\nreturn api;",
|
|
4163
|
-
"fields": [
|
|
4164
|
-
"columns",
|
|
4165
|
-
"mobile_columns"
|
|
4166
|
-
],
|
|
4167
|
-
"onEvent": {
|
|
4168
|
-
"submitSucc": {
|
|
4169
|
-
"weight": 0,
|
|
4170
|
-
"actions": [
|
|
4171
|
-
{
|
|
4172
|
-
"args": {
|
|
4173
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4174
|
-
"blank": false
|
|
4175
|
-
},
|
|
4176
|
-
"actionType": "url"
|
|
4177
|
-
}
|
|
4178
|
-
]
|
|
4179
|
-
}
|
|
4180
|
-
}
|
|
4319
|
+
"args": {
|
|
4320
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4321
|
+
"blank": false
|
|
4322
|
+
},
|
|
4323
|
+
"actionType": "url"
|
|
4181
4324
|
}
|
|
4182
|
-
]
|
|
4183
|
-
|
|
4184
|
-
"showCloseButton": true,
|
|
4185
|
-
"showErrorMsg": true,
|
|
4186
|
-
"showLoading": true,
|
|
4187
|
-
"size": "lg"
|
|
4188
|
-
},
|
|
4189
|
-
"actionType": "dialog"
|
|
4325
|
+
]
|
|
4326
|
+
}
|
|
4190
4327
|
}
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4328
|
+
}
|
|
4329
|
+
],
|
|
4330
|
+
"searchable": true,
|
|
4331
|
+
"showCloseButton": true,
|
|
4332
|
+
"showErrorMsg": true,
|
|
4333
|
+
"showLoading": true,
|
|
4334
|
+
"size": "lg"
|
|
4335
|
+
},
|
|
4336
|
+
"actionType": "dialog"
|
|
4337
|
+
}
|
|
4338
|
+
]
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
};
|
|
4343
|
+
|
|
4344
|
+
function fieldsExtend$1(){
|
|
4345
|
+
return {
|
|
4346
|
+
"columns": {
|
|
4347
|
+
"amis": {
|
|
4348
|
+
"type": "transfer",
|
|
4349
|
+
"sortable": true,
|
|
4350
|
+
"searchable": true,
|
|
4351
|
+
"source": {
|
|
4352
|
+
"method": "get",
|
|
4353
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4354
|
+
"headers": {
|
|
4355
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
},
|
|
4360
|
+
"mobile_columns": {
|
|
4361
|
+
"group": "手机端",
|
|
4362
|
+
"amis": {
|
|
4363
|
+
"type": "transfer",
|
|
4364
|
+
"sortable": true,
|
|
4365
|
+
"searchable": true,
|
|
4366
|
+
"source": {
|
|
4367
|
+
"method": "get",
|
|
4368
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4369
|
+
"headers": {
|
|
4370
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
}
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4378
|
+
function initApiAdaptor$1(){
|
|
4379
|
+
return `
|
|
4380
|
+
const recordId_tmp = api.body.recordId;
|
|
4381
|
+
let columns_tmp = {}, mobile_columns_tmp = {};
|
|
4382
|
+
if (recordId_tmp) {
|
|
4383
|
+
columns_tmp = payload.data.columns;
|
|
4384
|
+
mobile_columns_tmp = payload.data.mobile_columns;
|
|
4385
|
+
if (columns_tmp) {
|
|
4386
|
+
columns_tmp = lodash.map(columns_tmp, 'field');
|
|
4387
|
+
}
|
|
4388
|
+
if (mobile_columns_tmp) {
|
|
4389
|
+
mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
payload.data.columns = columns_tmp;
|
|
4393
|
+
payload.data.mobile_columns = mobile_columns_tmp;
|
|
4394
|
+
|
|
4395
|
+
delete payload.extensions;
|
|
4396
|
+
return payload;
|
|
4397
|
+
`
|
|
4398
|
+
}
|
|
4399
|
+
|
|
4400
|
+
function apiRequestAdaptor$1(){
|
|
4401
|
+
return `
|
|
4402
|
+
const formData_tmp = api.body.$;
|
|
4403
|
+
const objectName_tmp = api.body.objectName;
|
|
4404
|
+
const recordId_tmp = api.body.recordId;
|
|
4405
|
+
|
|
4406
|
+
if (typeof formData_tmp.columns == 'string') {
|
|
4407
|
+
formData_tmp.columns = formData_tmp.columns?.split(',');
|
|
4408
|
+
}
|
|
4409
|
+
if (typeof formData_tmp.mobile_columns == 'string') {
|
|
4410
|
+
formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
// 数据格式转换
|
|
4414
|
+
formData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {
|
|
4415
|
+
return { field: item };
|
|
4416
|
+
});
|
|
4417
|
+
formData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {
|
|
4418
|
+
return { field: item };
|
|
4419
|
+
});
|
|
4420
|
+
|
|
4421
|
+
let query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';
|
|
4422
|
+
if (api.body.recordId) {
|
|
4423
|
+
query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: "' + recordId_tmp +'", doc: {__saveData}){_id}}';
|
|
4424
|
+
};
|
|
4425
|
+
delete formData_tmp._id;
|
|
4426
|
+
let __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));
|
|
4427
|
+
api.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };
|
|
4428
|
+
|
|
4429
|
+
return api;
|
|
4430
|
+
`
|
|
4431
|
+
}
|
|
4432
|
+
|
|
4433
|
+
const getSetListviewSortButtonSchema = ()=>{
|
|
4434
|
+
return {
|
|
4435
|
+
"type": "button",
|
|
4436
|
+
"label": "默认排序规则",
|
|
4437
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4438
|
+
"onEvent": {
|
|
4439
|
+
"click": {
|
|
4440
|
+
"weight": 0,
|
|
4441
|
+
"actions": [
|
|
4195
4442
|
{
|
|
4196
|
-
"
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
"
|
|
4202
|
-
"
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4443
|
+
"dialog": {
|
|
4444
|
+
"type": "dialog",
|
|
4445
|
+
"title": "默认排序规则",
|
|
4446
|
+
"data": {
|
|
4447
|
+
"&": "$$",
|
|
4448
|
+
"targetObjectName": "${objectName}",
|
|
4449
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4450
|
+
"listName": "${listName}",
|
|
4451
|
+
"appId": "${appId}"
|
|
4452
|
+
},
|
|
4453
|
+
"body": [
|
|
4454
|
+
{
|
|
4455
|
+
"type": "steedos-object-form",
|
|
4456
|
+
"label": "对象表单",
|
|
4457
|
+
"objectApiName": "object_listviews",
|
|
4458
|
+
"recordId": "${recordId}",
|
|
4459
|
+
"className": "",
|
|
4460
|
+
"id": "u:061f158b4c5a",
|
|
4461
|
+
"mode": "edit",
|
|
4462
|
+
"fields": [
|
|
4463
|
+
"sort",
|
|
4464
|
+
"sort.$.field_name",
|
|
4465
|
+
"sort.$.order"
|
|
4466
|
+
],
|
|
4467
|
+
"onEvent": {
|
|
4468
|
+
"submitSucc": {
|
|
4469
|
+
"weight": 0,
|
|
4470
|
+
"actions": [
|
|
4216
4471
|
{
|
|
4217
|
-
"
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
"recordId": "${recordId}",
|
|
4221
|
-
"className": "",
|
|
4222
|
-
"id": "u:061f158b4c5a",
|
|
4223
|
-
"mode": "edit",
|
|
4224
|
-
"fields": [
|
|
4225
|
-
"sort",
|
|
4226
|
-
"sort.$.field_name",
|
|
4227
|
-
"sort.$.order"
|
|
4228
|
-
],
|
|
4229
|
-
"onEvent": {
|
|
4230
|
-
"submitSucc": {
|
|
4231
|
-
"weight": 0,
|
|
4232
|
-
"actions": [
|
|
4233
|
-
{
|
|
4234
|
-
"args": {
|
|
4235
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4236
|
-
"blank": false
|
|
4237
|
-
},
|
|
4238
|
-
"actionType": "url"
|
|
4239
|
-
}
|
|
4240
|
-
]
|
|
4241
|
-
}
|
|
4472
|
+
"args": {
|
|
4473
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4474
|
+
"blank": false
|
|
4242
4475
|
},
|
|
4243
|
-
"
|
|
4244
|
-
"initApiAdaptor": "let sort;\nif (recordId) {\n sort = payload.data.sort;\n //数据格式转换\n if (sort instanceof Array) {\n sort = lodash.map(sort, (item) => {\n return item.field_name + ':' + (item.order || 'asc')\n });\n }\n}\npayload.data.sort = sort;\ndelete payload.extensions;",
|
|
4245
|
-
"apiRequestAdaptor": "const recordId = api.body.recordId;\n//数据格式转换\nif (typeof formData.sort == 'string') {\n formData.sort = formData.sort?.split(',');\n}\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\nif (recordId) {\n query = 'mutation{record: ' + objectName + '__update(id: \"' + recordId + '\", doc: {__saveData}){_id}}';\n}\n__saveData = JSON.stringify(JSON.stringify(formData));\napi.data = { query: query.replace('{__saveData}', __saveData) };\n"
|
|
4476
|
+
"actionType": "url"
|
|
4246
4477
|
}
|
|
4247
|
-
]
|
|
4248
|
-
"showCloseButton": true,
|
|
4249
|
-
"showErrorMsg": true,
|
|
4250
|
-
"showLoading": true,
|
|
4251
|
-
"id": "u:d3f6947b6acf",
|
|
4252
|
-
"size": "lg"
|
|
4253
|
-
},
|
|
4254
|
-
"actionType": "dialog"
|
|
4255
|
-
}
|
|
4256
|
-
]
|
|
4257
|
-
}
|
|
4258
|
-
}
|
|
4259
|
-
},
|
|
4260
|
-
{
|
|
4261
|
-
"type": "button",
|
|
4262
|
-
"label": "删除",
|
|
4263
|
-
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4264
|
-
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4265
|
-
"onEvent": {
|
|
4266
|
-
"click": {
|
|
4267
|
-
"actions": [
|
|
4268
|
-
{
|
|
4269
|
-
"actionType": "ajax",
|
|
4270
|
-
"args": {
|
|
4271
|
-
"api": {
|
|
4272
|
-
"url": "${context.rootUrl}/graphql",
|
|
4273
|
-
"method": "post",
|
|
4274
|
-
"headers": {
|
|
4275
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4276
|
-
},
|
|
4277
|
-
"data": {
|
|
4278
|
-
"&": "$$",
|
|
4279
|
-
"uiSchema": "${uiSchema}",
|
|
4280
|
-
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4281
|
-
},
|
|
4282
|
-
"messages": {
|
|
4283
|
-
"success": "删除成功"
|
|
4284
|
-
},
|
|
4285
|
-
"requestAdaptor": "const { recordId } = api.body;\nvar deleteArray = [];\nif (recordId) { deleteArray.push(`delete:object_listviews__delete(id: \"${recordId}\")`); }\napi.data = { query: `mutation{${deleteArray.join(',')}}` };\n return api;\n",
|
|
4286
|
-
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
|
|
4287
|
-
}
|
|
4478
|
+
]
|
|
4288
4479
|
}
|
|
4289
4480
|
},
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4481
|
+
"fieldsExtend": fieldsExtend(),
|
|
4482
|
+
"initApiAdaptor": initApiAdaptor(),
|
|
4483
|
+
"apiRequestAdaptor": apiRequestAdaptor()
|
|
4484
|
+
}
|
|
4485
|
+
],
|
|
4486
|
+
"showCloseButton": true,
|
|
4487
|
+
"showErrorMsg": true,
|
|
4488
|
+
"showLoading": true,
|
|
4489
|
+
"id": "u:d3f6947b6acf",
|
|
4490
|
+
"size": "lg"
|
|
4491
|
+
},
|
|
4492
|
+
"actionType": "dialog"
|
|
4493
|
+
}
|
|
4494
|
+
]
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
};
|
|
4499
|
+
|
|
4500
|
+
function fieldsExtend(){
|
|
4501
|
+
return {
|
|
4502
|
+
"sort": {
|
|
4503
|
+
"amis": {
|
|
4504
|
+
"type": "tabs-transfer",
|
|
4505
|
+
"sortable": true,
|
|
4506
|
+
"searchable": true,
|
|
4507
|
+
"source": {
|
|
4508
|
+
"method": "get",
|
|
4509
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/sortFields/options",
|
|
4510
|
+
"headers": {
|
|
4511
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
|
|
4519
|
+
function initApiAdaptor(){
|
|
4520
|
+
return `
|
|
4521
|
+
let sort;
|
|
4522
|
+
if (recordId) {
|
|
4523
|
+
sort = payload.data.sort;
|
|
4524
|
+
//数据格式转换
|
|
4525
|
+
if (sort instanceof Array) {
|
|
4526
|
+
sort = lodash.map(sort, (item) => {
|
|
4527
|
+
return item.field_name + ':' + (item.order || 'asc')
|
|
4528
|
+
});
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
payload.data.sort = sort;
|
|
4532
|
+
delete payload.extensions;
|
|
4533
|
+
return payload;
|
|
4534
|
+
`
|
|
4535
|
+
}
|
|
4536
|
+
|
|
4537
|
+
function apiRequestAdaptor(){
|
|
4538
|
+
return `
|
|
4539
|
+
const recordId = api.body.recordId;
|
|
4540
|
+
//数据格式转换
|
|
4541
|
+
if (typeof formData.sort == 'string') {
|
|
4542
|
+
formData.sort = formData.sort?.split(',');
|
|
4543
|
+
}
|
|
4544
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
4545
|
+
const arr = item.split(':');
|
|
4546
|
+
return { field_name: arr[0], order: arr[1] };
|
|
4547
|
+
});
|
|
4548
|
+
if (recordId) {
|
|
4549
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4550
|
+
}
|
|
4551
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4552
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4553
|
+
return api;
|
|
4554
|
+
`
|
|
4555
|
+
}
|
|
4556
|
+
|
|
4557
|
+
const getDeleteListviewButtonSchema = ()=>{
|
|
4558
|
+
return {
|
|
4559
|
+
"type": "button",
|
|
4560
|
+
"label": "删除",
|
|
4561
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4562
|
+
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4563
|
+
"onEvent": {
|
|
4564
|
+
"click": {
|
|
4565
|
+
"actions": [
|
|
4566
|
+
{
|
|
4567
|
+
"actionType": "ajax",
|
|
4568
|
+
"args": {
|
|
4569
|
+
"api": {
|
|
4570
|
+
"url": "${context.rootUrl}/graphql",
|
|
4571
|
+
"method": "post",
|
|
4572
|
+
"headers": {
|
|
4573
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4574
|
+
},
|
|
4575
|
+
"data": {
|
|
4576
|
+
"&": "$$",
|
|
4577
|
+
"uiSchema": "${uiSchema}",
|
|
4578
|
+
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4579
|
+
},
|
|
4580
|
+
"messages": {
|
|
4581
|
+
"success": "删除成功"
|
|
4582
|
+
},
|
|
4583
|
+
"requestAdaptor": requestAdaptor(),
|
|
4584
|
+
"adaptor": adaptor(),
|
|
4299
4585
|
}
|
|
4300
4586
|
}
|
|
4301
4587
|
},
|
|
4302
|
-
{
|
|
4303
|
-
"
|
|
4304
|
-
"
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4588
|
+
{
|
|
4589
|
+
"actionType": "url",
|
|
4590
|
+
"args": {
|
|
4591
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
|
|
4592
|
+
"blank": false
|
|
4593
|
+
},
|
|
4594
|
+
"expression": "data.delete == 1"
|
|
4595
|
+
}
|
|
4596
|
+
]
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
};
|
|
4601
|
+
|
|
4602
|
+
|
|
4603
|
+
function requestAdaptor(){
|
|
4604
|
+
return `
|
|
4605
|
+
const { recordId } = api.body;
|
|
4606
|
+
var deleteArray = [];
|
|
4607
|
+
if (recordId) { deleteArray.push(\`delete:object_listviews__delete(id: "\${recordId}")\`); }
|
|
4608
|
+
api.data = { query: \`mutation{\${deleteArray.join(',')}}\` };
|
|
4609
|
+
return api;
|
|
4610
|
+
`
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
function adaptor(){
|
|
4614
|
+
return `
|
|
4615
|
+
if (payload.errors) {
|
|
4616
|
+
payload.status = 2;
|
|
4617
|
+
payload.msg = payload.errors[0].message;
|
|
4618
|
+
}
|
|
4619
|
+
return payload;
|
|
4620
|
+
`
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
const getSettingListviewToolbarButtonSchema = ()=>{
|
|
4624
|
+
return {
|
|
4625
|
+
"type": "dropdown-button",
|
|
4626
|
+
"trigger": "click",
|
|
4627
|
+
"icon": "fa fa-cog",
|
|
4628
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4629
|
+
"align": "right",
|
|
4630
|
+
"visibleOn": "${!isLookup}",
|
|
4631
|
+
"buttons": [
|
|
4632
|
+
{
|
|
4633
|
+
"label": "列表视图操作",
|
|
4634
|
+
"children": [
|
|
4635
|
+
getNewListviewButtonSchema(),
|
|
4636
|
+
getCopyListviewButtonSchema(),
|
|
4637
|
+
getRenameListviewButtonSchema(),
|
|
4638
|
+
getSetListviewShareButtonSchema(),
|
|
4639
|
+
getSetListviewFiltersButtonSchema(),
|
|
4640
|
+
getSetListviewColumnsButtonSchema(),
|
|
4641
|
+
getSetListviewSortButtonSchema(),
|
|
4642
|
+
getDeleteListviewButtonSchema()
|
|
4314
4643
|
]
|
|
4315
4644
|
}
|
|
4316
4645
|
]
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
|
|
4649
|
+
const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
4650
|
+
let displayAs = amisLib.Router.getTabDisplayAs(objectName);
|
|
4651
|
+
let buttons = [
|
|
4652
|
+
{
|
|
4653
|
+
"type": "button",
|
|
4654
|
+
"label": "表格",
|
|
4655
|
+
"onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
4656
|
+
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
4657
|
+
"rightIconClassName": "m-l-sm"
|
|
4658
|
+
},
|
|
4659
|
+
{
|
|
4660
|
+
"type": "button",
|
|
4661
|
+
"label": "分栏视图",
|
|
4662
|
+
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
4663
|
+
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
4664
|
+
"rightIconClassName": "m-l-sm"
|
|
4665
|
+
}
|
|
4666
|
+
];
|
|
4667
|
+
return {
|
|
4668
|
+
"type": "dropdown-button",
|
|
4669
|
+
"icon": "fa fa-table-columns",
|
|
4670
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4671
|
+
"align": "right",
|
|
4672
|
+
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
4673
|
+
"buttons": [
|
|
4674
|
+
{
|
|
4675
|
+
"label": "显示为",
|
|
4676
|
+
"children": buttons
|
|
4677
|
+
}
|
|
4678
|
+
]
|
|
4679
|
+
};
|
|
4680
|
+
};
|
|
4681
|
+
|
|
4682
|
+
|
|
4683
|
+
const onFieldsFilterToggleScript = `
|
|
4684
|
+
const scope = event.context.scoped;
|
|
4685
|
+
const filterForm = scope.getComponents().find(function(n){
|
|
4686
|
+
return n.props.type === "form";
|
|
4687
|
+
});
|
|
4688
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
4689
|
+
return n.props.type === "service";
|
|
4690
|
+
});
|
|
4691
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
4692
|
+
let resizeWindow = function(){
|
|
4693
|
+
//触发amis crud 高度重算
|
|
4694
|
+
setTimeout(()=>{
|
|
4695
|
+
window.dispatchEvent(new Event("resize"))
|
|
4696
|
+
}, 500);
|
|
4697
|
+
}
|
|
4698
|
+
let isMobile = Steedos.isMobile();
|
|
4699
|
+
if(filterService.props.data.showFieldsFilter){
|
|
4700
|
+
if(isMobile){
|
|
4701
|
+
// 手机上只能通过取消按钮来关闭搜索栏
|
|
4702
|
+
return;
|
|
4703
|
+
}
|
|
4704
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
4705
|
+
direction: "down",
|
|
4706
|
+
name: "btn_filter_form_cancel"
|
|
4707
|
+
});
|
|
4708
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
4709
|
+
resizeWindow();
|
|
4710
|
+
});
|
|
4711
|
+
}
|
|
4712
|
+
else{
|
|
4713
|
+
filterService.setData({showFieldsFilter: true});
|
|
4714
|
+
resizeWindow();
|
|
4715
|
+
if(isMobile){
|
|
4716
|
+
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
4717
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
4718
|
+
crudService && crudService.setData({showFieldsFilter: true});
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
`;
|
|
4722
|
+
|
|
4723
|
+
|
|
4724
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
|
|
4725
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
4726
|
+
const isMobile = window.innerWidth < 768;
|
|
4727
|
+
if(isMobile){
|
|
4728
|
+
showDisplayAs = false;
|
|
4729
|
+
}
|
|
4730
|
+
if(formFactor === 'SMALL'){
|
|
4731
|
+
const onReloadScript = `
|
|
4732
|
+
const scope = event.context.scoped;
|
|
4733
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
4734
|
+
return n.props.type === "crud";
|
|
4735
|
+
});
|
|
4736
|
+
listView.handleChangePage(1);
|
|
4737
|
+
`;
|
|
4738
|
+
return [
|
|
4739
|
+
// "bulkActions",
|
|
4740
|
+
...(headerToolbarItems || []),
|
|
4741
|
+
hiddenCount ? {} :{
|
|
4742
|
+
"type": "tpl",
|
|
4743
|
+
"tpl": "${count} 个项目"
|
|
4744
|
+
},
|
|
4745
|
+
{
|
|
4746
|
+
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
4747
|
+
"type": "button",
|
|
4748
|
+
"align": "right",
|
|
4749
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4750
|
+
"label": "",
|
|
4751
|
+
"icon": "fa fa-sync",
|
|
4752
|
+
"visibleOn": "${!showFieldsFilter}",
|
|
4753
|
+
"onEvent": {
|
|
4754
|
+
"click": {
|
|
4755
|
+
"actions": [
|
|
4756
|
+
{
|
|
4757
|
+
"actionType": "custom",
|
|
4758
|
+
"script": onReloadScript
|
|
4759
|
+
}
|
|
4760
|
+
]
|
|
4761
|
+
}
|
|
4762
|
+
},
|
|
4763
|
+
},
|
|
4764
|
+
filterVisible ? {
|
|
4765
|
+
"label": "",
|
|
4766
|
+
"icon": "fa fa-search",
|
|
4767
|
+
"type": "button",
|
|
4768
|
+
"badge": {
|
|
4769
|
+
"offset": [
|
|
4770
|
+
-5,
|
|
4771
|
+
1
|
|
4772
|
+
],
|
|
4773
|
+
"size":8,
|
|
4774
|
+
"animation": true,
|
|
4775
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
4776
|
+
},
|
|
4777
|
+
"align": "right",
|
|
4778
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4779
|
+
"onEvent": {
|
|
4780
|
+
"click": {
|
|
4781
|
+
"actions": [
|
|
4782
|
+
{
|
|
4783
|
+
"actionType": "custom",
|
|
4784
|
+
"script": onFieldsFilterToggleScript
|
|
4785
|
+
}
|
|
4786
|
+
]
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
} : {},
|
|
4790
|
+
getDisplayAsButton(mainObject?.name)
|
|
4791
|
+
]
|
|
4792
|
+
}else {
|
|
4793
|
+
return [
|
|
4794
|
+
// "filter-toggler",
|
|
4795
|
+
...(headerToolbarItems || []),
|
|
4796
|
+
"bulkActions",
|
|
4797
|
+
{
|
|
4798
|
+
"type": "columns-toggler",
|
|
4799
|
+
"className": "hidden"
|
|
4800
|
+
},
|
|
4801
|
+
// {
|
|
4802
|
+
// "type": "columns-toggler",
|
|
4803
|
+
// "className": "mr-2"
|
|
4804
|
+
// },
|
|
4805
|
+
hiddenCount ? {} : {
|
|
4806
|
+
"type": "tpl",
|
|
4807
|
+
"tpl": "${count} 个项目"
|
|
4808
|
+
},
|
|
4809
|
+
{
|
|
4810
|
+
"type": "reload",
|
|
4811
|
+
"align": "right",
|
|
4812
|
+
"tooltipPlacement": "bottom",
|
|
4813
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
4317
4814
|
},
|
|
4815
|
+
getExportExcelToolbarButtonSchema(),
|
|
4816
|
+
filterVisible ? {
|
|
4817
|
+
"label": "",
|
|
4818
|
+
"icon": "fa fa-search",
|
|
4819
|
+
"type": "button",
|
|
4820
|
+
"align": "right",
|
|
4821
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4822
|
+
"onEvent": {
|
|
4823
|
+
"click": {
|
|
4824
|
+
"actions": [
|
|
4825
|
+
{
|
|
4826
|
+
"actionType": "custom",
|
|
4827
|
+
"script": onFieldsFilterToggleScript
|
|
4828
|
+
}
|
|
4829
|
+
]
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
} : {},
|
|
4833
|
+
getSettingListviewToolbarButtonSchema(),
|
|
4318
4834
|
getDisplayAsButton(showDisplayAs)
|
|
4319
4835
|
// {
|
|
4320
4836
|
// "type": "search-box",
|
|
@@ -4793,20 +5309,7 @@ else{
|
|
|
4793
5309
|
}
|
|
4794
5310
|
}
|
|
4795
5311
|
|
|
4796
|
-
var searchableFilter = [];
|
|
4797
|
-
_.each(selfData, (value, key)=>{
|
|
4798
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
4799
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
4800
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
4801
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
4802
|
-
if(_.isString(value)){
|
|
4803
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
4804
|
-
}else{
|
|
4805
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
4806
|
-
}
|
|
4807
|
-
}
|
|
4808
|
-
}
|
|
4809
|
-
});
|
|
5312
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
4810
5313
|
|
|
4811
5314
|
if(searchableFilter.length > 0){
|
|
4812
5315
|
if(filters.length > 0 ){
|
|
@@ -5539,23 +6042,6 @@ else{
|
|
|
5539
6042
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5540
6043
|
};
|
|
5541
6044
|
|
|
5542
|
-
/*
|
|
5543
|
-
* @Author: baozhoutao@steedos.com
|
|
5544
|
-
* @Date: 2022-07-20 16:29:22
|
|
5545
|
-
* @LastEditors: Please set LastEditors
|
|
5546
|
-
* @LastEditTime: 2023-05-11 11:19:54
|
|
5547
|
-
* @Description:
|
|
5548
|
-
*/
|
|
5549
|
-
|
|
5550
|
-
function getContrastColor(bgColor) {
|
|
5551
|
-
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5552
|
-
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5553
|
-
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5554
|
-
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5555
|
-
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5556
|
-
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5557
|
-
}
|
|
5558
|
-
|
|
5559
6045
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5560
6046
|
// const Lookup = require('./lookup');
|
|
5561
6047
|
|
|
@@ -5746,19 +6232,7 @@ else{
|
|
|
5746
6232
|
// break;
|
|
5747
6233
|
case 'select':
|
|
5748
6234
|
if(readonly){
|
|
5749
|
-
const
|
|
5750
|
-
let map = {};
|
|
5751
|
-
___namespace.forEach(selectOptions,(option)=>{
|
|
5752
|
-
const optionValue = option.value + '';
|
|
5753
|
-
if(option.color){
|
|
5754
|
-
const background = '#'+option.color;
|
|
5755
|
-
const color = getContrastColor(background);
|
|
5756
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
5757
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
5758
|
-
}else {
|
|
5759
|
-
map[optionValue] = option.label;
|
|
5760
|
-
}
|
|
5761
|
-
});
|
|
6235
|
+
const map = getSelectMap(field.options);
|
|
5762
6236
|
convertData = {
|
|
5763
6237
|
type: "static-mapping",
|
|
5764
6238
|
name: field.name,
|
|
@@ -6457,7 +6931,8 @@ else{
|
|
|
6457
6931
|
data.global = "${global}";
|
|
6458
6932
|
data.context = "${context}";
|
|
6459
6933
|
data.defaultData = "${defaultData}";
|
|
6460
|
-
|
|
6934
|
+
data._master = "${_master}";
|
|
6935
|
+
|
|
6461
6936
|
return {
|
|
6462
6937
|
method: "post",
|
|
6463
6938
|
url: getApi$2() + '&objectName=${objectName}' ,
|
|
@@ -6523,7 +6998,7 @@ else{
|
|
|
6523
6998
|
formInitialValuesFun = new Function("return " + formInitialValuesFun)();
|
|
6524
6999
|
}
|
|
6525
7000
|
if(typeof formInitialValuesFun === "function"){
|
|
6526
|
-
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
|
|
7001
|
+
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global, master: api.body._master })
|
|
6527
7002
|
}
|
|
6528
7003
|
}
|
|
6529
7004
|
catch(ex){
|
|
@@ -6874,7 +7349,7 @@ else{
|
|
|
6874
7349
|
id: `service_${id}`,
|
|
6875
7350
|
name: `page`,
|
|
6876
7351
|
data: {
|
|
6877
|
-
|
|
7352
|
+
objectName: objectSchema.name,
|
|
6878
7353
|
// _id: null,
|
|
6879
7354
|
recordPermissions: objectSchema.permissions,
|
|
6880
7355
|
uiSchema: objectSchema,
|
|
@@ -7179,19 +7654,7 @@ else{
|
|
|
7179
7654
|
}, field.amis, {name: field.name}));
|
|
7180
7655
|
}
|
|
7181
7656
|
else if(field.type === 'select'){
|
|
7182
|
-
const
|
|
7183
|
-
let map = {};
|
|
7184
|
-
_$1.forEach(selectOptions,(option)=>{
|
|
7185
|
-
const optionValue = option.value + '';
|
|
7186
|
-
if(option.color){
|
|
7187
|
-
const background = '#'+option.color;
|
|
7188
|
-
const color = getContrastColor(background);
|
|
7189
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7190
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7191
|
-
}else {
|
|
7192
|
-
map[optionValue] = option.label;
|
|
7193
|
-
}
|
|
7194
|
-
});
|
|
7657
|
+
const map = getSelectMap(field.options);
|
|
7195
7658
|
columns.push(Object.assign({}, {
|
|
7196
7659
|
type: "mapping",
|
|
7197
7660
|
name: field.name,
|
|
@@ -7692,20 +8155,8 @@ else{
|
|
|
7692
8155
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
7693
8156
|
userFilters = [["${valueField.name}", "=", selfData.value]];
|
|
7694
8157
|
}
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
7698
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
7699
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
7700
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
7701
|
-
if(_.isString(value)){
|
|
7702
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
7703
|
-
}else{
|
|
7704
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
7705
|
-
}
|
|
7706
|
-
}
|
|
7707
|
-
}
|
|
7708
|
-
});
|
|
8158
|
+
|
|
8159
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
7709
8160
|
|
|
7710
8161
|
if(searchableFilter.length > 0){
|
|
7711
8162
|
if(userFilters.length > 0 ){
|
|
@@ -7756,11 +8207,10 @@ else{
|
|
|
7756
8207
|
if(api.data.$self._isRelated){
|
|
7757
8208
|
const self = api.data.$self;
|
|
7758
8209
|
const relatedKey = self.relatedKey;
|
|
7759
|
-
const recordId = self.recordId;
|
|
7760
8210
|
const refField = self.uiSchema.fields[relatedKey];
|
|
7761
8211
|
const masterRecord = self._master.record;
|
|
7762
8212
|
const masterObjectName = self._master.objectName;
|
|
7763
|
-
let relatedValue = recordId;
|
|
8213
|
+
let relatedValue = self._master.recordId;
|
|
7764
8214
|
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
7765
8215
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
7766
8216
|
}
|
|
@@ -7976,20 +8426,7 @@ else{
|
|
|
7976
8426
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
7977
8427
|
filters = [["${valueField.name}", "=", selfData.value]];
|
|
7978
8428
|
}
|
|
7979
|
-
var searchableFilter = [];
|
|
7980
|
-
_.each(selfData, (value, key)=>{
|
|
7981
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
7982
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
7983
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
7984
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
7985
|
-
if(_.isString(value)){
|
|
7986
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
7987
|
-
}else{
|
|
7988
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
7989
|
-
}
|
|
7990
|
-
}
|
|
7991
|
-
}
|
|
7992
|
-
});
|
|
8429
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
7993
8430
|
|
|
7994
8431
|
if(searchableFilter.length > 0){
|
|
7995
8432
|
if(filters.length > 0 ){
|
|
@@ -8515,7 +8952,7 @@ else{
|
|
|
8515
8952
|
* @Author: baozhoutao@steedos.com
|
|
8516
8953
|
* @Date: 2022-07-05 15:55:39
|
|
8517
8954
|
* @LastEditors: Please set LastEditors
|
|
8518
|
-
* @LastEditTime: 2023-05-
|
|
8955
|
+
* @LastEditTime: 2023-05-17 09:09:33
|
|
8519
8956
|
* @Description:
|
|
8520
8957
|
*/
|
|
8521
8958
|
|
|
@@ -8655,7 +9092,7 @@ else{
|
|
|
8655
9092
|
// } else {
|
|
8656
9093
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
8657
9094
|
// }
|
|
8658
|
-
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
|
|
9095
|
+
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
8659
9096
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
8660
9097
|
const options = {
|
|
8661
9098
|
globalFilter,
|
|
@@ -12302,6 +12739,7 @@ else{
|
|
|
12302
12739
|
exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
|
|
12303
12740
|
exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
|
|
12304
12741
|
exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
|
|
12742
|
+
exports.getObjectRecordDetailRelatedListButtonsSchemas = getObjectRecordDetailRelatedListButtonsSchemas;
|
|
12305
12743
|
exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
|
|
12306
12744
|
exports.getObjectRelated = getObjectRelated;
|
|
12307
12745
|
exports.getObjectRelatedList = getObjectRelatedList;
|