<form nz-form nc-adaptive-form [formGroup]="_<%= getCamelCase(name) %>Form">

  <div nz-row [nzGutter]="24"><% formFieldList.forEach(function(field) { %>

    <div nz-col [nzSpan]="<%= field.controlSpan %>">
      <nz-form-item>
        <nz-form-label<% if (field.required) { %> nzRequired<% } %>><%= field.name %></nz-form-label>
        <nz-form-control [nzErrorTip]="controlErrorTemplate"><% if (field.controlType === 'select') { %>
          <nz-select formControlName="<%= getCamelCase(field.key) %>"
                     nzPlaceHolder="请选择<%= field.name %>"<% if (field.optionName) { %>
                     [nzLoading]="_<%= getCamelCase(field.optionName) %>OptionResource.optionLoading"<% } %>
                     nzAllowClear
                     nzShowSearch
                     [nzServerSearch]="!!_<%= getCamelCase(field.optionName) %>OptionResource.search"
                     (nzOnSearch)="_<%= getCamelCase(field.optionName) %>OptionResource.search && _<%= getCamelCase(field.optionName) %>OptionResource.search($event)"><% if (field.optionName) { %>
            <nz-option *ngFor="let <%= getCamelCase(field.optionName) %> of _<%= getCamelCase(field.optionName) %>OptionResource.optionList"
                       [nzLabel]="<%= getCamelCase(field.optionName) %>.label || <%= getCamelCase(field.optionName) %>.value"
                       [nzValue]="<%= getCamelCase(field.optionName) %>.value"></nz-option><% } %>
          </nz-select><% } else if (field.controlType === 'selectMultiple') { %>
          <nz-select formControlName="<%= getCamelCase(field.key) %>"
                     nzPlaceHolder="请选择<%= field.name %>"
                     nzMode="multiple"<% if (field.optionName) { %>
                     [nzLoading]="_<%= getCamelCase(field.optionName) %>OptionResource.optionLoading"<% } %>
                     [nzShowArrow]="true"
                     nzAllowClear
                     nzShowSearch
                     [nzServerSearch]="!!_<%= getCamelCase(field.optionName) %>OptionResource.search"
                     (nzOnSearch)="_<%= getCamelCase(field.optionName) %>OptionResource.search && _<%= getCamelCase(field.optionName) %>OptionResource.search($event)"><% if (field.optionName) { %>
            <nz-option *ngFor="let <%= getCamelCase(field.optionName) %> of _<%= getCamelCase(field.optionName) %>OptionResource.optionList"
                       [nzLabel]="<%= getCamelCase(field.optionName) %>.label || <%= getCamelCase(field.optionName) %>.value"
                       [nzValue]="<%= getCamelCase(field.optionName) %>.value"></nz-option><% } %>
          </nz-select><% } else if (field.controlType === 'datetimePicker') { %>
          <nz-date-picker formControlName="<%= getCamelCase(field.key) %>" nzPlaceHolder="请选择<%= field.name %>" nzShowTime></nz-date-picker><% } else if (field.controlType === 'datePicker') { %>
          <nz-date-picker formControlName="<%= getCamelCase(field.key) %>" nzPlaceHolder="请选择<%= field.name %>"></nz-date-picker><% } else if (field.controlType === 'switch') { %>
          <nz-switch formControlName="<%= getCamelCase(field.key) %>"></nz-switch><% } else if (field.controlType === 'inputNumber') { %>
          <nz-input-number formControlName="<%= getCamelCase(field.key) %>" nzPlaceHolder="请输入<%= field.name %>" [nzFormatter]="_formatterNumber"></nz-input-number><% } else if (field.controlType === 'textarea') { %>
          <textarea nz-input formControlName="<%= getCamelCase(field.key) %>" placeholder="请输入<%= field.name %>"></textarea><% } else { %>
          <input nz-input formControlName="<%= getCamelCase(field.key) %>" placeholder="请输入<%= field.name %>"><% } %>
        </nz-form-control>
      </nz-form-item>
    </div><% }) %>

  </div>

</form>

<ng-template #controlErrorTemplate let-control>
  <div *ngFor="let error of control.errors | keyvalue">{{ error.value }}</div>
</ng-template>
