<nz-spin [nzSpinning]="saveLoading">
  <!-- 派工单 -->
  <!-- <nz-table nzSize="small" [nzNoResult]="' '" nzBordered #basicTable [nzShowPagination]="false">
    <thead>
      <tr>
        
        <th colspan="4">
          <h2><strong>派工单</strong></h2>
        </th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="width: 25%;">姓名</td>
        <td style="width: 25%;">
          <nz-select [(ngModel)]="fbsWorkshopDispatchList.personnelIdU8" style="width: 100%;" nzShowSearch nzAllowClear
            nzPlaceHolder="请选择" (ngModelChange)="personnelChange($event)">
            <ng-container *ngFor="let proper of properList">
              <nz-option [nzLabel]="proper.cpersonname" [nzValue]="proper.cpersoncode"> </nz-option>
            </ng-container>
          </nz-select>
        </td>
        <td style="width: 25%;">日期</td>
        <td style="width: 25%;">
          <nz-date-picker [(ngModel)]="fbsWorkshopDispatchList.date" nzPlaceHolder="请选择" nzDisabled>
          </nz-date-picker>
        </td>
      </tr>
      <tr>
        <td>订单编号</td>
        <td>
          <nz-select [(ngModel)]="fbsWorkshopDispatchList.productionOrderNumberId" style="width: 100%;" nzShowSearch
            nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="productionOrderNumberChange($event)">
            <ng-container *ngFor="let productionOrderNumber of productionOrderNumberList">
              <nz-option [nzLabel]="productionOrderNumber.mocode" [nzValue]="productionOrderNumber.moid"> </nz-option>
            </ng-container>
          </nz-select>
        </td>
        <td>产品</td>
        <td>
          <nz-select [(ngModel)]="fbsWorkshopDispatchList.productId" style="width: 100%;" nzShowSearch nzAllowClear
            nzPlaceHolder="请选择" (ngModelChange)="productChange($event)">
            <ng-container *ngFor="let produc of productList">
              <nz-option [nzLabel]="produc.cinvname" [nzValue]="produc.cinvcode"> </nz-option>
            </ng-container>
          </nz-select>
        </td>
      </tr>
      <tr>
        <td>任务数量</td>
        <td>
          <nz-input-number [(ngModel)]="fbsWorkshopDispatchList.numberOfTasks" [nzMin]="0" [nzStep]="1">
          </nz-input-number>
        </td>
        <td>标准工时</td>
        <td>
          <nz-input-number [(ngModel)]="fbsWorkshopDispatchList.standardWorkingHours" [nzMin]="0" [nzStep]="1">
          </nz-input-number>
        </td>
      </tr>
      <tr>
        <td>计划开工时间</td>
        <td>
          <nz-date-picker [(ngModel)]="fbsWorkshopDispatchList.plannedStartTime" nzPlaceHolder="请选择">
          </nz-date-picker>
        </td>
        <td>计划完工时间</td>
        <td>
          <nz-date-picker [(ngModel)]="fbsWorkshopDispatchList.plannedEndTime" nzPlaceHolder="请选择">
          </nz-date-picker>
        </td>
      </tr>
      <tr>
        <td>备注</td>
        <td colSpan="3"><textarea rows="2" nz-input [(ngModel)]="fbsWorkshopDispatchList.memo"></textarea></td>
      </tr>
    </tbody>
  </nz-table> -->

  <nz-card nzTitle="派工单">
    <!-- 按钮 -->
    <div nz-row [nzGutter]="24">
      <div nz-col nzMd="24" nzLg="24">
        <button (click)="workshopDispatchAddRow()" nz-button nzType="primary">新增</button>
      </div>
    </div>
    <nz-table style="margin-top: 5px;" class="tableTdPadding" nzSize="small" #editRowTable nzBordered [nzData]="workshopDispatchListList"
      [nzShowPagination]="false" [nzFrontPagination]=false [nzScroll]="{x:'123vw'}">
      <thead>
        <tr>
          <th nzWidth="2%">序号</th>
          <th nzWidth="5%">项目编码</th>
          <th nzWidth="5%">项目名称</th>
          <th nzWidth="5%">工作中心</th>
          <th nzWidth="5%">姓名</th>
          <th nzWidth="6%">日期</th>
          <th nzWidth="6%">订单编号</th>
          <th nzWidth="5%">物料编码</th>
          <th nzWidth="5%">物料名称</th>
          <th nzWidth="5%">计划数量</th>
          <th nzWidth="5%">剩余数量</th>
          <th nzWidth="5%">派工数量</th>
          <th nzWidth="5%">标准工时</th>
          <th nzWidth="6%">计划开工时间</th>
          <th nzWidth="6%">计划完工时间</th>
          <th nzWidth="6%">是否可扫码</th>
          <th nzWidth="6%">工艺</th>
          <th nzWidth="5%">备注</th>
          <th nzWidth="3%">操作</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let data of editRowTable.data">
          <td>{{data.sort}}</td>
          <td>
            {{data.productId}}
          </td>
          <td>
            {{data.productId}}
          </td>
          <td>
            {{data.productId}}
          </td>
          <td>
            <nz-select [nzMaxTagCount]="3" nzMode="multiple" [(ngModel)]="data.personnelIds" style="width: 100px" nzShowSearch
              nzAllowClear nzPlaceHolder="请选择"  [nzDropdownMatchSelectWidth]="false">
              <ng-container *ngFor="let proper of properList">
                <nz-option [nzLabel]="proper.personnelName" [nzValue]="proper.personnelCode"> </nz-option>
              </ng-container>
            </nz-select>
          </td>
          <td>
            <nz-date-picker [(ngModel)]="data.date" nzPlaceHolder="请选择" >
            </nz-date-picker>
          </td>
          <td>
            <nz-select [(ngModel)]="data.productionOrderNumberId" style="width: 150px" nzShowSearch
              nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="productionOrderNumberChange($event,data)" [nzDropdownMatchSelectWidth]="false">
              <ng-container *ngFor="let productionOrderNumber of productionOrderNumberList">
                <nz-option nzLabel="{{productionOrderNumber.mocode}}--{{productionOrderNumber.cinvcode}}--{{productionOrderNumber.cinvname}}--{{productionOrderNumber.qty}}" [nzValue]="productionOrderNumber.moid"> </nz-option>
              </ng-container>
            </nz-select>
          </td>
          <td>
            {{data.productId}}
          </td>
          <td>
            <nz-select [(ngModel)]="data.productId" style="width: 200px" nzShowSearch nzAllowClear
              nzPlaceHolder="请选择" (ngModelChange)="productChange($event,data)" [nzDropdownMatchSelectWidth]="false">
              <ng-container *ngFor="let produc of data.productList">
                <nz-option nzLabel="{{produc.cinvname}}" [nzValue]="produc.cinvcode"> </nz-option>
              </ng-container>
            </nz-select>
          </td>
          <td>
            {{data.plannedQuantity}}
          </td>
          <td>
            {{data.remainingQuantity}}
          </td>
          <td>
            <nz-input-number [(ngModel)]="data.numberOfTasks" [nzMin]="0" [nzStep]="1" (ngModelChange)="numberOfTasksChange($event,data)">
            </nz-input-number>
          </td>
          <td>
            <nz-input-number [(ngModel)]="data.standardWorkingHours" [nzMin]="0" [nzStep]="1">
            </nz-input-number>
          </td>
          <td>
            <nz-date-picker nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="data.plannedStartTime" nzPlaceHolder="请选择" [nzShowTime]="{ nzDefaultOpenValue: timeDefaultValue }">
            </nz-date-picker>
          </td>
          <td>
            <nz-date-picker nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="data.plannedEndTime" nzPlaceHolder="请选择" [nzShowTime]="{ nzDefaultOpenValue: timeDefaultValue }">
            </nz-date-picker>
          </td>
          <td>
            <nz-switch [(ngModel)]="data.isScanCodeSwith" name="isScanCodeSwith"
                          nzCheckedChildren="是"
                          nzUnCheckedChildren="否">
                        </nz-switch>
          </td>
          <td>
            <nz-select [(ngModel)]="data.fbsTechnologicalProcessId" style="width: 200px" nzShowSearch nzAllowClear
              nzPlaceHolder="请选择" (ngModelChange)="fbsTechnologicalProcessChange($event,data)" [nzDropdownMatchSelectWidth]="false">
              <ng-container *ngFor="let fbsTechnologicalProcess of fbsTechnologicalProcessList">
                <nz-option nzLabel="{{fbsTechnologicalProcess.name}}" [nzValue]="fbsTechnologicalProcess.id"> </nz-option>
              </ng-container>
            </nz-select>
          </td>
          <td><textarea rows="1" nz-input [(ngModel)]="data.memo"></textarea></td>
          <td><a nz-popconfirm nzTitle="是否删除?" (nzOnConfirm)="workshopDispatchDeleteRow(data.sort)">删除</a></td>
        </tr>
      </tbody>
    </nz-table>
  </nz-card>
</nz-spin>
<!-- 底部按钮 -->
<div class="base">
  <!-- 底部关闭按钮 -->
  <a nz-popconfirm style="margin-right: 2%" nzTitle="确认关闭吗(关闭前请确认数据已保存)" (nzOnConfirm)="close()">
    <button nz-button class="ant-btn buttonDistance"><span>关闭
      </span></button>
  </a>
  <!-- 底部保存按钮 -->
  <button nzbutton (click)="save()" nz-button nzType="primary" [nzLoading]="saveLoading"><span>保存</span></button>
</div>