<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 *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</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="15%">起始任务类型</th>
            <th nzWidth="15%">生成任务类型</th>
            <th nzWidth="10%">起点科室</th>
            <th nzWidth="10%">终点科室</th>
            <th nzWidth="10%">是否复制备注</th>
            <th nzWidth="10%">抢接单</th>
            <th nzWidth="10%">默认状态</th>
            <th nzWidth="10%">是否启用</th>
            <th nzWidth="10%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let i = index">
            <td>{{ data.startTaskTypeDTO?.taskName }}</td>
            <td>{{ data.createTaskTypeDTO?.taskName}}</td>
            <td>{{ data.startDept?.name }}</td>
            <td>{{ data.endDept?.name }}</td>
            <td>{{ data.copyRemark === 1 ? '是' : '否' }}</td>
            <td>{{ data.getOrderType?.name }}</td>
            <td>{{ data.getOrderRange === 4 ? '待到达' : (data.getOrderRange === 5 ? '待送达' : '') }}</td>
            <td>{{ data.active === 1 ? '是' : '否' }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit(data)">修改</span>
                <span *ngIf="coopBtns.del" (click)="showDelModal(data.id, '您确认要删除吗？','删除','del')">删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
        </nz-pagination>
      </div>
    </div>
  </div>

  <!-- 新增/编辑模态框 -->
  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
    <div class="modalBody">
      <div class="title">{{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
      </div>
      <overlay-scrollbars #osComponentRef1 class="content">
        <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="startTaskTypeId">起始任务类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择起始任务类型!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="startTaskTypeId" nzShowSearch nzAllowClear
                nzPlaceHolder="请选择起始任务类型" nzServerSearch (nzOnSearch)="changeInpTasktype($event)"
                (nzOpenChange)="changeFormTasktype($event)">
                <ng-container *ngFor="let data of taskTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="data.taskName" [nzValue]="data.id">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="createTaskTypeId">生成任务类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择生成任务类型!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="createTaskTypeId" nzShowSearch nzAllowClear
                nzPlaceHolder="请选择生成任务类型" nzServerSearch (nzOnSearch)="changeInpTasktype($event)"
                (nzOpenChange)="changeFormTasktype($event)">
                <ng-container *ngFor="let data of taskTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="data.taskName" [nzValue]="data.id">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="startDept">起点科室</nz-form-label>
            <nz-form-control nzErrorTip="请选择起点科室!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="startDept" nzAllowClear nzPlaceHolder="请选择起点科室">
                <ng-container *ngFor="let data of keepOrderDeptTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="endDept">终点科室</nz-form-label>
            <nz-form-control nzErrorTip="请选择终点科室!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="endDept" nzAllowClear nzPlaceHolder="请选择终点科室">
                <ng-container *ngFor="let data of keepOrderDeptTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="getOrderType">抢接单</nz-form-label>
            <nz-form-control nzErrorTip="请选择抢接单!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="getOrderType" nzAllowClear nzPlaceHolder="请选择抢接单" (ngModelChange)="changeGetOrderType($event)">
                <ng-container *ngFor="let data of keepOrderGetorderTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.value">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item *ngIf="validateForm.value.getOrderType === '1'">
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="getOrderRange">默认状态</nz-form-label>
            <nz-form-control nzErrorTip="请选择默认状态!">
              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="getOrderRange" nzAllowClear nzPlaceHolder="请选择默认状态">
                <ng-container *ngFor="let data of orderRangeList">
                  <nz-option *ngIf="true" [nzLabel]="data.name" [nzValue]="data.id">
                  </nz-option>
                </ng-container>
                <nz-option *ngIf="false" nzDisabled nzCustomContent>
                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
                </nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="copyRemark">是否复制备注</nz-form-label>
            <nz-form-control nzErrorTip="请选择是否复制备注!">
              <nz-radio-group formControlName="copyRemark">
                <label nz-radio [nzValue]="1">是</label>
                <label nz-radio [nzValue]="0">否</label>
              </nz-radio-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="active">是否启用</nz-form-label>
            <nz-form-control nzErrorTip="请选择是否启用!">
              <nz-radio-group formControlName="active">
                <label nz-radio [nzValue]="1">是</label>
                <label nz-radio [nzValue]="0">否</label>
              </nz-radio-group>
            </nz-form-control>
          </nz-form-item>
        </form>
      </overlay-scrollbars>
      <div class=" display_flex justify-content_flex-center">
        <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">保存</button>
        <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
      </div>
    </div>
  </div>
</div>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>
<!-- 遮罩 -->
<app-mask *ngIf="maskFlag"></app-mask>
