<div class="list-template">
  <div class="list-template__content">
    <div class="list-template__top" nz-row>
      <div nz-col nzXl='16' class="list-template__searchBox">
        <div class="list-template__searchItem">
          <span class="label">状态：</span>
          <nz-select
            [nzDropdownMatchSelectWidth]="false"
            class="formItem"
            nzServerSearch
            nzShowSearch
            nzAllowClear
            nzPlaceHolder="请选择状态"
            [(ngModel)]="alarmStatus"
          >
            <ng-container *ngFor="let data of alarmList">
              <nz-option
                nzLabel="{{ data.name }}"
                nzValue="{{ data.id }}"
              ></nz-option>
            </ng-container>
          </nz-select>
        </div>
      	
				<div class="list-template__searchItem">
				  <span class="label">工单状态：</span>
				  <nz-select
				    [nzDropdownMatchSelectWidth]="false"
				    class="formItem"
				    nzServerSearch
				    nzShowSearch
				    nzAllowClear
				    nzPlaceHolder="请选择工单状态"
				    [(ngModel)]="incidentStatus"
				  >
				    <ng-container *ngFor="let data of gdList">
				      <nz-option
				        nzLabel="{{ data.name }}"
				        nzValue="{{ data.id }}"
				      ></nz-option>
				    </ng-container>
				  </nz-select>
				</div>
				
      	<div class="list-template__searchItem">
      	  <span class="label">告警ip：</span>
      	  <input nz-input class="formItem" placeholder="请输入告警ip" [(ngModel)]="alarmIp" />
      	</div>
      	
				<div class="list-template__searchItem">
				  <span class="label">紧急度：</span>
				  <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzShowSearch nzAllowClear
				    nzPlaceHolder="请选择紧急度" [(ngModel)]="alarmUrgency">
				    <ng-container *ngFor="let data of urgencyList">
				      <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}"></nz-option>
				    </ng-container>
				  </nz-select>
				</div>
      	
      	<div class="list-template__searchItem">
      	  <span class="label width-105">告警时间区间：</span>
      	  <nz-range-picker nzShowTime [(ngModel)]="dateRange" (nzOnCalendarChange)="onCalendarChangeDate($event)" (ngModelChange)="changeDate($event)"></nz-range-picker>
      	</div>
      </div>
      <div nz-col nzXl='6' class="list-template__btns">
        <button nz-button class="btn default" (click)='search()'>搜索</button>
        <button nz-button class="btn ml8 default" (click)="reset()">重置</button>
        <button nz-button *ngIf="coopBtns.batchRecover" class="btn ml8 default" (click)="batchRecover($event)">批量恢复</button>
				<button nz-button *ngIf="coopBtns.batchProcessing" class="btn ml8 default" (click)="batchNo($event)">批量不处理</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%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
              (nzCheckedChange)="checkAll($event)"></th>
            <th nzWidth="10%">告警id</th>
            <th nzWidth="10%">告警来源</th>
            <th nzWidth="20%">告警内容</th>
            <th nzWidth="9%">告警状态</th>
						<th nzWidth="10%">告警ip</th>
						<th nzWidth="9%">紧急度</th>
						<th nzWidth="15%">告警时间</th>
						<th nzWidth="10%">工单单号</th>
            <th nzWidth="120px">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;">
            <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
            <td>{{ data.alarmId || '-' }}</td>
            <td>{{ data.alarmSource || '-' }}</td>
            <td>{{ data.alarmContent || '-' }}</td>
            <td [ngClass]="{'red': data.alarmStatus?.value == 1, 'yellow ': data.alarmStatus?.value == 2, 'green ': data.alarmStatus?.value == 4}">{{ data.alarmStatus?.name }}</td>
						<td>{{ data.alarmIp || '-' }}</td>
						<td>{{ data.alarmUrgency?.name }}</td>
						<td>{{ data.alarmActiveTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
						<td class="text-underline" (click)="detail($event, data)">{{ data.incidentSign }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.view" (click)="look(data)">查看</span>
                <span *ngIf="coopBtns.send && data.alarmStatus.value == 1" (click)="send(data)">消息发送</span>
								<span *ngIf="coopBtns.add && (data.alarmStatus.value == 1 || data.alarmStatus.value == 3)" (click)="addOrder(data)">建单</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList(false,'page')" (nzPageSizeChange)="getList(false, 'page')">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 新增/编辑模态框 -->
<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
  <div class="modalBody">
    <div class="title">{{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></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="title">名称</nz-form-label>
          <nz-form-control nzErrorTip="请填写名称!">
            <nz-input-group>
              <input type="text" nz-input formControlName="title" placeholder="请填写名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="taskTypeIds">绑定任务类型</nz-form-label>
          <nz-form-control nzErrorTip="请选择绑定任务类型!">
            <nz-select nzMode="multiple" [nzDropdownMatchSelectWidth]="false" formControlName="taskTypeIds" nzShowSearch nzAllowClear nzPlaceHolder="请选择绑定任务类型" nzServerSearch (nzOnSearch)="changeInp($event)" (nzOpenChange)="openTasktype($event)">
              <ng-container *ngFor="let data of taskTypeList">
                <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="deptIds">绑定科室</nz-form-label>
          <nz-form-control nzErrorTip="请选择绑定科室!">
            <nz-select nzMode="multiple" [nzDropdownMatchSelectWidth]="false" formControlName="deptIds" nzShowSearch nzAllowClear nzPlaceHolder="请选择绑定科室" nzServerSearch (nzOnSearch)="changeDeptInp($event)" (nzOpenChange)="openDept($event)">
              <ng-container *ngFor="let data of deptList">
                <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="type">快捷类型</nz-form-label>
          <nz-form-control nzErrorTip="请选择快捷类型!">
            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="type" nzShowSearch nzAllowClear nzPlaceHolder="请选择快捷类型" (nzOpenChange)="openSchedule($event)">
              <ng-container *ngFor="let data of typeList">
                <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>
      </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)="hideModal()">取消</button>
    </div>
  </div>
</div>

<!-- 查看模态框 -->
<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="lookModal">
  <div class="viewModalBody">
    <div class="title">查看<i class="icon_transport transport-guanbi" (click)="close()"></i>
    </div>
    <overlay-scrollbars #osComponentRef1 class="content">
			<div class="df view-item">
				<div class="df-item">告警id：{{itemData.alarmId || '-'}}</div>
				<div class="df-item">告警ip：{{itemData.alarmIp || '-'}}</div>
				<div class="df-item">告警来源：{{itemData.alarmSource || '-'}}</div>
				<div class="df-item">告警状态：{{itemData.alarmStatus?.name || '-'}}</div>
			</div>
			<div class="df view-item">
				<div class="df-item">告警地点：{{itemData.alarmLocation || '-'}}</div>
				<div class="df-item">紧急度：{{itemData.alarmUrgency?.name  || '-'}}</div>
				<div class="df-item">告警时间：{{itemData.alarmActiveTime | date:'yyyy-MM-dd HH:mm:ss' || '-'}}</div>
			</div>
			<div class="view-item">告警内容：{{itemData.alarmContent || '-'}}</div>
			<div class="view-item">其他数据：{{itemData.alarmExtension || '-'}}</div>
			<div class="view-item">告警描述：{{itemData.alarmDescription  || '-'}}</div>
    </overlay-scrollbars>
    <div class="display_flex justify-content_flex-center">
      <button nzType="primary" nz-button (click)="close()">知道了</button>
    </div>
  </div>
</div>

<!-- 模态框 -->
<app-dialog-delete [delModal]="optModal" (hideDelModalEvent)="hideOptModal()"
 [btnLoading]="btnLoading" (confirmDelEvent)="confirmOpt()" 
 [content]="infoContent"></app-dialog-delete>

<!-- 发送模态框 -->
<app-dialog-delete
  [delModal]="sendModal"
  (hideDelModalEvent)="hideSendModal()"
  [btnLoading]="btnLoading"
  (confirmDelEvent)="confirmSend()"
  [content]="tipsMsg2"
></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>

<!-- 详情 -->
<app-incident-detail [id]="coopData.incidentId" *ngIf="detailModalShow" (closeModelHs)="closeDetailModelOrder($event)" (confirmModelHs)="confirmDetailModelOrder($event)"></app-incident-detail>

<router-outlet (deactivate)="refreshList()"></router-outlet>