<!--一次计量数据匹配-->
<template>
  <div class="systemBase">
    <div>
      <div style="margin-top: 10px; border-bottom: 1px solid #d5d5d5">
        <el-form
          ref="searchData1"
          :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="baseSpotNo" label="计量点">
            <el-select
              v-model="search.baseSpotNo"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
            >
              <el-option
                v-for="(item, index) in baseSpotNameItem"
                :key="index"
                :label="item.baseSpotName"
                :value="item.baseSpotNo"
              >
              </el-option>
            </el-select>
          </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="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="valueFlag" label="数据状态">
                     <el-select v-model="search.valueFlag" clearable filterable collapse-tags size="small" style="width:120px">
                        <el-option v-for="(item,index) in valueFlagItem" :key="index" :label="item.valueFlag"
                         :value="item.valueFlag">
                        </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="searchData"
              v-loading.fullscreen.lock="operateLoading"
              v-privilege="activeMenu + 'SEARCH'"
              >查询</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">
              一次计量数据<span style="color: red"
                >(只会查询出进行了审核的数据)</span
              >
              <div class="common-operation-button-div">
                <el-button
                  size="mini"
                  type="primary"
                  icon="el-icon-check"
                  @click="mateData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'MATCH'"
                  >匹配</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  plain
                  icon="el-icon-remove-outline"
                  @click="removeData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'RELIEVE'"
                  >解除</el-button
                >
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="dataLoading"
                :row-class-name="tableRowClassName"
                ref="dataTable"
                highlight-current-row
                border
                :height="tableHeight"
                @selection-change="handleSelectionChange"
                :data="table.list"
                @row-click="getDataList2"
                :exchangeFilterMap="{
                  valueFlag: { '0': '作废', '1': '有效', '2': '洁净' },
                  weightType: {
                    '0': '毛重',
                    '1': '常规皮重',
                    '2': '期限皮重',
                    '3': '历史皮重',
                    '4': '标识皮重',
                    '5': '自重皮重',
                  },
                }"
                :icore-filter-flag="icoreFilterFlag"
                >>
                <el-table-column
                  type="index"
                  label="序号"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <el-table-column
                  type="selection"
                  width="55"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="actualFirstNo"
                  label="作业编号"
                  min-width="110"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="predictionNo"
                  label="预报编号"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="carNo"
                  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="meterWeight"
                  label="重量/t"
                  min-width="100"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.floor((scope.row.meterWeight - 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="addWeight"
                  min-width="100"
                  label="附加重量/t"
                  align="right"
                >
                  <template slot-scope="scope">
                    {{ Math.floor((scope.row.addWeight - 0) / 10) / 100 }}
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="weightType"
                  label="重量类型"
                  min-width="100"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.weightType == 0">毛重</span>
                    <span v-else-if="scope.row.weightType == 1">常规皮重</span>
                    <span v-else-if="scope.row.weightType == 2">期限皮重</span>
                    <span v-else-if="scope.row.weightType == 3">历史皮重</span>
                    <span v-else-if="scope.row.weightType == 4">标识皮重</span>
                    <span v-else-if="scope.row.weightType == 5">自重皮重</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="baseSpotName"
                  min-width="100"
                  label="计量点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="createTime"
                  min-width="160"
                  label="计量时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="createManName"
                  min-width="100"
                  label="计量员"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterClass"
                  min-width="100"
                  label="班次"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterGroup"
                  min-width="100"
                  label="班组"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="contractNo"
                  min-width="100"
                  label="合同号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="batchNo"
                  min-width="100"
                  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="materialName"
                  min-width="100"
                  label="材质"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="specName"
                  min-width="100"
                  label="规格"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="bindCardNo"
                  min-width="100"
                  label="绑定卡号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="loadPointName"
                  min-width="100"
                  label="卸货地点"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="sampleNo"
                  min-width="100"
                  label="取样编号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="sampleVoucher"
                  min-width="100"
                  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="100"
                  label="业务类型"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="valueFlag"
                  label="状态"
                  min-width="100"
                  align="center"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.valueFlag == 0">作废</span>
                    <span v-else-if="scope.row.valueFlag == 1">有效</span>
                    <span v-else-if="scope.row.valueFlag == 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>
      <el-row>
        <el-col :span="24">
          <div
            style="
              margin-top: 10px;
              padding-top: 10px;
              border-bottom: 1px solid #d5d5d5;
              border-top: 1px solid #d5d5d5;
            "
          >
            <el-form ref="search2" :inline="true" :model="search2">
              <el-form-item
                label-width="80px"
                prop="predictionNo"
                label="预报编号"
              >
                <el-input
                  v-model="search2.predictionNo"
                  clearable
                  size="small"
                  style="width: 120px"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
              <el-form-item prop="carNo" label="车号">
                <el-input
                  v-model="search2.carNo"
                  clearable
                  size="small"
                  style="width: 120px"
                  placeholder="请输入"
                ></el-input>
              </el-form-item>
              <el-form-item prop="predictionType" label="预报类型">
                <el-select
                  v-model="search2.predictionType"
                  clearable
                  filterable
                  collapse-tags
                  size="small"
                  style="width: 120px"
                >
                  <el-option
                    v-for="(item, index) in predictionTypeItem"
                    :key="index"
                    :label="item.predictionType"
                    :value="item.predictionType"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="meterTypeName" label="业务类型">
                <el-select
                  v-model="search2.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="matterNo" label="物资名称">
                <el-select
                  v-model="search2.matterNo"
                  clearable
                  filterable
                  collapse-tags
                  size="small"
                  style="width: 120px"
                  :filter-method="getMatterName2"
                >
                  <el-option
                    v-for="(item, index) in matterNameItem2"
                    :key="index"
                    :label="item.matterName"
                    :value="item.matterNo"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label-width="20px">
                <el-button
                  icon="el-icon-search"
                  type="primary"
                  size="mini"
                  @click="searchData2"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'SEARCH2'"
                  >查询</el-button
                >
              </el-form-item>
            </el-form>
          </div>
          <div class="common-title-div">计量预报</div>
          <div class="common-table-div">
            <el-table
              v-loading="dataLoading2"
              :row-class-name="tableRowClassName2"
              ref="dataTable2"
              highlight-current-row
              border
              :height="tableHeight"
              @current-change="handleCurrentChange"
              :data="table.list2"
              :exchangeFilterMap="{
                predictionType: {
                  '0': '批次预报',
                  '1': '单次预报',
                  '2': '联运预报',
                  '3': '分检预报',
                },
                valueFlag: {
                  '0': '未配车',
                  '1': '未使用',
                  '2': '已使用',
                  '3': '已作废',
                  '4': '正使用',
                },
              }"
              :icore-filter-flag="icoreFilterFlag"
            >
              <el-table-column
                type="index"
                label="序号"
                fixed="left"
                align="center"
              ></el-table-column>
              <!-- <el-table-column type="selection" width="55" align="center"></el-table-column> -->
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="noticeNo"
                label="通知单号"
                min-width="110"
                align="center"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="predictionNo"
                label="预报编号"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="carNo"
                label="车号"
                min-width="110"
                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="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="contractNo"
                label="合同号"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="contractNo"
                label="批次号"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="customerSupplierName"
                label="供应商"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="forwardingUnitName"
                label="发货单位"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="receivingUintName"
                label="收货单位"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="materialName"
                label="材质"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="specName"
                label="规格"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="shipmentGrossWeight"
                label="发运毛重/t"
                min-width="80"
                align="left"
              >
                <template slot-scope="scope">
                  {{
                    Math.floor((scope.row.shipmentGrossWeight - 0) / 10) / 100
                  }}
                </template>
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="shipmentNetWeight"
                label="发运净重/t"
                min-width="80"
                align="left"
              >
                <template slot-scope="scope">
                  {{ Math.floor((scope.row.shipmentNetWeight - 0) / 10) / 100 }}
                </template>
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="shipmentNum"
                label="发运数量"
                min-width="80"
                align="left"
              >
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="bindCardNo"
                label="绑定卡号"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="loadPointName"
                label="卸货地点"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="sampleNo"
                label="取样编号"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="sampleVoucher"
                label="取样凭证"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="carrierUnitName"
                label="承运单位"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="predictionType"
                label="预报类型"
                min-width="100"
                align="left"
              >
                <template slot-scope="scope">
                  <span v-if="scope.row.predictionType == 0">批次预报</span>
                  <span v-else-if="scope.row.predictionType == 1"
                    >单次预报</span
                  >
                  <span v-else-if="scope.row.predictionType == 2"
                    >联运预报</span
                  >
                  <span v-else-if="scope.row.predictionType == 3"
                    >分检预报</span
                  >
                </template>
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="predictionCombination"
                label="预报组合"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="meterTypeName"
                label="业务类型"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="usedType"
                label="可用类型"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="effectiveStartTime"
                label="有效开始时间"
                min-width="160"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="effectiveEndTime"
                label="有效结束时间"
                min-width="160"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="effectiveWeight"
                label="有效总量/t"
                min-width="80"
                align="left"
              >
                <template slot-scope="scope">
                  {{ Math.floor((scope.row.effectiveWeight - 0) / 10) / 100 }}
                </template>
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="effectiveNum"
                label="有效次数"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="meterWeight"
                label="检斤重量/t"
                min-width="80"
                align="left"
              >
                <template slot-scope="scope">
                  {{ Math.floor((scope.row.meterWeight - 0) / 10) / 100 }}
                </template>
              </el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="meterNum"
                label="检斤次数"
                min-width="80"
                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="valueFlag"
                label="状态"
                min-width="60"
                align="center"
              >
                <template slot-scope="scope">
                  <span v-if="scope.row.valueFlag == 0">未配车</span>
                  <span v-else-if="scope.row.valueFlag == 1">未使用</span>
                  <span v-else-if="scope.row.valueFlag == 2">已使用</span>
                  <span v-else-if="scope.row.valueFlag == 3">已作废</span>
                  <span v-else-if="scope.row.valueFlag == 4">正使用</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="common-foot-style">
            <el-pagination
              v-loading="dataLoading2"
              @size-change="pageSizeChange2"
              @current-change="pageCurrentChange2"
              :current-page="page2.pageNum"
              :page-sizes="[50, 100, 200, 400]"
              :page-size="page2.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="page2.totalPage"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import { formatDate } from '@/utils/util.js';
export default {
  data () {
    return {
      dataLoading: false,
      dataLoading2: false,
      operateLoading: false,
      icoreFilterFlag: true,
      baseSpotNameItem: [],//计量点
      actualFirst: {},
      meterTypeNameItem: [
        // {meterTypeNo:'1', meterTypeName:'采购进厂'},
        // {meterTypeNo:'2', meterTypeName:'销售出厂'},
        // {meterTypeNo:'3', meterTypeName:'内部倒运'}
      ],
      matterNameItem: [],
      matterNameItem2: [],
      valueFlagItem: [
        { valueFlag: '有效' },
        { valueFlag: '作废' },
        { valueFlag: '结净' }
      ],
      predictionTypeItem: [
        { predictionType: '批次预报' },
        { predictionType: '单次预报' },
        { predictionType: '联运预报' },
        { predictionType: '分检预报' }
      ],
      page: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      page2: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      table: {
        list: [],
        list2: []
      },
      multipleSelection: [],
      singleCurrent: {},
      tableHeight: 0,
      search: {
        carNo: '',
        baseSpotNo: '',
        meterTypeName: '',
        matterNo: '',
        valueFlag: '',
        strDate: formatDate(new Date(), 'yyyy-MM-dd') + ' 00:00:00',
        envDate: formatDate(new Date(), 'yyyy-MM-dd') + ' 23:59:59',
      },
      search2: {
        predictionNo: '',
        carNo: '',
        predictionType: '',
        meterTypeName: '',
        matterNo: ''
      },
      ruleValidateSearch: {
        envDate: [{
          required: true,
          validator: this.endTimeVerify,
          trigger: 'blur'
        }],
        strDate: [{
          required: true,
          validator: this.strTimeVerify,
          trigger: 'blur'
        }]
      },
      activeMenu: '',
      matList: []
    }
  },
  created () {
    this.tableHeight = (window.innerHeight - 320) / 2 > 200 ? (window.innerHeight - 320) / 2 : 200
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
  },
  mounted () {
    this.getDataList();
    this.getMatterNameItem();
    this.getBaseSpotNameItem();
    this.getMeterTypeNameItem();
  },
  methods: {
    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)
      }
    },
    getMatterName2 (val) {
      this.axios.get('pass/systemBase/v1/meterbasematterinfos/noPage' + '?validFlag=1' + '&matterName=' + val)
        .then(res => {
          this.matterNameItem2 = 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();
      }
    },
    strTimeVerify (rule, value, callback) {
      if (this.search.envDate && !this.search.strDate) {
        callback(new Error('开始时间不能为空！'));
      } else {
        callback()
      }
    },
    mateData () {
      if (this.multipleSelection.length !== 1) {
        return this.$message.warning('请选择一条计量数据！');
      }
      if (JSON.stringify(this.singleCurrent) == "{}") {
        return this.$message.warning('请选择一条计量预报数据！');
      }
      let obj = {}
      //  let obj = Object.assign(this.multipleSelection[0], this.singleCurrent);
      obj.actualFirstNo = this.multipleSelection[0].actualFirstNo
      obj.predictionNo = this.singleCurrent.predictionNo
      this.axios.post('pass/systemBase/v1/meterworkcaractualfirsts/match', obj, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('匹配成功');
          this.getDataListUpdate()
          this.getDataList2(this.actualFirst);
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    removeData () {
      if (this.multipleSelection.length < 1) {
        return this.$message.warning('请选择计量数据！');
      }
      this.axios.post('pass/systemBase/v1/meterworkcaractualfirsts/remove', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('解除成功');
          this.getDataListUpdate()
          this.getDataList2(this.actualFirst);
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    handleSelectionChange (val) {
      this.multipleSelection = val;
      this.$refs.dataTable.setCurrentRow(this.multipleSelection[val.length - 1])
      this.getDataList2(this.multipleSelection[val.length - 1])
    },
    pageSizeChange (size) {
      this.page.pageSize = size;
      this.getDataList();
    },
    pageCurrentChange (index) {
      this.page.pageNum = index;
      this.getDataList();
    },
    pageSizeChange2 (size) {
      this.page2.pageSize = size;
      this.getDataList2(this.actualFirst);
    },
    pageCurrentChange2 (index) {
      this.page2.pageNum = index;
      this.getDataList2(this.actualFirst);
    },
    handleCurrentChange (val) {
      this.singleCurrent = val
    },
    getDataList () {
      this.dataLoading = true;
      this.axios.get('pass/systemBase/v1/meterworkcaractualfirsts/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&weightType=0&valueFlag=1')
        .then(res => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.page.totalPage = res.data.total;
          if (this.table.list.length > 0) {
            this.$refs.dataTable.setCurrentRow(this.table.list[0])
            this.getDataList2(this.table.list[0])
          }
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getDataListUpdate () {
      this.dataLoading = true;
      this.axios.get('pass/systemBase/v1/meterworkcaractualfirsts/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&weightType=0&valueFlag=1')
        .then(res => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.page.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getDataList2 (row) {
      this.actualFirst = row
      if (row === undefined || row === null) {
        this.table.list2 = []
        return
      }
      this.dataLoading2 = true;
      this.$refs.dataTable.setCurrentRow(this.actualFirst)
      this.axios.get('pass/systemBase/v1/pretrackscales/select' + '?pageNum=' + this.page2.pageNum + '&pageSize=' + this.page2.pageSize + '&carNo=' + row.carNo)
        .then(res => {
          this.dataLoading2 = false;
          this.table.list2 = res.data.list;
          this.page2.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading2 = false;
        });
    },
    searchData () {
      this.$refs['searchData1'].validate((valid) => {
        if (valid) {
          this.dataLoading = true;
          this.table.list2 = []
          this.page.pageNum = 1;
          //  this.search.valueFlag1 = this.search.valueFlag === '有效' ? 1 : this.search.valueFlag === '作废' ? 0 : this.search.valueFlag === '结净' ? 2 : ''
          //  this.search.strDate = formatDate (this.search.strDate, 'yyyy-MM-dd')
          //  this.search.envDate = formatDate (this.search.envDate, 'yyyy-MM-dd')
          if (isNaN(this.search.strDate) && !isNaN(Date.parse(this.search.strDate))) {
          } else {
            this.search.strDate = formatDate(this.search.strDate, 'yyyy-MM-dd HH:mm:ss')
          }
          if (isNaN(this.search.envDate) && !isNaN(Date.parse(this.search.envDate))) {
          } else {
            this.search.envDate = formatDate(this.search.envDate, 'yyyy-MM-dd HH:mm:ss')
          }
          this.axios.get('pass/systemBase/v1/meterworkcaractualfirsts/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&carNo=' + this.search.carNo
            + '&baseSpotNo=' + this.search.baseSpotNo + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&valueFlag=1'
            + '&createTime1=' + this.search.strDate + '&createTime2=' + this.search.envDate)
            .then(res => {
              this.dataLoading = false;
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
              if (this.table.list.length > 0) {
                this.$refs.dataTable.setCurrentRow(this.table.list[0])
                this.getDataList2(this.table.list[0])
              }
            }).catch(e => {
              this.dataLoading = false;
            });
        }
      })
    },
    searchData2 () {
      this.dataLoading2 = true;
      this.page2.pageNum = 1;
      this.search2.predictionType1 = this.search2.predictionType === '批次预报' ? 0 : this.search2.predictionType === '单次预报' ? 1 : this.search2.predictionType === '联运预报' ? 2 : this.search2.predictionType === '分检预报' ? 3 : ''
      this.axios.get('pass/systemBase/v1/pretrackscales/' + '?pageNum=' + this.page2.pageNum + '&pageSize=' + this.page2.pageSize + '&carNo=' + this.search2.carNo
        + '&predictionNo=' + this.search2.predictionNo + '&meterTypeName=' + this.search2.meterTypeName + '&matterNo=' + this.search2.matterNo + '&predictionType=' + this.search2.predictionType1)
        .then(res => {
          this.dataLoading2 = false;
          this.table.list2 = res.data.list;
          this.page2.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading2 = false;
        });
    },
    getMatterNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasematterinfos/noPage' + '?validFlag=1')
        .then(res => {
          this.matList = res.data;
          this.matterNameItem = [...res.data].slice(0, 300);
        })
    },
    getBaseSpotNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasespotinfos/noPage' + '?validFlag=1')
        .then(res => {
          this.baseSpotNameItem = res.data;
        })
    },
    getMeterTypeNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001006' + '&validFlag=1')
        .then(res => {
          this.meterTypeNameItem = res.data;
        })
    },
    tableRowClassName ({
      row,
      rowIndex
    }) {
      if (row.valueFlag === '0') {
        return 'error-row2';
      }
      return '';
    },
    tableRowClassName2 ({
      row,
      rowIndex
    }) { }
  }
}
</script>

<style scoped>
</style>