<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" (nzOnSearch)="changeInp($event)" (nzOpenChange)="openOtherTasktype($event)"
            [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择关联科室"
            [(ngModel)]="searchDto.deptId">
            <ng-container *ngFor="let option of deptList">
              <nz-option *ngIf="!isLoading" [nzLabel]="option.dept + '（' + option.pcode + '）'" [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>
        </div>
        <div class="list-template__searchItem">
          <span class="label">地点名称：</span>
          <input nz-input class="formItem" [(ngModel)]="searchDto.name" placeholder="请输入地点名称" nzSize="default" />
        </div>
      </div>
      <div nz-col nzXl='6' class="list-template__btns">
        <button nz-button class="btn default" (click)='search()'>搜索</button>
        <button class="btn default ml8" (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 nzWidth="19%">地点名称</th>
            <th nzWidth="19%">关联科室（科室编码）</th>
            <th nzWidth="19%">地点编码</th>
            <th nzWidth="19%">地点电话</th>
            <th nzWidth="19%">操作</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.deptDTO?.dept }}<ng-container *ngIf="data.deptDTO?.pcode">（{{ data.deptDTO.pcode }}）</ng-container></td>
            <td>{{ data.placeCode}}</td>
            <td>{{ data.phones}}</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">
  <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="name">地点名称</nz-form-label>
          <nz-form-control nzErrorTip="请填写地点名称!">
            <nz-input-group>
              <input type="text" nz-input formControlName="name" placeholder="请填写地点名称" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptId">关联科室</nz-form-label>
          <nz-form-control nzErrorTip="请选择关联科室!">
            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="deptId" nzShowSearch nzAllowClear nzPlaceHolder="请选择关联科室" nzServerSearch (nzOnSearch)="changeInp($event)" (nzOpenChange)="openOtherTasktype($event)" [nzDisabled]="tabTypeListDisabled">
              <ng-container *ngFor="let data of deptList">
                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept + '（' + data.pcode + '）'" [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" nzFor="priority">优先级</nz-form-label>
				  <nz-form-control nzErrorTip="请选择优先级!">
				    <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="priority" nzShowSearch
				    nzPlaceHolder="请选择优先级" nzServerSearch>
				      <ng-container *ngFor="let option of priority_c_List">
				        <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 [nzSm]="6" [nzXs]="24" nzRequired nzFor="placeCode">地点编码</nz-form-label>
          <nz-form-control nzErrorTip="请填写地点编码!">
            <nz-input-group>
              <input type="text" nz-input formControlName="placeCode" placeholder="请填写地点编码" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phones">地点电话</nz-form-label>
          <nz-form-control nzErrorTip="请填写地点电话!">
            <nz-input-group>
              <input (ngModelChange)="deptsPhoneChange()" nz-input formControlName="phones" placeholder="请填写地点电话" />
            </nz-input-group>
          </nz-form-control>
        </nz-form-item>
        <nz-input-group *ngFor="let phone of deptPhones;let index = index" class="dynamic">
          <input nz-input [ngModel]="phone.phone" [ngModelOptions]="{standalone: true}" placeholder="请填写科室电话"
            (ngModelChange)="deptsPhoneChange($event,phone)" />
          <i nz-icon nzType="minus-circle-o" (click)="removeDeptPhone(index, $event)"></i>
        </nz-input-group>
        <button nz-button nzType="dashed" [disabled]="isAddDeptsPhone" class="add-button"
          (click)="addDeptPhone($event)">
          <i nz-icon nzType="plus"></i>
          添加科室号码
        </button>
      </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>
<!-- 删除模态框 -->
<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" (confirmDelEvent)="confirmDel()" content="是否确认删除？"></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>
