<template>
  <div class="mod-config">
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item :label="'BU:'">
        <el-select v-model="searchData.buNo" placeholder="请选择"  >
          <el-option label="全部" value=""></el-option>
          <el-option
            v-for = "i in buList"
            :key = "i.buNo"
            :label = "i.buDesc"
            :value = "i.buNo">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'发货通知单:'">
        <el-input v-model="searchData.delNo"  style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'CMC Invoice:'">
        <el-input v-model="searchData.cmcInvoice"  style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'通知单状态:'">
        <el-select filterable v-model="searchData.notifyStatus" style="width: 120px">
          <el-option label="全部" value=""></el-option>
          <el-option label="已下达" value="已下达"></el-option>
          <el-option label="仓库已确认" value="仓库已确认"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'ReadyDate'" >
        <el-date-picker
          style="width: 120px"
          v-model="searchData.startDate"
          type="date"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'to'" >
        <el-date-picker
          style="width: 120px"
          v-model="searchData.endDate"
          type="date"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="' '" >
        <el-button @click="searchTable()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'查询'}}</el-button>
      </el-form-item>
    </el-form>

    <el-table
      @row-click="changeData"
      highlight-current-row
      :height="height"
      :data="dataList"
      ref="mainTable"
      border
      v-loading="dataListLoading"
      style="width: 100%;">
      <el-table-column
        header-align="center"
        align="center"
        width="150"
        fixed="left"
        label="操作">
        <template slot-scope="scope">

          <a type="text" size="small" v-if="scope.row.notifyStatus==='已下达'" @click="confirmModelOpen(scope.row)">仓库确认</a>
          <a type="text" size="small" v-if="scope.row.notifyStatus==='仓库已确认'" @click="cancerConfirm(scope.row)">取消确认</a>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(item,index) in columnList1" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed==''?false:item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                             style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 1000]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
    <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName"   type="border-card" @tab-click="tabClick" >
      <el-tab-pane label="明细" name="detail">
        <el-table
          :height="height"
          :data="dataList2"
          border
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in columnList2" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed==''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
              <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
            </template>
          </el-table-column>
<!--          <el-table-column-->
<!--            fixed="left"-->
<!--            header-align="center"-->
<!--            align="center"-->
<!--            width="100"-->
<!--            label="操作">-->
<!--            <template slot-scope="scope">-->
<!--              <a  v-if="currentRow.notifyStatus==='已计划'" type="text" size="small" @click="openUpdateDetailModel(scope.row)">修改</a>-->
<!--              <a v-if="currentRow.notifyStatus==='已计划'" type="text" size="small" @click="deleteDelDetail(scope.row)">删除</a>-->
<!--            </template>-->
<!--          </el-table-column>-->
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="装箱明细" name="pallet">
        <el-button @click="upLoadPallet()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'导入装箱单'}}</el-button>
        <el-table
          :data="dataList3"
          :height="height"
          border
          v-loading="dataListLoading"
          style="width: 100%; ">
<!--          <el-table-column-->
<!--            header-align="center"-->
<!--            align="center"-->
<!--            width="80"-->
<!--            label="操作">-->
<!--            <template slot-scope="scope">-->
<!--              <a type="text" size="small"  @click="deleteNotifySOSPlus(scope.row)">编辑</a>-->

