<!--
 * @Author: your name
 * @Date: 2021-12-01 09:58:58
 * @LastEditTime: 2021-12-01 20:00:33
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \tms-obc-web\src\app\routes\supply-goods\components\carload\carload.component.html
-->

<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"
        (formSubmit)="st?.load(1)"
        (formReset)="resetSF()"
      ></sf>
    
    </div>
    <!-- [loading]="service.http.loading" -->

    <!-- 查询字段大于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"  (click)="st?.load(1)">查询</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>
  <div class="actionAreaWrap">
    <button nz-button (click)="orderExport()" nzType="primary">导入货源</button>
  </div>
  <nz-tabset [nzTabPosition]="'top'" [nzType]="'card'" class="table" [nzSelectedIndex]="nzSelectedIndex">
    <nz-tab *ngFor="let tab of tabs; let i = index" [nzTitle]="tab" (nzClick)="tabChange(i)">
      <nz-table
        #nzTable
        [nzData]="listData"
        nzTableLayout="fixed"
        [nzLoading]="loading"
        [nzTotal]="total"
        [nzBordered]="true"
        [nzScroll]="{ x: '1400px' }"
        [nzFrontPagination]="false"
        [nzPageSize]="pageSize"
        [nzPageIndex]="pageIndex"
        (nzPageIndexChange)="changePageIndex($event)"
        [nzShowTotal]="totalTemplate"
        [nzShowSizeChanger]="true"
        (nzPageSizeChange)="changePageSize($event)"
        [nzPageSizeOptions]="[10, 20, 30, 50, 100, 200, 300, 500, 1000]"
      >
        <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
        <thead>
          <tr>
            <th nzAlign="center"  nzWidth="100px">货源编号</th>
            <th nzWidth="100px" nzAlign="center">货源类型</th>
            <th nzWidth="100px" nzAlign="center">货主</th>
            <th nzWidth="100px" nzAlign="center">项目名称</th>
            <th nzWidth="100px" nzAlign="center">装货地</th>
            <th nzWidth="100px" nzAlign="center">卸货地</th>
            <th nzWidth="100px" nzAlign="center">货物名称</th>
            <th nzWidth="160px" nzAlign="center">重量/体积</th>
            <th nzWidth="160px" nzAlign="center">用车需求</th>
            <th nzWidth="160px" nzAlign="center">总费用</th>
            <th nzWidth="160px" nzAlign="center">附加费</th>
            <th nzWidth="160px" nzAlign="center">用车需求</th>
            <th nzWidth="120px" nzAlign="center">货源状态</th>
            <th nzWidth="120px" nzAlign="center">创建时间</th>
            <th nzWidth="120px" nzAlign="center">审核状态</th>
            <th nzWidth="120px" nzAlign="center">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of nzTable.data">
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                <div><span style="color: #52c41a;">●</span>已接单</div>
                <div><span >●</span>已取消</div>
                <div><span style="color: #f59a23;">●</span>待接单</div>
              </td>
              <td>
                {{data.id3}}
              </td>
              <td>
                <div>
                  <div><span style="color: #52c41a;">●</span>审核通过</div>
                  <div><span style="color: #d9001b;">●</span>不通过</div>
                  <div><span style="color: #f59a23;">●</span>待审核</div>
                  <!-- <span>待审核</span> -->
                </div>
              </td>
              <td>
                <div>
                  <a  nz-button nzType="link" (click)="showApply()">货源审核</a>
                  <a  nz-button nzType="link" (click)="showApply()">修改运费</a>
                  <a  nz-button nzType="link" nzDanger (click)="showAssign()">指派熟车</a>
                  <a  nz-button nzType="link" nzDanger (click)="showApply()">修改单价</a>
                </div>
              </td>
          </tr>
        </tbody>
      </nz-table>
    </nz-tab>
  </nz-tabset>
</nz-card>

<nz-modal [(nzVisible)]="isVisible"   [nzFooter]="nzModalFooter" nzTitle="修改运费" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel('suppliersType')">
  <ng-container *nzModalContent>
    <sf #sfFre [schema]="freightSchema" [ui]="uiFre" [compact]="false" [button]="'none'">
      <ng-template sf-template="manys" let-me let-ui="ui" let-schema="schema">
        <div>
          <span>{{this.sfFre.value.contactsName}}</span>
        </div>
      </ng-template>
      <ng-template sf-template="unifiedSocia" let-me let-ui="ui" let-schema="schema">
          <nz-input-number
          [(ngModel)]="ssdsad"
          [nzMin]="0"
          [nzMax]="30"
          nzPlaceHolder="请输入1-30"
          id="margin"
          width=400
          ngDefaultControl
          required
        ></nz-input-number
        >&nbsp; &nbsp;天内支付运费。
      </ng-template>
      <ng-template sf-template="fujia" let-me let-ui="ui" let-schema="schema">
         15.00（费率：<a href="javaccript:;">5.3</a> ）
      </ng-template>
    </sf>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="default" (click)="handleCancel('suppliersType')">取消</button>
    <button nz-button nzType="primary" (click)="handleOK()" [disabled]="">确认修改</button>
  </ng-template>
</nz-modal>

<nz-modal [(nzVisible)]="isVisibleAssign" [nzWidth]="900"  [nzFooter]="nzModalFooter" nzTitle="指派熟车" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel('assign')">
  <ng-container *nzModalContent>
    <sf #sfAssign [schema]="schemaAssign" [ui]="ui" [mode]="'search'"  (formSubmit)="stAssign?.load(1)"
    (formReset)="resetSFAssign()"></sf>
    <st
      #stAssign
      multiSort
      [scroll]="{ x: '900px' }"
      [data]="listData2"
      [columns]="ColumnsAssign"
      [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParamsAssign }"
      [res]="{ reName: { list: 'data', total: 'data.total' } }"
      [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
      (change)="change($event)"
    >
    </st>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="default" (click)="handleCancel('assign')">取消</button>
    <button nz-button nzType="primary" (click)="handleOK()" [disabled]="">确认修改</button>
  </ng-template>
</nz-modal>
