{
  "version": 6,
  "form": [
    {
      "page": {
        "id": "p${newId()}",
        "type": "fx-page",
        "props": {
          "title": "${title}",
          "key": "${newId()}"
        }
      },
      "graph": {
        "shape": "panel",
        "id": "root_panel",
        "type": "fx-split-panel",
        "props": {
          "horizontal": false,
          "shadow": "never",
          "size": "1200"
        },
        "children": [
          {
            "id": "${newId()}",
            "type": "fx-split-panel",
            "shape": "panel",
            "props": {
              "horizontal": false,
              "scroll": true,
              "tab": false
            },
            "children": [
              {
                "id": "${newId()}",
                "type": "fx-form-panel",
                "shape": "panel",
                "props": {
                  "size": "56",
                  "label": "标题",
                  "colNum": 2,
                  "alignY": "center",
                  "paddingLeft": 16,
                  "shadow": ""
                },
                "children": [
                  {
                    "id": "id${newId()}",
                    "type": "fx-title",
                    "props": {
                      "label": "${layout.cardMaster[0].label}",
                      "fontSize": 16,
                      "color": "#01070D",
                      "fontWeight": "bold",
                      "showPrefix": false,
                      "prefixWidth": 5,
                      "prefixHeight": 24,
                      "prefixColor": "#1E90FF"
                    }
                  }
                ]
              },
              {
                "id": "${newId()}",
                "type": "fx-form-panel",
                "shape": "panel",
                "props": {
                  "size": "0",
                  "gridTemplateColumns": "1fr 1fr 1fr",
                  "paddingTop": 10
                },
                "children": [
                  <#list layout.cardMaster[0].fields as field>
                  {
                    "id": "${field.id}",
                    "type": "${field.editor}",
                    "props": {
                      "label": "${field.label}",
                      "dataset": "${field.dataset}",
                      "required": "${field.required}",
                      <#if field.lookup??>
                        "lookup": {
                      <#list field.lookup as k, v>
                        <#if v?is_enumerable>
                          "${k}": [
                          <#list v as v1>
                            {
                            <#list v1 as vk1, vv1>
                              "${vk1}": "${vv1}"<#if vk1_has_next>,</#if>
                            </#list>
                            }
                            <#if v1_has_next>,</#if>
                          </#list>
                          ]
                        <#else>
                          "${k}": "${v}"
                        </#if>
                        <#if k_has_next>,</#if>
                      </#list>
                           },
                      </#if>
                      "field": "${field.id}",
                      "placeholder": "请输入内容",
                      "labelWidth": 150,
                      <#if (field.readonly = true)>
                        "readonly": true,
                      <#else>
                        "readonly": false,
                    </#if>
                      "affixError": true
                    },
                    "events": {}
                  }
                  <#if field_has_next>
                    <#if (param.masterCol lte 1 )>
                      <#if (field.desc != "")>
                        ,{
                          "id": "id${newId()}",
                          "type": "fx-label",
                          "props": {
                            "label": "${field.desc}",
                            "labelWidth": 0,
                            "affixError": true,
                            "labelAlign": "left"
                          }
                        }
                        ,{
                          "id": "id${newId()}",
                          "type": "fx-placeholder",
                          "props": {
                            "label": "占位"
                          },
                          "layout": {
                            "row": 1
                          }
                        }
                      <#else>
                        ,{
                          "id": "id${newId()}",
                          "type": "fx-placeholder",
                          "props": {
                            "label": "占位"
                          },
                          "layout": {
                            "row": 1
                          }
                        }
                        ,{
                          "id": "id${newId()}",
                          "type": "fx-placeholder",
                          "props": {
                            "label": "占位"
                          },
                          "layout": {
                            "row": 1
                          }
                        }
                      </#if>
                    </#if>
                    <#if (param.masterCol = 2 && ((field_index+1) % 2 = 0 ) )>
                      ,{
                        "id": "id${newId()}",
                        "type": "fx-placeholder",
                        "props": {
                          "label": "占位"
                        },
                        "layout": {
                          "row": 1
                        }
                      }
                    </#if>
                    ,
                  </#if>
                  </#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:addSubRow",
                          "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:loadSubRow",
                            "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:delSubRow",
                            "dataset": "${layout.listSub[0].dataset}",
                            "preAction": "",
                            "link": true,
                            "confirm": ""
                          }
                        }
                      ]
                    },
                    "events": {}
                  }
                ]
              },
              {
                "id": "${newId()}",
                "type": "fx-form-panel",
                "shape": "panel",
                "props": {},
                "children": []
              },
              {
                "id": "${newId()}",
                "type": "fx-form-panel",
                "shape": "panel",
                "props": {
                  "size": "16",
                  "backgroundColor": "transparent"
                },
                "children": []
              }
              <#if group_has_next>,</#if>
            ]
          },
          {
            "shape": "panel",
            "id": "form_panel",
            "type": "fx-form-panel",
            "props": {
              "colNum": 3,
              "paddingX": 5,
              "paddingY": 5,
              "size": "56",
              "alignX": "",
              "alignY": "center",
              "shadow": "always"
            },
            "children": [
              {
                "id": "id${newId()}",
                "type": "fx-button-group",
                "props": {
                  "showDropdown": false,
                  "textAlign": "center",
                  "dataset": "${layout.cardMaster[0].dataset}"
                },
                "slots": {
                  "default": [
                    {
                      "type": "fx-button",
                      "props": {
                        "label": "保存",
                        "leftIcon": "save",
                        "type": "success",
                        "action": "button:saveCard"
                      },
                      "id": "id${newId()}",
                      "events": {}
                    },
                    {
                      "type": "fx-button",
                      "props": {
                        "label": "删除",
                        "leftIcon": "delete",
                        "action": "button:delCard",
                        "type": "danger"
                      },
                      "id": "id${newId()}"
                    },
                    {
                      "type": "fx-button",
                      "props": {
                        "label": "返回",
                        "leftIcon": "return",
                        "action": "button:backList"
                      },
                      "id": "${newId()}",
                      "events": {}
                    }
                  ],
                  "dropdown": []
                },
                "layout": {
                  "row": 3,
                  "col": 3
                }
              }
            ]
          }
        ]
      }
    },
    <#if (subIndSave = true || subIndSave = "true")>
      <#assign datasetSub = layout.cardSub>
    <#else>
      <#assign datasetSub = layout.listSub>
    </#if>
    <#list datasetSub as assist_dialog>
    {
      "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 dfields = assist_dialog.fields>
              <#assign col = param.subCol>
              <#include "incModel/inc_list_dialog.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:saveSubRow",
                        "dataset": "${assist_dialog.dataset}"
                      },
                      "id": "id${newId()}"
                    },
                    {
                      "type": "fx-button",
                      "props": {
                        "label": "保存行并新增",
                        "type": "primary",
                        "action": "button:saveAddRow",
                        "dataset": "${assist_dialog.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": []
  }
}
