<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 class="list-template__searchItem">
          <span class="label">科室：</span>
          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event,'dept')" nzServerSearch nzShowSearch nzPlaceHolder="请选择科室" [(ngModel)]="dept">
            <ng-container *ngFor="let option of hospitals1">
              <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>
        </div>
        <div class="list-template__searchItem">
          <span class="label">标本名称</span>：
          <input nz-input class="formItem" [(ngModel)]="specimenName" placeholder="请输入标本名称" nzSize="default" />
        </div>
				<div class="list-template__searchItem">
				  <span class="label label--big">是否包含位置</span>：
					<nz-radio-group [(ngModel)]="containPosition">
						<label nz-radio nzValue="1">是</label>
						<label nz-radio nzValue="0">否</label>
					</nz-radio-group>
				</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.add" class="btn ml8 default" (click)="showModal()">新增</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>标本名称</th>
            <th>位置</th>
            <th>系统</th>
            <th>部位</th>
            <th>是否包含位置</th>
            <th>关联科室</th>
            <th nzWidth="120px">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of listOfData;let index=index;">
            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
            <td>{{ data.specimenName||'-' }}</td>
            <td>{{ data.position && data.position.name||'-' }}</td>
            <td>{{ data.system && data.system.name||'-'}}</td>
            <td>{{ data.organ && data.organ.name||'-' }}</td>
            <td>{{ data.containPosition==1?'是':'否' }}</td>
            <td>{{ data.dept && data.dept.dept }}</td>
            <td>
              <div class="coop">
                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
              </div>
            </td>
          </tr>
        </tbody>
      </nz-table>
      <div class="list-template__pagination">
        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
        </nz-pagination>
      </div>
    </div>
  </div>
</div>
<!-- 新增/编辑模态框 -->
<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal" (click)="clickExtra($event)">
  <div class="modalBody">
    <div class="title">常用标本名称 - {{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
    </div>
    <div class="content">
      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptId">关联科室</nz-form-label>
          <nz-form-control nzErrorTip="请选择关联科室!">
            <nz-input-group>
							<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event,'dept')" nzServerSearch nzShowSearch nzPlaceHolder="请选择关联科室" formControlName="deptId">
							  <ng-container *ngFor="let option of hospitals1">
							    <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 [nzSm]="8" [nzXs]="24" nzRequired nzFor="containPosition">是否包含位置</nz-form-label>
          <nz-form-control nzErrorTip="请选择是否包含位置!">
            <nz-input-group>
              <nz-radio-group formControlName="containPosition" (ngModelChange)="radioChange()">
              	<label nz-radio nzValue="1">是</label>
              	<label nz-radio nzValue="0">否</label>
              </nz-radio-group>
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
				<nz-form-item *ngIf="validateForm.value.containPosition==1">
				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="positionId">位置</nz-form-label>
				  <nz-form-control nzErrorTip="请填写位置!">
				    <nz-input-group>
							<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择位置" formControlName="positionId">
							  <ng-container *ngFor="let option of placeList">
							    <nz-option [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
							  </ng-container>
							</nz-select>
				    </nz-input-group>
				  </nz-form-control>
				</nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="systemId">系统</nz-form-label>
          <nz-form-control nzErrorTip="请填写系统!">
            <nz-input-group>
							<nz-select class="formItem" (ngModelChange)="systemChange()" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择系统" formControlName="systemId">
							  <ng-container *ngFor="let option of systemList">
							    <nz-option [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
							  </ng-container>
							</nz-select>
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="organId">部位</nz-form-label>
          <nz-form-control nzErrorTip="请填写部位!">
            <nz-input-group>
        			<nz-select class="formItem" (ngModelChange)="apparatusChange()" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择部位" formControlName="organId">
        			  <ng-container *ngFor="let option of apparatusList">
        			    <nz-option [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
        			  </ng-container>
        			</nz-select>
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
				<nz-form-item>
				  <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="specimenName">标本名称</nz-form-label>
						<nz-form-control nzErrorTip="请填写标本名称!" style="display: inline-block;width:100%;" class="address">
						  <nz-input-group>
						    <input class="formItem addressFocus" (ngModelChange)="specimenNameChange($event)" nz-input formControlName="specimenName" placeholder="请选择标本名称" (focus)="focusAddress()" />
						    <div class="addressList" *ngIf="validateForm.value.organId && isShowAddressList">
						      <ng-container *ngIf="!addressLoading && specimenNameList.length">
						        <div class="addressItem ellipsis-oneline" *ngFor="let item of specimenNameList" [title]="item.name" (click)="selectAddress(item.name)">{{item.name}}</div>
						      </ng-container>
						      <div *ngIf="!addressLoading && !specimenNameList.length" class="w100 h100 padding8 display_flex justify-content_flex-center align-items_center">
						        <nz-empty></nz-empty>
						      </div>
						      <div *ngIf="addressLoading" class="w100 h100 padding8 display_flex justify-content_flex-center align-items_center">
						        <nz-spin nzSimple></nz-spin>
						      </div>
						    </div>
						  </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)="submitForm()" [nzLoading]="btnLoading">确认</button>
      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
    </div>
  </div>
</div>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" 
  (confirmDelEvent)="confirmDel()" (cancelDelEvent)="cancelDel()" content="您确认要删除吗？" confirmTxt="是" cancelTxt="否">
</app-dialog-delete>

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

<!-- 查看详情 -->
<router-outlet (deactivate)="getList()"></router-outlet>

