<template>
  <div class="mod-config">
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item :label="'工厂编码:'">
        <el-input v-model="searchData.site"  style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'报关单号:'">
        <el-input v-model="searchData.declarationNo"  style="width: 120px"></el-input>
      </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-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">{{'查询'}}</el-button>
      </el-form-item><br>
      <el-form-item label=" ">
        <el-button @click="chooseBrandType()" type="primary" style="margin-left: 2px">{{'导出报关要素'}}</el-button>
      </el-form-item>
      <el-form-item label=" ">
        <el-button @click="chooseHsCodeDescType" type="primary" style="margin-left: 2px">{{'导出报关单'}}</el-button>
      </el-form-item>
      <el-form-item label=" ">
        <el-button @click="exportInvoiceList()" type="primary" style="margin-left: 2px">{{'导出发票'}}</el-button>
      </el-form-item>
      <el-form-item label=" ">
        <el-button @click="exportPakingList()" type="primary" style="margin-left: 2px">{{'导出箱单'}}</el-button>
      </el-form-item>
      <el-form-item label=" ">
        <el-button @click="exportGoodsList()" type="primary" style="margin-left: 2px">{{'导出出口货物委托书'}}</el-button>
      </el-form-item>
<!--      <el-form-item label=" ">
        <el-button @click="exportContract()" type="primary" style="margin-left: 2px">{{'导出合同'}}</el-button>
      </el-form-item>-->
      <el-form-item label=" ">
        <el-button @click="exportAllOpen()" type="primary" style="margin-left: 2px">{{'一键导出'}}</el-button>
      </el-form-item>
    </el-form>

    <el-table
      @row-click="changeData"
      highlight-current-row
      @current-change="handleCurrentChange"
      :height="height"
      :data="dataList"
      ref="mainTable"
      border
      v-loading="dataListLoading"
      style="width: 100%;">
      <el-table-column
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <a type="text" size="small" @click="deleteBG(scope.row)">删除报关单</a>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(item,index) in columnList" :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>
      </el-tab-pane>
    </el-tabs>

    <el-dialog title="一键导出" :close-on-click-modal="false" v-drag :visible.sync="exportAllFlag" :width="'740px'">
      <el-form label-position="top"  style="margin-left: 7px;margin-top: 10px;margin-bottom: 20px">
        <el-row :gutter="20">
          <div class="custom-divider"><span class="text" style="left: 22%">报关要素</span></div>
          <!--          报关要素-->
          <el-col :span="12">
            <el-form-item :label="'品牌'" >
              <el-radio v-model="brandType" label="境外品牌（其他）">境外品牌（其他）</el-radio>
              <el-radio v-model="brandType" label="无品牌">无品牌</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="hsCodeDescType" label="Y">中文</el-radio>
              <el-radio style="margin-left: 50px;" v-model="hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'托/箱'" >
              <el-radio v-model="packageUnit" label="托">托</el-radio>
              <el-radio v-model="packageUnit" label="箱">箱</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'重量'" >
              <el-radio v-model="declarationWeight" label="不显示">不显示</el-radio>
              <el-radio v-model="declarationWeight" label="显示">显示</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <div class="custom-divider"><span class="text">发票</span></div>
          <!--         发票-->
          <el-col :span="8" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.hsCodeDesc">品名</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.contractFlag">合同</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="24" style="">
            <el-form-item :label="'发票备注'" >
              <el-input type="textarea" :rows="2" v-model="exportInvoice.fpremark"></el-input>
            </el-form-item>
          </el-col>
          <!--         箱单-->
        </el-row>
        <el-row :gutter="20" style="margin-top: 30px">
          <div class="custom-divider"><span class="text">箱单</span></div>
          <el-col :span="8" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.goodsLabel">货物明细</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="currentRow.buNo==='03-RFID'">
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.upc">UPC</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="currentRow.buNo==='03-RFID'">
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.so">SO</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'序号类型'" >
              <el-radio v-model="exportPaking.itemNo" label="Y">序号</el-radio>
              <el-radio v-model="exportPaking.itemNo" label="N">栈板号</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'Shipping Mark'" >
              <el-input v-model="exportPaking.shippingMark"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID'">
            <el-form-item :label="'栈板重量参数'" >
              <el-input  v-model="exportPaking.palletWeight"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'RFID Base Material'" >
              <el-checkbox v-model="exportPaking.material"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'HS Code'" >
              <el-input :disabled="!exportPaking.material" v-model="exportPaking.hsCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID'">
            <el-form-item :label="'制造地'" >
              <el-input  v-model="exportPaking.origin"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'Non-reusable plastic packaging'" >
              <el-checkbox v-model="exportPaking.packaging"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'plastic packaging'" >
              <el-input :disabled="!exportPaking.packaging" v-model="exportPaking.kgs"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24" style="">
            <el-form-item :label="'箱单备注'" >
              <el-input type="textarea" :rows="2" v-model="exportPaking.xdremark"></el-input>
            </el-form-item>
          </el-col>
       </el-row>
        <el-row :gutter="20" style="margin-top: 30px">
          <!--         出口货物委托书-->
          <div class="custom-divider"><span class="text" style="left: 25%">出口货物委托书</span></div>
          <el-col :span="8">
            <el-form-item :label="'贸易方式'" >
              <el-input v-model="exportGoods.salesMethod"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'币制'" >
              <el-input  v-model="exportGoods.currency"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'货物产地'" >
              <el-input  v-model="exportGoods.madeArea"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'发货港'" >
              <el-input v-model="exportGoods.sendPort"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'唛头'" >
              <el-input v-model="exportGoods.voyage"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'提/送货日期'" >
              <el-input v-model="exportGoods.deliveryGoodsDate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="'船期'" >
              <el-input v-model="exportGoods.shippingDate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item :label="'发货人'" >
              <el-input type="textarea"
                        :rows="4" v-model="exportGoods.shipper"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <el-table v-show="currentRow.buNo==='02-Hardtag' || currentRow.buNo==='04-MHM'"
                :height="240"
                :data="propertiesList"
                stripe
                highlight-current-row
                border :row-style="{ height: '30px' }"
                style="width: 100%;margin-top: 70px">
        <el-table-column
          prop="hsCode"
          header-align="center"
          align="center"
          label="HS Code">
        </el-table-column>
        <el-table-column
          prop="hsCodeDesc"
          header-align="center"
          align="center"
          label="品名">
        </el-table-column>
        <el-table-column
          prop="ehundred"
          header-align="center"
          align="center"
          label="品牌">
          <template slot-scope="scope">
            <el-select v-model="scope.row.brand" placeholder="请选择"  style="width: 150px">
              <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableList" :key="key"></el-option>
            </el-select>
          </template>
        </el-table-column>
      </el-table>
      <el-table v-show="currentRow.buNo==='03-RFID'"
                :height="180"
                :data="notifyPartDetailList"
                stripe  class="expClass"
                highlight-current-row
                border :row-style="{ height: '30px' }"
                style="width: 100%;margin-top: 70px">
        <el-table-column
          prop="pn"
          header-align="center"
          align="center"
          label="PN">
        </el-table-column>
        <el-table-column
          prop="ehundred"
          header-align="center"
          align="center"
          label="E100">
          <template slot-scope="scope">
            <el-input v-model="scope.row.ehundred" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          prop="lossratio"
          header-align="center"
          align="center"
          label="纯FSC纸重量损耗">
          <template slot-scope="scope">
            <el-input v-model="scope.row.lossratio" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 80px;text-align:center">
        <el-button type="primary" @click="exportAll()">确定</el-button>
        <el-button type="primary" @click="exportAllFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="导出报关要素" :close-on-click-modal="false" v-drag :visible.sync="brandTypeFlag"
               :width="(currentRow.buNo==='02-Hardtag' || currentRow.buNo==='04-MHM')?'600px':'300px'">
      <el-form label-position="top"  style="margin-left: 7px;margin-top: 10px;margin-bottom: 20px">
        <el-row :gutter="20">
          <el-col :span="(currentRow.buNo==='02-Hardtag' || currentRow.buNo==='04-MHM')?12:24">
            <el-form-item :label="'品牌'" >
              <el-radio v-model="brandType" label="境外品牌（其他）">境外品牌（其他）</el-radio>
              <el-radio v-model="brandType" label="无品牌">无品牌</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="(currentRow.buNo==='02-Hardtag' || currentRow.buNo==='04-MHM')?12:24">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="hsCodeDescType" label="Y">中文</el-radio>
              <el-radio style="margin-left: 102px;" v-model="hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table v-show="currentRow.buNo==='02-Hardtag' || currentRow.buNo==='04-MHM'"
        :height="240"
                :data="propertiesList"
                stripe
                highlight-current-row
                border :row-style="{ height: '30px' }"
                style="width: 100%;">
        <el-table-column
          prop="hsCode"
          header-align="center"
          align="center"
          label="HS Code">
        </el-table-column>
        <el-table-column
          prop="hsCodeDesc"
          header-align="center"
          align="center"
          label="品名">
        </el-table-column>
        <el-table-column
          prop="ehundred"
          header-align="center"
          align="center"
          label="品牌">
          <template slot-scope="scope">
            <el-select v-model="scope.row.brand" placeholder="请选择"  style="width: 150px">
              <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableList" :key="key"></el-option>
            </el-select>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="downloadDeclarationElements()">确定</el-button>
        <el-button type="primary" @click="brandTypeFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="导出报关单" :close-on-click-modal="false" v-drag :visible.sync="declarationFlag" width="300px">
      <el-form label-position="top"  style="margin-left: 7px;margin-top: 10px;">
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="hsCodeDescType" label="Y">中文</el-radio>
              <el-radio v-model="hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="'托/箱'" >
              <el-radio v-model="packageUnit" label="托">托</el-radio>
              <el-radio v-model="packageUnit" label="箱">箱</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="'重量'" >
              <el-radio v-model="declarationWeight" label="不显示">不显示</el-radio>
              <el-radio v-model="declarationWeight" label="显示">显示</el-radio>
            </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="downloadDeclaration()()">确定</el-button>
        <el-button type="primary" @click="declarationFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="导出发票" :close-on-click-modal="false" v-drag :visible.sync="exportInvoiceFlag" width="450px">
      <el-form label-position="top"  style="margin-left: 2px;margin-top: 10px;">
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item :label="''" >
              <template #label>
                <span slot="label" style="" class="big-label">
                  <a href="#" @click="openTemplate('发票')">发票模版</a>
                </span>
              </template>
              <el-input v-model="exportInvoice.templateName" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.hsCodeDesc">品名</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.hsCodeFlag">Hs Code</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.contractFlag">合同</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportInvoice.goodsLabel">货物明细</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="exportInvoice.hsCodeDescType" label="Y">中文</el-radio>
              <el-radio v-model="exportInvoice.hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID'">
            <el-form-item :label="'制造地'" >
              <el-input  v-model="exportInvoice.origin"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'RFID Base Material'" >
              <el-checkbox v-model="exportInvoice.material"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'HS Code'" >
              <el-input :disabled="!exportInvoice.material" v-model="exportInvoice.hsCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'Non-reusable plastic packaging'" >
              <el-checkbox v-model="exportInvoice.packaging"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'plastic packaging'" >
              <el-input :disabled="!exportInvoice.packaging" v-model="exportInvoice.kgs"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24" style="">
            <el-form-item :label="'备注'" >
              <el-input type="textarea" :rows="3" v-model="exportInvoice.fpremark"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table v-show="currentRow.buNo==='03-RFID'"
                :height="240"
                :data="notifyPartDetailList"
                stripe class="expClass"
                highlight-current-row
                border :row-style="{ height: '30px' }"
                style="width: 100%;margin-top: 60px">
        <el-table-column
          prop="pn"
          header-align="center"
          align="center"
          label="PN">
        </el-table-column>
        <el-table-column
          prop="ehundred"
          header-align="center"
          align="center"
          label="E100">
          <template slot-scope="scope">
            <el-input v-model="scope.row.ehundred" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          prop="lossratio"
          header-align="center"
          align="center"
          label="纯FSC纸重量损耗">
          <template slot-scope="scope">
            <el-input v-model="scope.row.lossratio" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="downloadInvoice()">确定</el-button>
        <el-button type="primary" @click="exportInvoiceFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="导出箱单" :close-on-click-modal="false" v-drag :visible.sync="exportPakingFlag" width="450px">
      <el-form label-position="top"  style="margin-left: 2px;margin-top: 10px;">
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item :label="''" >
              <template #label>
                <span slot="label" style="" class="big-label">
                  <a href="#" @click="openTemplate('箱单')">箱单模版</a>
                </span>
              </template>
              <el-input v-model="exportPaking.templateName" disabled ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='03-RFID'">
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.upc">UPC</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='03-RFID'">
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.so">SO</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'序号类型'" >
              <el-radio v-model="exportPaking.itemNo" label="Y">序号</el-radio>
              <el-radio v-model="exportPaking.itemNo" label="N">栈板号</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='04-MHM'">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="exportPaking.hsCodeDescType" label="Y">中文</el-radio>
              <el-radio v-model="exportPaking.hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
