<!--结净计量数据查询-->
<template>
  <div class="systemBase">
    <div>
      <div style="margin-top: 10px; border-bottom: 1px solid #d5d5d5">
        <el-form
          ref="searchData"
          :inline="true"
          :model="search"
          :rules="ruleValidateSearch"
        >
          <el-form-item label-width="70px" prop="carNo" label="车号">
            <el-input
              v-model="search.carNo"
              size="small"
              clearable
              style="width: 120px"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item prop="meterTypeName" label="业务类型">
            <el-select
              v-model="search.meterTypeName"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
            >
              <el-option
                v-for="(item, index) in meterTypeNameItem"
                :key="index"
                :label="item.baseName"
                :value="item.baseName"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="baseSpot1Name" label="毛重计量点">
            <el-select
              v-model="search.baseSpot1Name"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
            >
              <el-option
                v-for="item in spotNameList"
                :key="item.baseSpotNo"
                :label="item.baseSpotName"
                :value="item.baseSpotName"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="matterNo" label="物资名称">
            <el-select
              v-model="search.matterNo"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
              :filter-method="getMatterName"
            >
              <el-option
                v-for="item in matterNameItem"
                :key="item.matterNo"
                :label="item.matterName"
                :value="item.matterNo"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="uploadFlag" label="数据状态">
            <el-select
              v-model="search.uploadFlag"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
            >
              <el-option
                v-for="(item, index) in uploadFlagItem"
                :key="index"
                :label="item.uploadFlag"
                :value="item.uploadFlag"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item prop="predictionType" label="预报类型">
            <el-select
              v-model="search.predictionType"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
            >
              <el-option
                v-for="(item, index) in predictionList"
                :key="index"
                :label="item.val"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item> -->
          <el-form-item prop="strDate" label="开始时间">
            <el-date-picker
              v-model="search.strDate"
              clearable
              type="datetime"
              style="width: 180px"
              placeholder="选择日期"
              size="small"
            ></el-date-picker>
          </el-form-item>
          <el-form-item prop="envDate" label="结束时间">
            <el-date-picker
              v-model="search.envDate"
              clearable
              type="datetime"
              style="width: 180px"
              placeholder="选择日期"
              size="small"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label-width="20px">
            <el-button
              icon="el-icon-search"
              type="primary"
              size="mini"
              @click="searchDatas"
              v-loading.fullscreen.lock="operateLoading"
              v-privilege="activeMenu + 'SEARCH'"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item label-width="20px">
            <el-button
              icon="el-icon-printer"
              type="primary"
              size="mini"
              @click="printQRCode"
              v-privilege="activeMenu + 'PRINT'"
              >打印检斤小票</el-button
            >
          </el-form-item>
          <el-form-item label-width="20px">
            <el-button
              icon="el-icon-download"
              type="primary"
              size="mini"
              :loading="tableExportLoading"
              @click="doExport"
              v-privilege="activeMenu + 'EXPORT'"
              >导出</el-button
            >
          </el-form-item>
        </el-form>
      </div>
      <el-row>
        <el-col :span="24">
          <div style="border-right: 1px solid #d5d5d5">
            <div class="common-title-div" style="display: flex">
              结净计量数据查询 （
              <div
                style="
                  width: 12px;
                  height: 12px;
                  background-color: #000000;
                  color: #000000;
                  margin-top: 5px;
                "
              ></div>
              待审核
              <div
                style="
                  width: 12px;
                  height: 12px;
                  background-color: rgb(0, 116, 10);
                  color: rgb(0, 116, 10);
                  margin-left: 5px;
                  margin-top: 5px;
                "
              ></div>
              待上传
              <div
                style="
                  width: 12px;
                  height: 12px;
                  background-color: red;
                  color: red;
                  margin-left: 5px;
                  margin-top: 5px;
                "
              ></div>
              已上传）
            </div>
            <div class="common-table-div" id="topTable">
              <el-table
                id="excelTable"
                v-loading="dataLoading"
                @row-click="getRow"
                ref="dataTable"
                highlight-current-row
                border
                :height="tableHeight"
                :summary-method="getSummaries"
                show-summary
                @selection-change="handleSelectionChange"
                :data="table.list"
                :row-class-name="tableRowClassName"
                :exchangeFilterMap="{
                  uploadFlag: { '0': '待审核', '1': '待上传', '2': '已上传' },
                  grossMode: {
                    '1': '远程计量',
                    '2': '智能计量',
                    '3': '手工录入',
                    '4': '放行智能计量',
                    '5': '滞后匹配',
                  },
                  tareMode: {
                    '1': '远程计量',
                    '2': '智能计量',
                    '3': '手工录入',
                    '4': '放行智能计量',
                    '5': '滞后匹配',
                  },
                  netMode: { '1': '正常结净', '2': '匹配结净' },
                }"
                :icore-filter-flag="icoreFilterFlag"
              >
                <el-table-column
                  type="index"
                  label="序号"
                  :fixed="isFixed"
                  align="center"
                ></el-table-column>
                <!-- <el-table-column type="selection" width="55" align="center" :fixed="isFixed"></el-table-column> -->
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="predictionNo"
                  label="预报编号"
                  min-width="80"
                  align="left"
                  fixed="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="carNo"
                  label="车号"
                  min-width="80"
                  fixed="left"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="railwayNo"
                  label="火车号"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="trailerNo"
                  label="挂号"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="matterName"
                  label="物资名称"
                  min-width="120"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="contractNo"
                  min-width="120"
                  label="合同号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="batchNo"
                  min-width="120"
                  label="批次号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="customerSupplierName"
                  min-width="200"
                  label="供应商"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="forwardingUnitName"
                  min-width="200"
                  label="发货单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="receivingUintName"
                  min-width="200"
                  label="收货单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="grossWeight"
                  label="毛重/t"
                  min-width="100"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.round((scope.row.grossWeight - 0) / 10) / 100 }}
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="tareWeight"
                  label="皮重/t"
                  min-width="100"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.round((scope.row.tareWeight - 0) / 10) / 100 }}
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="netWeight"
                  label="净重/t"
                  min-width="100"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.round((scope.row.netWeight - 0) / 10) / 100 }}
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="addWeight"
                  label="附加重量/t"
                  min-width="100"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.round((scope.row.addWeight - 0) / 10) / 100 }}
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterNum"
                  min-width="110"
                  label="数量"
                  align="right"
                >
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="actualFirst1No"
                  min-width="120"
                  label="毛重作业编号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="baseSpot1Name"
                  min-width="120"
                  label="毛重计量点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="grossTime"
                  min-width="160"
                  label="毛重计量时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="grossManName"
                  min-width="120"
                  label="毛重计量员"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="grossClass"
                  min-width="120"
                  label="毛重班次"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="grossGroup"
                  min-width="120"
                  label="毛重班组"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="grossMode"
                  label="毛重计量方式"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.grossMode == 1">远程计量</span>
                    <span v-else-if="scope.row.grossMode == 2">智能计量</span>
                    <span v-else-if="scope.row.grossMode == 3">手工录入</span>
                    <span v-else-if="scope.row.grossMode == 4"
                      >放行智能计量</span
                    >
                    <span v-else-if="scope.row.grossMode == 5">滞后匹配</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="actualFirst2No"
                  label="皮重作业编号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="baseSpot2Name"
                  label="皮重计量点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="160"
                  prop="tareTime"
                  label="皮重计量时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="tareManName"
                  label="皮重计量员"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netClass"
                  label="皮重班次"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="tareGroup"
                  label="皮重班组"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="tareMode"
                  label="皮重计量方式"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.tareMode == 1">远程计量</span>
                    <span v-else-if="scope.row.tareMode == 2">智能计量</span>
                    <span v-else-if="scope.row.tareMode == 3">手工录入</span>
                    <span v-else-if="scope.row.tareMode == 4"
                      >放行智能计量</span
                    >
                    <span v-else-if="scope.row.tareMode == 5">滞后匹配</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netSpot3Name"
                  label="净重计量点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="160"
                  prop="netTime"
                  label="净重计量时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netManName"
                  label="净重计量员"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netClass"
                  label="净重班次"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netGroup"
                  label="净重班组"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100"
                  prop="netMode"
                  label="结净方式"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.netMode == 1">正常结净</span>
                    <span v-else-if="scope.row.netMode == 2">匹配结净</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="materialName"
                  min-width="120"
                  label="材质"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="specName"
                  min-width="120"
                  label="规格"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="loadPointName"
                  min-width="120"
                  label="卸货地点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="sampleNo"
                  min-width="120"
                  label="取样编号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="sampleVoucher"
                  min-width="120"
                  label="取样凭证"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="carrierUnitName"
                  min-width="200"
                  label="承运单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterTypeName"
                  min-width="120"
                  label="业务类型"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="uploadFlag"
                  min-width="80"
                  label="状态"
                  align="center"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.uploadFlag == 0">待审核</span>
                    <span v-else-if="scope.row.uploadFlag == 1">待上传</span>
                    <span v-else-if="scope.row.uploadFlag == 2">已上传</span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div class="common-foot-style">
              <el-pagination
                v-loading="dataLoading"
                @size-change="pageSizeChange"
                @current-change="pageCurrentChange"
                :current-page="page.pageNum"
                :page-sizes="[50, 100, 200, 400]"
                :page-size="page.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="page.totalPage"
              >
              </el-pagination>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
    <div id="qrcode2" ref="qrcode2" v-show="false">
      <div id="printContent" style="box-sizeing: border-box">
        <div
          style="
            text-align: center;
            width: 280px;
            -webkit-transform-origin-x: 0;
            -webkit-transition: scale(0.58);
          "
        >
          <strong
            style="
              font-size: 6px;
              -webkit-transform-origin-x: 0;
              -webkit-transition: scale(0.5);
            "
            >金川集团股份有限公司</strong
          ><br />
          <strong
            style="
              font-size: 6px;
              -webkit-transform-origin-x: 0;
              -webkit-transition: scale(0.5);
            "
            >检斤小票</strong
          ><br />
        </div>
        <table style="border-collapse: collapse; text-align: center">
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 6px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.5);
              "
            >
              流水号
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 6px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.5);
              "
            >
              {{ actualNo1 }}
            </td>
            <td
              style="width: 130px; height: 20px; border: 1px solid rgb(0, 0, 0)"
              rowspan="8"
            >
              <div
                style="
                  text-align: center;
                  width: 130px;
                  height: 160px;
                  padding-top: 1px;
                  padding-left: 1px;
                "
                id="XQ2"
              ></div>
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              预报编号
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ predictionNo1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              车号
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ carNo1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              检斤类型
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ meterTypeName1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              毛重(t)
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ grossWeight1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              皮重(t)
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ tareWeight1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              净重(t)
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ netWeight1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              附加重量
            </td>
            <td
              style="
                width: 80px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ addWeight1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              物质名称
            </td>
            <td
              colspan="2"
              style="
                width: 130px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ matterName1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              来源
            </td>
            <td
              colspan="2"
              style="
                width: 130px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ forwardingUnitName1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              去向
            </td>
            <td
              colspan="2"
              style="
                width: 130px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ receivingUintName1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              计量时间
            </td>
            <td
              colspan="2"
              style="
                width: 130px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ netTime1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 50px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              规格
            </td>
            <td
              colspan="2"
              style="
                width: 130px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
            >
              {{ specName1 }}
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 103px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                text-align: left;
                padding-left: 10px;
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
              colspan="3"
            >
              注：本小票不作为结算凭证，请注意保管！
            </td>
          </tr>
          <tr>
            <td
              style="
                width: 103px;
                height: 20px;
                border: 1px solid rgb(0, 0, 0);
                text-align: left;
                padding-left: 10px;
                font-size: 7px;
                -webkit-transform-origin-x: 0;
                -webkit-transition: scale(0.58);
              "
              colspan="3"
            >
              打票时间:{{ nowTime }}
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>
<script>
import { formatDate } from '@/utils/util.js';
export default {
  data () {
    return {
      grossWeight1: '',
      tareWeight1: '',
      netWeight1: '',
      nowTime: '',
      actualNo1: '',
      predictionNo1: '',
      carNo1: '',
      matterName1: '',
      meterTypeName1: '',
      forwardingUnitName1: '',
      receivingUintName1: '',
      tareTime1: '',
      netTime1: '',
      addWeight1: '',
      specName1: '',
      dataLoading: false,
      operateLoading: false,
      icoreFilterFlag: true,
      meterTypeNameItem: [],
      matterNameItem: [],
      uploadFlagItem: [
        { uploadFlag: '待审核' },
        { uploadFlag: '待上传' },
        { uploadFlag: '已上传' }
      ],
      page: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      isFixed: 'left',
      table: {
        list: []
      },
      multipleSelection: [],
      tableHeight: 0,
      search: {
        carNo: '',
        meterTypeName: '',
        matterNo: '',
        uploadFlag: '',
        strDate: '',
        envDate: '',
        baseSpot1Name: '',
        predictionType: ''
      },
      ruleValidateSearch: {
        envDate: [{
          required: true,
          validator: this.endTimeVerify,
          trigger: 'blur'
        }],
        strDate: [{
          required: true,
          validator: this.strTimeVerify,
          trigger: 'blur'
        }]
      },
      actualFirst: {},
      tableExportLoading: false,
      activeMenu: '',
      matList: [],
      spotNameList: [],
      predictionList: [
        {
          id: '1',
          val: '单次预报'
        },
        {
          id: '2',
          val: '联运预报'
        },
        {
          id: '3',
          val: '分检预报'
        }
      ]
    }
  },
  created () {
    this.tableHeight = (window.innerHeight - 220) > 400 ? window.innerHeight - 220 : 400
    this.search.envDate = new Date()
    this.search.strDate = new Date(new Date().setDate(new Date().getDate() - 7))
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
    this.getSpotList()
  },
  mounted () {
    // this.getDataList();
    this.getMatterNameItem();
    this.getMeterTypeNameItem()
    this.searchDatas()
  },
  methods: {
    getSpotList () {
      this.axios.get('pass/systemBase/v1/meterbasespotinfos/noPage' + '?validFlag=1&spotTypeName=汽车衡')
        .then(res => {
          console.log(res, '磅点返回数据')
          this.spotNameList = [...res.data];
        })
    },
    endTimeVerify (rule, value, callback) {
      if (this.search.strDate && !this.search.envDate) {
        callback(new Error('结束时间不能为空！'));
      } else if (this.search.envDate) {
        if (Date.parse(this.search.envDate) > Date.parse(this.search.strDate)) {
          callback();
        } else {
          callback(new Error('结束时间不得早于开始时间！'));
        }
      } else {
        callback();
      }
    },
    getSummaries (param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "总计";
        }
        if (index === 1) {
          sums[index] = data.length;
        } else if (column.property === "grossWeight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].grossWeight ? Math.round((data[i].grossWeight - 0) / 10) / 100 : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        } else if (column.property === "tareWeight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].tareWeight ? Math.round((data[i].tareWeight - 0) / 10) / 100 : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        } else if (column.property === "netWeight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].netWeight ? Math.round((data[i].netWeight - 0) / 10) / 100 : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        } else if (column.property === "addWeight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].addWeight ? Math.round((data[i].addWeight - 0) / 10) / 100 : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        }
      });
      return sums;
    },
    getMatterName (val) {
      if (val) {
        this.matterNameItem = this.matList.filter(item => {
          if (item.matterName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.matterNameItem = [...this.matList].slice(0, 300)
      }
    },
    strTimeVerify (rule, value, callback) {
      if (this.search.envDate && !this.search.strDate) {
        callback(new Error('开始时间不能为空！'));
      } else {
        callback()
      }
    },
    searchDatas () {
      this.page.pageNum = 1;
      this.searchData()
    },
    searchData () {
      this.$refs['searchData'].validate((valid) => {
        if (valid) {
          this.dataLoading = true;
          this.search.uploadFlag1 = this.search.uploadFlag === '待审核' ? 0 : this.search.uploadFlag === '待上传' ? 1 : this.search.uploadFlag === '已上传' ? 2 : ''
          this.search.strDate = formatDate(this.search.strDate, 'yyyy-MM-dd HH:mm:ss')
          this.search.envDate = formatDate(this.search.envDate, 'yyyy-MM-dd HH:mm:ss')
          this.axios.get('pass/systemBase/v1/meterworkcaractuals/selectView' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&carNo=' + this.search.carNo
            + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&uploadFlag=' + this.search.uploadFlag1
            + '&netTime1=' + this.search.strDate + '&netTime2=' + this.search.envDate + `&baseSpot1Name=${this.search.baseSpot1Name}&predictionType=${this.search.predictionType}`)
            .then(res => {
              this.dataLoading = false;
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
            }).catch(e => {
              this.dataLoading = false;
            });
        }
      })
    },
    getRow (val) {
      this.actualFirst = val
      this.grossWeight1 = this.actualFirst.grossWeight ? (this.actualFirst.grossWeight / 1000).toFixed(2) : ''
      this.tareWeight1 = this.actualFirst.tareWeight ? (this.actualFirst.tareWeight / 1000).toFixed(2) : ''
      this.netWeight1 = this.actualFirst.netWeight ? (this.actualFirst.netWeight / 1000).toFixed(2) : ''
      this.nowTime = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
      this.actualNo1 = this.actualFirst.actualNo ? this.actualFirst.actualNo : ''
      this.predictionNo1 = this.actualFirst.predictionNo ? this.actualFirst.predictionNo : ''
      this.carNo1 = this.actualFirst.carNo ? this.actualFirst.carNo : ''
      this.matterName1 = this.actualFirst.matterName ? this.actualFirst.matterName : ''
      this.meterTypeName1 = this.actualFirst.meterTypeName ? this.actualFirst.meterTypeName : ''
      this.forwardingUnitName1 = this.actualFirst.forwardingUnitName ? this.actualFirst.forwardingUnitName : ''
      this.receivingUintName1 = this.actualFirst.receivingUintName ? this.actualFirst.receivingUintName : ''
      this.grossTime1 = this.actualFirst.grossTime ? this.actualFirst.grossTime : ''
      this.tareTime1 = this.actualFirst.tareTime ? this.actualFirst.tareTime : ''
      this.netTime1 = this.actualFirst.netTime ? this.actualFirst.netTime : ''
      this.addWeight1 = this.actualFirst.addWeight ? this.actualFirst.addWeight : 0
      this.specName1 = this.actualFirst.specName ? this.actualFirst.specName : ''
    },
    // 导出
    doExport () {
      if (this.table.list.length === 0) {
        this.$message.warning("表格无数据不能导出");
        return true;
      }
      this.tableExportLoading = true;
      this.isFixed = false;
      this.icoreFilterFlag = false;
      setTimeout(() => {
        let data = this.table.list;
        this.table.list = [];
        // 将大表控件bigDataShow改成[10000, 28];
        setTimeout(() => {
          // this.bigDataShow = [10000, 28];
          // this.isFixed = false;
          this.table.list = data;
          setTimeout(() => {
            this.tableExportLoading = false;
            this.doExport2();
          }, 0);
        }, 0);
      }, 0);
    },
    doExport2 () {
      // 将固定列去掉，否则导出的element-ui表格会有两个，因为element-ui固定列的实现原理是表格上面再套一层表格
      this.$nextTick(() => {
        let table = document.querySelector("#topTable .el-table");
        let header = document.querySelector(
          "#topTable .el-table .el-table__header"
        );
        let body = document.querySelector("#topTable .el-table .el-table__body");
        console.log(body)
        let footer = document.querySelector(
          "#topTable .el-table .el-table__footer"
        );
        let oTd = document.querySelectorAll("#topTable .el-table td");
        let oTh = document.querySelectorAll("#topTable .el-table th");
        // let tjTd = document.querySelectorAll('#power_table .el-table .el-table__footer td[rowspan="1"]');
        // 设置表格的border属性值为1，解决表格导出后无边框问题
        header.border = "1";
        body.border = "1";
        // footer.border = "1";
        for (let item of Array.from(oTd)) {
          item.style.height = "27px";
          // item.setAttribute('style', 'height:27px;mso-number-format:"@"');
        }
        for (let item of Array.from(oTh)) {
          item.style.height = "27px";
        }
        // 处理表格底部合计统计样式问题
        // for (let item of Array.from(tjTd)) {
        //   item.setAttribute('rowspan', '2');
        // }
        let ex = '<th class="gutter" style="width: 10px; height: 27px;"></th>';
        let ex2 = '<th class="gutter" style="width: 0px; height: 27px;"></th>';
        ex = new RegExp(ex, "g").test(table.outerHTML) ? ex : ex2;
        // console.log(new RegExp(ex2, 'g').test(table.outerHTML), 'table.outerHTML', table.outerHTML);
        let bd = table.outerHTML.replace(new RegExp(ex, "g"), "");
        bd = bd.replace("正在整理数据", "");
        let html =
          '<html><head><meta charset="utf-8" /></head><body>' +
          bd +
          "</body></html>";
        let blob = new Blob([html], { type: "application/vnd.ms-excel" });
        let link = document.createElement("a");
        link.download = "计量实绩信息表.xls";
        link.href = URL.createObjectURL(blob);
        // document.body.appendChild(link);
        link.click();
        // 导出之后将a标签移除掉，并将border属性设置为最初的0
        // document.body.removeChild(link)
        header.border = "0";
        body.border = "0";
        // s
        for (let item of Array.from(oTd)) {
          item.style.height = "";
        }
        for (let item of Array.from(oTh)) {
          item.style.height = "";
        }
        // for (let item of Array.from(tjTd)) {
        //   item.setAttribute('rowspan', '1');
        // }
        // this.bigDataShow = [4, 28];
        this.isFixed = true;
        this.icoreFilterFlag = true;
      });
    },
    printQRCode () {
      if (JSON.stringify(this.actualFirst) === "{}") {
        this.$message.warning('请选择结净计量数据')
        return
      }
      let str = this.actualFirst.actualNo + ',' + this.actualFirst.netWeight + ',' + '2'
      this.axios.post('pass/systemBase/v1/meterworkcaractualfirsts/encryptionForWeb', { str }, { individualType: 'json' })
        .then(res => {
          if (res.code == 0 || res.code == 200) {
            let qrCode = res.data
            setTimeout(() => {
              document.getElementById("XQ2").innerHTML = ""; //置空
              new QRCode(document.getElementById("XQ2"), {
                text: qrCode,
                width: 128,
                height: 158,
                colorDark: "#000000",
                colorLight: "#ffffff",
              })
              setTimeout(() => {
                this.printPage('printContent');
              }, 500)
            }, 100)
          }
        }).catch(e => {
          this.$message.error(res.message)
        })
    },
    handleSelectionChange (val) {
      this.multipleSelection = val;
    },
    pageSizeChange (size) {
      this.page.pageSize = size;
      this.searchData()
    },
    pageCurrentChange (index) {
      this.page.pageNum = index;
      this.searchData()
    },
    getDataList () {
      this.dataLoading = true;
      this.axios.get('pass/systemBase/v1/meterworkcaractuals/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize)
        .then(res => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.page.totalPage = res.data.total;
          this.table.list.forEach(item => {
            item.grossTime = item.grossTime ? item.grossTime + '\xa0' : item.grossTime;
            item.tareTime = item.tareTime ? item.tareTime + '\xa0' : item.tareTime;
            item.netTime = item.netTime ? item.netTime + '\xa0' : item.netTime;
            item.predictionNo = item.predictionNo ? item.predictionNo + '\xa0' : item.predictionNo;
            item.actualFirst1No = item.actualFirst1No ? item.actualFirst1No + '\xa0' : item.actualFirst1No;
            item.actualFirst2No = item.actualFirst2No ? item.actualFirst2No + '\xa0' : item.actualFirst2No;
          });
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    tableRowClassName ({
      row,
      rowIndex
    }) {
      if (row.uploadFlag === '2') {
        return 'error-row2';
      } else if (row.uploadFlag === '1') {
        return 'wait-row'
      }
      return '';
    },
    getMatterNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasematterinfos/noPage' + '?validFlag=1')
        .then(res => {
          this.matList = res.data;
          this.matterNameItem = [...res.data].slice(0, 300);
        })
    },
    getMeterTypeNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001006' + '&validFlag=1')
        .then(res => {
          this.meterTypeNameItem = res.data;
        })
    }
  }
}
</script>

<style scoped>
.small-font {
  font-size: 7px;
  -webkit-transform-origin-x: 0;
  -webkit-transition: scale(0.58);
}
</style>