<#include "incModel/inc_card_flow_body_h.ftl"/>
<#list layout.cardMaster as group>
    <#assign colNum = param.rCardCol>
    {
        "id": "${newId()}",
        "type": "fx-form-panel",
        "shape": "panel",
            "props": {
            "size": "16",
            "backgroundColor": "--color-transparent"
        },
        "children": []
    },
    <#include "incModel/inc_card_fields_only.ftl"/>
</#list>
,{
    "id": "${newId()}",
    "type": "fx-form-panel",
    "shape": "panel",
    "props": {
        "size": "16",
    "backgroundColor": "--color-transparent"
    },
    "children": []
},
{
    "id": "${newId()}",
    "type": "fx-split-panel",
    "shape": "panel",
    "props": {
        "size": "56",
        "horizontal": true
    },
    "children": [
        {
            "id": "${newId()}",
            "type": "fx-form-panel",
            "shape": "panel",
            "props": {
                "size": "",
                "label": "",
                "colNum": 2,
                "alignY": "center",
                "paddingLeft": 16,
                "shadow": ""
            },
            "children": [
                {
                    "id": "id${newId()}",
                    "type": "fx-title",
                    "props": {
                        "label": "子表列表配置",
                        "fontSize": 16,
                        "color": "#01070D",
                        "fontWeight": "bold",
                        "showPrefix": false,
                        "prefixWidth": 5,
                        "prefixHeight": 24,
                        "prefixColor": "#1E90FF"
                    }
                }
            ]
        },
        {
            "id": "id${newId()}",
            "type": "fx-form-panel",
            "shape": "panel",
            "props": {
                "alignX": "right",
                "size": "150",
                "alignY": "center",
                "paddingRight": 16
            },
            "children": [
                {
                    "id": "id${newId()}",
                    "type": "fx-button",
                    "props": {
                        "label": "新增",
                        "type": "primary",
                        "action": "button:addRow",
                        "size": "default",
                        "linkType": "dialog",
                        "leftIcon": "plus",
                        "fxLink": "dialog:cardSubDialog",
                        "fxLink_text": "子表编辑卡片",
                        "preAction": "",
                        "dataset": "${layout.listSub[0].dataset}"
                    },
                    "events": {}
                }
            ]
        }
    ]
},
{
    "id": "${newId()}",
    "type": "fx-form-panel",
    "shape": "panel",
    "props": {
        "size": "400",
        "label": "子表列表",
        "colNum": 0,
        "paddingLeft": 16,
        "paddingRight": 16,
        "shadow": "",
        "paddingTop": 0
    },
    "children": [
        {
            "id": "id${newId()}",
            "type": "fx-table",
            "props": {
                "label": "子表表格",
                "border": true,
                "stripe": true,
                "showHeader": true,
                "fit": true,
                "dataset": "${layout.listSub[0].dataset}",
                "actionWidth": 150
            },
            "slots": {
                "default": [
                    <#list layout.listSub[0].fields as field>
                        {
                            "id": "id${newId()}",
                            "type": "fx-table-column",
                            "props": {
                                "field": "${field.id}",
                                "label": "${field.label}"
                            }
                        }
                        <#if field_has_next>,</#if>
                    </#list>
                ],
                "button": [
                    {
                        "id": "id${newId()}",
                        "type": "fx-button",
                        "props": {
                            "label": "编辑",
                            "type": "text",
                            "leftIcon": "edit",
                            "action": "button:loadRow",
                            "dataset": "${layout.listSub[0].dataset}",
                            "linkType": "dialog",
                            "fxLink": "dialog:cardSubDialog",
                            "fxLink_text": "子表编辑卡片"
                        }
                    },
                    {
                        "id": "id${newId()}",
                        "type": "fx-button",
                        "props": {
                            "label": "删除",
                            "type": "text",
                            "leftIcon": "delete-themes",
                            "action": "button:delRow",
                            "dataset": "${layout.listSub[0].dataset}",
                            "preAction": "",
                            "link": true,
                            "confirm": ""
                        }
                    }
                ]
            },
            "events": {}
        }
    ]
}
<#include "incModel/inc_card_flow_body_b.ftl"/>
<#--子表编辑弹窗-->
<#list layout.listSub as group>
    ,{
        "page": {
            "id": "id${newId()}",
            "type": "fx-dialog",
            "props": {
                <#if (param.cardSubTitle == "")>
                "title": "子表编辑卡片",
                <#else>
                "title": "${param.cardSubTitle}",
                </#if>
                "key": "cardSubDialog",
                "closeOnClickModal": false
            },
            "events": {}
        },
        "graph": {
            "shape": "panel",
            "id": "root_panel",
            "type": "fx-split-panel",
            "props": {
                "horizontal": false,
                "shadow": "never"
            },
            "children": [
                {
                    "id": "${newId()}",
                    "type": "fx-split-panel",
                    "shape": "panel",
                    "props": {
                        "horizontal": false,
                        "scroll": true,
                        "backgroundColor": "--color-white"
                    },
                    "children": [
                        <#assign colNum = param.subCol>
                        <#include "incModel/inc_card_fields_only.ftl"/>
                    ]
                },
                {
                    "id": "${newId()}",
                    "type": "fx-form-panel",
                    "shape": "panel",
                    "props": {
                        "size": "0"
                    },
                    "children": [
                        {
                            "id": "id${newId()}",
                            "type": "fx-divider",
                            "props": {
                                "label": "",
                                "contentPosition": "center",
                                "direction": "horizontal"
                            }
                        }
                    ]
                },
                {
                    "id": "${newId()}",
                    "type": "fx-form-panel",
                    "shape": "panel",
                    "props": {
                        "size": "56",
                        "paddingRight": 10,
                        "alignY": "center"
                    },
                    "children": [
                        {
                            "id": "id${newId()}",
                            "type": "fx-button-group",
                            "props": {
                                "menus": [],
                                "textAlign": "right"
                            },
                            "slots": {
                                "default": [
                                    {
                                        "type": "fx-button",
                                        "props": {
                                            "label": "保存",
                                            "leftIcon": "save",
                                            "type": "success",
                                            "action": "button:saveRow",
                                            "dataset": "${group.dataset}"
                                        },
                                        "id": "id${newId()}"
                                    },
                                    {
                                        "type": "fx-button",
                                        "props": {
                                            "label": "保存行并新增",
                                            "type": "primary",
                                            "action": "button:saveAddRow",
                                            "dataset": "${group.dataset}"
                                        },
                                        "id": "${newId()}",
                                        "events": {}
                                    },
                                    {
                                        "type": "fx-button",
                                        "props": {
                                            "label": "关闭",
                                            "leftIcon": "close",
                                            "type": "",
                                            "action": "button:closeDialog"
                                        },
                                        "id": "id${newId()}"
                                    }
                                ]
                            }
                        }
                    ]
                }
            ]
        }
    }
</#list>
],
    "model": [
        <#list datasets as dataset>
            <#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
        </#list>
    ],
    "option": {
        "widgetRef": [${widgetRef}],
        "vars": []
    }
}