<!--          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.boxChange">显示箱数零头</el-checkbox>
            </el-form-item>
          </el-col>-->
          <el-col :span="12" >
            <el-form-item :label="''" >
              <el-checkbox v-model="exportPaking.goodsLabel">货物明细</el-checkbox>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item :label="'Shipping Mark'" >
              <el-input v-model="exportPaking.shippingMark"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID'">
            <el-form-item :label="'制造地'" >
              <el-input  v-model="exportPaking.origin"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-show="currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID'">
            <el-form-item :label="'栈板重量参数'" >
              <el-input  v-model="exportPaking.palletWeight"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'RFID Base Material'" >
              <el-checkbox v-model="exportPaking.material"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'HS Code'" >
              <el-input :disabled="!exportPaking.material" v-model="exportPaking.hsCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'Non-reusable plastic packaging'" >
              <el-checkbox v-model="exportPaking.packaging"></el-checkbox>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'plastic packaging'" >
              <el-input :disabled="!exportPaking.packaging" v-model="exportPaking.kgs"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24" style="">
            <el-form-item :label="'备注'" >
              <el-input type="textarea" :rows="3" v-model="exportPaking.xdremark"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table v-show="currentRow.buNo==='03-RFID'"
        :height="240"
        :data="notifyPartDetailList"
        stripe class="expClass"
        highlight-current-row
        border :row-style="{ height: '30px' }"
        style="width: 100%;margin-top: 60px">
        <el-table-column
          prop="pn"
          header-align="center"
          align="center"
          label="PN">
        </el-table-column>
        <el-table-column
          prop="ehundred"
          header-align="center"
          align="center"
          label="E100">
          <template slot-scope="scope">
            <el-input v-model="scope.row.ehundred" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          prop="lossratio"
          header-align="center"
          align="center"
          label="纯FSC纸重量损耗">
          <template slot-scope="scope">
            <el-input v-model="scope.row.lossratio" style="width: 100px;"></el-input>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="downloadPackingList()">确定</el-button>
        <el-button type="primary" @click="exportPakingFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="导出出口货物委托书" :close-on-click-modal="false" v-drag :visible.sync="exportGoodsFlag" width="500px">
      <el-form label-position="top"  style="margin-left: 7px;margin-top: 10px;">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item :label="'品名类型'" >
              <el-radio v-model="exportGoods.hsCodeDescType" label="Y">中文</el-radio>
              <el-radio v-model="exportGoods.hsCodeDescType" label="N">英文</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'贸易方式'" >
              <el-input v-model="exportGoods.salesMethod"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'币制'" >
              <el-input  v-model="exportGoods.currency"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'货物产地'" >
              <el-input  v-model="exportGoods.madeArea"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'发货港'" >
              <el-input v-model="exportGoods.sendPort"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'唛头'" >
              <el-input v-model="exportGoods.voyage"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'提/送货日期'" >
              <el-input v-model="exportGoods.deliveryGoodsDate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="'船期'" >
              <el-input v-model="exportGoods.shippingDate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="'发货人'" >
              <el-input type="textarea"
                        :rows="4" v-model="exportGoods.shipper"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-footer style="height:40px;margin-top: 80px;text-align:center">
        <el-button type="primary" @click="downloadExportGoods()">确定</el-button>
        <el-button type="primary" @click="exportGoodsFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="模版" @close="closeTemplateDialog" @open="openTemplateDialog" :visible.sync="templateFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="templateData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="模版名称">
          <el-input v-model="templateData.name" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label=" ">
          <el-button type="primary" style="padding: 3px 12px" @click="searchTemplateList()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="templateList"
        stripe
        highlight-current-row
        border
        @row-dblclick="templateRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="buNo"
          header-align="center"
          align="center"
          label="BuNo">
        </el-table-column>
        <el-table-column
          prop="name"
          header-align="center"
          align="center"
          label="模版名称">
        </el-table-column>
        <el-table-column
          prop="shippingMode"
          header-align="center"
          align="center"
          label="运输方式">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="templateFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
  </div>