<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column
            v-for="(item,index) in columnList3" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed==''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
              <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                                 style="width: 100px; height: 80px"/></span>
            </template>
          </el-table-column>
        </el-table>

      </el-tab-pane>
      <el-tab-pane label="手工装箱" name="box">
        <el-button @click="newPalletModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'创建栈板'}}</el-button>
        <el-table
          :data="dataList4"
          :height="height"
          border
          v-loading="dataListLoading"
          style="width: 100%; ">
          <el-table-column
            header-align="center"
            align="center"
            width="150"
            fixed="left"
            label="操作">
            <template slot-scope="scope">

              <a type="text" size="small" v-if="currentRow.notifyStatus==='仓库已确认'" @click="boxDetailModel(scope.row)">箱明细</a>
              <a type="text" size="small" v-if="currentRow.notifyStatus==='仓库已确认'" @click="updatePalletModel(scope.row)">修改</a>
              <a type="text" size="small" v-if="currentRow.notifyStatus==='仓库已确认'" @click="deletePallet(scope.row)">删除</a>
            </template>
          </el-table-column>
          <el-table-column
            v-for="(item,index) in columnList4" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed==''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
              <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                                 style="width: 100px; height: 80px"/></span>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>

    <el-dialog title="栈板明细" :close-on-click-modal="false" v-drag :visible.sync="boxDetailModelFlag" width="600px">
      <el-form  label-position="top"  style="margin-left: 7px;margin-top: -5px;">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item :label="'发货通知单号'" >
              <el-input v-model="boxDetailData.delNo" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'序号'" >
              <el-input v-model="boxDetailData.seqNo" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="' '" >
              <el-button @click="newBoxModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增箱'}}</el-button>

            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table
        :data="dataList5"
        :height="height"
        border
        v-loading="dataListLoading"
        style="width: 100%; ">
        <el-table-column
          header-align="center"
          align="center"
          width="150"
          fixed="left"
          label="操作">
          <template slot-scope="scope">
            <a type="text" size="small" v-if="currentRow.notifyStatus=='仓库已确认'" @click="updateBoxModel(scope.row)">修改</a>
            <a type="text" size="small" v-if="currentRow.notifyStatus=='仓库已确认'" @click="deleteBox(scope.row)">删除</a>
          </template>
        </el-table-column>
        <el-table-column
          v-for="(item,index) in columnList5" :key="index"
          :sortable="item.columnSortable"
          :prop="item.columnProp"
          :header-align="item.headerAlign"
          :show-overflow-tooltip="item.showOverflowTooltip"
          :align="item.align"
          :fixed="item.fixed==''?false:item.fixed"
          :min-width="item.columnWidth"
          :label="item.columnLabel">
          <template slot-scope="scope">
            <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
            <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                               style="width: 100px; height: 80px"/></span>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="boxDetailModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="仓库确认" :close-on-click-modal="false" v-drag :visible.sync="confirmModelFlag" width="400px">
      <el-form  label-position="top"  style="margin-left: 7px;margin-top: -5px;">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="'CMC Invoice'" >
              <el-input v-model="confirmModel.cmcInvoice" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'ReadyDate'" >
              <el-input v-model="confirmModel.readyDate" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'预计发货日期'" >
              <el-date-picker
                style="width: 100%"
                v-model="confirmModel.notifyDate"
                type="date"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="confirmDo()">保存</el-button>
        <el-button type="primary" @click="boxDetailModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="维护栈板" :close-on-click-modal="false" v-drag :visible.sync="palletModelFlag" width="600px">
      <el-form  label-position="top"  style="margin-left: 7px;margin-top: -5px;">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item :label="'栈板编号'" >
              <el-input v-model="palletModelData.palletRemark"  ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'数量'" >
              <el-input v-model="palletModelData.palletQty" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'长(M)'" >
              <el-input v-model="palletModelData.length" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'宽(M)'" >
              <el-input v-model="palletModelData.width" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'高(M)'" >
              <el-input v-model="palletModelData.height" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'体积'" >
              <el-input v-model="palletModelData.volume" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'毛重'" >
              <el-input v-model="palletModelData.grossWeight"  type="number"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'净重'" >
              <el-input v-model="palletModelData.netWeight" type="number" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="savePalletHeader()">保存</el-button>
        <el-button type="primary" @click="palletModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="维护箱" :close-on-click-modal="false" v-drag :visible.sync="boxModelFlag" width="600px">
      <el-form  label-position="top"  style="margin-left: 7px;margin-top: -5px;">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item :label="'物料编码'" >
              <el-input v-model="boxModelData.partNo"  ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'数量'" >
              <el-input v-model="boxModelData.qty" type="number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'PO'" >
              <el-input v-model="boxModelData.poNo"  ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'箱数'" >
              <el-input v-model="boxModelData.boxQty" type="boxQty" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="'ROLLS'" >
              <el-input v-model="boxModelData.rolls" type="number" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="saveBoxHeader()">保存</el-button>
        <el-button type="primary" @click="boxModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <!-- 导入 -->
    <pallet-upload-excel ref="palletUploadExcel" @refreshTable="searchPalletTable" v-drag></pallet-upload-excel>

  </div>
