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