<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='15' class="list-template__searchBox"></div>
      <div nz-col nzXl="9" class="list-template__btns">
        <button nz-button class="btn default ml8" (click)="checkFixedTab('formManagement')">表单生成</button>
      </div>
    </div>
    <div class="list-template__bottom">
      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
        [nzLoading]="loading1">
        <thead>
          <tr class="thead">
            <th nzWidth="4%">序号</th>
            <th nzWidth="12%">表单号</th>
            <th nzWidth="12%">发起时间</th>
            <th nzWidth="12%">发起人</th>
            <th nzWidth="12%">包含类型</th>
            <th nzWidth="12%">工单数</th>
            <th nzWidth="12%">开始时间</th>
            <th nzWidth="12%">结束时间</th>
            <th nzWidth="12%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index">
            <td>{{ i + (pageIndex - 1) * pageSize + 1}}</td>
            <td>{{ data.code || '无' }}</td>
            <td>{{data.addTime?(data.addTime|date:'yyyy-MM-dd HH:mm'):'无'}}</td>
            <td>{{ data.addUserDTO?data.addUserDTO.name:'无' }}</td>
            <td>{{ data.taskTypeDTO?data.taskTypeDTO.taskName:'无' }}</td>
            <td>{{data.total}}</td>
            <td>{{data.startTime?(data.startTime|date:'yyyy-MM-dd HH:mm:ss'):'无'}}</td>
            <td>{{data.endTime?(data.endTime|date:'yyyy-MM-dd HH:mm:ss'):'无'}}</td>
            <td>
              <div class="coop">
                <button nz-button nzType="link" (click)="lookView(data)">查看视图</button>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>

<!-- 表单生成按钮todo -->
<div class="newOrder newOrder_todo display_flex justify-content_flex-center align-items_center" *ngIf="fixedTab == 'formManagement'">
  <div class="modalBody">
    <p class="title">
      表单生成
      <i class="icon_transport transport-guanbi" (click)="formManagementCancel()"></i>
    </p>
    <div class="content">
      <overlay-scrollbars [ngStyle]="{ height: '206px' }" class="conditions">
        <div nz-row>
          <div nz-col nzSpan="5">日期选择：</div>
          <div nz-col nzSpan="19">
              <nz-range-picker nzShowTime [nzAllowClear]="false" nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="dateRange"></nz-range-picker>
          </div>
        </div>
        <div nz-row class="mt8">
          <div nz-col nzSpan="5">其他临床服务：</div>
          <div nz-col nzSpan="19">
            <nz-radio-group [(ngModel)]="tasktypeId">
              <label nz-radio [nzValue]="option.id" *ngFor="let option of taskTypes">{{option.taskName}}</label>
            </nz-radio-group>
          </div>
        </div>
        <div nz-row>
          <div nz-col nzSpan="5">楼栋选择：</div>
          <div nz-col nzSpan="19">
            <nz-checkbox-group [(ngModel)]="buildings"></nz-checkbox-group>
          </div>
        </div>
      </overlay-scrollbars>
    </div>
    <div class="btns display_flex justify-content_flex-center align-items_center">
      <button
        nz-button
        class="btn"
        nzType="primary"
        (click)="saveFormManagement()"
      >
        确认
      </button>
      <button
        class="btn cancel"
        nz-button
        nzType="default"
        (click)="formManagementCancel()"
      >
        取消
      </button>
    </div>
  </div>
  </div>

<!-- 表单生成 -->
<div class="newOrder display_flex justify-content_flex-center align-items_center" *ngIf="fixedTab == 'formManagementTable'">
<div class="modalBody">
  <p class="title">
    表单生成
    <i class="icon_transport transport-guanbi" (click)="formManagementCancel()"></i>
  </p>
  <div class="content">
    <nz-table class="hospitalTable" [nzData]="formManagementList" nzSize="middle" [nzShowPagination]="false"
      [nzLoading]="formManagementLoading" [nzScroll]="{ y: '350px' }">
      <thead>
        <tr class="thead">
            <th nzWidth="8%">序号</th>
            <th nzWidth="23%">工单单号</th>
            <th nzWidth="23%">申请科室</th>
            <th nzWidth="23%">任务类型</th>
            <th nzWidth="23%">发起时间</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let data of formManagementList;let i = index;">
            <td>{{ i + (formManagementListPageIndex - 1) * formManagementListPageSize + 1}}</td>
            <td>{{ data.gdcode || '无' }}</td>
            <td>{{ data.createDeptDTO ? (data.createDeptDTO.building ? data.createDeptDTO.building.buildingName + " - " : '') + data.createDeptDTO.dept : '无' }}</td>
            <td>{{ data.taskType.taskName }}<ng-container *ngIf="data.goodsRemark">-{{data.goodsRemark}}</ng-container></td>
            <td>{{ data.startTime | date:'yyyy-MM-dd HH:mm'}}</td>
        </tr>
      </tbody>
    </nz-table>
    <div class="pagination">
      <nz-pagination [(nzPageIndex)]="formManagementListPageIndex" nzShowSizeChanger [(nzTotal)]="formManagementListLength"
        [(nzPageSize)]="formManagementListPageSize" (nzPageIndexChange)="getOtherTasktype()"
        (nzPageSizeChange)="getOtherTasktype()">
      </nz-pagination>
    </div>
  </div>
  <div class="btns display_flex justify-content_flex-center align-items_center">
    <button
      nz-button
      class="btn"
      nzType="primary"
      (click)="formManagementOk()"
      [nzLoading]="isOkLoading"
      *ngIf="formManagementList.length"
    >
      确认生成
    </button>
    <button
      class="btn cancel"
      nz-button
      nzType="default"
      (click)="formManagementCancel()"
    >
      取消
    </button>
  </div>
</div>
</div>