</template>

<script>
  import {} from "@/api/sysLanguage.js"
  import palletUploadExcel from "./pallet_upload_excel.vue";
  import {
    searchEcssCoDelNotifyHeaderForCK,
    searchEcssCoDelNotifyDetail,
    confirmEcssDel,
    cancerConfirmEcssDel,
    searchCoDelPalletData,
    searchEcssCoDelPalletHeaderData,
    searchEcssCoDelPalletDetailData,
    savePalletHeader,
    deletePalletHeader,
    savePalletDetail,
    deletePalletDetail,
  }from "@/api/ecss/ecss.js"
  import {getAllBuList}from  '@/api/factory/site.js'
  export default {
    name: "null",
    components:{
      palletUploadExcel,
    },
    data() {
      return {
        pageIndex: 1,
        pageSize: 100,
        totalPage: 0,
        height: 200,
        buList:[],
        dataList:[],
        dataList2:[],
        dataList3:[],
        dataList4:[],
        dataList5:[],
        boxDetailData:{
          site:'',
          buNo:'',
          delNo:'',
          seqNo:'',
        },
        dataListLoading: false,
        boxDetailModelFlag: false,
        searchData: {
          page: 1,
          limit: 100,
          buNo:'',
          delNo:'',
          cmcInvoice:'',
          notifyStatus:'',
          startDate:'',
          endDate:'',
          username:this.$store.state.user.name,
        },
        palletModelFlag:false,
        palletModelData:{
          addFlag:0,
          site:'',
          buNo:'',
          delNo:'',
          seqNo:'',
          palletNo:'',
          palletQty:'',
          length:'',
          width:'',
          height:'',
          volume:'',
          grossWeight:'',
          netWeight:'',
          palletRemark:'',

        },
        boxModelFlag:false,
        boxModelData:{
          addFlag:0,
          site:'',
          buNo:'',
          delNo:'',
          seqNo:'',
          itemNo:'',
          partNo:'',
          qty:'',
          poNo:'',
          boxQty:'',
          rolls:'',

        },
        buttons:{
          search:'查询',
        },
        confirmModelFlag:false,
        confirmModel:{
          site:'',
          buDesc:'',
          cmcInvoice:'',
          delNo:'',
          readyDate:'',
          shippingMode:'',
          destination:'',
          notifyDate:'',
          remark:'',
        },

        activeName:'detail',
        columnList1: [
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1BuDesc',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "buDesc",
            headerAlign: "center",
            align: "left",
            columnLabel: "BU",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1CmcInvoice',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "cmcInvoice",
            headerAlign: "center",
            align: "left",
            columnLabel: "CMC Invoice",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1DelNo',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "delNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "发货通知单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 110
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1ReadyDate',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "readyDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "ReadyDate",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1CustomerName',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "customerName",
            headerAlign: "center",
            align: "left",
            columnLabel: "客户名称",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1ShippingMode',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "shippingMode",
            headerAlign: "center",
            align: "left",
            columnLabel: "ShippingMode",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1Destination',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "destination",
            headerAlign: "center",
            align: "left",
            columnLabel: "Destination",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1NotifyStatus',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "notifyStatus",
            headerAlign: "center",
            align: "left",
            columnLabel: "通知单状态",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1NotifyDate',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "notifyDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "发货日期",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1ErpDelNo',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "erpDelNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "ERP发货单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1CreateBy',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "createBy",
            headerAlign: "center",
            align: "left",
            columnLabel: "创建人",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1CreateDate',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "createDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "创建时间",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 130
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1UpdateBy',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "updateBy",
            headerAlign: "center",
            align: "left",
            columnLabel: "修改人",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1UpdateDate',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "updateDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "修改时间",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 130
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table1Remark',
            tableId: "801002Table1",
            tableName: "关务系统发货通知单",
            columnProp: "remark",
            headerAlign: "center",
            align: "left",
            columnLabel: "Remark",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 300
          },
        ],
        columnList2: [
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2ItemNo',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "itemNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "行号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2PartNo',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "partNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "PN",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2PartDescription',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "partDescription",
            headerAlign: "center",
            align: "left",
            columnLabel: "Description",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Qty',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "qty",
            headerAlign: "center",
            align: "right",
            columnLabel: "Qty (pcs)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2SalesOrder',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "salesOrder",
            headerAlign: "center",
            align: "left",
            columnLabel: "销售订单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2CustomerPO',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "customerPO",
            headerAlign: "center",
            align: "left",
            columnLabel: "客户采购单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Version',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "version",
            headerAlign: "center",
            align: "left",
            columnLabel: "Version",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Status',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "status",
            headerAlign: "center",
            align: "left",
            columnLabel: "Status",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Family',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "family",
            headerAlign: "center",
            align: "left",
            columnLabel: "Family",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Lt',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "lt",
            headerAlign: "center",
            align: "right",
            columnLabel: "LT (wks)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2CmcComment',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "cmcComment",
            headerAlign: "center",
            align: "left",
            columnLabel: "CMC Comment",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2SaleType',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "saleType",
            headerAlign: "center",
            align: "left",
            columnLabel: "内外销方式",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2AwbBl',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "awbBl",
            headerAlign: "center",
            align: "left",
            columnLabel: "AWB/ BL#",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2ShippingNumber',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "shippingNumber",
            headerAlign: "center",
            align: "left",
            columnLabel: "ShippingNumber",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2ForwarderInfo',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "forwarderInfo",
            headerAlign: "center",
            align: "left",
            columnLabel: "Forwarder Info",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Currency',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "currency",
            headerAlign: "center",
            align: "left",
            columnLabel: "Currency",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Tp',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "tp",
            headerAlign: "center",
            align: "right",
            columnLabel: "TP",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2TtlAmount',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "ttlAmount",
            headerAlign: "center",
            align: "right",
            columnLabel: "TTL Amount",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2SumPrice',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "sumPrice",
            headerAlign: "center",
            align: "right",
            columnLabel: "价税合计",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2So',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "so",
            headerAlign: "center",
            align: "left",
            columnLabel: "SO",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Upc',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "upc",
            headerAlign: "center",
            align: "left",
            columnLabel: "UPC",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          // {
          //   userId: this.$store.state.user.name,
          //   functionId: 801002,
          //   serialNumber: '801002Table2ErpDelItemNo',
          //   tableId: "801002Table2",
          //   tableName: "关务系统发货通知单明细",
          //   columnProp: "erpDelItemNo",
          //   headerAlign: "center",
          //   align: "right",
          //   columnLabel: "ERP发货单行号",
          //   columnHidden: false,
          //   columnImage: false,
          //   columnSortable: false,
          //   sortLv: 0,
          //   status: true,
          //   fixed: '',
          //   columnWidth: 60
          // },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table2Remark',
            tableId: "801002Table2",
            tableName: "关务系统发货通知单明细",
            columnProp: "remark",
            headerAlign: "center",
            align: "left",
            columnLabel: "Remark",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 300
          },
        ],
        columnList3:[
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3ItemNo',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "itemNo",
            headerAlign: "center",
            align: "right",
            columnLabel: "序号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 40
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3PalletRemark',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "palletRemark",
            headerAlign: "center",
            align: "left",
            columnLabel: "栈板码",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3PalletQty',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "palletQty",
            headerAlign: "center",
            align: "right",
            columnLabel: "托数",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 40
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3PoNo',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "poNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "PO",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3PN',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "partNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "PN",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Qty',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "qty",
            headerAlign: "center",
            align: "right",
            columnLabel: "数量",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3BoxQty',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "boxQty",
            headerAlign: "center",
            align: "right",
            columnLabel: "箱数",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Rolls',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "rolls",
            headerAlign: "center",
            align: "right",
            columnLabel: "Rolls",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Length',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "length",
            headerAlign: "center",
            align: "right",
            columnLabel: "长(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Width',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "width",
            headerAlign: "center",
            align: "right",
            columnLabel: "宽(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Height',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "height",
            headerAlign: "center",
            align: "right",
            columnLabel: "高(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table3Volume',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "volume",
            headerAlign: "center",
            align: "right",
            columnLabel: "体积",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002TableGrossWeight',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "grossWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "毛重",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002TableNetWeight',
            tableId: "801002Table3",
            tableName: "装箱明细",
            columnProp: "netWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "净重",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
        ],
        columnList4:[
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4SeqNo',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "seqNo",
            headerAlign: "center",
            align: "right",
            columnLabel: "序号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 40
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4PalletRemark',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "palletRemark",
            headerAlign: "center",
            align: "left",
            columnLabel: "栈板码",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4PalletQty',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "palletQty",
            headerAlign: "center",
            align: "right",
            columnLabel: "数量",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4Length',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "length",
            headerAlign: "center",
            align: "right",
            columnLabel: "长(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4Width',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "width",
            headerAlign: "center",
            align: "right",
            columnLabel: "宽(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4Height',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "height",
            headerAlign: "center",
            align: "right",
            columnLabel: "高(M)",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4GrossWeight',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "grossWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "毛重",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table4NetWeight',
            tableId: "801002Table4",
            tableName: "装箱栈板主表",
            columnProp: "netWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "净重",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },
        ],
        columnList5:[
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table5PartNo',
            tableId: "801002Table5",
            tableName: "栈板装箱明细",
            columnProp: "partNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "物料编码",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table5Qty',
            tableId: "801002Table5",
            tableName: "栈板装箱明细",
            columnProp: "qty",
            headerAlign: "center",
            align: "right",
            columnLabel: "数量",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table5BoxQty',
            tableId: "801002Table5",
            tableName: "栈板装箱明细",
            columnProp: "boxQty",
            headerAlign: "center",
            align: "right",
            columnLabel: "箱数",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801002,
            serialNumber: '801002Table5Rolls',
            tableId: "801002Table5",
            tableName: "栈板装箱明细",
            columnProp: "rolls",
            headerAlign: "center",
            align: "right",
            columnLabel: "Rolls",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70
          },
        ],
        currentRow:{},
      }
    },
    mounted() {
      this.$nextTick(() => {
        this.height = (window.innerHeight - 260)/2;
      })
    },
    methods: {
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.searchTable()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.searchTable()
      },
      searchTable(){
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        searchEcssCoDelNotifyHeaderForCK(this.searchData).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code == 0) {
            this.dataList = data.page.list
            this.pageIndex = data.page.currPage
            this.pageSize = data.page.pageSize
            this.totalPage = data.page.totalCount
            if(this.dataList.length>0){
              this.$refs.mainTable.setCurrentRow(this.dataList[0]);
              this.changeData(this.dataList[0])
            }else {
              this.changeData(null)
            }
          } else {
            this.dataList = [];
          }
        });
      },
      changeData(row){
        this.currentRow = JSON.parse(JSON.stringify(row));
        this.headerData=row;
        this.refreshCurrentTabTable ();
      },
      refreshCurrentTabTable(){
        if(this.currentRow===''||this.currentRow===null){
          this.currentRow={site:'',delNo:'',notifyStatus:''}
        }
        if(this.activeName==='detail'){
          searchEcssCoDelNotifyDetail(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.dataList2 = data.rows

            } else {
              this.dataList2 = [];
            }
          });
        }
        if(this.activeName==='pallet'){
          searchCoDelPalletData(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.dataList3 = data.rows

            } else {
              this.dataList3 = [];
            }
          });
        }
        if(this.activeName==='box'){
          searchEcssCoDelPalletHeaderData(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.dataList4 = data.rows

            } else {
              this.dataList4 = [];
            }
          });
        }
      },
      tabClick (tab, event) {
        // 刷新列表数据
        this.refreshCurrentTabTable()
      },

      confirmDo(){
        confirmEcssDel(this.confirmModel).then(({data}) => {
            if (data && data.code === 0) {
              this.searchTable()
              this.confirmModelFlag=false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
      },
      cancerConfirm(row){
        this.$confirm('取消确认这条发货通知单？', '提示').then(() => {
          cancerConfirmEcssDel(row).then(({data}) => {
            if (data && data.code === 0) {
              this.searchTable()
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },
      getBu () {
        let tempData = {
          username: this.$store.state.user.name,
        }
        getAllBuList(tempData).then(({data}) => {
          if (data.code === 0) {
            this.buList = data.rows
          }
        })
      },
      confirmModelOpen(row){
        this.confirmModel=JSON.parse(JSON.stringify(row));
        this.confirmModelFlag=true
      },
      upLoadPallet(){
        if(this.dataList3.length>0){
          this.$alert('已经有明细无法再次导入请去手工装箱全部删除！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        if(this.currentRow.site===''||this.currentRow.site==null){
          this.$alert('请先选择发货通知单！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        if(this.currentRow.notifyStatus!=='仓库已确认'){
          this.$alert('仓库未确认无法导入装箱清单！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        let inData={
          site:this.currentRow.site,
          buNo:this.currentRow.buNo,
          delNo:this.currentRow.delNo,
          cmcInvoice:this.currentRow.cmcInvoice,
        }
        this.$nextTick(() => {
          this.$refs.palletUploadExcel.init(inData)
        })
      },
      searchPalletTable(){
        this.refreshCurrentTabTable();
      },
      boxDetailModel(row){
        this.boxDetailData=row
        searchEcssCoDelPalletDetailData(row).then(({data}) => {
          if (data.code === 0) {
            this.dataList5 = data.rows
          }
        })
        this.boxDetailModelFlag=true
      },
      updatePalletModel(row){
        this.palletModelData=JSON.parse(JSON.stringify(row))
        this.palletModelData.addFlag=1
        this.palletModelFlag=true
      },
      newPalletModel(){
        if(this.currentRow.site===''||this.currentRow.site==null){
          this.$alert('请先选择发货通知单！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        this.palletModelData={
          addFlag:0,
          site:this.currentRow.site,
          buNo:this.currentRow.buNo,
          delNo:this.currentRow.delNo,
          seqNo:'',
          palletNo:'',
          palletQty:'',
          length:'',
          width:'',
          height:'',
          volume:'',
          grossWeight:'',
          netWeight:'',
          palletRemark:'',
        }
        this.palletModelFlag=true
      },
      savePalletHeader(){
        if(this.palletModelData.palletQty===''||this.palletModelData.palletQty==null){
          this.$alert('请输入数量！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        if(this.palletModelData.grossWeight===''||this.palletModelData.grossWeight==null){
          this.$alert('请输入毛重！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        if(this.palletModelData.netWeight===''||this.palletModelData.netWeight==null){
          this.$alert('请输入净重！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        savePalletHeader(this.palletModelData).then(({data}) => {
          if (data && data.code === 0) {
            this.refreshCurrentTabTable()
            this.palletModelFlag=false;
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })

      },
      deletePallet(row){
        this.$confirm('确认删除此明细？', '提示').then(() => {
          deletePalletHeader(row).then(({data}) => {
            if (data && data.code === 0) {
              this.refreshCurrentTabTable()
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },

      updateBoxModel(row){
        this.boxModelData=JSON.parse(JSON.stringify(row))
        this.boxModelData.addFlag=1
        this.boxModelFlag=true
      },
      newBoxModel(){
        this.boxModelData={
          addFlag:0,
          site:this.boxDetailData.site,
          buNo:this.boxDetailData.buNo,
          delNo:this.boxDetailData.delNo,
          seqNo:this.boxDetailData.seqNo,
          itemNo:'',
          partNo:'',
          qty:'',
          poNo:'',
          boxQty:'',
          rolls:'',
        }
        this.boxModelFlag=true
      },
      saveBoxHeader(){
        if(this.boxModelData.partNo===''||this.boxModelData.partNo==null){
          this.$alert('请输入物料！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }
        if(this.boxModelData.qty<=0||this.boxModelData.qty==null){
          this.$alert('请输入数量！', '错误', {
            confirmButtonText: '确定'
          })
          return false
        }

        savePalletDetail(this.boxModelData).then(({data}) => {
          if (data && data.code === 0) {
            searchEcssCoDelPalletDetailData(this.boxDetailData).then(({data}) => {
              if (data.code === 0) {
                this.dataList5 = data.rows
              }
            })
            this.boxModelFlag=false;
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })

      },
      deleteBox(row){
        this.$confirm('确认删除此明细？', '提示').then(() => {
          deletePalletDetail(row).then(({data}) => {
            if (data && data.code === 0) {
              searchEcssCoDelPalletDetailData(this.boxDetailData).then(({data}) => {
                if (data.code === 0) {
                  this.dataList5 = data.rows
                }
              })
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },
    },
    created() {
      this.getBu ()
    }
  }
</script>

<style scoped>

</style>
