// 部件配置对象
export const ctrlState = () => {
  return {
    controlCodeName: '{{ctrl.codeName}}',
    controlName: '{{ctrl.name}}',
    portletType: '{{ctrl.portletType}}',
    showCaption: {{ctrl.showTitleBar}},
    childControls: [
    {{~#if ctrl.psControls~}}
      {{~#each ctrl.psControls as | control |~}}
        '{{control.name}}'
      {{~/each~}}
    {{~/if~}}
    ],
    {{#if ctrl.psAppDataEntity}}
    // 实体名称
    appEntityCodeName: '{{ctrl.psAppDataEntity.codeName}}',
    {{/if}}
    {{#if ctrl.psUIActionGroup.psUIActionGroupDetails}}
    // 操作栏模型
    actionBarModelData: {
    {{#each ctrl.psUIActionGroup.psUIActionGroupDetails as | groupDetail |}}
      {{groupDetail.psUIAction.uIActionTag}} : {
        viewlogicname: '{{groupDetail.name}}',
        showCaption:{{groupDetail.showCaption}},
        actionName: '{{groupDetail.psUIAction.caption}}',
        icon: '{{groupDetail.psUIAction.psSysImage.cssClass}}',
        imgPath: '{{groupDetail.psUIAction.psSysImage.imagePath}}',
        disabled: false,
        visabled: true,
        dataAccessAction: {{#if groupDetail.psUIAction.dataAccessAction}}false{{else}}true{{/if}},
        getNoPrivDisplayMode: {{#if groupDetail.psUIAction.noPrivDisplayMode}}groupDetail.psUIAction.noPrivDisplayMode{{else}}6{{/if}},
        codeName:'{{groupDetail.psUIAction.codeName}}',
        fullCodeName:'{{groupDetail.psUIAction.fullCodeName}}',
        uIActionMode:'{{groupDetail.psUIAction.uIActionMode}}',
        uIActionTag:'{{groupDetail.psUIAction.uIActionTag}}',
        uIActionType:'{{groupDetail.psUIAction.uIActionType}}'
      },
    {{/each}}
    },
    {{/if}}
    {{#and (eq ctrl.portletType 'HTML') ctrl.pageUrl}}
    // 网页地址
    pageUrl: '{{ctrl.pageUrl}}',
    {{/and}}
    {{#eq ctrl.portletType 'RAWITEM'}}
    // 内容类型
    contentType: '{{ctrl.contentType}}',
      {{#eq ctrl.contentType 'RAW'}}
    rawContent: `{{ctrl.rawContent}}`,
      {{/eq}}
      {{#eq ctrl.contentType 'HTML'}}
    rawContent: `{{ctrl.htmlContent}}`,
      {{/eq}}
    {{/eq}}
    {{#if ctrl.rawContent}}
    // 直接内容
    rawContent: `{{ctrl.rawContent}}`,
    {{/if}}
    {{#eq ctrl.portletType 'LIST'}}
      {{#ctrl.psControls}}
    {{name}}: {
      action:{
        loadAction: '{{getPSControlAction.psAppDEMethod.codeName}}',
        removeAction: '{{removePSControlAction.psAppDEMethod.codeName}}',
        updateAction: '{{updatePSControlAction.psAppDEMethod.codeName}}',
        loadDraftAction: '{{getDraftPSControlAction.psAppDEMethod.codeName}}',
        createAction: '{{createPSControlAction.psAppDEMethod.codeName}}',
        fetchAction:'{{fetchPSControlAction.psAppDEMethod.codeName}}'
      }
    }
      {{/ctrl.psControls}}
    {{/eq}}
  }
};