<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='18' class="list-template__searchBox"></div>
      <div nz-col nzLg="6" class="list-template__btns">
        <button nz-button *ngIf="coopBtns.add" class="btn default" (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="5%">序号</th>
            <th nzWidth="15%">业务名称</th>
            <th nzWidth="15%">任务类型</th>
            <th nzWidth="15%">关联业务</th>
            <th nzWidth="15%">关联表</th>
            <th nzWidth="10%">发起时是否弹窗选择</th>
            <th nzWidth="25%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index = index">
            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
            <td>{{data.name || ''}}</td>
            <td>{{data.taskTypeDTO ? data.taskTypeDTO.taskName : ''}}</td>
            <td>{{data.relationTrans ? data.relationTrans.name : ''}}</td>
            <td>{{data.relationTable || ''}}</td>
            <td>{{data.startAlert == 1 ? '是' : '否'}}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.del&&!data.status" (click)="showDelModal(data,'您确认要删除吗？','删除','del')">删除</span>
                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</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">{{modelName}}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i></div>
      <div class="content">
        <form nz-form [formGroup]="validateForm" class="addForm">
          <nz-form-item>
            <nz-form-label [nzSpan]="24" nzRequired nzFor="name">业务名称</nz-form-label>
            <nz-form-control nzErrorTip="请输入业务名称!">
              <nz-input-group>
                <input nz-input formControlName="name" placeholder="请输入业务名称" />
              </nz-input-group>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="24" nzRequired nzFor="taskType">任务类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择任务类型!">
              <nz-select class="formItem" (nzOnSearch)="changeInp($event, 'taskType')" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择任务类型" formControlName="taskType" (nzOpenChange)="getTaskTypeList($event)">
                <ng-container *ngFor="let option of taskTypeList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="option.taskName" [nzValue]="option.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 [nzSpan]="24" nzRequired nzFor="relationTrans">业务类型</nz-form-label>
            <nz-form-control nzErrorTip="请选择业务类型!">
              <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择业务类型" formControlName="relationTrans" (nzOpenChange)="getRelationTransList($event)">
                <ng-container *ngFor="let option of relationTransList">
                  <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.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 [nzSpan]="10" nzRequired nzFor="startAlert">发起时是否弹窗选择</nz-form-label>
            <nz-form-control [nzSpan]="14" nzErrorTip="请选择发起时是否弹窗选择!">
              <nz-radio-group formControlName="startAlert">
                <label nz-radio [nzValue]="1">是</label>
                <label nz-radio [nzValue]="0">否</label>
              </nz-radio-group>
            </nz-form-control>
          </nz-form-item>
        </form>
      </div>
      <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>
  <!-- 删除模态框 -->
  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
    (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
</div>
<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>

