<div class="content priority">
  <div class="contentInner">
    <div class="list-template" id="priorityTable">
      <div class="list-template__content">
        <div class="list-template__bottom">
         <div class="list-template__top" nz-row>
            <div nz-col nzLg="24" class="list-template__btns">
              <button nz-button class="btn default" (click)="addPriorityModal()">新增</button>
            </div>
          </div>
          <nz-table class="list-template__nzTable" [nzData]="priorityList" nzSize="middle" [nzShowPagination]="false"
            [nzLoading]="loading1" [nzScroll]="{ y: tablePriorityHeight + 'px' }">
            <thead>
              <tr class="thead">
                <th nzWidth="35%">科室名称</th>
                <th nzWidth="35%">故障现象</th>
                <th nzWidth="10%">处理组</th>
                <th nzWidth="10%">处理人</th>
                <th nzWidth="10%">操作</th>
              </tr>
            </thead>
            <tbody>
              <tr *ngFor="let data of priorityList;let i = index">
                <td>{{data.dept}}</td>
                <td>{{data.category}}</td>
                <td>{{data.handleGroupDTO?data.handleGroupDTO.groupName:''}}</td>
                <td>{{data.handleUserDTO?data.handleUserDTO.name:''}}</td>
                <td>
                  <div class="coop">
                    <span (click)="showDelModal(data,'您确认要删除吗？','删除','delPriority')">删除</span>
                    <span (click)="editPriority(data)">编辑</span>
                  </div>
                </td>
              </tr>
            </tbody>
          </nz-table>
					<div class="list-template__pagination">
					  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
					    (nzPageIndexChange)="getPriorityList()" (nzPageSizeChange)="getPriorityList()">
					  </nz-pagination>
					</div>
        </div>
      </div>
    </div>
  </div>
</div>

<!-- 操作成功/失败提示框 -->
<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
  [info]="promptInfo">
</app-prompt-modal>

<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>

<!-- 新增/编辑模态框 -->
<div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modalPriority">
  <div class="modalBody">
    <div class="title">{{modelName}}<i class="icon_transport transport-guanbi" (click)="hidePriorityModal()"></i></div>
    <div class="content">
      <form nz-form [formGroup]="validatePriorityForm" class="addForm">
				<nz-form-item>
				 <nz-form-label nzRequired nzFor="department" [nzSpan]="6">科室</nz-form-label>
				 <nz-form-control nzErrorTip="请选择科室!" [nzSpan]="18">
				   <nz-input-group>
				 		<nz-select class="formItem" nzMode="multiple" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event)" nzServerSearch nzShowSearch nzPlaceHolder="请选择申请科室" formControlName="department">
				 		  <ng-container *ngFor="let option of hospitals">
				 		    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
				 		  </ng-container>
				 		  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
				 		    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
				 		  </nz-option>
				 		</nz-select>
				 	</nz-input-group>
				 </nz-form-control>
				</nz-form-item>
				
        <nz-form-item>
          <nz-form-label nzFor="malfunction" [nzSpan]="6">故障现象</nz-form-label>
          <nz-form-control [nzSpan]="18">
          	<!-- <nz-cascader [nzOptions]="malfunctionData" nzMode="multiple"
          		formControlName="malfunction" 
          		nzPlaceHolder="请选择故障现象">
          	</nz-cascader> -->
						<!-- <nz-tree-select
							nzPlaceHolder="请选择故障现象"
							formControlName="malfunction" 
							[nzNodes]="malfunctionData"
							[nzMultiple]="true"
						>
						</nz-tree-select> -->
						<nz-select class="formItem" nzMode="multiple" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择故障现象" formControlName="malfunction" >
						  <ng-container *ngFor="let option of malfunctionData">
						    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
						  </ng-container>
						  <nz-option *ngIf="isDeptLoading" 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 nzRequired nzFor="handleGroup" [nzSpan]="6">处理组</nz-form-label>
           <nz-form-control nzErrorTip="请选择处理组!" [nzSpan]="18">
             <nz-input-group>
           		<nz-select class="formItem" (ngModelChange)="changeGroup($event)" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择处理组" formControlName="handleGroup">
           		  <ng-container *ngFor="let option of allUserGroup">
           		    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.groupName" [nzValue]="option.id"></nz-option>
           		  </ng-container>
           		  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
           		    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
           		  </nz-option>
           		</nz-select>
           	</nz-input-group>
           </nz-form-control>
        </nz-form-item>
				
				<nz-form-item>
					<nz-form-label nzRequired nzFor="binding" [nzSpan]="7">是否绑定人员</nz-form-label>
					<nz-form-control nzErrorTip="请选择!" [nzSpan]="17">
						<nz-radio-group formControlName="binding" (ngModelChange)="changeRadio($event)">
						  <label nz-radio nzValue="1">是</label>
						  <label nz-radio nzValue="0">否</label>
						</nz-radio-group>
					</nz-form-control>
				</nz-form-item>
				
        <nz-form-item *ngIf="validatePriorityForm.value.binding==1">
          <nz-form-label nzRequired nzFor="handleUser" [nzSpan]="6">处理人</nz-form-label>
          <nz-form-control nzErrorTip="请选择处理人!" [nzSpan]="18">
            <nz-input-group>
          		<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzPlaceHolder="请选择处理人" formControlName="handleUser">
          		  <ng-container *ngFor="let option of userData">
          		    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
          		  </ng-container>
          		  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
          		    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
          		  </nz-option>
          		</nz-select>
          	</nz-input-group>
          </nz-form-control>
        </nz-form-item>
      </form>
    </div>
    <div class=" display_flex justify-content_flex-center">
      <button nzType="primary" nz-button (click)="submitPriorityForm()" [nzLoading]="btnLoading">确认</button>
      <button class="btn cancel" nz-button nzType="default" (click)="hidePriorityModal()">取消</button>
    </div>
  </div>
</div>