</template>

<script>

  import {} from "@/api/sysLanguage.js"
  import {
    searchDeclarationHeader,
    searchDeclarationDetail,
    deleteDeclaration,
    downloadDeclarationElements,
    getNotifyPartDetail,
    getCustomerInfo,
    searchTemplateList,
    getPropertiesListByDeclaration
  }from "@/api/ecss/ecss.js"
  import {EventBus} from "../../../main";
  import ExportUtil from "@/utils/export";
  export default {
    name: "declaration",
    components:{

    },
    data() {
      return {
        exportAllFlag:false,
        templateFlag:false,
        templateData:{},
        templateList:[],
        customerInfoList:[],
        notifyPartDetailList:[],
        propertiesList:[],
        currentRow:{},
        exportGoodsFlag:false,
        exportGoods:{
          salesMethod:'EXW',
          currency: 'USD',
          madeArea: 'Shanghai, China',
          sendPort:'Shanghai, China',
          deliveryGoodsDate:'',
          voyage :'',
          shippingDate:'',
          hsCodeDescType:'N',
          shipper:'Checkpoint Commercial (Shanghai) Co., Ltd.   保点贸易（上海）有限公司\t\t\t\t\t\t\n' +
          'Room 1411, No. 31, Lane 2419, Hunan Road, Pudong New Area, Shanghai\t\t\t\t\t\t\n' +
          '电话/Tel: (86-21)38112888   传真/Fax: (86-21)38112990\t\t\t\t\t\t\n' +
          '上海市浦东新区沪南路2419弄31号1411室\t\t\t\t\t\t\n'
        },
        brandTypeFlag:false,
        declarationFlag:false,
        exportInvoiceFlag:false,
        exportInvoice:{
          origin:"made in china",
          templateName:'',
          hsCodeDesc:'',
          contractFlag:'',
          packaging:'',
          kgs:'',
          hsCode:'',
          material:'',
          hsCodeDescType:'',
          goodsLabel:true,
          hsCodeFlag:true,
          fpremark:''
        },
        exportPakingFlag:false,
        exportPaking:{
          origin:"made in china",
          itemNo:'',
          upc:'',
          so:'',
          shippingMark:'',
          palletWeight:'',
          templateName:'',
          hsCodeDesc:'',
          contractFlag:'',
          packaging:'',
          kgs:'',
          hsCode:'',
          material:'',
          hsCodeDescType:'',
          goodsLabel:true,
          boxChange:'',
          xdremark:''
        },
        brandType:'',
        hsCodeDescType:'N',
        packageUnit: '',
        declarationWeight: '不显示',
        exportParam: {},
        pageIndex: 1,
        pageSize: 100,
        totalPage: 0,
        height: 200,
        dataList:[],
        dataList2:[],
        dataListLoading: false,
        searchData: {
          page: 1,
          limit: 100,
          site:"",
          declarationNo:'',
          delNo:'',
          cmcInvoice:'',
          startDate:'',
          endDate:'',
        },
        buttons:{
          search:'查询',
        },
        activeName:'detail',
        columnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1Site',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "site",
            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: 801006,
            serialNumber: '801006Table1DeclarationNo',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "declarationNo",
            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: 801006,
            serialNumber: '801006Table1CustomsOfficeCode',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "customsOfficeCode",
            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: 801006,
            serialNumber: '801006Table1InputCode',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "inputCode",
            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: 801006,
            serialNumber: '801006Table2Levy',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "dutyStatus",
            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: 801006,
            serialNumber: '801006Table1LocalShipper',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "localShipper",
            headerAlign: "center",
            align: "left",
            columnLabel: "境内发货人",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 130
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1LocalShipAddress',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "localShipAddress",
            headerAlign: "center",
            align: "left",
            columnLabel: "境内发货人地址",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 180
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1ShipType',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shipType",
            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: 801006,
            serialNumber: '801006Table1ShipDate',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shipDate",
            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: 801006,
            serialNumber: '801006Table1SubmitDate',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "submitDate",
            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: 801006,
            serialNumber: '801006Table1FilingNo',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "filingNo",
            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: 801006,
            serialNumber: '801006Table1OverseasShipper',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "overseasShipper",
            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: 801006,
            serialNumber: '801006Table1ShippingMode',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shippingMode",
            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: 801006,
            serialNumber: '801006Table1ShippingData',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shippingData",
            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: 801006,
            serialNumber: '801006Table1DeliverNo',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "deliverNo",
            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: 801006,
            serialNumber: '801006Table1SalesPartner',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "salesPartner",
            headerAlign: "center",
            align: "left",
            columnLabel: "生产销售单位",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 180
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1RegulatoryMethod',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "regulatoryMethod",
            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: 801006,
            serialNumber: '801006Table1DutyStatus',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "dutyStatus",
            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: 801006,
            serialNumber: '801006Table1PermitNumber',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "permitNumber",
            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: 801006,
            serialNumber: '801006Table1CmcInvoice',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "cmcInvoice",
            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: 801006,
            serialNumber: '801006Table1SalesArea',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "salesArea",
            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: 801006,
            serialNumber: '801006Table1ReceiveArea',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "receiveArea",
            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: 801006,
            serialNumber: '801006Table1ShippingPort',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shippingPort",
            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: 801006,
            serialNumber: '801006Table1ExitPort',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "exitPort",
            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: 801006,
            serialNumber: '801006Table1Documents',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "documents",
            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: 801006,
            serialNumber: '801006Table1Remark',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "remark",
            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: 801006,
            serialNumber: '801006Table1PackageType',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "packageType",
            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: 801006,
            serialNumber: '801006Table1PackageQty',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "packageQty",
            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: 801006,
            serialNumber: '801006Table1GrossWeight',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "grossWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "毛重（KG）",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1NetWeight',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "netWeight",
            headerAlign: "center",
            align: "right",
            columnLabel: "毛重（KG）",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1PaymentType',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "paymentType",
            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: 801006,
            serialNumber: '801006Table1ShipPrice',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "shipPrice",
            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: 801006,
            serialNumber: '801006Table1Premium',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "premium",
            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: 801006,
            serialNumber: '801006Table1OtherPrice',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "otherPrice",
            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: 801006,
            serialNumber: '801006Table1SpecialRelationshipComfirm',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "specialRelationshipComfirm",
            headerAlign: "center",
            align: "left",
            columnLabel: "特殊关系确认",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1PriceInfluenceConfirm',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "priceInfluenceConfirm",
            headerAlign: "center",
            align: "left",
            columnLabel: "价格影响确认",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1RoyaltyPaymentsConfirm',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "royaltyPaymentsConfirm",
            headerAlign: "center",
            align: "left",
            columnLabel: "支付特许使用费确认",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table1DelNo',
            tableId: "801006Table1",
            tableName: "报关单主记录",
            columnProp: "delNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "发货通知单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 90
          },
        ],
        columnList2: [
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table2ItemNo',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "itemNo",
            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: 801006,
            serialNumber: '801006Table2HsCode',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "hsCode",
            headerAlign: "center",
            align: "left",
            columnLabel: "HS Code",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table2HsCodeDesc',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "hsCodeDesc",
            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: 801006,
            serialNumber: '801006Table2Qty',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "qty",
            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: 801006,
            serialNumber: '801006Table2NetWeight',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "netWeight",
            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: 801006,
            serialNumber: '801006Table2UnitPrice',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "unitPrice",
            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: 801006,
            serialNumber: '801006Table2TotalPrice',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "totalPrice",
            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: 801006,
            serialNumber: '801006Table2Currency',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "currency",
            headerAlign: "center",
            align: "left",
            columnLabel: "币制",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 801006,
            serialNumber: '801006Table2MadeArea',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "madeArea",
            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: 801006,
            serialNumber: '801006Table2Destination',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "destination",
            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: 801006,
            serialNumber: '801006Table2SourceArea',
            tableId: "801006Table2",
            tableName: "报关单子记录",
            columnProp: "sourceArea",
            headerAlign: "center",
            align: "left",
            columnLabel: "境内货源地",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
        ],
      }
    },
    mounted() {
      this.$nextTick(() => {
        this.height = (window.innerHeight - 240)/2;
      })
    },
    methods: {
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.searchTable()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.searchTable()
      },
      changeData(row){
        this.currentRow = JSON.parse(JSON.stringify(row));
        this.refreshCurrentTabTable ();
      },
      searchTable(){
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        searchDeclarationHeader(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 = [];
          }
        });
      },
      tabClick (tab, event) {
        // 刷新列表数据
        this.refreshCurrentTabTable()
      },
      refreshCurrentTabTable(){
        if(this.currentRow===''||this.currentRow===null){
          this.currentRow={site:'',declarationNo:''}
        }
        if(this.activeName==='detail'){
          searchDeclarationDetail(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.dataList2 = data.rows

            } else {
              this.dataList2 = [];
            }
          });
        }

      },
      deleteBG(row){
        this.$confirm('是否删除此条数据?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteDeclaration(row).then(({data}) => {
            if (data && data.code === 0) {
              this.searchTable()
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },
      handleCurrentChange(val) {
        this.currentRow = val;
      },
      chooseBrandType() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        this.brandType='境外品牌（其他）'
        this.brandTypeFlag = true
        if (this.currentRow.buNo==='02-Hardtag' || this.currentRow.buNo==='04-MHM') {
          this.currentRow.brand='品牌'
          getPropertiesListByDeclaration(this.currentRow).then(({data}) => {
            if (data && data.code == 0) {
              this.propertiesList = data.rows
            } else {
              this.propertiesList = [];
            }
          });
        }
      },
      chooseHsCodeDescType() {
        if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        //this.hsCodeDescType=''
        this.declarationFlag = true
      },
      searchTemplateOne() {
        this.templateData.buNo = this.currentRow.buNo
        this.templateData.customName = this.currentRow.customName
        this.templateData.shippingMode = this.currentRow.shippingMode
        searchTemplateList(this.templateData).then(({data}) => {
          if (data && data.code === 0){
            if (data.rows && data.rows.length > 0) {
              this.templateRowDblclick(data.rows[0]);
            }
          }
        })
      },
      exportInvoiceList() {
        if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        this.exportInvoice.templateName=''
        this.exportInvoice.hsCodeDesc=this.currentRow.hsCodeDesc
        this.exportInvoice.contractFlag=this.currentRow.contractFlag
        this.exportInvoice.packaging=this.currentRow.packaging
        this.exportInvoice.kgs=this.currentRow.kgs
        this.exportInvoice.hsCode=this.currentRow.hsCode
        this.exportInvoice.material=this.currentRow.material
        this.exportInvoice.hsCodeDescType=this.currentRow.hsCodeDescType
        this.exportInvoice.goodsLabel=this.currentRow.goodsLabel
        this.exportInvoice.origin="made in china"
        //this.exportInvoice = this.currentRow
        if (!this.exportInvoice.origin) {
          this.exportInvoice.origin = 'made in china'
        }
        if (!this.exportInvoice.itemNo) {
          this.exportInvoice.itemNo = 'Y'
        }
        this.notifyPartDetailList = [];
        this.exportInvoiceFlag = true
        if (this.currentRow.buNo==='03-RFID') {
          getNotifyPartDetail(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.notifyPartDetailList = data.rows
              this.notifyPartDetailList.forEach(o => {
                if (!o.lossratio) {
                  o.lossratio = '1.2';
                }
              });
            } else {
              this.notifyPartDetailList = [];
            }
          });
        }
        this.templateData.type='发票'
        this.searchTemplateOne();
      },
      exportPakingList() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
       this.exportPaking.origin='made in china'
        this.exportPaking.itemNo=this.currentRow.itemNo
        this.exportPaking.upc=this.currentRow.upc
        this.exportPaking.so=this.currentRow.so
        this.exportPaking.shippingMark=this.currentRow.shippingMark
        this.exportPaking.palletWeight=this.currentRow.palletWeight
        this.exportPaking.hsCodeDesc=this.currentRow.hsCodeDesc
        this.exportPaking.contractFlag=this.currentRow.contractFlag
        this.exportPaking.packaging=this.currentRow.packaging
        this.exportPaking.kgs=this.currentRow.kgs
        this.exportPaking.hsCode=this.currentRow.hsCode
        this.exportPaking.material=this.currentRow.material
        this.exportPaking.hsCodeDescType=this.currentRow.hsCodeDescType
        this.exportPaking.goodsLabel=this.currentRow.goodsLabel
        this.exportPaking.boxChange=this.currentRow.boxChange
        //this.exportPaking = this.currentRow
        if (!this.exportPaking.origin) {
          this.exportPaking.origin = 'made in china'
        }
        if (!this.exportPaking.itemNo) {
          this.exportPaking.itemNo = 'Y'
        }
        this.notifyPartDetailList = [];
        this.exportPaking.templateName=''
        this.exportPakingFlag = true
        if (this.currentRow.buNo==='03-RFID') {
            getNotifyPartDetail(this.currentRow).then(({data}) => {
              //区分请求成功和失败的状况
              if (data && data.code == 0) {
                this.notifyPartDetailList = data.rows
                this.notifyPartDetailList.forEach(o => {
                  if (!o.lossratio) {
                    o.lossratio = '1.2';
                  }
                });
              } else {
                this.notifyPartDetailList = [];
              }
            });
          }
        this.templateData.type='箱单'
        this.searchTemplateOne();
      },
      exportGoodsList() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        this.exportGoods.hsCodeDescType = 'N'
        this.exportGoods.salesMethod = 'EXW'
        this.exportGoods.currency = this.currentRow.currency?this.currentRow.currency:this.dataList2.length>0?this.dataList2[0].currency:'USD'
        this.exportGoods.madeArea = 'Shanghai, China'
        this.exportGoods.sendPort = 'Shanghai, China'
        this.exportGoods.deliveryGoodsDate = ''
        this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:''
        this.exportGoods.shippingDate = ''
        this.exportGoodsFlag = true
      },
      // 导出
      downloadDeclarationElements() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        let exportParam={}
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        exportParam.brandType = this.brandType
        exportParam.hsCodeDescType=this.hsCodeDescType
        if (this.propertiesList.length>0) {
          this.currentRow.brand='品牌'
          exportParam.brand = '品牌'
          exportParam.propertiesList = this.propertiesList
        }
        let error;
        ExportUtil.export(
          "/ecss/coDel/downloadDeclarationElements",
          exportParam, this.currentRow.declarationNo+"报关要素.xlsx"
        );
        this.brandTypeFlag = false
      },
      downloadDeclaration() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        if (!this.packageUnit ) {
          this.$message.warning('请选择托/箱！')
          return
        }
        let exportParam={}
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        exportParam.hsCodeDescType=this.hsCodeDescType
        exportParam.packageUnit=this.packageUnit
        exportParam.declarationWeight = this.declarationWeight
        ExportUtil.export(
          "/ecss/coDel/downloadDeclaration",
          exportParam, this.currentRow.declarationNo+"报关单.xlsx"
        );
       this.declarationFlag = false
      },
      downloadInvoice() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        let exportParam=this.exportInvoice
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        exportParam.notifyPartDetailList = this.notifyPartDetailList
        ExportUtil.export(
          "/ecss/coDel/downloadInvoice",
          exportParam, this.currentRow.declarationNo+"发票.xlsx"
        );
       this.exportInvoiceFlag=false
        this.searchTable()
      },
      downloadPackingList() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        if ((this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID')
          && !this.exportPaking.origin) {
          this.$message.warning('请填写制造地！')
          return
        }
        if ((this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID')
          && !this.exportPaking.palletWeight) {
          this.$message.warning('请填写栈板重量！')
          return
        }
        if (this.exportPaking.material && !this.exportPaking.hsCode) {
          this.$message.warning('请填写hsCode！')
          return
        }
        if (this.exportPaking.packaging && !this.exportPaking.kgs) {
          this.$message.warning('请填写plastic packaging！')
          return
        }
        let exportParam=this.exportPaking
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        exportParam.notifyPartDetailList = this.notifyPartDetailList
        ExportUtil.export(
          "/ecss/coDel/downloadPackingList",
          exportParam, this.currentRow.declarationNo+"箱单.xlsx"
        );
        this.exportPakingFlag = false;
        this.searchTable()
      },
      downloadExportGoods() {
       if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        let exportParam=this.exportGoods
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        ExportUtil.export(
          "/ecss/coDel/downloadExportGoods",
          exportParam, this.currentRow.declarationNo+"出口货物委托书.xlsx"
        );
        this.exportGoodsFlag = false;
        this.searchTable()
      },
      exportContract(){
        if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        let exportParam=this.exportGoods
        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        ExportUtil.export(
          "/ecss/coDel/downloadContract",
          exportParam, this.currentRow.declarationNo+"合同.xlsx"
        );
        this.searchTable()
      },
      exportAll(){
        if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        if (!this.packageUnit ) {
          this.$message.warning('请选择托/箱！')
          return
        }
        let exportParam=this.exportPaking
        exportParam.salesMethod=this.exportGoods.salesMethod
        exportParam.currency=this.exportGoods.currency
        exportParam.madeArea=this.exportGoods.madeArea
        exportParam.sendPort=this.exportGoods.sendPort
        exportParam.deliveryGoodsDate=this.exportGoods.deliveryGoodsDate
        exportParam.voyage=this.exportGoods.voyage
        exportParam.shippingDate=this.exportGoods.shippingDate
        exportParam.hsCodeDescType=this.exportGoods.hsCodeDescType
        exportParam.shipper=this.exportGoods.shipper

        exportParam.brandType = this.brandType
        exportParam.hsCodeDescType=this.hsCodeDescType
        exportParam.packageUnit=this.packageUnit
        exportParam.declarationWeight = this.declarationWeight
        if (this.propertiesList.length>0) {
          this.currentRow.brand='品牌'
          exportParam.brand = '品牌'
          exportParam.propertiesList = this.propertiesList
        }
        exportParam.hsCodeDesc = this.exportInvoice.hsCodeDesc
        exportParam.contractFlag = this.exportInvoice.contractFlag
        exportParam.fpremark = this.exportInvoice.fpremark

        exportParam.declarationNo = this.currentRow.declarationNo
        exportParam.site = this.currentRow.site
        exportParam.delNo = this.currentRow.delNo
        exportParam.notifyPartDetailList = this.notifyPartDetailList
        ExportUtil.export(
          "/ecss/coDel/downloadAll",
          exportParam, this.currentRow.declarationNo+"单证信息.xlsx"
        );
        this.exportAllFlag = false
        this.searchTable()
      },

      async exportAllOpen() {
        if (!this.currentRow || !this.currentRow.buNo) {
          this.$message.warning('请选择报关单！')
          return
        }
        // 报关要素
        this.brandType='境外品牌（其他）'
        this.exportAllFlag = true
        if (this.currentRow.buNo==='02-Hardtag' || this.currentRow.buNo==='04-MHM') {
          this.currentRow.brand='品牌'
          getPropertiesListByDeclaration(this.currentRow).then(({data}) => {
            if (data && data.code == 0) {
              this.propertiesList = data.rows
            } else {
              this.propertiesList = [];
            }
          });
        }
        // 发票
        this.exportInvoice.templateName=''
        this.exportInvoice.hsCodeDesc=this.currentRow.hsCodeDesc
        this.exportInvoice.contractFlag=this.currentRow.contractFlag
        this.exportInvoice.packaging=this.currentRow.packaging
        this.exportInvoice.kgs=this.currentRow.kgs
        this.exportInvoice.hsCode=this.currentRow.hsCode
        this.exportInvoice.material=this.currentRow.material
        this.exportInvoice.hsCodeDescType=this.currentRow.hsCodeDescType
        this.exportInvoice.goodsLabel=this.currentRow.goodsLabel
        this.exportInvoice.origin="made in china"

        if (!this.exportInvoice.origin) {
          this.exportInvoice.origin = 'made in china'
        }
        if (!this.exportInvoice.itemNo) {
          this.exportInvoice.itemNo = 'Y'
        }
        this.notifyPartDetailList = [];
        this.templateData.type='发票'
        await this.searchTemplateOne();
        // 箱单
        //this.exportPaking.origin='made in china'
        this.exportPaking.itemNo=this.currentRow.itemNo
        this.exportPaking.upc=this.currentRow.upc
        this.exportPaking.so=this.currentRow.so
        this.exportPaking.shippingMark=this.currentRow.shippingMark
        this.exportPaking.palletWeight=this.currentRow.palletWeight
        this.exportPaking.hsCodeDesc=this.currentRow.hsCodeDesc
        this.exportPaking.contractFlag=this.currentRow.contractFlag
        this.exportPaking.packaging=this.currentRow.packaging
        this.exportPaking.kgs=this.currentRow.kgs
        this.exportPaking.hsCode=this.currentRow.hsCode
        this.exportPaking.material=this.currentRow.material
        this.exportPaking.hsCodeDescType=this.currentRow.hsCodeDescType
        this.exportPaking.goodsLabel=this.currentRow.goodsLabel
        this.exportPaking.boxChange=this.currentRow.boxChange

        if (!this.exportPaking.origin) {
          this.exportPaking.origin = 'made in china'
        }
        if (!this.exportPaking.itemNo) {
          this.exportPaking.itemNo = 'Y'
        }
        this.notifyPartDetailList = [];
        this.exportPaking.templateName=''

        if (this.currentRow.buNo==='03-RFID') {
          await getNotifyPartDetail(this.currentRow).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code == 0) {
              this.notifyPartDetailList = data.rows
              this.notifyPartDetailList.forEach(o => {
                if (!o.lossratio) {
                  o.lossratio = '1.2';
                }
              });
            } else {
              this.notifyPartDetailList = [];
            }
          });
        }
        this.templateData.type='箱单'
        await searchTemplateList(this.templateData).then(({data}) => {
          if (data && data.code === 0){
            if (data.rows && data.rows.length > 0) {
              let row = data.rows[0];
              this.exportPaking.templateName=row.name
              this.exportPaking.upc=row.upc
              this.exportPaking.so=row.so
              this.exportPaking.shippingMark=row.shippingMark
              this.exportPaking.palletWeight=row.palletWeight
              this.exportPaking.boxChange=row.boxChange
              this.exportPaking.itemNo=row.itemNo
              this.exportPaking.origin=this.currentRow.origin?this.currentRow.origin:row.origin
              this.exportPaking.packaging=this.currentRow.packaging?this.currentRow.packaging:row.packaging
              this.exportPaking.kgs=this.currentRow.kgs?this.currentRow.kgs:row.kgs
              this.exportPaking.hsCode=this.currentRow.hsCode?this.currentRow.hsCode:row.hsCode
              this.exportPaking.material=this.currentRow.material?this.currentRow.material:row.material
              this.exportPaking.hsCodeDescType=this.currentRow.hsCodeDescType?this.currentRow.hsCodeDescType:row.hsCodeDescType
              this.exportPaking.goodsLabel=this.currentRow.goodsLabel?this.currentRow.goodsLabel:row.goodsLabel
              this.notifyPartDetailList.forEach(o => {
                // 开启fsc损耗则给默认值
                if (o.lossratio) {
                  if (row.fscWeight) {
                    o.lossratio = o.lossratio;
                  } else {
                    o.lossratio = '';
                  }
                } else {
                  if (row.fscWeight) {
                    o.lossratio = '1.2';
                  } else {
                    o.lossratio = '';
                  }
                }
              });
            }
          }
        })
        this.exportGoods.salesMethod = 'EXW'
        this.exportGoods.currency = this.currentRow.currency?this.currentRow.currency:this.dataList2.length>0?this.dataList2[0].currency:'USD'
        this.exportGoods.madeArea = 'Shanghai, China'
        this.exportGoods.sendPort = 'Shanghai, China'
        this.exportGoods.deliveryGoodsDate = ''
        this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:''
        this.exportGoods.shippingDate = '';
        this.templateData.type='出口货物委托书'
        await this.searchTemplateOne();
      },

      getCustomerInfo() {
        getCustomerInfo(this.currentRow).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code == 0) {
            this.customerInfoList = data.rows
          } else {
            this.customerInfoList = [];
          }
        });
      },

      openTemplate (type) {
        this.templateData.type=type;
        this.templateFlag = true;
      },

      openTemplateDialog () {
        //请求
        this.searchTemplateList();
      },
      closeTemplateDialog () {
        this.templateList = []
        this.templateFlag = false
      },
      searchTemplateList () {
        this.templateData.buNo = this.currentRow.buNo
        this.templateData.customName = ''
        searchTemplateList(this.templateData).then(({data}) => {
          if (data && data.code === 0){
            this.templateList = data.rows;
          }
        })
      },
      templateRowDblclick (row) {
        if (this.templateData.type=='发票') {
          this.exportInvoice.templateName=row.name
          this.exportInvoice.hsCodeDesc=row.hsCodeDesc
          this.exportInvoice.contractFlag=row.contractFlag

          this.exportInvoice.origin=this.currentRow.origin?this.currentRow.origin:row.origin
          this.exportInvoice.packaging=this.currentRow.packaging?this.currentRow.packaging:row.packaging
          this.exportInvoice.kgs=this.currentRow.kgs?this.currentRow.kgs:row.kgs
          this.exportInvoice.hsCode=this.currentRow.hsCode?this.currentRow.hsCode:row.hsCode
          this.exportInvoice.material=this.currentRow.material?this.currentRow.material:row.material
          this.exportInvoice.hsCodeDescType=this.currentRow.hsCodeDescType?this.currentRow.hsCodeDescType:row.hsCodeDescType
          this.exportInvoice.goodsLabel=this.currentRow.goodsLabel?this.currentRow.goodsLabel:row.goodsLabel
          this.exportInvoice.fpremark = row.remark
        } else if (this.templateData.type=='箱单'){
          this.exportPaking.templateName=row.name
          this.exportPaking.upc=row.upc
          this.exportPaking.so=row.so
          this.exportPaking.shippingMark=row.shippingMark
          this.exportPaking.palletWeight=row.palletWeight
          this.exportPaking.boxChange=row.boxChange
          this.exportPaking.itemNo=row.itemNo

          this.exportPaking.origin=this.currentRow.origin?this.currentRow.origin:row.origin
          this.exportPaking.packaging=this.currentRow.packaging?this.currentRow.packaging:row.packaging
          this.exportPaking.kgs=this.currentRow.kgs?this.currentRow.kgs:row.kgs
          this.exportPaking.hsCode=this.currentRow.hsCode?this.currentRow.hsCode:row.hsCode
          this.exportPaking.material=this.currentRow.material?this.currentRow.material:row.material
          this.exportPaking.hsCodeDescType=this.currentRow.hsCodeDescType?this.currentRow.hsCodeDescType:row.hsCodeDescType
          this.exportPaking.goodsLabel=this.currentRow.goodsLabel?this.currentRow.goodsLabel:row.goodsLabel
          this.exportPaking.xdremark = row.remark
        } else if (this.templateData.type=='出口货物委托书'){
          this.exportGoods.salesMethod = row.salesMethod
          this.exportGoods.currency = row.currency
          this.exportGoods.madeArea = row.madeArea
          this.exportGoods.sendPort = row.sendPort
          this.exportGoods.deliveryGoodsDate = row.deliveryGoodsDate
          this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:row.voyage
          this.exportGoods.shippingDate = row.shippingDate;
          this.exportGoods.shipper=row.shipper
        }
        if (this.templateData.type!=='出口货物委托书') {
          this.notifyPartDetailList.forEach(o => {
            // 开启fsc损耗则给默认值
            if (o.lossratio) {
              if (row.fscWeight) {
                o.lossratio = o.lossratio;
              } else {
                o.lossratio = '';
              }
            } else {
              if (row.fscWeight) {
                o.lossratio = '1.2';
              } else {
                o.lossratio = '';
              }
            }
          });
        }
        this.templateFlag = false
      },
    },
    activated() {
      this.searchTable()
    },
    created() {

    }
  }
</script>

<style scoped>
/deep/ .expClass .cell {
  line-height: 24px;
  font-size: 12px;
  height: 24px;
}
.custom-divider {
  position: relative;
  height: 1px;
  background: #ebeef5;
  margin: 10px 0;
  width: 720px;
}
.custom-divider .text {
  position: absolute;
  left: 20%;
  top: -10px;
  transform: translateX(-50%);
  padding: 0 15px;
  background: white;
  color: #909399;
}
</style>
