<div class="panel panel-default">
  <!--标题-->
  <div class="panel-title">
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb">
        <!-- TODO -->
        <li class="breadcrumb-item">考务管理</li>
        <li class="breadcrumb-item active" aria-current="page">编排监控</li>
      </ol>
    </nav>
  </div>
  <div class="panel-body ml-sm" [hidden]="this.editShowType=='only'">
    <div class="card card-default">
      <div class="card-body">
        <!--查询条件-->
        <div class="row mb-3 ml-1" [hidden]="this.editShowType=='only'">
          <div class="col-lg-12">
            <form (ngSubmit)="framePager.goSearch()" class="form-inline">
              <div class="input-group mr-1 input-group-sm">
                <label>关键字：</label>
                <input name="keyword" [(ngModel)]="query.query" class="input-sm form-control" type="text"
                    value="" maxlength="64" placeholder="请输入查询关键字">
              </div>&nbsp;&nbsp;
              <div class="input-group mr-1 input-group-sm">
                <label>考试批次：</label>
                <select class="custom-select"  [(ngModel)]="query.exam_time_id" [ngModelOptions]="{standalone: true}">
                  <option *ngFor="let item of examTimeIdArray; let i = index" [value]="item.id">{{item.exam_year_month}}</option>
                </select>
              </div>&nbsp;&nbsp;
              <div class="input-group mr-1 input-group-sm">
                <label>考区：</label>
                <flex-select [allowClear]="true"
                  [(items)] = "masterSchoolList"
                  respDataPath= "array"
                  optionValueField="id"
                  optionTextField="org_name"
                  [(ngModel)]="query.exam_area_id"
                  placeholder="请选择"
                  [ngModelOptions]="{standalone: true}"
                  width = "40"
                  noResultsFound = "无数据"
                  >
                </flex-select>
              </div>&nbsp;&nbsp;
              <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" (click)="framePager.goSearch()">
                <i class="fa fa-search"></i> 查询</button>
              <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" (click)="reset()">
                <i class="fa fa-undo"></i> 重置</button>
            </form>
          </div>
        </div>

        <!-- 工具栏 -->
        <div class="row mb-2" [hidden]="this.editShowType=='only'">
          <div class="col-lg-12">
            <div class="pull-left">


            </div>
          </div>
        </div>

        <!--表格-->
        <div class="row">
          <div class="col-lg-12 ml-0" [hidden]="this.editShowType=='only'">
            <table class="table table-sm table-striped table-hover table-bordered bg-white">
              <thead>
                <tr>
                  <th>
                    <div class="checkbox c-checkbox">
                      <label class="nomargin">
                        <input type="checkbox" (change)="framePager.checkedMasterToggle($event)" />
                        <span class="fa fa-check"></span>
                      </label>
                    </div>
                  </th>
                  <th>序号</th>
                  <th align="center">考试批次</th>
                  <th align="center">考区代码</th>
                  <th>考区名称</th>
                 <!-- <th>考点名称</th>-->
                  <th align="center">编排时间</th>
                  <th>编排人员</th>
                  <th align="center">状态</th>
                </tr>
              </thead>
              <tbody>
                <tr *ngFor="let item of framePager.getRecords(); let i = index">
                  <td>
                    <div class="checkbox c-checkbox input-group-sm">
                      <label nomargin>
                        <input type="checkbox" [value]="item.id" [(checked)]="item.isChecked" [(ngModel)]="item.isChecked" />
                        <span class="fa fa-check"></span>
                      </label>
                    </div>
                  </td>
                  <td>{{framePager.pageStart + i}}</td>
                  <td align="center">{{item.year_code}}</td>
                  <td align="center">{{item.org_code}}</td>
                  <td>{{item.org_name}}</td>
                  <!--<td>{{item.exam_name}}</td>-->
                  <td align="center">{{item.layout_time}}</td>
                  <td>{{item.optr_name}}</td>
                  <td align="center">{{formatRow(item.layout_status)}}</td>
                </tr>
              </tbody>
            </table>
            <!-- TODO -->
            <frame-pager [url]="QUERY_URL" hideSearch="true" [autoLoad]="false" hasCheck="true" #framePager (preReqEvent)="this.search($event)"></frame-pager>
          </div>

          <!-- 编辑页面 -->
          <div class="col-lg-12" *ngIf="this.item && this.editShowType != null &&this.editShowType!='modal'">
            <ng-container *ngTemplateOutlet="editTemplateModal">
            </ng-container>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- only编辑页面 -->
  <div class="col-lg-12" *ngIf="this.item && this.editShowType != null && this.editShowType =='only'">
    <ng-container *ngTemplateOutlet="editTemplateModal">
    </ng-container>
  </div>
</div>



<ng-template #editFormTemplate>
  <form [formGroup]="formModel" *ngIf="item" class="form-validate form-horizontal" novalidate="">
    <input type="hidden" class="form-control" formControlName="id" [(ngModel)]="this.item.id" [formControl]="this.formModel.controls['id']"
    />
  </form>
</ng-template>

<ng-template #editTemplateModal>
  <div class="modal-content">
    <div class="modal-header info-success-qm">
      <div class="pull-left">
        <em class="fa-lg fas fa-edit "></em> 编辑页面
      </div>
      <button type="button" class="close" (click)="this.hideModal()">×</button>
    </div>

    <!-- 1@3 -->
    <div class="modal-body">
      <div [ngTemplateOutlet]="editFormTemplate"></div>
    </div>

    <div class="modal-footer">
      <button class="btn btn-info" (click)="this.save()">
        <i class="fa fa-info-circle"> </i> 保存
      </button>
      <button class="btn btn-default" (click)="this.hideModal()">
        <i class="icon-close"> </i> 取消
      </button>
    </div>
  </div>
</ng-template>