@steedos-widgets/amis-lib 1.2.8 → 1.2.9
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 +1228 -753
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1229 -755
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1228 -753
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +44 -1
- package/dist/types/lib/converter/amis/fields/index.d.ts +1 -0
- package/dist/types/lib/converter/amis/fields_filter.d.ts +3 -1
- package/dist/types/lib/converter/amis/header.d.ts +80 -5
- package/dist/types/lib/converter/amis/index.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbar.d.ts +3 -1
- 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/objects.d.ts +36 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2265,7 +2265,7 @@ const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
|
2265
2265
|
return listButtons;
|
|
2266
2266
|
};
|
|
2267
2267
|
|
|
2268
|
-
const getObjectRelatedListButtons =
|
|
2268
|
+
const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
2269
2269
|
// const buttons = getButtons(uiSchema, ctx);
|
|
2270
2270
|
// const relatedListButtons = _.filter(buttons, (button) => {
|
|
2271
2271
|
// if(button.objectName === 'cms_files'){
|
|
@@ -2552,6 +2552,67 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
2552
2552
|
}
|
|
2553
2553
|
};
|
|
2554
2554
|
|
|
2555
|
+
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
2556
|
+
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
2557
|
+
if(ctx.formFactor === 'SMALL'){
|
|
2558
|
+
return {
|
|
2559
|
+
"type": "button",
|
|
2560
|
+
"icon": "fa fa-angle-down",
|
|
2561
|
+
"onEvent": {
|
|
2562
|
+
"click": {
|
|
2563
|
+
"actions": [
|
|
2564
|
+
{
|
|
2565
|
+
"actionType": "drawer",
|
|
2566
|
+
"drawer": {
|
|
2567
|
+
"type": "drawer",
|
|
2568
|
+
"title": "操作",
|
|
2569
|
+
"body": [
|
|
2570
|
+
{
|
|
2571
|
+
"type": "button-group",
|
|
2572
|
+
"vertical": true,
|
|
2573
|
+
"tiled": true,
|
|
2574
|
+
"buttons": [
|
|
2575
|
+
...___default["default"].map(buttons, (button)=>{
|
|
2576
|
+
return {
|
|
2577
|
+
type: 'steedos-object-button',
|
|
2578
|
+
name: button.name,
|
|
2579
|
+
objectName: button.objectName,
|
|
2580
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2581
|
+
className: `button_${button.name} w-full`
|
|
2582
|
+
}
|
|
2583
|
+
})
|
|
2584
|
+
],
|
|
2585
|
+
"btnLevel": "enhance",
|
|
2586
|
+
"className": "w-full",
|
|
2587
|
+
"btnClassName": "w-full",
|
|
2588
|
+
"size": "lg"
|
|
2589
|
+
}
|
|
2590
|
+
],
|
|
2591
|
+
"position": "bottom",
|
|
2592
|
+
"closeOnOutside": true,
|
|
2593
|
+
"resizable": false,
|
|
2594
|
+
"className": "buttons-drawer",
|
|
2595
|
+
"bodyClassName": "m-none p-none",
|
|
2596
|
+
"actions": []
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
]
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
}else {
|
|
2604
|
+
return ___default["default"].map(buttons, (button) => {
|
|
2605
|
+
return {
|
|
2606
|
+
type: 'steedos-object-button',
|
|
2607
|
+
name: button.name,
|
|
2608
|
+
objectName: button.objectName,
|
|
2609
|
+
visibleOn: getButtonVisibleOn$1(button),
|
|
2610
|
+
className: `button_${button.name}`
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2555
2616
|
async function getObjectFieldsFilterButtonSchema(objectSchema) {
|
|
2556
2617
|
// const amisListViewId = `listview_${objectSchema.name}`;
|
|
2557
2618
|
return {
|
|
@@ -2604,11 +2665,11 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2604
2665
|
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
2605
2666
|
}
|
|
2606
2667
|
const selfData = api.body.$self;
|
|
2607
|
-
const filterFormSearchableFields = selfData.filterFormSearchableFields;
|
|
2608
2668
|
const uiSchema = selfData.uiSchema;
|
|
2609
2669
|
const fields = uiSchema.fields;
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2670
|
+
const filterFormSearchableFields = (selfData.filterFormSearchableFields || []).filter(function(item){
|
|
2671
|
+
return !!fields[item]
|
|
2672
|
+
});
|
|
2612
2673
|
const resolveAll = function(values){
|
|
2613
2674
|
payload.data = {
|
|
2614
2675
|
"body": values
|
|
@@ -2623,21 +2684,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2623
2684
|
return Promise.all(filterFormSearchableFields.map(function (item) {
|
|
2624
2685
|
const field = _.clone(fields[item]);
|
|
2625
2686
|
if (
|
|
2626
|
-
field &&
|
|
2627
|
-
[
|
|
2628
|
-
"grid",
|
|
2629
|
-
"avatar",
|
|
2630
|
-
"image",
|
|
2631
|
-
"object",
|
|
2632
|
-
"[object]",
|
|
2633
|
-
"[Object]",
|
|
2634
|
-
"[grid]",
|
|
2635
|
-
"[text]",
|
|
2636
|
-
"audio",
|
|
2637
|
-
"file",
|
|
2638
|
-
],
|
|
2639
|
-
field.type
|
|
2640
|
-
)
|
|
2687
|
+
field && window.isFieldTypeSearchable(field.type)
|
|
2641
2688
|
) {
|
|
2642
2689
|
delete field.defaultValue;
|
|
2643
2690
|
delete field.required;
|
|
@@ -2734,6 +2781,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2734
2781
|
}
|
|
2735
2782
|
}
|
|
2736
2783
|
}
|
|
2784
|
+
filterForm.reset();
|
|
2737
2785
|
listView.handleFilterSubmit(removedValues);
|
|
2738
2786
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2739
2787
|
return n.props.type === "service";
|
|
@@ -2996,9 +3044,27 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2996
3044
|
"headers": {
|
|
2997
3045
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2998
3046
|
},
|
|
2999
|
-
"data":
|
|
3047
|
+
"data": {
|
|
3048
|
+
"$self": "$$"
|
|
3049
|
+
},
|
|
3000
3050
|
"requestAdaptor": "",
|
|
3001
|
-
"adaptor":
|
|
3051
|
+
"adaptor": `
|
|
3052
|
+
if(payload.errors){
|
|
3053
|
+
payload.status = 2;
|
|
3054
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
3055
|
+
}
|
|
3056
|
+
const selfData = api.body.$self;
|
|
3057
|
+
const uiSchema = selfData.uiSchema;
|
|
3058
|
+
const fields = uiSchema.fields;
|
|
3059
|
+
const options = (payload.data?.options || []).filter(function(item){
|
|
3060
|
+
let field = fields[item.value];
|
|
3061
|
+
return !!field && window.isFieldTypeSearchable(field.type)
|
|
3062
|
+
});
|
|
3063
|
+
payload.data = {
|
|
3064
|
+
"options": options
|
|
3065
|
+
};
|
|
3066
|
+
return payload;
|
|
3067
|
+
`
|
|
3002
3068
|
},
|
|
3003
3069
|
"options": [],
|
|
3004
3070
|
"required": true,
|
|
@@ -3161,6 +3227,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3161
3227
|
"rightIcon": "fa fa-caret-down",
|
|
3162
3228
|
"size": "sm",
|
|
3163
3229
|
"hideCaret": true,
|
|
3230
|
+
"closeOnClick": true,
|
|
3164
3231
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
3165
3232
|
"buttons": listViewButtonOptions
|
|
3166
3233
|
}
|
|
@@ -3345,12 +3412,47 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3345
3412
|
"type": "grid",
|
|
3346
3413
|
"columns": [
|
|
3347
3414
|
{
|
|
3348
|
-
"body": {
|
|
3415
|
+
"body": [{
|
|
3416
|
+
"type": "service",
|
|
3417
|
+
"onEvent": {
|
|
3418
|
+
"@history_paths.changed": {
|
|
3419
|
+
"actions": [
|
|
3420
|
+
{
|
|
3421
|
+
"actionType": "reload"
|
|
3422
|
+
}
|
|
3423
|
+
]
|
|
3424
|
+
}
|
|
3425
|
+
},
|
|
3426
|
+
"body":[{
|
|
3427
|
+
"type": "button",
|
|
3428
|
+
"visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
|
|
3429
|
+
"className":"flex mr-2",
|
|
3430
|
+
"onEvent": {
|
|
3431
|
+
"click": {
|
|
3432
|
+
"actions": [
|
|
3433
|
+
{
|
|
3434
|
+
"actionType": "custom",
|
|
3435
|
+
"script": "Steedos.goBack()"
|
|
3436
|
+
}
|
|
3437
|
+
]
|
|
3438
|
+
}
|
|
3439
|
+
},
|
|
3440
|
+
"body": [
|
|
3441
|
+
{
|
|
3442
|
+
"type": "steedos-icon",
|
|
3443
|
+
"category": "utility",
|
|
3444
|
+
"name": "back",
|
|
3445
|
+
"colorVariant": "default",
|
|
3446
|
+
"className": "slds-button_icon slds-global-header__icon"
|
|
3447
|
+
}
|
|
3448
|
+
]
|
|
3449
|
+
}]
|
|
3450
|
+
},{
|
|
3349
3451
|
"type": "tpl",
|
|
3350
3452
|
"className": "block",
|
|
3351
3453
|
// "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'>`
|
|
3352
3454
|
"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>`
|
|
3353
|
-
},
|
|
3455
|
+
}],
|
|
3354
3456
|
"md": "auto",
|
|
3355
3457
|
"className": "",
|
|
3356
3458
|
"columnClassName": "flex justify-center items-center"
|
|
@@ -3437,18 +3539,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3437
3539
|
* @param {*} relatedObjectSchema 相关对象UISchema
|
|
3438
3540
|
* @returns amisSchema
|
|
3439
3541
|
*/
|
|
3440
|
-
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel) {
|
|
3542
|
+
async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relatedLabel, ctx) {
|
|
3441
3543
|
const { icon, label } = relatedObjectSchema;
|
|
3442
|
-
|
|
3443
|
-
let amisButtonsSchema = _$1.map(buttons, (button) => {
|
|
3444
|
-
return {
|
|
3445
|
-
type: 'steedos-object-button',
|
|
3446
|
-
name: button.name,
|
|
3447
|
-
objectName: button.objectName,
|
|
3448
|
-
visibleOn: getButtonVisibleOn$1(button),
|
|
3449
|
-
className: `button_${button.name}`
|
|
3450
|
-
}
|
|
3451
|
-
});
|
|
3544
|
+
let amisButtonsSchema = getObjectRecordDetailRelatedListButtonsSchemas(relatedObjectSchema, {formFactor: ctx.formFactor});
|
|
3452
3545
|
const reg = new RegExp('_', 'g');
|
|
3453
3546
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3454
3547
|
const recordRelatedListHeader = {
|
|
@@ -3521,83 +3614,44 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
3521
3614
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
3522
3615
|
}
|
|
3523
3616
|
|
|
3524
|
-
const
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3617
|
+
const getExportExcelToolbarButtonSchema = ()=>{
|
|
3618
|
+
return {
|
|
3619
|
+
"type": "button",
|
|
3620
|
+
"icon": "fa fa-download",
|
|
3621
|
+
"align": "right",
|
|
3622
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3623
|
+
"tooltipPlacement": "bottom",
|
|
3624
|
+
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
3625
|
+
"tooltip": "导出Excel",
|
|
3626
|
+
"onEvent": {
|
|
3627
|
+
"click": {
|
|
3628
|
+
"weight": 0,
|
|
3629
|
+
"actions": [
|
|
3630
|
+
{
|
|
3631
|
+
"args": {
|
|
3632
|
+
"api": {
|
|
3633
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
3634
|
+
"method": "get",
|
|
3635
|
+
"messages": {},
|
|
3636
|
+
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
3637
|
+
"data": {
|
|
3638
|
+
"uiSchema": "${uiSchema}",
|
|
3639
|
+
"listName": "${listName}"
|
|
3640
|
+
},
|
|
3641
|
+
"headers": {
|
|
3642
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3646
|
+
"actionType": "download"
|
|
3647
|
+
}
|
|
3648
|
+
]
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3540
3651
|
}
|
|
3541
|
-
];
|
|
3542
|
-
return {
|
|
3543
|
-
"type": "dropdown-button",
|
|
3544
|
-
"icon": "fa fa-table-columns",
|
|
3545
|
-
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3546
|
-
"align": "right",
|
|
3547
|
-
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
3548
|
-
"buttons": [
|
|
3549
|
-
{
|
|
3550
|
-
"label": "显示为",
|
|
3551
|
-
"children": buttons
|
|
3552
|
-
}
|
|
3553
|
-
]
|
|
3554
|
-
};
|
|
3555
3652
|
};
|
|
3556
3653
|
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
const onFieldsFilterToggleScript = `
|
|
3561
|
-
const scope = event.context.scoped;
|
|
3562
|
-
const filterForm = scope.getComponents().find(function(n){
|
|
3563
|
-
return n.props.type === "form";
|
|
3564
|
-
});
|
|
3565
|
-
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3566
|
-
return n.props.type === "service";
|
|
3567
|
-
});
|
|
3568
|
-
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3569
|
-
let resizeWindow = function(){
|
|
3570
|
-
//触发amis crud 高度重算
|
|
3571
|
-
setTimeout(()=>{
|
|
3572
|
-
window.dispatchEvent(new Event("resize"))
|
|
3573
|
-
}, 500);
|
|
3574
|
-
}
|
|
3575
|
-
let isMobile = Steedos.isMobile();
|
|
3576
|
-
if(filterService.props.data.showFieldsFilter){
|
|
3577
|
-
if(isMobile){
|
|
3578
|
-
// 手机上只能通过取消按钮来关闭搜索栏
|
|
3579
|
-
return;
|
|
3580
|
-
}
|
|
3581
|
-
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3582
|
-
direction: "down",
|
|
3583
|
-
name: "btn_filter_form_cancel"
|
|
3584
|
-
});
|
|
3585
|
-
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3586
|
-
resizeWindow();
|
|
3587
|
-
});
|
|
3588
|
-
}
|
|
3589
|
-
else{
|
|
3590
|
-
filterService.setData({showFieldsFilter: true});
|
|
3591
|
-
resizeWindow();
|
|
3592
|
-
if(isMobile){
|
|
3593
|
-
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
3594
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3595
|
-
crudService && crudService.setData({showFieldsFilter: true});
|
|
3596
|
-
}
|
|
3597
|
-
}
|
|
3598
|
-
`;
|
|
3599
|
-
|
|
3600
|
-
function getExportApiRequestAdaptorScript(){
|
|
3654
|
+
function requestAdaptor$1(){
|
|
3601
3655
|
return `
|
|
3602
3656
|
// 获取列表视图的属性
|
|
3603
3657
|
let uiSchema = api.body.uiSchema;
|
|
@@ -3651,667 +3705,1101 @@ function getExportApiRequestAdaptorScript(){
|
|
|
3651
3705
|
`
|
|
3652
3706
|
}
|
|
3653
3707
|
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
const isMobile = window.innerWidth < 768;
|
|
3657
|
-
if(isMobile){
|
|
3658
|
-
showDisplayAs = false;
|
|
3659
|
-
}
|
|
3660
|
-
if(formFactor === 'SMALL'){
|
|
3661
|
-
const onReloadScript = `
|
|
3662
|
-
const scope = event.context.scoped;
|
|
3663
|
-
var listView = scope.parent.getComponents().find(function(n){
|
|
3664
|
-
return n.props.type === "crud";
|
|
3665
|
-
});
|
|
3666
|
-
listView.handleChangePage(1);
|
|
3667
|
-
`;
|
|
3668
|
-
return [
|
|
3669
|
-
// "bulkActions",
|
|
3670
|
-
...(headerToolbarItems || []),
|
|
3671
|
-
hiddenCount ? {} :{
|
|
3672
|
-
"type": "tpl",
|
|
3673
|
-
"tpl": "${count} 个项目"
|
|
3674
|
-
},
|
|
3675
|
-
{
|
|
3676
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
3708
|
+
const getNewListviewButtonSchema = ()=>{
|
|
3709
|
+
return {
|
|
3677
3710
|
"type": "button",
|
|
3678
|
-
"
|
|
3679
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3680
|
-
"label": "",
|
|
3681
|
-
"icon": "fa fa-sync",
|
|
3682
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
3711
|
+
"label": "新建",
|
|
3683
3712
|
"onEvent": {
|
|
3684
3713
|
"click": {
|
|
3714
|
+
"weight": 0,
|
|
3685
3715
|
"actions": [
|
|
3686
3716
|
{
|
|
3687
|
-
"
|
|
3688
|
-
|
|
3717
|
+
"dialog": {
|
|
3718
|
+
"type": "dialog",
|
|
3719
|
+
"title": "新建 列表视图",
|
|
3720
|
+
"data": {
|
|
3721
|
+
"&": "$$",
|
|
3722
|
+
"all": "${uiSchema.list_views.all}",
|
|
3723
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3724
|
+
"appId": "${appId}",
|
|
3725
|
+
"global": "${global}",
|
|
3726
|
+
"targetObjectName": "${objectName}",
|
|
3727
|
+
},
|
|
3728
|
+
"body": [
|
|
3729
|
+
{
|
|
3730
|
+
"type": "steedos-object-form",
|
|
3731
|
+
"label": "对象表单",
|
|
3732
|
+
"objectApiName": "object_listviews",
|
|
3733
|
+
"recordId": "",
|
|
3734
|
+
"mode": "edit",
|
|
3735
|
+
"defaultData": {
|
|
3736
|
+
"&": "${list_view}",
|
|
3737
|
+
"name":"",
|
|
3738
|
+
"label":"",
|
|
3739
|
+
"filters":"",
|
|
3740
|
+
"shared":false
|
|
3741
|
+
},
|
|
3742
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
3743
|
+
"fields": fields$1(),
|
|
3744
|
+
"onEvent": {
|
|
3745
|
+
"submitSucc": {
|
|
3746
|
+
"weight": 0,
|
|
3747
|
+
"actions": [
|
|
3748
|
+
{
|
|
3749
|
+
"args": {
|
|
3750
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3751
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3752
|
+
"blank": false
|
|
3753
|
+
},
|
|
3754
|
+
"actionType": "url",
|
|
3755
|
+
}
|
|
3756
|
+
]
|
|
3757
|
+
}
|
|
3758
|
+
},
|
|
3759
|
+
"messages": {
|
|
3760
|
+
"success": "成功",
|
|
3761
|
+
"failed": "失败"
|
|
3762
|
+
},
|
|
3763
|
+
}
|
|
3764
|
+
],
|
|
3765
|
+
"showCloseButton": true,
|
|
3766
|
+
"showErrorMsg": true,
|
|
3767
|
+
"showLoading": true,
|
|
3768
|
+
"closeOnEsc": false,
|
|
3769
|
+
"dataMapSwitch": false,
|
|
3770
|
+
"size": "lg"
|
|
3771
|
+
},
|
|
3772
|
+
"actionType": "dialog"
|
|
3689
3773
|
}
|
|
3690
3774
|
]
|
|
3691
3775
|
}
|
|
3692
|
-
}
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
};
|
|
3779
|
+
|
|
3780
|
+
function fields$1(){
|
|
3781
|
+
return [
|
|
3782
|
+
"label",
|
|
3783
|
+
"name",
|
|
3784
|
+
"object_name",
|
|
3785
|
+
"filter_scope",
|
|
3786
|
+
"show_count",
|
|
3787
|
+
"columns.$.field",
|
|
3788
|
+
"columns.$.width",
|
|
3789
|
+
"sort.$.field_name",
|
|
3790
|
+
"sort.$.order",
|
|
3791
|
+
"filters",
|
|
3792
|
+
"mobile_columns.$.field",
|
|
3793
|
+
"searchable_fields.$.field",
|
|
3794
|
+
"is_system",
|
|
3795
|
+
"shared"
|
|
3796
|
+
]
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
function fieldsExtend$4(){
|
|
3800
|
+
return {
|
|
3801
|
+
"label": {
|
|
3802
|
+
"is_wide": true
|
|
3803
|
+
},
|
|
3804
|
+
"name": {
|
|
3805
|
+
"amis": {
|
|
3806
|
+
"hidden": true
|
|
3807
|
+
}
|
|
3808
|
+
},
|
|
3809
|
+
"object_name": {
|
|
3810
|
+
"amis": {
|
|
3811
|
+
"hidden": true
|
|
3812
|
+
}
|
|
3813
|
+
},
|
|
3814
|
+
"filter_scope": {
|
|
3815
|
+
"amis": {
|
|
3816
|
+
"hidden": true
|
|
3817
|
+
}
|
|
3818
|
+
},
|
|
3819
|
+
"columns": {
|
|
3820
|
+
"amis": {
|
|
3821
|
+
"hidden": true
|
|
3822
|
+
}
|
|
3823
|
+
},
|
|
3824
|
+
"filter_fields": {
|
|
3825
|
+
"amis": {
|
|
3826
|
+
"hidden": true
|
|
3827
|
+
}
|
|
3828
|
+
},
|
|
3829
|
+
"scrolling_mode": {
|
|
3830
|
+
"amis": {
|
|
3831
|
+
"hidden": true
|
|
3832
|
+
}
|
|
3833
|
+
},
|
|
3834
|
+
"sort": {
|
|
3835
|
+
"amis": {
|
|
3836
|
+
"hidden": true
|
|
3837
|
+
}
|
|
3838
|
+
},
|
|
3839
|
+
"show_count": {
|
|
3840
|
+
"amis": {
|
|
3841
|
+
"hidden": true
|
|
3842
|
+
}
|
|
3843
|
+
},
|
|
3844
|
+
"type": {
|
|
3845
|
+
"amis": {
|
|
3846
|
+
"hidden": true
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3849
|
+
"shared": {
|
|
3850
|
+
"amis": {
|
|
3851
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
const getCopyListviewButtonSchema = ()=>{
|
|
3858
|
+
return {
|
|
3859
|
+
"type": "button",
|
|
3860
|
+
"label": "复制",
|
|
3709
3861
|
"onEvent": {
|
|
3710
3862
|
"click": {
|
|
3863
|
+
"weight": 0,
|
|
3711
3864
|
"actions": [
|
|
3712
3865
|
{
|
|
3713
|
-
"
|
|
3714
|
-
|
|
3866
|
+
"dialog": {
|
|
3867
|
+
"type": "dialog",
|
|
3868
|
+
"title": "复制 列表视图",
|
|
3869
|
+
"data": {
|
|
3870
|
+
"&": "$$",
|
|
3871
|
+
"listName": "${listName}",
|
|
3872
|
+
"targetObjectName": "${objectName}",
|
|
3873
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
3874
|
+
"appId": "${appId}",
|
|
3875
|
+
"global": "${global}"
|
|
3876
|
+
},
|
|
3877
|
+
"body": [
|
|
3878
|
+
{
|
|
3879
|
+
"type": "steedos-object-form",
|
|
3880
|
+
"label": "对象表单",
|
|
3881
|
+
"objectApiName": "object_listviews",
|
|
3882
|
+
"recordId": "",
|
|
3883
|
+
"mode": "edit",
|
|
3884
|
+
"defaultData": {
|
|
3885
|
+
"&": "${list_view}",
|
|
3886
|
+
"name":"",
|
|
3887
|
+
"label": "${list_view.label} 的副本",
|
|
3888
|
+
"shared":false
|
|
3889
|
+
},
|
|
3890
|
+
"fieldsExtend": fieldsExtend$3(),
|
|
3891
|
+
"fields": fields(),
|
|
3892
|
+
"onEvent": {
|
|
3893
|
+
"submitSucc": {
|
|
3894
|
+
"weight": 0,
|
|
3895
|
+
"actions": [
|
|
3896
|
+
{
|
|
3897
|
+
"args": {
|
|
3898
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3899
|
+
"blank": false
|
|
3900
|
+
},
|
|
3901
|
+
"actionType": "url",
|
|
3902
|
+
}
|
|
3903
|
+
]
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
],
|
|
3908
|
+
"showCloseButton": true,
|
|
3909
|
+
"showErrorMsg": true,
|
|
3910
|
+
"showLoading": true,
|
|
3911
|
+
"closeOnEsc": false,
|
|
3912
|
+
"dataMapSwitch": false,
|
|
3913
|
+
"size": "lg"
|
|
3914
|
+
},
|
|
3915
|
+
"actionType": "dialog"
|
|
3715
3916
|
}
|
|
3716
3917
|
]
|
|
3717
3918
|
}
|
|
3718
3919
|
}
|
|
3719
|
-
|
|
3720
|
-
|
|
3920
|
+
}
|
|
3921
|
+
};
|
|
3922
|
+
|
|
3923
|
+
function fields(){
|
|
3924
|
+
return [
|
|
3925
|
+
"label",
|
|
3926
|
+
"name",
|
|
3927
|
+
"object_name",
|
|
3928
|
+
"filter_scope",
|
|
3929
|
+
"show_count",
|
|
3930
|
+
"columns.$.field",
|
|
3931
|
+
"columns.$.width",
|
|
3932
|
+
"sort.$.field_name",
|
|
3933
|
+
"sort.$.order",
|
|
3934
|
+
"filters",
|
|
3935
|
+
"mobile_columns.$.field",
|
|
3936
|
+
"searchable_fields.$.field",
|
|
3937
|
+
"is_system",
|
|
3938
|
+
"shared"
|
|
3721
3939
|
]
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
"
|
|
3738
|
-
}
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
"
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
function fieldsExtend$3(){
|
|
3943
|
+
return {
|
|
3944
|
+
"label": {
|
|
3945
|
+
"is_wide": true
|
|
3946
|
+
},
|
|
3947
|
+
"name": {
|
|
3948
|
+
"is_wide": true,
|
|
3949
|
+
"amis": {
|
|
3950
|
+
"hidden": true
|
|
3951
|
+
}
|
|
3952
|
+
},
|
|
3953
|
+
"object_name": {
|
|
3954
|
+
"amis": {
|
|
3955
|
+
"hidden": true
|
|
3956
|
+
}
|
|
3957
|
+
},
|
|
3958
|
+
"filter_scope": {
|
|
3959
|
+
"amis": {
|
|
3960
|
+
"hidden": true
|
|
3961
|
+
}
|
|
3962
|
+
},
|
|
3963
|
+
"columns": {
|
|
3964
|
+
"amis": {
|
|
3965
|
+
"hidden": true
|
|
3966
|
+
}
|
|
3967
|
+
},
|
|
3968
|
+
"filter_fields": {
|
|
3969
|
+
"amis": {
|
|
3970
|
+
"hidden": true
|
|
3971
|
+
}
|
|
3972
|
+
},
|
|
3973
|
+
"scrolling_mode": {
|
|
3974
|
+
"amis": {
|
|
3975
|
+
"hidden": true
|
|
3976
|
+
}
|
|
3977
|
+
},
|
|
3978
|
+
"sort": {
|
|
3979
|
+
"amis": {
|
|
3980
|
+
"hidden": true
|
|
3981
|
+
}
|
|
3982
|
+
},
|
|
3983
|
+
"show_count": {
|
|
3984
|
+
"amis": {
|
|
3985
|
+
"hidden": true
|
|
3986
|
+
}
|
|
3987
|
+
},
|
|
3988
|
+
"type": {
|
|
3989
|
+
"amis": {
|
|
3990
|
+
"hidden": true
|
|
3991
|
+
}
|
|
3992
|
+
},
|
|
3993
|
+
"shared": {
|
|
3994
|
+
"amis": {
|
|
3995
|
+
"visibleOn": "${global.user.is_space_admin}"
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
|
|
4001
|
+
const getRenameListviewButtonSchema = ()=>{
|
|
4002
|
+
return {
|
|
3746
4003
|
"type": "button",
|
|
3747
|
-
"label": "",
|
|
3748
|
-
"
|
|
3749
|
-
"align": "right",
|
|
3750
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3751
|
-
"tooltipPlacement": "bottom",
|
|
3752
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
3753
|
-
"tooltip": "导出Excel",
|
|
4004
|
+
"label": "重命名",
|
|
4005
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3754
4006
|
"onEvent": {
|
|
3755
4007
|
"click": {
|
|
3756
4008
|
"weight": 0,
|
|
3757
4009
|
"actions": [
|
|
3758
4010
|
{
|
|
3759
|
-
"
|
|
3760
|
-
"
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
"
|
|
3764
|
-
"
|
|
3765
|
-
"
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
"
|
|
4011
|
+
"dialog": {
|
|
4012
|
+
"type": "dialog",
|
|
4013
|
+
"title": "重命名 列表视图",
|
|
4014
|
+
"data": {
|
|
4015
|
+
"targetObjectName": "${objectName}",
|
|
4016
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4017
|
+
"appId": "${appId}"
|
|
4018
|
+
},
|
|
4019
|
+
"body": [
|
|
4020
|
+
{
|
|
4021
|
+
"type": "steedos-object-form",
|
|
4022
|
+
"label": "对象表单",
|
|
4023
|
+
"objectApiName": "object_listviews",
|
|
4024
|
+
"recordId": "${recordId}",
|
|
4025
|
+
"mode": "edit",
|
|
4026
|
+
"fields": [
|
|
4027
|
+
"label"
|
|
4028
|
+
],
|
|
4029
|
+
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4030
|
+
"onEvent": {
|
|
4031
|
+
"submitSucc": {
|
|
4032
|
+
"weight": 0,
|
|
4033
|
+
"actions": [
|
|
4034
|
+
{
|
|
4035
|
+
"args": {
|
|
4036
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4037
|
+
"blank": false
|
|
4038
|
+
},
|
|
4039
|
+
"actionType": "url",
|
|
4040
|
+
},
|
|
4041
|
+
]
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
3771
4044
|
}
|
|
3772
|
-
|
|
4045
|
+
],
|
|
4046
|
+
"showCloseButton": true,
|
|
4047
|
+
"showErrorMsg": true,
|
|
4048
|
+
"showLoading": true,
|
|
4049
|
+
"size": "lg"
|
|
3773
4050
|
},
|
|
3774
|
-
"actionType": "
|
|
4051
|
+
"actionType": "dialog"
|
|
3775
4052
|
}
|
|
3776
4053
|
]
|
|
3777
4054
|
}
|
|
3778
4055
|
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
4056
|
+
}
|
|
4057
|
+
};
|
|
4058
|
+
|
|
4059
|
+
const getSetListviewShareButtonSchema = ()=>{
|
|
4060
|
+
return {
|
|
3783
4061
|
"type": "button",
|
|
3784
|
-
"
|
|
3785
|
-
"
|
|
4062
|
+
"label": "共享设置",
|
|
4063
|
+
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
3786
4064
|
"onEvent": {
|
|
3787
4065
|
"click": {
|
|
4066
|
+
"weight": 0,
|
|
3788
4067
|
"actions": [
|
|
3789
4068
|
{
|
|
3790
|
-
"
|
|
3791
|
-
|
|
4069
|
+
"dialog": {
|
|
4070
|
+
"type": "dialog",
|
|
4071
|
+
"title": "共享设置",
|
|
4072
|
+
"data": {
|
|
4073
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4074
|
+
},
|
|
4075
|
+
"body": [
|
|
4076
|
+
{
|
|
4077
|
+
"type": "steedos-object-form",
|
|
4078
|
+
"label": "对象表单",
|
|
4079
|
+
"objectApiName": "object_listviews",
|
|
4080
|
+
"recordId": "${recordId}",
|
|
4081
|
+
"mode": "edit",
|
|
4082
|
+
"fields": [
|
|
4083
|
+
"shared"
|
|
4084
|
+
]
|
|
4085
|
+
}
|
|
4086
|
+
],
|
|
4087
|
+
"showCloseButton": true,
|
|
4088
|
+
"showErrorMsg": true,
|
|
4089
|
+
"showLoading": true,
|
|
4090
|
+
"closeOnEsc": false,
|
|
4091
|
+
"dataMapSwitch": false,
|
|
4092
|
+
"size": "md"
|
|
4093
|
+
},
|
|
4094
|
+
"actionType": "dialog"
|
|
3792
4095
|
}
|
|
3793
4096
|
]
|
|
3794
4097
|
}
|
|
3795
4098
|
}
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
"
|
|
3802
|
-
"
|
|
3803
|
-
"
|
|
3804
|
-
"
|
|
3805
|
-
{
|
|
3806
|
-
"
|
|
3807
|
-
"
|
|
4099
|
+
}
|
|
4100
|
+
};
|
|
4101
|
+
|
|
4102
|
+
const getSetListviewFiltersButtonSchema = ()=>{
|
|
4103
|
+
return {
|
|
4104
|
+
"type": "button",
|
|
4105
|
+
"label": "过滤设置",
|
|
4106
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4107
|
+
"onEvent": {
|
|
4108
|
+
"click": {
|
|
4109
|
+
"weight": 0,
|
|
4110
|
+
"actions": [
|
|
3808
4111
|
{
|
|
3809
|
-
"
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
"
|
|
3813
|
-
"
|
|
3814
|
-
"
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
4112
|
+
"dialog": {
|
|
4113
|
+
"type": "dialog",
|
|
4114
|
+
"title": "过滤设置",
|
|
4115
|
+
"data": {
|
|
4116
|
+
"targetObjectName": "${objectName}",
|
|
4117
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4118
|
+
"listName": "${listName}",
|
|
4119
|
+
"appId": "${appId}"
|
|
4120
|
+
},
|
|
4121
|
+
"body": [
|
|
4122
|
+
{
|
|
4123
|
+
"type": "steedos-object-form",
|
|
4124
|
+
"label": "对象表单",
|
|
4125
|
+
"objectApiName": "object_listviews",
|
|
4126
|
+
"recordId": "${recordId}",
|
|
4127
|
+
"mode": "edit",
|
|
4128
|
+
"fields": [
|
|
4129
|
+
"filters"
|
|
4130
|
+
],
|
|
4131
|
+
"initApiAdaptor": initApiAdaptor$2(),
|
|
4132
|
+
"apiRequestAdaptor": apiRequestAdaptor$2(),
|
|
4133
|
+
"fieldsExtend": fieldsExtend$2(),
|
|
4134
|
+
"onEvent": {
|
|
4135
|
+
"submitSucc": {
|
|
4136
|
+
"weight": 0,
|
|
4137
|
+
"actions": [
|
|
3828
4138
|
{
|
|
3829
|
-
"
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
"recordId": "",
|
|
3833
|
-
"mode": "edit",
|
|
3834
|
-
"defaultData": {
|
|
3835
|
-
"&": "${list_view}",
|
|
3836
|
-
"name":"",
|
|
3837
|
-
"label":"",
|
|
3838
|
-
"filters":"",
|
|
3839
|
-
"shared":false
|
|
3840
|
-
},
|
|
3841
|
-
"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}",
|
|
3842
|
-
"fields": [
|
|
3843
|
-
"label",
|
|
3844
|
-
"name",
|
|
3845
|
-
"object_name",
|
|
3846
|
-
"filter_scope",
|
|
3847
|
-
"show_count",
|
|
3848
|
-
"columns.$.field",
|
|
3849
|
-
"columns.$.width",
|
|
3850
|
-
"sort.$.field_name",
|
|
3851
|
-
"sort.$.order",
|
|
3852
|
-
"filters",
|
|
3853
|
-
"mobile_columns.$.field",
|
|
3854
|
-
"searchable_fields.$.field",
|
|
3855
|
-
"is_system",
|
|
3856
|
-
"shared"
|
|
3857
|
-
],
|
|
3858
|
-
"onEvent": {
|
|
3859
|
-
"submitSucc": {
|
|
3860
|
-
"weight": 0,
|
|
3861
|
-
"actions": [
|
|
3862
|
-
{
|
|
3863
|
-
"args": {
|
|
3864
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
3865
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
3866
|
-
"blank": false
|
|
3867
|
-
},
|
|
3868
|
-
"actionType": "url",
|
|
3869
|
-
}
|
|
3870
|
-
]
|
|
3871
|
-
}
|
|
3872
|
-
},
|
|
3873
|
-
"messages": {
|
|
3874
|
-
"success": "成功",
|
|
3875
|
-
"failed": "失败"
|
|
4139
|
+
"args": {
|
|
4140
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4141
|
+
"blank": false
|
|
3876
4142
|
},
|
|
4143
|
+
"actionType": "url",
|
|
3877
4144
|
}
|
|
3878
|
-
]
|
|
3879
|
-
|
|
3880
|
-
"showErrorMsg": true,
|
|
3881
|
-
"showLoading": true,
|
|
3882
|
-
"closeOnEsc": false,
|
|
3883
|
-
"dataMapSwitch": false,
|
|
3884
|
-
"size": "lg"
|
|
3885
|
-
},
|
|
3886
|
-
"actionType": "dialog"
|
|
4145
|
+
]
|
|
4146
|
+
}
|
|
3887
4147
|
}
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
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
|
-
"label"
|
|
3998
|
-
],
|
|
3999
|
-
"fieldsExtend": "{\n \"label\":{\n \"is_wide\": true\n }\n}",
|
|
4000
|
-
"onEvent": {
|
|
4001
|
-
"submitSucc": {
|
|
4002
|
-
"weight": 0,
|
|
4003
|
-
"actions": [
|
|
4004
|
-
{
|
|
4005
|
-
"args": {
|
|
4006
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
|
|
4007
|
-
"blank": false
|
|
4008
|
-
},
|
|
4009
|
-
"actionType": "url",
|
|
4010
|
-
},
|
|
4011
|
-
]
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
],
|
|
4016
|
-
"showCloseButton": true,
|
|
4017
|
-
"showErrorMsg": true,
|
|
4018
|
-
"showLoading": true,
|
|
4019
|
-
"size": "lg"
|
|
4020
|
-
},
|
|
4021
|
-
"actionType": "dialog"
|
|
4022
|
-
}
|
|
4023
|
-
]
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
},
|
|
4027
|
-
{
|
|
4028
|
-
"type": "button",
|
|
4029
|
-
"label": "共享设置",
|
|
4030
|
-
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
4031
|
-
"onEvent": {
|
|
4032
|
-
"click": {
|
|
4033
|
-
"weight": 0,
|
|
4034
|
-
"actions": [
|
|
4035
|
-
{
|
|
4036
|
-
"dialog": {
|
|
4037
|
-
"type": "dialog",
|
|
4038
|
-
"title": "共享设置",
|
|
4039
|
-
"data": {
|
|
4040
|
-
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4041
|
-
},
|
|
4042
|
-
"body": [
|
|
4043
|
-
{
|
|
4044
|
-
"type": "steedos-object-form",
|
|
4045
|
-
"label": "对象表单",
|
|
4046
|
-
"objectApiName": "object_listviews",
|
|
4047
|
-
"recordId": "${recordId}",
|
|
4048
|
-
"mode": "edit",
|
|
4049
|
-
"fields": [
|
|
4050
|
-
"shared"
|
|
4051
|
-
]
|
|
4052
|
-
}
|
|
4053
|
-
],
|
|
4054
|
-
"showCloseButton": true,
|
|
4055
|
-
"showErrorMsg": true,
|
|
4056
|
-
"showLoading": true,
|
|
4057
|
-
"closeOnEsc": false,
|
|
4058
|
-
"dataMapSwitch": false,
|
|
4059
|
-
"size": "md"
|
|
4060
|
-
},
|
|
4061
|
-
"actionType": "dialog"
|
|
4062
|
-
}
|
|
4063
|
-
]
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
|
-
},
|
|
4067
|
-
{
|
|
4068
|
-
"type": "button",
|
|
4069
|
-
"label": "过滤设置",
|
|
4070
|
-
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4071
|
-
"onEvent": {
|
|
4072
|
-
"click": {
|
|
4073
|
-
"weight": 0,
|
|
4074
|
-
"actions": [
|
|
4075
|
-
{
|
|
4076
|
-
"dialog": {
|
|
4077
|
-
"type": "dialog",
|
|
4078
|
-
"title": "过滤设置",
|
|
4079
|
-
"data": {
|
|
4080
|
-
"targetObjectName": "${objectName}",
|
|
4081
|
-
"objectName": "${objectName}",
|
|
4082
|
-
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4083
|
-
"listName": "${listName}",
|
|
4084
|
-
"appId": "${appId}"
|
|
4085
|
-
},
|
|
4086
|
-
"body": [
|
|
4087
|
-
{
|
|
4088
|
-
"type": "steedos-object-form",
|
|
4089
|
-
"label": "对象表单",
|
|
4090
|
-
"objectApiName": "object_listviews",
|
|
4091
|
-
"recordId": "${recordId}",
|
|
4092
|
-
"mode": "edit",
|
|
4093
|
-
"fields": [
|
|
4094
|
-
"filters"
|
|
4095
|
-
],
|
|
4096
|
-
"initApiRequestAdaptor": "",
|
|
4097
|
-
"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;",
|
|
4098
|
-
"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",
|
|
4099
|
-
"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}",
|
|
4100
|
-
"onEvent": {
|
|
4101
|
-
"submitSucc": {
|
|
4102
|
-
"weight": 0,
|
|
4103
|
-
"actions": [
|
|
4104
|
-
{
|
|
4105
|
-
"args": {
|
|
4106
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4107
|
-
"blank": false
|
|
4108
|
-
},
|
|
4109
|
-
"actionType": "url",
|
|
4110
|
-
}
|
|
4111
|
-
]
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
}
|
|
4115
|
-
],
|
|
4116
|
-
"showCloseButton": true,
|
|
4117
|
-
"showErrorMsg": true,
|
|
4118
|
-
"showLoading": true,
|
|
4119
|
-
"closeOnEsc": false,
|
|
4120
|
-
"dataMapSwitch": false,
|
|
4121
|
-
"size": "lg"
|
|
4122
|
-
},
|
|
4123
|
-
"actionType": "dialog"
|
|
4124
|
-
}
|
|
4125
|
-
]
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
|
-
},
|
|
4148
|
+
}
|
|
4149
|
+
],
|
|
4150
|
+
"showCloseButton": true,
|
|
4151
|
+
"showErrorMsg": true,
|
|
4152
|
+
"showLoading": true,
|
|
4153
|
+
"closeOnEsc": false,
|
|
4154
|
+
"dataMapSwitch": false,
|
|
4155
|
+
"size": "lg"
|
|
4156
|
+
},
|
|
4157
|
+
"actionType": "dialog"
|
|
4158
|
+
}
|
|
4159
|
+
]
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
};
|
|
4164
|
+
|
|
4165
|
+
|
|
4166
|
+
function initApiAdaptor$2(){
|
|
4167
|
+
return `
|
|
4168
|
+
const recordId_tmp = api.body.recordId;
|
|
4169
|
+
let data_tmp;
|
|
4170
|
+
if (recordId_tmp) {
|
|
4171
|
+
data_tmp = payload.data;
|
|
4172
|
+
// 数据格式转换
|
|
4173
|
+
if (data_tmp) {
|
|
4174
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4175
|
+
try {
|
|
4176
|
+
data_tmp.filters = JSON.parse(data_tmp.filters);
|
|
4177
|
+
} catch (e) { }
|
|
4178
|
+
}
|
|
4179
|
+
|
|
4180
|
+
if (data_tmp.filters && lodash.isString(data_tmp.filters)) {
|
|
4181
|
+
data_tmp._filters_type_controller = 'function';
|
|
4182
|
+
} else {
|
|
4183
|
+
data_tmp._filters_type_controller = 'conditions'
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4186
|
+
if (data_tmp._filters_type_controller === 'conditions') {
|
|
4187
|
+
data_tmp._filters_conditions = window.amisConvert.filtersToConditions(data_tmp.filters || []);
|
|
4188
|
+
data_tmp.filters = data_tmp._filters_conditions;
|
|
4189
|
+
} else {
|
|
4190
|
+
data_tmp._filters_function = data_tmp.filters;
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
for (key in data_tmp) {
|
|
4195
|
+
if (data_tmp[key] === null) {
|
|
4196
|
+
delete data_tmp[key];
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
payload.data = Object.assign(payload.data, data_tmp);
|
|
4200
|
+
delete payload.extensions;
|
|
4201
|
+
return payload;
|
|
4202
|
+
`
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
function apiRequestAdaptor$2(){
|
|
4206
|
+
return `
|
|
4207
|
+
const recordId = api.body.recordId;
|
|
4208
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
4209
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData.filters);
|
|
4210
|
+
} else {
|
|
4211
|
+
formData.filters = formData._filters_function || null;
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
delete formData._filters_type_controller;
|
|
4215
|
+
delete formData._filters_conditions;
|
|
4216
|
+
delete formData._filters_function;
|
|
4217
|
+
|
|
4218
|
+
query = 'mutation{record: ' + objectName + '__insert(doc: {__saveData}){_id}}';
|
|
4219
|
+
if (api.body.recordId) {
|
|
4220
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4221
|
+
};
|
|
4222
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4223
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4224
|
+
return api;
|
|
4225
|
+
`
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
function fieldsExtend$2(){
|
|
4229
|
+
return {
|
|
4230
|
+
"filters": {
|
|
4231
|
+
"visible_on": "true",
|
|
4232
|
+
"amis": {
|
|
4233
|
+
"type": "condition-builder",
|
|
4234
|
+
"label": "条件组件1",
|
|
4235
|
+
"source": {
|
|
4236
|
+
"method": "get",
|
|
4237
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
|
|
4238
|
+
"dataType": "json",
|
|
4239
|
+
"headers": {
|
|
4240
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
|
|
4248
|
+
const getSetListviewColumnsButtonSchema = ()=>{
|
|
4249
|
+
return {
|
|
4250
|
+
"type": "button",
|
|
4251
|
+
"label": "显示的列",
|
|
4252
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4253
|
+
"onEvent": {
|
|
4254
|
+
"click": {
|
|
4255
|
+
"weight": 0,
|
|
4256
|
+
"actions": [
|
|
4129
4257
|
{
|
|
4130
|
-
"
|
|
4131
|
-
"
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
"
|
|
4135
|
-
"
|
|
4136
|
-
"
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4258
|
+
"args": {},
|
|
4259
|
+
"dialog": {
|
|
4260
|
+
"type": "dialog",
|
|
4261
|
+
"title": "显示的列",
|
|
4262
|
+
"data": {
|
|
4263
|
+
"&": "$$",
|
|
4264
|
+
"targetObjectName": "${objectName}",
|
|
4265
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4266
|
+
"listName": "${listName}",
|
|
4267
|
+
"appId": "${appId}"
|
|
4268
|
+
},
|
|
4269
|
+
"body": [
|
|
4270
|
+
{
|
|
4271
|
+
"type": "steedos-object-form",
|
|
4272
|
+
"label": "对象表单",
|
|
4273
|
+
"objectApiName": "object_listviews",
|
|
4274
|
+
"recordId": "${recordId}",
|
|
4275
|
+
"mode": "edit",
|
|
4276
|
+
"fieldsExtend": fieldsExtend$1(),
|
|
4277
|
+
"initApiAdaptor": initApiAdaptor$1(),
|
|
4278
|
+
"apiRequestAdaptor": apiRequestAdaptor$1(),
|
|
4279
|
+
"fields": [
|
|
4280
|
+
"columns",
|
|
4281
|
+
"mobile_columns"
|
|
4282
|
+
],
|
|
4283
|
+
"onEvent": {
|
|
4284
|
+
"submitSucc": {
|
|
4285
|
+
"weight": 0,
|
|
4286
|
+
"actions": [
|
|
4151
4287
|
{
|
|
4152
|
-
"
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
"
|
|
4157
|
-
"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}",
|
|
4158
|
-
"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;",
|
|
4159
|
-
"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;",
|
|
4160
|
-
"fields": [
|
|
4161
|
-
"columns",
|
|
4162
|
-
"mobile_columns"
|
|
4163
|
-
],
|
|
4164
|
-
"onEvent": {
|
|
4165
|
-
"submitSucc": {
|
|
4166
|
-
"weight": 0,
|
|
4167
|
-
"actions": [
|
|
4168
|
-
{
|
|
4169
|
-
"args": {
|
|
4170
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4171
|
-
"blank": false
|
|
4172
|
-
},
|
|
4173
|
-
"actionType": "url"
|
|
4174
|
-
}
|
|
4175
|
-
]
|
|
4176
|
-
}
|
|
4177
|
-
}
|
|
4288
|
+
"args": {
|
|
4289
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4290
|
+
"blank": false
|
|
4291
|
+
},
|
|
4292
|
+
"actionType": "url"
|
|
4178
4293
|
}
|
|
4179
|
-
]
|
|
4180
|
-
|
|
4181
|
-
"showCloseButton": true,
|
|
4182
|
-
"showErrorMsg": true,
|
|
4183
|
-
"showLoading": true,
|
|
4184
|
-
"size": "lg"
|
|
4185
|
-
},
|
|
4186
|
-
"actionType": "dialog"
|
|
4294
|
+
]
|
|
4295
|
+
}
|
|
4187
4296
|
}
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4297
|
+
}
|
|
4298
|
+
],
|
|
4299
|
+
"searchable": true,
|
|
4300
|
+
"showCloseButton": true,
|
|
4301
|
+
"showErrorMsg": true,
|
|
4302
|
+
"showLoading": true,
|
|
4303
|
+
"size": "lg"
|
|
4304
|
+
},
|
|
4305
|
+
"actionType": "dialog"
|
|
4306
|
+
}
|
|
4307
|
+
]
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
};
|
|
4312
|
+
|
|
4313
|
+
function fieldsExtend$1(){
|
|
4314
|
+
return {
|
|
4315
|
+
"columns": {
|
|
4316
|
+
"amis": {
|
|
4317
|
+
"type": "transfer",
|
|
4318
|
+
"sortable": true,
|
|
4319
|
+
"searchable": true,
|
|
4320
|
+
"source": {
|
|
4321
|
+
"method": "get",
|
|
4322
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4323
|
+
"headers": {
|
|
4324
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
},
|
|
4329
|
+
"mobile_columns": {
|
|
4330
|
+
"group": "手机端",
|
|
4331
|
+
"amis": {
|
|
4332
|
+
"type": "transfer",
|
|
4333
|
+
"sortable": true,
|
|
4334
|
+
"searchable": true,
|
|
4335
|
+
"source": {
|
|
4336
|
+
"method": "get",
|
|
4337
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/fields/options",
|
|
4338
|
+
"headers": {
|
|
4339
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
function initApiAdaptor$1(){
|
|
4348
|
+
return `
|
|
4349
|
+
const recordId_tmp = api.body.recordId;
|
|
4350
|
+
let columns_tmp = {}, mobile_columns_tmp = {};
|
|
4351
|
+
if (recordId_tmp) {
|
|
4352
|
+
columns_tmp = payload.data.columns;
|
|
4353
|
+
mobile_columns_tmp = payload.data.mobile_columns;
|
|
4354
|
+
if (columns_tmp) {
|
|
4355
|
+
columns_tmp = lodash.map(columns_tmp, 'field');
|
|
4356
|
+
}
|
|
4357
|
+
if (mobile_columns_tmp) {
|
|
4358
|
+
mobile_columns_tmp = lodash.map(mobile_columns_tmp, 'field');
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
payload.data.columns = columns_tmp;
|
|
4362
|
+
payload.data.mobile_columns = mobile_columns_tmp;
|
|
4363
|
+
|
|
4364
|
+
delete payload.extensions;
|
|
4365
|
+
return payload;
|
|
4366
|
+
`
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
function apiRequestAdaptor$1(){
|
|
4370
|
+
return `
|
|
4371
|
+
const formData_tmp = api.body.$;
|
|
4372
|
+
const objectName_tmp = api.body.objectName;
|
|
4373
|
+
const recordId_tmp = api.body.recordId;
|
|
4374
|
+
|
|
4375
|
+
if (typeof formData_tmp.columns == 'string') {
|
|
4376
|
+
formData_tmp.columns = formData_tmp.columns?.split(',');
|
|
4377
|
+
}
|
|
4378
|
+
if (typeof formData_tmp.mobile_columns == 'string') {
|
|
4379
|
+
formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');
|
|
4380
|
+
}
|
|
4381
|
+
|
|
4382
|
+
// 数据格式转换
|
|
4383
|
+
formData_tmp.columns = lodash.map(formData_tmp.columns, (item) => {
|
|
4384
|
+
return { field: item };
|
|
4385
|
+
});
|
|
4386
|
+
formData.mobile_columns = lodash.map(formData.mobile_columns, (item) => {
|
|
4387
|
+
return { field: item };
|
|
4388
|
+
});
|
|
4389
|
+
|
|
4390
|
+
let query_tmp = 'mutation{record: ' + objectName_tmp + '__insert(doc: {__saveData}){_id}}';
|
|
4391
|
+
if (api.body.recordId) {
|
|
4392
|
+
query_tmp = 'mutation{record: ' + objectName_tmp + '__update(id: "' + recordId_tmp +'", doc: {__saveData}){_id}}';
|
|
4393
|
+
};
|
|
4394
|
+
delete formData_tmp._id;
|
|
4395
|
+
let __saveData_tmp = JSON.stringify(JSON.stringify(formData_tmp));
|
|
4396
|
+
api.data = { query: query_tmp.replace('{__saveData}', __saveData_tmp) };
|
|
4397
|
+
|
|
4398
|
+
return api;
|
|
4399
|
+
`
|
|
4400
|
+
}
|
|
4401
|
+
|
|
4402
|
+
const getSetListviewSortButtonSchema = ()=>{
|
|
4403
|
+
return {
|
|
4404
|
+
"type": "button",
|
|
4405
|
+
"label": "默认排序规则",
|
|
4406
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4407
|
+
"onEvent": {
|
|
4408
|
+
"click": {
|
|
4409
|
+
"weight": 0,
|
|
4410
|
+
"actions": [
|
|
4192
4411
|
{
|
|
4193
|
-
"
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
"
|
|
4199
|
-
"
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4412
|
+
"dialog": {
|
|
4413
|
+
"type": "dialog",
|
|
4414
|
+
"title": "弹框标题",
|
|
4415
|
+
"data": {
|
|
4416
|
+
"&": "$$",
|
|
4417
|
+
"targetObjectName": "${objectName}",
|
|
4418
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4419
|
+
"listName": "${listName}",
|
|
4420
|
+
"appId": "${appId}"
|
|
4421
|
+
},
|
|
4422
|
+
"body": [
|
|
4423
|
+
{
|
|
4424
|
+
"type": "steedos-object-form",
|
|
4425
|
+
"label": "对象表单",
|
|
4426
|
+
"objectApiName": "object_listviews",
|
|
4427
|
+
"recordId": "${recordId}",
|
|
4428
|
+
"className": "",
|
|
4429
|
+
"id": "u:061f158b4c5a",
|
|
4430
|
+
"mode": "edit",
|
|
4431
|
+
"fields": [
|
|
4432
|
+
"sort",
|
|
4433
|
+
"sort.$.field_name",
|
|
4434
|
+
"sort.$.order"
|
|
4435
|
+
],
|
|
4436
|
+
"onEvent": {
|
|
4437
|
+
"submitSucc": {
|
|
4438
|
+
"weight": 0,
|
|
4439
|
+
"actions": [
|
|
4213
4440
|
{
|
|
4214
|
-
"
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
"recordId": "${recordId}",
|
|
4218
|
-
"className": "",
|
|
4219
|
-
"id": "u:061f158b4c5a",
|
|
4220
|
-
"mode": "edit",
|
|
4221
|
-
"fields": [
|
|
4222
|
-
"sort",
|
|
4223
|
-
"sort.$.field_name",
|
|
4224
|
-
"sort.$.order"
|
|
4225
|
-
],
|
|
4226
|
-
"onEvent": {
|
|
4227
|
-
"submitSucc": {
|
|
4228
|
-
"weight": 0,
|
|
4229
|
-
"actions": [
|
|
4230
|
-
{
|
|
4231
|
-
"args": {
|
|
4232
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4233
|
-
"blank": false
|
|
4234
|
-
},
|
|
4235
|
-
"actionType": "url"
|
|
4236
|
-
}
|
|
4237
|
-
]
|
|
4238
|
-
}
|
|
4441
|
+
"args": {
|
|
4442
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
|
|
4443
|
+
"blank": false
|
|
4239
4444
|
},
|
|
4240
|
-
"
|
|
4241
|
-
"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;",
|
|
4242
|
-
"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"
|
|
4445
|
+
"actionType": "url"
|
|
4243
4446
|
}
|
|
4244
|
-
]
|
|
4245
|
-
"showCloseButton": true,
|
|
4246
|
-
"showErrorMsg": true,
|
|
4247
|
-
"showLoading": true,
|
|
4248
|
-
"id": "u:d3f6947b6acf",
|
|
4249
|
-
"size": "lg"
|
|
4250
|
-
},
|
|
4251
|
-
"actionType": "dialog"
|
|
4252
|
-
}
|
|
4253
|
-
]
|
|
4254
|
-
}
|
|
4255
|
-
}
|
|
4256
|
-
},
|
|
4257
|
-
{
|
|
4258
|
-
"type": "button",
|
|
4259
|
-
"label": "删除",
|
|
4260
|
-
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4261
|
-
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4262
|
-
"onEvent": {
|
|
4263
|
-
"click": {
|
|
4264
|
-
"actions": [
|
|
4265
|
-
{
|
|
4266
|
-
"actionType": "ajax",
|
|
4267
|
-
"args": {
|
|
4268
|
-
"api": {
|
|
4269
|
-
"url": "${context.rootUrl}/graphql",
|
|
4270
|
-
"method": "post",
|
|
4271
|
-
"headers": {
|
|
4272
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4273
|
-
},
|
|
4274
|
-
"data": {
|
|
4275
|
-
"&": "$$",
|
|
4276
|
-
"uiSchema": "${uiSchema}",
|
|
4277
|
-
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4278
|
-
},
|
|
4279
|
-
"messages": {
|
|
4280
|
-
"success": "删除成功"
|
|
4281
|
-
},
|
|
4282
|
-
"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",
|
|
4283
|
-
"adaptor": "if (payload.errors) {\n payload.status = 2;\n payload.msg = payload.errors[0].message;\n}\nreturn payload;",
|
|
4284
|
-
}
|
|
4447
|
+
]
|
|
4285
4448
|
}
|
|
4286
4449
|
},
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4450
|
+
"fieldsExtend": fieldsExtend(),
|
|
4451
|
+
"initApiAdaptor": initApiAdaptor(),
|
|
4452
|
+
"apiRequestAdaptor": apiRequestAdaptor()
|
|
4453
|
+
}
|
|
4454
|
+
],
|
|
4455
|
+
"showCloseButton": true,
|
|
4456
|
+
"showErrorMsg": true,
|
|
4457
|
+
"showLoading": true,
|
|
4458
|
+
"id": "u:d3f6947b6acf",
|
|
4459
|
+
"size": "lg"
|
|
4460
|
+
},
|
|
4461
|
+
"actionType": "dialog"
|
|
4462
|
+
}
|
|
4463
|
+
]
|
|
4464
|
+
}
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
};
|
|
4468
|
+
|
|
4469
|
+
function fieldsExtend(){
|
|
4470
|
+
return {
|
|
4471
|
+
"sort": {
|
|
4472
|
+
"amis": {
|
|
4473
|
+
"type": "tabs-transfer",
|
|
4474
|
+
"sortable": true,
|
|
4475
|
+
"searchable": true,
|
|
4476
|
+
"source": {
|
|
4477
|
+
"method": "get",
|
|
4478
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${targetObjectName}/sortFields/options",
|
|
4479
|
+
"headers": {
|
|
4480
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
|
|
4488
|
+
function initApiAdaptor(){
|
|
4489
|
+
return `
|
|
4490
|
+
let sort;
|
|
4491
|
+
if (recordId) {
|
|
4492
|
+
sort = payload.data.sort;
|
|
4493
|
+
//数据格式转换
|
|
4494
|
+
if (sort instanceof Array) {
|
|
4495
|
+
sort = lodash.map(sort, (item) => {
|
|
4496
|
+
return item.field_name + ':' + (item.order || 'asc')
|
|
4497
|
+
});
|
|
4498
|
+
}
|
|
4499
|
+
}
|
|
4500
|
+
payload.data.sort = sort;
|
|
4501
|
+
delete payload.extensions;
|
|
4502
|
+
return payload;
|
|
4503
|
+
`
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
function apiRequestAdaptor(){
|
|
4507
|
+
return `
|
|
4508
|
+
const recordId = api.body.recordId;
|
|
4509
|
+
//数据格式转换
|
|
4510
|
+
if (typeof formData.sort == 'string') {
|
|
4511
|
+
formData.sort = formData.sort?.split(',');
|
|
4512
|
+
}
|
|
4513
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
4514
|
+
const arr = item.split(':');
|
|
4515
|
+
return { field_name: arr[0], order: arr[1] };
|
|
4516
|
+
});
|
|
4517
|
+
if (recordId) {
|
|
4518
|
+
query = 'mutation{record: ' + objectName + '__update(id: "' + recordId + '", doc: {__saveData}){_id}}';
|
|
4519
|
+
}
|
|
4520
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
4521
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
4522
|
+
return api;
|
|
4523
|
+
`
|
|
4524
|
+
}
|
|
4525
|
+
|
|
4526
|
+
const getDeleteListviewButtonSchema = ()=>{
|
|
4527
|
+
return {
|
|
4528
|
+
"type": "button",
|
|
4529
|
+
"label": "删除",
|
|
4530
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4531
|
+
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4532
|
+
"onEvent": {
|
|
4533
|
+
"click": {
|
|
4534
|
+
"actions": [
|
|
4535
|
+
{
|
|
4536
|
+
"actionType": "ajax",
|
|
4537
|
+
"args": {
|
|
4538
|
+
"api": {
|
|
4539
|
+
"url": "${context.rootUrl}/graphql",
|
|
4540
|
+
"method": "post",
|
|
4541
|
+
"headers": {
|
|
4542
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4543
|
+
},
|
|
4544
|
+
"data": {
|
|
4545
|
+
"&": "$$",
|
|
4546
|
+
"uiSchema": "${uiSchema}",
|
|
4547
|
+
"recordId": "${uiSchema.list_views[listName]._id}"
|
|
4548
|
+
},
|
|
4549
|
+
"messages": {
|
|
4550
|
+
"success": "删除成功"
|
|
4551
|
+
},
|
|
4552
|
+
"requestAdaptor": requestAdaptor(),
|
|
4553
|
+
"adaptor": adaptor(),
|
|
4296
4554
|
}
|
|
4297
4555
|
}
|
|
4298
4556
|
},
|
|
4299
4557
|
{
|
|
4300
|
-
"
|
|
4301
|
-
"
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4558
|
+
"actionType": "url",
|
|
4559
|
+
"args": {
|
|
4560
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/all",
|
|
4561
|
+
"blank": false
|
|
4562
|
+
},
|
|
4563
|
+
"expression": "data.delete == 1"
|
|
4564
|
+
}
|
|
4565
|
+
]
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
};
|
|
4570
|
+
|
|
4571
|
+
|
|
4572
|
+
function requestAdaptor(){
|
|
4573
|
+
return `
|
|
4574
|
+
const { recordId } = api.body;
|
|
4575
|
+
var deleteArray = [];
|
|
4576
|
+
if (recordId) { deleteArray.push(\`delete:object_listviews__delete(id: "\${recordId}")\`); }
|
|
4577
|
+
api.data = { query: \`mutation{\${deleteArray.join(',')}}\` };
|
|
4578
|
+
return api;
|
|
4579
|
+
`
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
function adaptor(){
|
|
4583
|
+
return `
|
|
4584
|
+
if (payload.errors) {
|
|
4585
|
+
payload.status = 2;
|
|
4586
|
+
payload.msg = payload.errors[0].message;
|
|
4587
|
+
}
|
|
4588
|
+
return payload;
|
|
4589
|
+
`
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
const getSettingListviewToolbarButtonSchema = ()=>{
|
|
4593
|
+
return {
|
|
4594
|
+
"type": "dropdown-button",
|
|
4595
|
+
"trigger": "click",
|
|
4596
|
+
"icon": "fa fa-cog",
|
|
4597
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4598
|
+
"align": "right",
|
|
4599
|
+
"visibleOn": "${!isLookup}",
|
|
4600
|
+
"buttons": [
|
|
4601
|
+
{
|
|
4602
|
+
"label": "列表视图操作",
|
|
4603
|
+
"children": [
|
|
4604
|
+
getNewListviewButtonSchema(),
|
|
4605
|
+
getCopyListviewButtonSchema(),
|
|
4606
|
+
getRenameListviewButtonSchema(),
|
|
4607
|
+
getSetListviewShareButtonSchema(),
|
|
4608
|
+
getSetListviewFiltersButtonSchema(),
|
|
4609
|
+
getSetListviewColumnsButtonSchema(),
|
|
4610
|
+
getSetListviewSortButtonSchema(),
|
|
4611
|
+
getDeleteListviewButtonSchema()
|
|
4311
4612
|
]
|
|
4312
4613
|
}
|
|
4313
4614
|
]
|
|
4615
|
+
}
|
|
4616
|
+
};
|
|
4617
|
+
|
|
4618
|
+
const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
4619
|
+
let displayAs = amisLib.Router.getTabDisplayAs(objectName);
|
|
4620
|
+
let buttons = [
|
|
4621
|
+
{
|
|
4622
|
+
"type": "button",
|
|
4623
|
+
"label": "表格",
|
|
4624
|
+
"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');",
|
|
4625
|
+
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
4626
|
+
"rightIconClassName": "m-l-sm"
|
|
4627
|
+
},
|
|
4628
|
+
{
|
|
4629
|
+
"type": "button",
|
|
4630
|
+
"label": "分栏视图",
|
|
4631
|
+
"onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
4632
|
+
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
4633
|
+
"rightIconClassName": "m-l-sm"
|
|
4634
|
+
}
|
|
4635
|
+
];
|
|
4636
|
+
return {
|
|
4637
|
+
"type": "dropdown-button",
|
|
4638
|
+
"icon": "fa fa-table-columns",
|
|
4639
|
+
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4640
|
+
"align": "right",
|
|
4641
|
+
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
4642
|
+
"buttons": [
|
|
4643
|
+
{
|
|
4644
|
+
"label": "显示为",
|
|
4645
|
+
"children": buttons
|
|
4646
|
+
}
|
|
4647
|
+
]
|
|
4648
|
+
};
|
|
4649
|
+
};
|
|
4650
|
+
|
|
4651
|
+
|
|
4652
|
+
const onFieldsFilterToggleScript = `
|
|
4653
|
+
const scope = event.context.scoped;
|
|
4654
|
+
const filterForm = scope.getComponents().find(function(n){
|
|
4655
|
+
return n.props.type === "form";
|
|
4656
|
+
});
|
|
4657
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
4658
|
+
return n.props.type === "service";
|
|
4659
|
+
});
|
|
4660
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
4661
|
+
let resizeWindow = function(){
|
|
4662
|
+
//触发amis crud 高度重算
|
|
4663
|
+
setTimeout(()=>{
|
|
4664
|
+
window.dispatchEvent(new Event("resize"))
|
|
4665
|
+
}, 500);
|
|
4666
|
+
}
|
|
4667
|
+
let isMobile = Steedos.isMobile();
|
|
4668
|
+
if(filterService.props.data.showFieldsFilter){
|
|
4669
|
+
if(isMobile){
|
|
4670
|
+
// 手机上只能通过取消按钮来关闭搜索栏
|
|
4671
|
+
return;
|
|
4672
|
+
}
|
|
4673
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
4674
|
+
direction: "down",
|
|
4675
|
+
name: "btn_filter_form_cancel"
|
|
4676
|
+
});
|
|
4677
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
4678
|
+
resizeWindow();
|
|
4679
|
+
});
|
|
4680
|
+
}
|
|
4681
|
+
else{
|
|
4682
|
+
filterService.setData({showFieldsFilter: true});
|
|
4683
|
+
resizeWindow();
|
|
4684
|
+
if(isMobile){
|
|
4685
|
+
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
4686
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
4687
|
+
crudService && crudService.setData({showFieldsFilter: true});
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
`;
|
|
4691
|
+
|
|
4692
|
+
|
|
4693
|
+
function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
|
|
4694
|
+
// console.log(`getObjectHeaderToolbar====>`, filterVisible)
|
|
4695
|
+
const isMobile = window.innerWidth < 768;
|
|
4696
|
+
if(isMobile){
|
|
4697
|
+
showDisplayAs = false;
|
|
4698
|
+
}
|
|
4699
|
+
if(formFactor === 'SMALL'){
|
|
4700
|
+
const onReloadScript = `
|
|
4701
|
+
const scope = event.context.scoped;
|
|
4702
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
4703
|
+
return n.props.type === "crud";
|
|
4704
|
+
});
|
|
4705
|
+
listView.handleChangePage(1);
|
|
4706
|
+
`;
|
|
4707
|
+
return [
|
|
4708
|
+
// "bulkActions",
|
|
4709
|
+
...(headerToolbarItems || []),
|
|
4710
|
+
hiddenCount ? {} :{
|
|
4711
|
+
"type": "tpl",
|
|
4712
|
+
"tpl": "${count} 个项目"
|
|
4713
|
+
},
|
|
4714
|
+
{
|
|
4715
|
+
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
4716
|
+
"type": "button",
|
|
4717
|
+
"align": "right",
|
|
4718
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4719
|
+
"label": "",
|
|
4720
|
+
"icon": "fa fa-sync",
|
|
4721
|
+
"visibleOn": "${!showFieldsFilter}",
|
|
4722
|
+
"onEvent": {
|
|
4723
|
+
"click": {
|
|
4724
|
+
"actions": [
|
|
4725
|
+
{
|
|
4726
|
+
"actionType": "custom",
|
|
4727
|
+
"script": onReloadScript
|
|
4728
|
+
}
|
|
4729
|
+
]
|
|
4730
|
+
}
|
|
4731
|
+
},
|
|
4732
|
+
},
|
|
4733
|
+
filterVisible ? {
|
|
4734
|
+
"label": "",
|
|
4735
|
+
"icon": "fa fa-search",
|
|
4736
|
+
"type": "button",
|
|
4737
|
+
"badge": {
|
|
4738
|
+
"offset": [
|
|
4739
|
+
-5,
|
|
4740
|
+
1
|
|
4741
|
+
],
|
|
4742
|
+
"size":8,
|
|
4743
|
+
"animation": true,
|
|
4744
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
4745
|
+
},
|
|
4746
|
+
"align": "right",
|
|
4747
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4748
|
+
"onEvent": {
|
|
4749
|
+
"click": {
|
|
4750
|
+
"actions": [
|
|
4751
|
+
{
|
|
4752
|
+
"actionType": "custom",
|
|
4753
|
+
"script": onFieldsFilterToggleScript
|
|
4754
|
+
}
|
|
4755
|
+
]
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
} : {},
|
|
4759
|
+
getDisplayAsButton(mainObject?.name)
|
|
4760
|
+
]
|
|
4761
|
+
}else {
|
|
4762
|
+
return [
|
|
4763
|
+
// "filter-toggler",
|
|
4764
|
+
...(headerToolbarItems || []),
|
|
4765
|
+
"bulkActions",
|
|
4766
|
+
{
|
|
4767
|
+
"type": "columns-toggler",
|
|
4768
|
+
"className": "hidden"
|
|
4769
|
+
},
|
|
4770
|
+
// {
|
|
4771
|
+
// "type": "columns-toggler",
|
|
4772
|
+
// "className": "mr-2"
|
|
4773
|
+
// },
|
|
4774
|
+
hiddenCount ? {} : {
|
|
4775
|
+
"type": "tpl",
|
|
4776
|
+
"tpl": "${count} 个项目"
|
|
4777
|
+
},
|
|
4778
|
+
{
|
|
4779
|
+
"type": "reload",
|
|
4780
|
+
"align": "right",
|
|
4781
|
+
"tooltipPlacement": "bottom",
|
|
4782
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
4314
4783
|
},
|
|
4784
|
+
getExportExcelToolbarButtonSchema(),
|
|
4785
|
+
filterVisible ? {
|
|
4786
|
+
"label": "",
|
|
4787
|
+
"icon": "fa fa-search",
|
|
4788
|
+
"type": "button",
|
|
4789
|
+
"align": "right",
|
|
4790
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4791
|
+
"onEvent": {
|
|
4792
|
+
"click": {
|
|
4793
|
+
"actions": [
|
|
4794
|
+
{
|
|
4795
|
+
"actionType": "custom",
|
|
4796
|
+
"script": onFieldsFilterToggleScript
|
|
4797
|
+
}
|
|
4798
|
+
]
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
} : {},
|
|
4802
|
+
getSettingListviewToolbarButtonSchema(),
|
|
4315
4803
|
getDisplayAsButton(showDisplayAs)
|
|
4316
4804
|
// {
|
|
4317
4805
|
// "type": "search-box",
|
|
@@ -4790,20 +5278,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4790
5278
|
}
|
|
4791
5279
|
}
|
|
4792
5280
|
|
|
4793
|
-
var searchableFilter = [];
|
|
4794
|
-
_.each(selfData, (value, key)=>{
|
|
4795
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
4796
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
4797
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
4798
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
4799
|
-
if(_.isString(value)){
|
|
4800
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
4801
|
-
}else{
|
|
4802
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
});
|
|
5281
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
4807
5282
|
|
|
4808
5283
|
if(searchableFilter.length > 0){
|
|
4809
5284
|
if(filters.length > 0 ){
|
|
@@ -6225,6 +6700,29 @@ if(typeof window != 'undefined'){
|
|
|
6225
6700
|
window.getFieldSearchable = getFieldSearchable;
|
|
6226
6701
|
}
|
|
6227
6702
|
|
|
6703
|
+
|
|
6704
|
+
function isFieldTypeSearchable(fieldType) {
|
|
6705
|
+
return !___namespace.includes(
|
|
6706
|
+
[
|
|
6707
|
+
"grid",
|
|
6708
|
+
"avatar",
|
|
6709
|
+
"image",
|
|
6710
|
+
"object",
|
|
6711
|
+
"[object]",
|
|
6712
|
+
"[Object]",
|
|
6713
|
+
"[grid]",
|
|
6714
|
+
"[text]",
|
|
6715
|
+
"audio",
|
|
6716
|
+
"file",
|
|
6717
|
+
],
|
|
6718
|
+
fieldType
|
|
6719
|
+
)
|
|
6720
|
+
}
|
|
6721
|
+
|
|
6722
|
+
if (typeof window != 'undefined') {
|
|
6723
|
+
window.isFieldTypeSearchable = isFieldTypeSearchable;
|
|
6724
|
+
}
|
|
6725
|
+
|
|
6228
6726
|
var index = /*#__PURE__*/Object.freeze({
|
|
6229
6727
|
__proto__: null,
|
|
6230
6728
|
OMIT_FIELDS: OMIT_FIELDS,
|
|
@@ -6236,6 +6734,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6236
6734
|
getSelectFieldOptions: getSelectFieldOptions,
|
|
6237
6735
|
convertSFieldToAmisField: convertSFieldToAmisField,
|
|
6238
6736
|
getFieldSearchable: getFieldSearchable,
|
|
6737
|
+
isFieldTypeSearchable: isFieldTypeSearchable,
|
|
6239
6738
|
getAmisStaticFieldType: getAmisStaticFieldType
|
|
6240
6739
|
});
|
|
6241
6740
|
|
|
@@ -6847,7 +7346,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6847
7346
|
id: `service_${id}`,
|
|
6848
7347
|
name: `page`,
|
|
6849
7348
|
data: {
|
|
6850
|
-
|
|
7349
|
+
objectName: objectSchema.name,
|
|
6851
7350
|
// _id: null,
|
|
6852
7351
|
recordPermissions: objectSchema.permissions,
|
|
6853
7352
|
uiSchema: objectSchema,
|
|
@@ -7665,20 +8164,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7665
8164
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
7666
8165
|
userFilters = [["${valueField.name}", "=", selfData.value]];
|
|
7667
8166
|
}
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
7671
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
7672
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
7673
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
7674
|
-
if(_.isString(value)){
|
|
7675
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
7676
|
-
}else{
|
|
7677
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
7678
|
-
}
|
|
7679
|
-
}
|
|
7680
|
-
}
|
|
7681
|
-
});
|
|
8167
|
+
|
|
8168
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
7682
8169
|
|
|
7683
8170
|
if(searchableFilter.length > 0){
|
|
7684
8171
|
if(userFilters.length > 0 ){
|
|
@@ -7949,20 +8436,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
7949
8436
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
7950
8437
|
filters = [["${valueField.name}", "=", selfData.value]];
|
|
7951
8438
|
}
|
|
7952
|
-
var searchableFilter = [];
|
|
7953
|
-
_.each(selfData, (value, key)=>{
|
|
7954
|
-
if(!_.isEmpty(value) || _.isBoolean(value)){
|
|
7955
|
-
if(_.startsWith(key, '__searchable__between__')){
|
|
7956
|
-
searchableFilter.push([\`\${key.replace("__searchable__between__", "")}\`, "between", value])
|
|
7957
|
-
}else if(_.startsWith(key, '__searchable__')){
|
|
7958
|
-
if(_.isString(value)){
|
|
7959
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "contains", value])
|
|
7960
|
-
}else{
|
|
7961
|
-
searchableFilter.push([\`\${key.replace("__searchable__", "")}\`, "=", value])
|
|
7962
|
-
}
|
|
7963
|
-
}
|
|
7964
|
-
}
|
|
7965
|
-
});
|
|
8439
|
+
var searchableFilter = SteedosUI.getSearchFilter(selfData) || [];
|
|
7966
8440
|
|
|
7967
8441
|
if(searchableFilter.length > 0){
|
|
7968
8442
|
if(filters.length > 0 ){
|
|
@@ -8488,7 +8962,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
8488
8962
|
* @Author: baozhoutao@steedos.com
|
|
8489
8963
|
* @Date: 2022-07-05 15:55:39
|
|
8490
8964
|
* @LastEditors: Please set LastEditors
|
|
8491
|
-
* @LastEditTime: 2023-05-
|
|
8965
|
+
* @LastEditTime: 2023-05-17 09:09:33
|
|
8492
8966
|
* @Description:
|
|
8493
8967
|
*/
|
|
8494
8968
|
|
|
@@ -8628,7 +9102,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
8628
9102
|
// } else {
|
|
8629
9103
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
8630
9104
|
// }
|
|
8631
|
-
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel);
|
|
9105
|
+
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
8632
9106
|
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
8633
9107
|
const options = {
|
|
8634
9108
|
globalFilter,
|
|
@@ -12275,6 +12749,7 @@ exports.getObjectListHeaderFirstLine = getObjectListHeaderFirstLine;
|
|
|
12275
12749
|
exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
|
|
12276
12750
|
exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
|
|
12277
12751
|
exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
|
|
12752
|
+
exports.getObjectRecordDetailRelatedListButtonsSchemas = getObjectRecordDetailRelatedListButtonsSchemas;
|
|
12278
12753
|
exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
|
|
12279
12754
|
exports.getObjectRelated = getObjectRelated;
|
|
12280
12755
|
exports.getObjectRelatedList = getObjectRelatedList;
|