<!--
 * @Author: your name
 * @Date: 2021-12-24 15:38:08
 * @LastEditTime : 2022-04-15 16:42:10
 * @LastEditors  : Shiming
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\waybill-management\\components\\abnormal-appear\\abnormal-appear.component.html
-->
<page-header-wrapper title="异常上报"> </page-header-wrapper>

<nz-card>
  <div nz-row nzGutter="8">
    <!-- 查询字段小于或等于3个时，不显示伸缩按钮 -->
    <div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
      <sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false"
        (formSubmit)="search()" (formReset)="resetSF()"></sf>
    </div>

    <!-- 查询字段大于3个时，根据展开状态调整布局 -->
    <ng-container *ngIf="queryFieldCount > 4">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="isLoading && st.loading"
          (click)="search()" acl [acl-ability]="['WAYBILL-ABNORMAL-search']">查询</button>
        <button nz-button (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card>

<nz-card class="content-box">
  <nz-tabset [(nzSelectedIndex)]="selectedIndex" (nzSelectedIndexChange)="selectChange($event)">
    <nz-tab [nzTitle]="'待回复(' + tabs?.stayQuantity + ')'">
      <st #st [data]="service.$api_get_listOperatePage" [columns]="columns"
        [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
        [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
        [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false"
        [scroll]="{ x: '2000px' }">
        <ng-template st-row="exceptionCertificateFirstFilePath" let-item let-index="index">
          <div class="imgBox">
            <div *ngIf="item?.exceptionCertificateFirstFilePath">
              <app-imagelist style="width: 40px;height: 40px" [imgList]="[item?.exceptionCertificateFirstFilePath]">
              </app-imagelist>
            </div>
            <div *ngIf="item?.exceptionCertificateSecondFilePath">
              <app-imagelist style="width: 40px;height: 40px" [imgList]="[item?.exceptionCertificateSecondFilePath]">
              </app-imagelist>
            </div>
            <div *ngIf="item?.exceptionCertificateThirdFilePath">
              <app-imagelist style="width: 40px;height: 40px" [imgList]="[item?.exceptionCertificateThirdFilePath]">
              </app-imagelist>
            </div>
          </div>
        </ng-template>
      </st>
    </nz-tab>
    <nz-tab [nzTitle]="'已回复(' + tabs?.receivedQuantity + ')'">
      <st #st2 [data]="service.$api_get_listOperatePage" [columns]="columns2"
        [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams2 }"
        [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
        [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false"
        [scroll]="{ x: '2000px' }">
        <ng-template st-row="exceptionCertificateFirstFilePath" let-item let-index="index">
          <div class="imgBox">
            <div *ngIf="item?.exceptionCertificateFirstFilePath">
              <app-imagelist [imgList]="[item?.exceptionCertificateFirstFilePath]"> </app-imagelist>
            </div>
            <div *ngIf="item?.exceptionCertificateSecondFilePath">
              <app-imagelist [imgList]="[item?.exceptionCertificateSecondFilePath]"> </app-imagelist>
            </div>
            <div *ngIf="item?.exceptionCertificateThirdFilePath">
              <app-imagelist [imgList]="[item?.exceptionCertificateThirdFilePath]"> </app-imagelist>
            </div>
          </div>
        </ng-template>
      </st>
    </nz-tab>
  </nz-tabset>
</nz-card>

<ng-template #detailModal>
  <div nz-row nzGutter="8">
    <div nz-col nzSpan="24" se-container [labelWidth]="110" [col]="1">
      <se label="异常编号">
        {{itemInfo.exceptionCode}}
      </se>
      <se label="装货地">
        {{itemInfo.loadingAddressArr}}
      </se>
      <se label="卸货地">
        {{itemInfo.unloadingAddressArr}}
      </se>
      <se label="异常信息">
        {{itemInfo.exceptionContent}}
      </se>
      <se label="异常图片">
        <div style="display: flex;">
          <div *ngIf="itemInfo?.exceptionCertificateFirstFilePath" style="cursor: pointer;">
            <app-imagelist [imgList]="[itemInfo?.exceptionCertificateFirstFilePath]"> </app-imagelist>
          </div>
          <div *ngIf="itemInfo?.exceptionCertificateSecondFilePath" style="cursor: pointer;">
            <app-imagelist [imgList]="[itemInfo?.exceptionCertificateSecondFilePath]"> </app-imagelist>
          </div>
          <div *ngIf="itemInfo?.exceptionCertificateThirdFilePath" style="cursor: pointer;">
            <app-imagelist [imgList]="[itemInfo?.exceptionCertificateThirdFilePath]"> </app-imagelist>
          </div>
        </div>
      </se>
      <ng-container *ngIf="itemInfo.replyAppUserName">
        <se label="回复内容">
          {{itemInfo.replyContent}}
        </se>
        <se label="回复人">
          {{itemInfo.replyAppUserName}}
        </se>
        <se label="回复时间">
          {{itemInfo.replyTime}}
        </se>
      </ng-container>

    </div>
  </div>
</ng-template>

<ng-template #replyModal>
  <div nz-row nzGutter="8">
    <div nz-col nzSpan="24" se-container [labelWidth]="110">
      <se [col]="1" label="回复内容" required>
        <textarea nz-input rows="3" placeholder="请填写回复内容" [(ngModel)]="replyContent"
          style="width: 325px; margin-left: 14px"></textarea>
      </se>
    </div>
  </div>
</ng-template>