<!--汽车衡计量预报管理-->
<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"
          style="padding-left: 12px"
          label-width="70px"
        >
          <el-form-item prop="predictionNo" label="预报编号">
            <el-input
              v-model="search.predictionNo"
              clearable
              size="small"
              style="width: 120px"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item prop="carNo" label="车号">
            <el-input
              v-model="search.carNo"
              clearable
              size="small"
              style="width: 120px"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item prop="railwayNo" label="火车号">
            <el-input
              v-model="search.railwayNo"
              clearable
              size="small"
              style="width: 120px"
              placeholder="请输入"
            ></el-input>
          </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 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="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="contractNo" label="合同号">
            <el-input
              v-model="search.contractNo"
              clearable
              size="small"
              style="width: 120px"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item prop="forwardingUnitName" label="发货单位">
            <el-select
              v-model="search.forwardingUnitName"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
              :filter-method="filterSdr"
            >
              <el-option
                v-for="item in provideList"
                :key="item.customerSupplierNo"
                :label="item.customerSupplierName"
                :value="item.customerSupplierName"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="customerSupplierName" label="供应商">
            <el-select
              v-model="search.customerSupplierName"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
              :filter-method="filterCust"
            >
              <el-option
                v-for="item in customerList"
                :key="item.customerSupplierNo"
                :label="item.customerSupplierName"
                :value="item.customerSupplierName"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="receivingUintName" label="收货单位">
            <el-select
              v-model="search.receivingUintName"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 120px"
              :filter-method="filterRcv"
            >
              <el-option
                v-for="item in rcvList"
                :key="item.customerSupplierNo"
                :label="item.customerSupplierName"
                :value="item.customerSupplierName"
              >
              </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="getMatterName2"
            >
              <el-option
                v-for="item in matterNameItem2"
                :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="startTime" label="开始时间">
            <el-date-picker
              class="measure-self-picker"
              v-model="search.startTime"
              clearable
              type="datetime"
              style="width: 120px"
              placeholder="选择日期"
              @change="dateChange(search.startTime, 'startTime')"
              size="small"
            ></el-date-picker>
          </el-form-item>
          <el-form-item prop="endTime" label="结束时间">
            <el-date-picker
              class="measure-self-picker"
              v-model="search.endTime"
              clearable
              type="datetime"
              style="width: 120px"
              placeholder="选择日期"
              @change="dateChange(search.endTime, 'endTime')"
              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-search"
              type="primary"
              size="mini"
              @click="historySearchData"
              v-loading.fullscreen.lock="operateLoading"
              v-privilege="activeMenu + 'HISTORYSEARCH'"
              >历史查询</el-button
            >
          </el-form-item>
        </el-form>
      </div>
      <el-row>
        <el-col :span="18">
          <div style="border-right: 1px solid #d5d5d5">
            <div class="common-title-div">
              计量预报管理
              <div class="common-operation-button-div">
                <el-button
                  icon="el-icon-circle-plus-outline"
                  type="primary"
                  size="mini"
                  @click="addData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'ADD'"
                  >新增</el-button
                >
                <el-button
                  icon="el-icon-edit"
                  type="primary"
                  size="mini"
                  @click="modifyData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'UPDATE'"
                  >修改</el-button
                >
                <el-button
                  size="mini"
                  type="primary"
                  icon="el-icon-check"
                  @click="enableData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'RECOVERY'"
                  >启用</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  plain
                  icon="el-icon-remove-outline"
                  @click="discardData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'ABOLISH'"
                  >废除</el-button
                >
                <el-button
                  size="mini"
                  type="primary"
                  icon="el-icon-check"
                  @click="combinedData"
                  v-loading.fullscreen.lock="operateLoading"
                  v-privilege="activeMenu + 'TRANSPORT'"
                  >联运</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
                >
                <el-button
                  type="primary"
                  size="mini"
                  @click="showBatchDialog"
                  v-privilege="activeMenu + 'BATCHEDIT'"
                  >批量修改</el-button
                >
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="dataLoading"
                @row-click="rowChange"
                :row-class-name="tableRowClassName"
                ref="dataTable"
                highlight-current-row
                :bigDataShow="groupList"
                :style="{ width: tWidth + '%' }"
                border
                :height="tableHeight"
                @row-dblclick="rowDblClick2"
                @selection-change="handleSelectionChange"
                :data="table.list"
                @cell-click="getDataList2"
                :exchangeFilterMap="{
                  valueFlag: {
                    '0': '未配车',
                    '1': '未使用',
                    '2': '已使用',
                    '3': '已作废',
                    '4': '正使用',
                  },
                  predictionType: {
                    '0': '批次预报',
                    '1': '单次预报',
                    '2': '联运预报',
                    '3': '分检预报',
                  },
                  usedType: { '0': '次数', '1': '时间', '2': '总量' },
                }"
                :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="predictionNo"
                  label="预报编号"
                  min-width="120"
                  align="left"
                ></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="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="contractNo"
                  label="合同号"
                  min-width="100"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="batchNo"
                  min-width="110"
                  label="批次号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="heatNo"
                  min-width="120"
                  label="炉号(检验批次)"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="customerSupplierName"
                  min-width="160"
                  label="供应商"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="forwardingUnitName"
                  min-width="160"
                  label="发货单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="receivingUintName"
                  min-width="160"
                  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="shipmentGrossWeight"
                  min-width="100"
                  label="发运毛重"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="shipmentNetWeight"
                  min-width="100"
                  label="发运净重"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="shipmentNum"
                  min-width="100"
                  label="发运数量"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="addWeightSum"
                  min-width="100"
                  label="附加重量总和"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="bindCardNo"
                  min-width="200"
                  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="160"
                  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="100"
                  label="承运单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="predictionType"
                  min-width="100"
                  label="预报类型"
                  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"
                  min-width="300"
                  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="usedType"
                  min-width="100"
                  label="可用类型"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.usedType == 0">次数</span>
                    <span v-else-if="scope.row.usedType == 1">时间</span>
                    <span v-else-if="scope.row.usedType == 2">总量</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="effectiveStartTime"
                  min-width="160"
                  label="有效开始时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="effectiveEndTime"
                  min-width="160"
                  label="有效结束时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="effectiveWeight"
                  min-width="100"
                  label="有效总量"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="effectiveNum"
                  min-width="100"
                  label="有效次数"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterWeight"
                  min-width="100"
                  label="检斤重量"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="meterNum"
                  min-width="100"
                  label="检斤次数"
                  align="right"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="railwayNo"
                  min-width="100"
                  label="火车车号"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="carAllocationTime"
                  min-width="160"
                  label="配车时间"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="valueFlag"
                  label="状态"
                  width="60"
                  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>
                    <span v-else-if="scope.row.valueFlag == 3">已作废</span>
                    <span v-else-if="scope.row.valueFlag == 4">正使用</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="memo"
                  min-width="200"
                  label="备注"
                  align="left"
                ></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="[100, 500, 1000]"
                :page-size="page.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="page.totalPage"
              >
              </el-pagination>
            </div>
            <div
              ref="editTitle"
              class="common-title-div"
              style="margin-top: 20px; border-top: 1px solid #d5d5d5"
            >
              预报编辑区
            </div>
            <div ref="editDiv" class="commom-edit-div">
              <el-form
                ref="baseData"
                label-width="80px"
                :inline="true"
                :rules="ruleValidateTable1"
                :model="baseData"
              >
                <el-form-item prop="noticeNo" label="通知单号">
                  <el-input
                    v-model="baseData.noticeNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                    disabled
                  ></el-input>
                </el-form-item>
                <el-form-item prop="predictionType" label="预报类型">
                  <el-select
                    v-model="baseData.predictionType"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    @change="decisionPredictionType(baseData.predictionType)"
                  >
                    <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="shipmentNetWeight" label="发运净重">
                  <el-input
                    v-model="baseData.shipmentNetWeight"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="shipmentNum" label="发运数量">
                  <el-input
                    v-model="baseData.shipmentNum"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="shipmentGrossWeight" label="发运毛重">
                  <el-input
                    v-model="baseData.shipmentGrossWeight"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="materialName" label="材       质">
                  <el-select
                    v-model="baseData.materialName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in materialNameItem"
                      :key="index"
                      :label="item.baseName"
                      :value="item.baseName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="specName" label="规       格">
                  <el-select
                    v-model="baseData.specName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in specNameItem"
                      :key="index"
                      :label="item.baseName"
                      :value="item.baseName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="matterName" label="物资名称">
                  <el-select
                    v-model="baseData.matterName"
                    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.matterName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="usedType" label="可用类型">
                  <el-select
                    v-model="baseData.usedType"
                    :readonly="isUsedType"
                    :disabled="isUsedType"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    @change="decisionUsedType(baseData.usedType)"
                  >
                    <el-option
                      v-for="(item, index) in usedTypeItem"
                      :key="index"
                      :label="item.usedType"
                      :value="item.usedType"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="forwardingUnitName" label="发货单位">
                  <el-select
                    v-model="baseData.forwardingUnitName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    :filter-method="filterESdr"
                  >
                    <el-option
                      v-for="item in editProList"
                      :key="item.customerSupplierNo"
                      :label="item.customerSupplierName"
                      :value="item.customerSupplierName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="卸货地点"
                 :rules="typeFlag ? loadRules.loadPointName : {}">
                  <el-select
                    v-model="baseData.loadPointName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in loadPointNameItem"
                      :key="index"
                      :label="item.loadPointName"
                      :value="item.loadPointName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="meterTypeName" label="业务类型">
                  <el-select
                    v-model="baseData.meterTypeName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    @change="typeChange"
                  >
                    <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="effectiveWeight" label="有效总量">
                  <el-input
                    v-model="baseData.effectiveWeight"
                    clearable
                    size="small"
                    :readonly="isEffectiveWeight"
                    :disabled="isEffectiveWeight"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="receivingUintName" label="收货单位">
                  <el-select
                    v-model="baseData.receivingUintName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    :filter-method="filterERcv"
                  >
                    <el-option
                      v-for="item in editReceList"
                      :key="item.customerSupplierNo"
                      :label="item.customerSupplierName"
                      :value="item.customerSupplierName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  prop="contractNo"
                  label="合 同  号"
                  :rules="typeFlag ? contractNoRules.contractNo : {}"
                >
                  <el-input
                    v-model="baseData.contractNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="effectiveNum" label="有效次数">
                  <el-input
                    v-model="baseData.effectiveNum"
                    clearable
                    size="small"
                    style="width: 120px"
                    :readonly="isEffectiveNum"
                    :disabled="isEffectiveNum"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="carrierUnitName" label="承运单位">
                  <el-select
                    v-model="baseData.carrierUnitName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in carrierUnitNameItem"
                      :key="index"
                      :label="item.carrierUnitName"
                      :value="item.carrierUnitName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="customerSupplierName" label="供应商">
                  <el-select
                    v-model="baseData.customerSupplierName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    :filter-method="filterECust"
                  >
                    <el-option
                      v-for="item in editCustList"
                      :key="item.customerSupplierNo"
                      :label="item.customerSupplierName"
                      :value="item.customerSupplierName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="carNo" label="车      号">
                  <el-input
                    v-model="baseData.carNo"
                    size="small"
                    clearable
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="trailerNo" label="挂号">
                  <el-input
                    v-model="baseData.trailerNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="railwayNo" label="火车车号">
                  <el-input
                    v-model="baseData.railwayNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="effectiveStartTime" label="开始时间">
                  <el-date-picker
                    v-model="baseData.effectiveStartTime"
                    clearable
                    type="datetime"
                    style="width: 120px"
                    :readonly="isEffectiveTime"
                    :disabled="isEffectiveTime"
                    placeholder="选择日期"
                    size="small"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item prop="effectiveEndTime" label="结束时间">
                  <el-date-picker
                    v-model="baseData.effectiveEndTime"
                    clearable
                    type="datetime"
                    style="width: 120px"
                    :readonly="isEffectiveTime"
                    :disabled="isEffectiveTime"
                    placeholder="选择日期"
                    size="small"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item
                  prop="batchNo"
                  label="炉号(检验批次)"
                  label-width="125px"
                >
                  <el-input
                    v-model="baseData.heatNo"
                    size="small"
                    clearable
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="memo" label="批次号">
                  <el-input
                    v-model="baseData.batchNo"
                    size="small"
                    clearable
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="memo" label="备注">
                  <el-input
                    v-model="baseData.memo"
                    size="small"
                    clearable
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="common-title-div">
            附加重量
            <div class="common-operation-button-div">
              <el-button
                icon="el-icon-circle-plus-outline"
                type="primary"
                size="mini"
                @click="addData2"
                v-loading.fullscreen.lock="operateLoading"
                v-privilege="activeMenu + 'ADD2'"
                >新增</el-button
              >
              <el-button
                size="mini"
                type="danger"
                plain
                icon="el-icon-remove-outline"
                @click="discardData2"
                v-loading.fullscreen.lock="operateLoading"
                v-privilege="activeMenu + 'DELETE2'"
                >删除</el-button
              >
            </div>
          </div>
          <div class="common-table-div">
            <el-table
              v-loading="dataLoading2"
              :row-class-name="tableRowClassName"
              ref="dataTable2"
              highlight-current-row
              border
              :height="tableHeight"
              @selection-change="handleSelectionChange2"
              :data="table.list2"
              :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="utensilNo"
                label="器具编号"
                min-width="110"
                align="center"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="utensilName"
                label="器具名称"
                min-width="80"
                align="left"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="utensilWeight"
                label="器具重量（KG）"
                min-width="120"
                align="right"
              ></el-table-column>
              <el-table-column
                sortable
                :show-overflow-tooltip="true"
                prop="utensilUtensilName"
                label="器具属性"
                min-width="80"
                align="left"
              ></el-table-column>
              <!-- <el-table-column sortable :show-overflow-tooltip="true" prop="memo" label="备注" min-width="200" align="left"></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="[100, 500, 1000]"
              :page-size="page2.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="page2.totalPage"
            >
            </el-pagination>
          </div>
          <div
            ref="editTitle"
            class="common-title-div"
            style="margin-top: 20px; border-top: 1px solid #d5d5d5"
          >
            附加重量编辑区
          </div>
          <div ref="editDiv" class="commom-edit-div">
            <el-form
              ref="baseData2"
              label-width="80px"
              :inline="true"
              :rules="ruleValidateTable2"
              :model="baseData2"
            >
              <el-form-item prop="utensilNo" label="器具编号">
                <el-input
                  v-model="baseData2.utensilNo"
                  clearable
                  size="small"
                  style="width: 120px"
                  placeholder="请输入"
                  @blur="getUtensil(baseData2.utensilName)"
                ></el-input>
              </el-form-item>
              <el-form-item prop="utensilName" label="器具名称">
                <el-select
                  v-model="baseData2.utensilName"
                  clearable
                  filterable
                  collapse-tags
                  size="small"
                  style="width: 120px"
                  @change="getUtensil(baseData2.utensilName)"
                >
                  <el-option
                    v-for="(item, index) in utensilNameItem"
                    :key="index"
                    :label="item.baseName"
                    :value="item.baseName"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="utensilUtensilName" label="器具属性">
                <el-select
                  v-model="baseData2.utensilUtensilName"
                  clearable
                  filterable
                  collapse-tags
                  size="small"
                  style="width: 120px"
                  readonly
                  disabled
                >
                  <el-option
                    v-for="(item, index) in utensilUtensilNameItem"
                    :key="index"
                    :label="item.baseName"
                    :value="item.baseName"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="utensilWeight" label="器具重量">
                <el-input
                  v-model="baseData2.utensilWeight"
                  clearable
                  size="small"
                  style="width: 120px"
                  placeholder="请输入"
                  readonly
                  disabled
                ></el-input>
              </el-form-item>
            </el-form>
          </div>
        </el-col>
      </el-row>
    </div>
    <!-- 批量编辑弹窗 -->
    <batch-edit-dialog
      type="forecast"
      :showFlag="editDialogVisible"
      :baseData="batchEditData"
      :dataList="batchEditList"
      @close="closeDialog"
    >
    </batch-edit-dialog>
  </div>
</template>
<script>
import { formatDate, getCookie } from '@/utils/util.js';
import { cookieUserId, cookieUserName } from '@/config/config.js';
import { recordChange } from '../../../utils/utils'
import batchEditDialog from '../../measurementDataManagement/components/dataManagementOfTruckScale/common/batchEditDialog';
export default {
  data () {
    return {
      dataLoading: false,
      dataLoading2: false,
      operateLoading: false,
      isEffectiveWeight: true,
      isEffectiveNum: true,
      isEffectiveTime: true,
      isUsedType: true,
      flag: 0,
      actualFirst: {},
      meterTypeNameItem: [],
      matterNameItem: [],
      valueFlagItem: [
        { valueFlag: '未配车' },
        { valueFlag: '未使用' },
        { valueFlag: '已使用' },
        { valueFlag: '已作废' },
        { valueFlag: '正使用' }
      ],
      predictionTypeItem: [
        // { id: '0', predictionType: '批次预报' },
        { id: '1', predictionType: '单次预报' },
        { id: '2', predictionType: '联运预报' },
        { id: '3', predictionType: '分检预报' }
      ],//预报类型
      usedTypeItem: [
        { id: '0', usedType: '次数' },
        { id: '1', usedType: '时间' },
        { id: '2', usedType: '总量' },
      ],
      matterNameItem2: [],
      loadPointNameItem: [],//卸货地点
      materialNameItem: [],//材质
      forwardingUnitNameItem: [],//发货单位
      icoreFilterFlag: true,
      specNameItem: [],//规格
      receivingUintNameItem: [],//收货单位
      carrierUnitNameItem: [],//承运单位
      customerSupplierNameItem: [],//供应商
      utensilNameItem: [],//器具名称
      utensilUtensilNameItem: [],//器具属性
      page: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      page2: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      table: {
        list: [],
        list2: []
      },
      modifyBaseDate: {},
      baseData: {
        loadPointName: '',
        noticeNo: '',
        predictionType: '单次预报',
        shipmentNetWeight: '',
        effectiveWeight: '',
        materialName: '',
        forwardingUnitName: '',
        railwayNo: '',
        carNo: '',
        meterTypeName: '',
        shipmentNum: '',
        effectiveNum: '1',
        specName: '',
        receivingUintName: '',
        contractNo: '',
        matterName: '',
        shipmentGrossWeight: '',
        usedType: '次数',
        carrierUnitName: '',
        customerSupplierName: '',
        trailerNo: '',
        memo: '',
        effectiveStartTime: '',
        effectiveEndTime: '',
        heatNo: ''
      },
      baseData2: {
        utensilName: '',
        utensilWeight: '',
        utensilUtensilName: '',
        utensilNo: '',
        memo: ''
      },
      multipleSelection: [],
      tableHeight: 0,
      search: {
        predictionNo: '',
        carNo: '',
        meterTypeName: '',
        matterNo: '',
        valueFlag: '',
        predictionType: '',
        forwardingUnitName: '',
        contractNo: '',
        customerSupplierName: '',
        receivingUintName: '',
        startTime: '',
        endTime: '',
        railwayNo: ''
      },
      ruleValidateSearch: {},
      ruleValidateTable1: {
        effectiveEndTime: [{ required: false, validator: this.effectiveEndTimeVerify, trigger: 'blur' }],
        effectiveWeight: [{ required: false, validator: this.effectiveWeightEmpty, trigger: 'change' }],
        effectiveNum: [{ required: true, validator: this.effectiveNumEmpty, trigger: 'change' }],
        effectiveStartTime: [{ required: false, validator: this.effectiveStartTimeVerify, trigger: 'change' }],
        railwayNo: [{ required: false, validator: this.railwayNoEmpty, trigger: 'change' }],
        matterName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        meterTypeName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        customerSupplierName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        predictionType: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        usedType: [{ required: true, message: '该项不能为空', trigger: 'change' }],
      },
      ruleValidateTable2: {
        utensilWeight: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        utensilNo: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        utensilUtensilName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        utensilName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
      },
      activeMenu: '',
      sdrList: [], // 发货单位
      rcvList: [], // 收货单位
      loadList: [], // 厂内单位
      typeFlag: true,
      customerUnitNameItem: [],
      receivingSUnitNameItem: [],
      loadRules: {
        loadPointName: [{ required: true, message: '该项不能为空', trigger: 'blur' }]
      },
      contractNoRules: { contractNo: [{ required: true, message: '该项不能为空', trigger: 'blur' }] },
      groupList: [8, 1],
      tWidth: 99,
      userNo: '',
      userName: '',
      oldObj: {},
      provideList: [],
      customerList: [],
      rcvList: [],
      receiverList: [],
      editCustList: [],
      editReceList: [],
      editProList: [],
      allList: [],
      editDialogVisible: false,
      batchEditData: {},
      batchEditList: []
    }
  },
  created () {
    this.tableHeight = (window.innerHeight - 220) / 2 > 200 ? (window.innerHeight - 220) / 2 : 200
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
    this.userNo = getCookie(cookieUserId)
    this.userName = getCookie(cookieUserName)
  },
  mounted () {
    this.searchData();
    this.getLoadPointNameItem();
    this.getMatterNameItem();//物料
    this.getCarrierUnitNameItem();//承运单位
    this.getUtensilNameItem();//器具名称
    // this.getCustomerSupplierNameItem();//供应商
    this.getMeterTypeNameItem();//业务类型
    this.getUtensilUtensilNameItem();//器具属性
    this.getMaterialNameItem();//材质
    this.getSpecNameItem();//规格
    // this.getForwardingUnitNameItem();//发货单位
    // this.getReceivingUintNameItem();//收货单位
    this.getMeterbasecustomersupplier(); // 所有供应商信息
  },
  methods: {
    getHeight () {
      this.tWidth = this.tWidth + Math.random()
    },
    getCode (code, arr, codeKey, nameKey) {
      if (!code) {
        return '';
      }
      let targetRow = arr.find(item => {
        return item[codeKey] === code;
      });
      return targetRow ? targetRow[nameKey] : '';
    },
    typeChange (val) {
      if (val) {
        if (val === '采购进厂') {
          this.typeFlag = true
        } else {
          this.typeFlag = false
        }
      }
    },
    // 显示批量修改弹窗
    showBatchDialog () {
      try {
        this.multipleSelection.forEach(item => {
          if (item.valueFlag - 0 !== 1) {
            if (item.valueFlag - 0 === 2) {
              throw new Error(`选中数据中存在已洁净的数据，请到洁净计量数据维护页面进行修改`)
            } else if (item.valueFlag - 0 === 4) {
              throw new Error(`选中数据中存在正使用的数据，请到一次计量数据维护页面进行修改`)
            } else if (item.valueFlag - 0 === 3) {
              throw new Error(`选中数据中存在作废的数据，不能进行批量修改`)
            }
          }
        })
      } catch (e) {
        return this.$message.error(e.message)
      }
      if (this.multipleSelection.length === 0) {
        return this.$message.error('请选择要进行批量修改的数据')
      }
      this.batchEditList = [...this.multipleSelection]
      this.editDialogVisible = true;
    },
    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) {
      if (val) {
        this.matterNameItem2 = this.matList.filter(item => {
          if (item.matterName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.matterNameItem2 = [...this.matList].slice(0, 300)
      }
    },
    filterCust (val) {
      console.log(val)
      if (val) {
        this.customerList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.customerList = [...this.allList].slice(0, 300)
      }
    },
    filterRcv (val) {
      if (val) {
        this.receiverList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.receiverList = [...this.allList].slice(0, 300)
      }
    },
    filterSdr (val) {
      if (val) {
        this.rcvList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.rcvList = [...this.allList].slice(0, 300)
      }
    },
    filterESdr (val) {
      if (val) {
        this.editProList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.editProList = [...this.allList].slice(0, 300)
      }
    },
    filterERcv (val) {
      if (val) {
        this.editReceList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.editReceList = [...this.allList].slice(0, 300)
      }
    },
    filterECust (val) {
      if (val) {
        this.editCustList = this.allList.filter(item => {
          if (item.customerSupplierName.indexOf(val) !== -1) {
            return true
          }
        }).slice(0, 300)
      } else {
        this.editCustList = [...this.allList].slice(0, 300)
      }
    },
    getUtensil (val) {
      if (this.baseData2.utensilNo !== '' && val !== '') {
        this.axios.get('pass/systemBase/v1/meterbaseaddweights/' + '?utensilNo=' + this.baseData2.utensilNo + '&utensilName=' + val)
          .then(res => {
            if (res.data.list.length !== 0) {
              this.baseData2.utensilWeight = res.data.list[0].utensilWeight
              this.baseData2.utensilUtensilName = res.data.list[0].utensilUtensilName
              this.baseData2.addWeightNo = res.data.list[0].addWeightNo
            } else {
              this.baseData2.utensilWeight = '',
                this.baseData2.utensilUtensilName = ''
            }
          })
      } else {
        this.baseData2.utensilWeight = '',
          this.baseData2.utensilUtensilName = ''
      }
    },
    effectiveWeightEmpty (rule, value, callback) {
      if (this.baseData.usedType === '总量' && (this.baseData.effectiveWeight === '' || this.baseData.effectiveWeight === null)) {
        return callback(new Error('有效总量不能为空'))
      } else {
        return callback()
      }
    },
    effectiveNumEmpty (rule, value, callback) {
      if (this.baseData.usedType === '次数' && (this.baseData.effectiveNum === '' || this.baseData.effectiveNum === null)) {
        return callback(new Error('有效次数不能为空'))
      } else {
        return callback()
      }
    },
    effectiveStartTimeVerify (rule, value, callback) {
      if (this.baseData.usedType === '时间' && (this.baseData.effectiveStartTime === '' || this.baseData.effectiveStartTime === null)) {
        return callback(new Error('开始时间不能为空'))
      } else {
        return callback()
      }
    },
    effectiveEndTimeVerify (rule, value, callback) {
      if (this.baseData.usedType === '时间' && (this.baseData.effectiveEndTime === '' || this.baseData.effectiveEndTime === null)) {
        return callback(new Error('开始时间不能为空'))
      } else if (this.baseData.effectiveEndTime) {
        if (Date.parse(this.baseData.effectiveEndTime) > Date.parse(this.baseData.effectiveStartTime)) {
          callback();
        } else {
          callback(new Error('结束时间不得早于开始时间！'));
        }
      } else {
        callback();
      }
    },
    railwayNoEmpty (rule, value, callback) {
      if (this.baseData.predictionType === '分检预报' && (this.baseData.railwayNo === '' || this.baseData.railwayNo === null)) {
        return callback(new Error('火车号不能为空'))
      } else {
        return callback()
      }
    },
    decisionPredictionType (val) {
      if (val === '批次预报') {
        this.baseData.effectiveNum = ''
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.railwayNo[0].required = false
        this.isUsedType = false
        this.isEffectiveWeight = true
        this.isEffectiveNum = false
        this.isEffectiveTime = true
      } else if (val === '单次预报') {
        this.baseData.usedType = '次数'
        this.baseData.effectiveNum = 1
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = true
        this.isEffectiveTime = true
      } else if (val === '联运预报') {
        this.baseData.usedType = '次数'
        this.baseData.effectiveNum = 1
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = true
        this.isEffectiveTime = true
      } else if (val === '分检预报') {
        this.baseData.usedType = '次数'
        this.baseData.effectiveNum = ''
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.railwayNo[0].required = true
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = false
        this.isEffectiveTime = true
      }
    },
    decisionUsedType (val) {
      if (val === '次数') {
        this.baseData.effectiveNum = ''
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isEffectiveWeight = true
        this.isEffectiveNum = false
        this.isEffectiveTime = true
      } else if (val === '时间') {
        this.baseData.effectiveNum = ''
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.effectiveNum[0].required = false
        this.ruleValidateTable1.effectiveStartTime[0].required = true
        this.ruleValidateTable1.effectiveEndTime[0].required = true
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isEffectiveWeight = true
        this.isEffectiveNum = true
        this.isEffectiveTime = false
      } else if (val === '总量') {
        this.baseData.effectiveNum = ''
        this.baseData.effectiveStartTime = ''
        this.baseData.effectiveEndTime = ''
        this.baseData.railwayNo = ''
        this.baseData.effectiveWeight = ''
        this.ruleValidateTable1.effectiveNum[0].required = false
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = true
        this.isEffectiveWeight = false
        this.isEffectiveNum = true
        this.isEffectiveTime = true
      }
    },
    refresh () {
      this.baseData = {
        loadPointName: '',
        noticeNo: '',
        predictionType: '单次预报',
        shipmentNetWeight: '',
        effectiveWeight: '',
        materialName: '',
        forwardingUnitName: '',
        railwayNo: '',
        carNo: '',
        meterTypeName: '',
        shipmentNum: '',
        effectiveNum: '1',
        specName: '',
        receivingUintName: '',
        contractNo: '',
        matterName: '',
        shipmentGrossWeight: '',
        usedType: '次数',
        carrierUnitName: '',
        customerSupplierName: '',
        trailerNo: '',
        memo: '',
        effectiveStartTime: '',
        effectiveEndTime: ''
      },
        this.isEffectiveWeight = true
      this.isEffectiveNum = true
      this.isEffectiveTime = true
      this.isUsedType = true
      this.ruleValidateTable1.effectiveNum[0].required = false
      this.ruleValidateTable1.effectiveStartTime[0].required = false
      this.ruleValidateTable1.effectiveEndTime[0].required = false
      this.ruleValidateTable1.railwayNo[0].required = false
      this.ruleValidateTable1.effectiveWeight[0].required = false
      this.$refs['baseData'].resetFields();
    },
    refresh2 () {
      this.baseData2 = {
        utensilName: '',
        utensilWeight: '',
        utensilUtensilName: '',
        utensilNo: '',
        memo: ''
      },
        this.baseData2.utensilName = this.utensilNameItem[0].baseName;
      this.baseData2.utensilUtensilName = this.utensilUtensilNameItem[0].baseName;
      this.$refs['baseData2'].resetFields();
    },
    async recordSingleData (createManNo, createManName, operationId, operationPage, operationFunction, operationPredictionNo = '', operationCarnNo = '', operationBeforeFix = '', operationAfterFix = '') {
      const param = { createManNo, createManName, operationId, operationPage, operationFunction, operationPredictionNo, operationCarnNo, operationBeforeFix, operationAfterFix }
      const res = await this.axios.post('pass/systemBase/v1/meterbaseoperationlogs/addList', [param], { individualType: 'json' })
      if (!res.succeed) {
        this.$message.error(`保存${operationFunction.split('-')[1]}操作日志失败`)
      }
    },
    addData () {
      this.$refs['baseData'].validate((valid) => {
        if (valid) { 
          if (this.typeFlag) {
            if (this.baseData.loadPointName === '') {
              return this.$message.error('请选择卸货地点')
            }
          }
          let baseData2 = {}
          this.baseData.predictionNo = ''
          this.baseData.id = ''
          this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') ? this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') : ''
          this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'usedType', 'id') ? this.getCode(this.baseData.usedType, this.usedTypeItem, 'usedType', 'id') : ''
          this.baseData.meterTypeNo = this.getCode(this.baseData.meterTypeName, this.meterTypeNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.meterTypeName, this.meterTypeNameItem, 'baseName', 'baseCode') : ''
          this.baseData.matterNo = this.getCode(this.baseData.matterName, this.matterNameItem, 'matterName', 'matterNo') ? this.getCode(this.baseData.matterName, this.matterNameItem, 'matterName', 'matterNo') : ''
          this.baseData.loadPointNo = this.getCode(this.baseData.loadPointName, this.loadPointNameItem, 'loadPointName', 'loadPointNo') ? this.getCode(this.baseData.loadPointName, this.loadPointNameItem, 'loadPointName', 'loadPointNo') : ''
          this.baseData.carrierUnitNo = this.getCode(this.baseData.carrierUnitName, this.carrierUnitNameItem, 'carrierUnitName', 'carrierUnitNo') ? this.getCode(this.baseData.carrierUnitName, this.carrierUnitNameItem, 'carrierUnitName', 'carrierUnitNo') : ''
          this.baseData.customerSupplierNo = this.getCode(this.baseData.customerSupplierName, this.allList, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.customerSupplierName, this.allList, 'customerSupplierName', 'customerSupplierNo') : ''
          this.baseData.materialNo = this.getCode(this.baseData.materialName, this.materialNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.materialName, this.materialNameItem, 'baseName', 'baseCode') : ''
          this.baseData.specNo = this.getCode(this.baseData.specName, this.specNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.specName, this.specNameItem, 'baseName', 'baseCode') : ''
          this.baseData.forwardingUnitNo = this.getCode(this.baseData.forwardingUnitName, this.allList, 'companyName', 'companyNo') ? this.getCode(this.baseData.forwardingUnitName, this.allList, 'companyName', 'companyNo') : ''
          this.baseData.receivingUintNo = this.getCode(this.baseData.receivingUintName, this.allList, 'companyName', 'companyNo') ? this.getCode(this.baseData.receivingUintName, this.allList, 'companyName', 'companyNo') : ''
          baseData2.predictionType = this.baseData.predictionType
          baseData2.usedType = this.baseData.usedType
          baseData2.meterTypeNo = this.baseData.meterTypeNo
          baseData2.matterNo = this.baseData.matterNo
          baseData2.loadPointNo = this.baseData.loadPointNo
          baseData2.carrierUnitNo = this.baseData.carrierUnitNo
          baseData2.customerSupplierNo = this.baseData.customerSupplierNo
          baseData2.materialNo = this.baseData.materialNo
          baseData2.specNo = this.baseData.specNo
          baseData2.forwardingUnitNo = this.baseData.forwardingUnitNo
          baseData2.receivingUintNo = this.baseData.receivingUintNo
          baseData2.loadPointName = this.baseData.loadPointName
          baseData2.noticeNo = this.baseData.noticeNo
          baseData2.shipmentNetWeight = this.baseData.shipmentNetWeight
          baseData2.effectiveWeight = this.baseData.effectiveWeight
          baseData2.materialName = this.baseData.materialName
          baseData2.forwardingUnitName = this.baseData.forwardingUnitName
          baseData2.railwayNo = this.baseData.railwayNo
          baseData2.carNo = this.baseData.carNo
          baseData2.meterTypeName = this.baseData.meterTypeName
          baseData2.shipmentNum = this.baseData.shipmentNum
          baseData2.effectiveNum = this.baseData.effectiveNum
          baseData2.specName = this.baseData.specName
          baseData2.receivingUintName = this.baseData.receivingUintName
          baseData2.contractNo = this.baseData.contractNo
          baseData2.matterName = this.baseData.matterName
          baseData2.shipmentGrossWeight = this.baseData.shipmentGrossWeight
          baseData2.usedType = this.baseData.usedType
          baseData2.carrierUnitName = this.baseData.carrierUnitName
          baseData2.customerSupplierName = this.baseData.customerSupplierName
          baseData2.trailerNo = this.baseData.trailerNo
          baseData2.memo = this.baseData.memo
          baseData2.effectiveStartTime = this.baseData.effectiveStartTime
          baseData2.effectiveEndTime = this.baseData.effectiveEndTime
          baseData2.heatNo = this.baseData.heatNo
          this.axios.post('pass/systemBase/v1/pretrackscales/add', baseData2, { individualType: 'json' }).then(async res => {
            if (res.succeed) {
              console.log(res, '新增数据返回结果')
              await this.recordSingleData(this.userNo, this.userName, res.data.id, '汽车衡计量预报管理', '新增');
              this.$message.success('新增成功');
              this.searchDatas();
              this.refresh();
            } else {
              this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType')
              this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'id', 'usedType')
              this.$message.error(res.message)
            }
          }).catch(e => {
            this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType')
            this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'id', 'usedType')
            this.$message.error(e.message)
          })
        }
      })
    },
    modifyData () {
      this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') ? this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') : ''
      this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'usedType', 'id') ? this.getCode(this.baseData.usedType, this.usedTypeItem, 'usedType', 'id') : ''
      this.baseData.meterTypeNo = this.getCode(this.baseData.meterTypeName, this.meterTypeNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.meterTypeName, this.meterTypeNameItem, 'baseName', 'baseCode') : ''
      this.baseData.matterNo = this.getCode(this.baseData.matterName, this.matterNameItem, 'matterName', 'matterNo') ? this.getCode(this.baseData.matterName, this.matterNameItem, 'matterName', 'matterNo') : ''
      this.baseData.loadPointNo = this.getCode(this.baseData.loadPointName, this.loadPointNameItem, 'loadPointName', 'loadPointNo') ? this.getCode(this.baseData.loadPointName, this.loadPointNameItem, 'loadPointName', 'loadPointNo') : ''
      this.baseData.carrierUnitNo = this.getCode(this.baseData.carrierUnitName, this.carrierUnitNameItem, 'carrierUnitName', 'carrierUnitNo') ? this.getCode(this.baseData.carrierUnitName, this.carrierUnitNameItem, 'carrierUnitName', 'carrierUnitNo') : ''
      this.baseData.customerSupplierNo = this.getCode(this.baseData.customerSupplierName, this.allList, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.customerSupplierName, this.allList, 'customerSupplierName', 'customerSupplierNo') : ''
      this.baseData.materialNo = this.getCode(this.baseData.materialName, this.materialNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.materialName, this.materialNameItem, 'baseName', 'baseCode') : ''
      this.baseData.specNo = this.getCode(this.baseData.specName, this.specNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.specName, this.specNameItem, 'baseName', 'baseCode') : ''
      this.baseData.forwardingUnitNo = this.getCode(this.baseData.forwardingUnitName, this.allList, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.forwardingUnitName, this.allList, 'customerSupplierName', 'customerSupplierNo') : ''
      this.baseData.receivingUintNo = this.getCode(this.baseData.receivingUintName, this.allList, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.receivingUintName, this.allList, 'customerSupplierName', 'customerSupplierNo') : ''
      // 记录修改日志字符串
      const { oldStr, newStr } = recordChange(this.oldObj, this.baseData)
      const param = {
        createManNo: this.userNo,
        createManName: this.userName,
        operationPage: '汽车衡计量预报管理',
        operationFunction: "修改",
        operationId: this.baseData.id,
        operationPredictionNo: this.baseData.predictionNo,
        operationCarnNo: this.baseData.carNo,
        operationBeforeFix: oldStr,
        operationAfterFix: newStr
      }
      this.axios.post('pass/systemBase/v1/pretrackscales/update', this.baseData, { individualType: 'json' }).then(async res => {
        if (res.succeed) {
          const log = await this.axios.post('pass/systemBase/v1/meterbaseoperationlogs/addList', [param], { individualType: 'json' })
          if (!log.succeed) {
            this.$message.error('修改日志保存失败');
          }
          this.$message.success('修改成功');
          this.oldObj = {}
          this.$message.success('修改成功');
          this.searchDatas();
          this.refresh();
        } else {
          this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType')
          this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'id', 'usedType')
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType')
        this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'id', 'usedType')
        this.$message.error(e.message)
      })
    },
    enableData () {
      if (this.multipleSelection.length < 1) {
        this.$message.warning('请选择您要启用的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/pretrackscales/recover', this.multipleSelection, { individualType: 'json' }).then(async res => {
        if (res.succeed) {
          await this.recordSingleData(this.userNo, this.userName, this.multipleSelection[0].id, '汽车衡计量预报管理', '启用');
          this.$message.success('启用成功');
          this.searchDatas();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    discardData () {
      if (this.multipleSelection.length < 1) {
        this.$message.warning('请选择您要停用的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/pretrackscales/abolish', this.multipleSelection, { individualType: 'json' }).then(async res => {
        if (res.succeed) {
          await this.recordSingleData(this.userNo, this.userName, this.multipleSelection[0].id, '汽车衡计量预报管理', '停用');
          this.$message.success('停用成功');
          this.searchDatas();
        } else {
          this.$message.error(res.message);
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    combinedData () {
      if (this.multipleSelection.length < 2) {
        this.$message.warning('请选择至少2条您要联运的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/pretrackscales/combined', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('联运成功');
          this.searchDatas();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },//联运
    removeData () {
      if (this.multipleSelection.length < 1) {
        this.$message.warning('请选择您要解除联运的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/pretrackscales/remove', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('解除联运成功');
          this.searchDatas();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },//解除
    addData2 () {
      this.baseData2.predictionNo = this.actualFirst.predictionNo
      this.baseData2.utensilTypeNo = this.getCode(this.baseData2.utensilUtensilName, this.utensilUtensilNameItem, 'baseName', 'baseCode')
      this.baseData2.utensilNameNo = this.getCode(this.baseData2.utensilName, this.utensilNameItem, 'baseName', 'baseCode')
      this.axios.post('pass/systemBase/v1/peraddweights/checkAndAdd', this.baseData2, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('新增成功');
          this.searchDatas(1);
          this.getDataList2(this.actualFirst);
          this.refresh2();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    discardData2 () {
      if (this.multipleSelection2.length < 1) {
        this.$message.warning('请选择您要删除的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/peraddweights/delete', this.multipleSelection2, { individualType: 'json' }).then(res => {
        if (res.code === '0' || res.code === '200') {
          this.$message.success('删除成功');
          this.searchDatas(1);
          this.getDataList2(this.actualFirst);
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })

    },
    // 关闭批量修改弹窗
    closeDialog () {
      this.editDialogVisible = false
      this.multipleSelection = []
      this.batchEditList = []
      this.$refs.dataTable.clearSelection();
      this.searchData()
    },
    rowChange (row, column, event) {
      this.oldObj = { ...row }
      this.baseData = Object.assign({}, row);
      this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType')
      this.baseData.usedType = this.getCode(this.baseData.usedType, this.usedTypeItem, 'id', 'usedType')
      this.axios.get('pass/systemBase/v1/meterbasematterinfos/noPage' + '?validFlag=1' + '&matterNo=' + this.baseData.matterNo)
        .then(res => {
          this.matterNameItem = res.data;
        })
      if (this.baseData.predictionType === '批次预报') {
        this.isUsedType = false
        this.ruleValidateTable1.railwayNo[0].required = false
        if (this.baseData.usedType === '次数') {
          this.ruleValidateTable1.effectiveNum[0].required = true
          this.ruleValidateTable1.effectiveStartTime[0].required = false
          this.ruleValidateTable1.effectiveEndTime[0].required = false
          this.ruleValidateTable1.effectiveWeight[0].required = false
          this.isEffectiveWeight = true
          this.isEffectiveNum = false
          this.isEffectiveTime = true
        } else if (this.baseData.usedType === '时间') {
          this.ruleValidateTable1.effectiveNum[0].required = false
          this.ruleValidateTable1.effectiveStartTime[0].required = true
          this.ruleValidateTable1.effectiveEndTime[0].required = true
          this.ruleValidateTable1.railwayNo[0].required = false
          this.ruleValidateTable1.effectiveWeight[0].required = false
          this.isEffectiveWeight = true
          this.isEffectiveNum = true
          this.isEffectiveTime = false
        } else if (this.baseData.usedType === '总量') {
          this.ruleValidateTable1.effectiveNum[0].required = false
          this.ruleValidateTable1.effectiveStartTime[0].required = false
          this.ruleValidateTable1.effectiveEndTime[0].required = false
          this.ruleValidateTable1.railwayNo[0].required = false
          this.ruleValidateTable1.effectiveWeight[0].required = true
          this.isEffectiveWeight = false
          this.isEffectiveNum = true
          this.isEffectiveTime = true
        }
      } else if (this.baseData.predictionType === '单次预报') {
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = true
        this.isEffectiveTime = true
      } else if (this.baseData.predictionType === '联运预报') {
        this.ruleValidateTable1.railwayNo[0].required = false
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = true
        this.isEffectiveTime = true
      } else if (this.baseData.predictionType === '分检预报') {
        this.ruleValidateTable1.railwayNo[0].required = true
        this.ruleValidateTable1.effectiveNum[0].required = true
        this.ruleValidateTable1.effectiveStartTime[0].required = false
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        this.ruleValidateTable1.effectiveWeight[0].required = false
        this.isUsedType = true
        this.isEffectiveWeight = true
        this.isEffectiveNum = false
        this.isEffectiveTime = true
      }
    },
    handleSelectionChange (val) {
      this.multipleSelection = val;
      this.batchEditList = [...this.multipleSelection]
      if (val.length > 0) {
        this.$refs.dataTable.setCurrentRow(this.multipleSelection[val.length - 1])
        this.getDataList2(this.multipleSelection[val.length - 1])
        this.rowChange(this.multipleSelection[val.length - 1])
        this.batchEditData = { ...val[0] }
      }
    },
    rowDblClick2 (row, column, event) {
      let rFlag = false
      for (let i = 0; i < this.multipleSelection.length; i++) {
        if (this.multipleSelection[i].predictionNo === row.predictionNo) {
          rFlag = true
          if (row.predictionCombination !== '' && row.predictionCombination !== null) {
            this.table.list.forEach(item => {
              if (item.predictionCombination === row.predictionCombination) {
                this.$refs.dataTable.toggleRowSelection(item, false)
              }
            })
          } else {
            this.$refs.dataTable.toggleRowSelection(row, false)
          }
        }
      }
      if (rFlag === false) {
        this.$refs.dataTable.toggleRowSelection(row, true)
        if (row.predictionCombination !== '' && row.predictionCombination !== null) {
          this.table.list.forEach(item => {
            if (item.predictionCombination === row.predictionCombination) {
              this.$refs.dataTable.toggleRowSelection(item, true)
            }
          })
        }
      }
    },
    pageSizeChange (size) {
      this.page.pageSize = size;
      this.searchDatas();
    },
    pageCurrentChange (index) {
      this.page.pageNum = index;
      this.searchData();
    },
    handleSelectionChange2 (val) {
      this.multipleSelection2 = val;
    },
    pageSizeChange2 (size) {
      this.page2.pageSize = size;
      this.getDataList2(this.actualFirst);
    },
    pageCurrentChange2 (index) {
      this.page2.pageNum = index;
      this.getDataList2(this.actualFirst);
    },
    searchDatas () {
      this.page.pageNum = 1;
      this.searchData()
    },
    dateChange (val, name) {
      if (val) {
        this.search[name] = formatDate(val)
      } else {
        this.search[name] = ''
      }
    },
    searchData (val) {
      this.$refs.dataTable.bodyWrapper.scrollTop = 0;
      this.$refs['searchData1'].validate((valid) => {
        if (valid) {
          this.dataLoading = true;
          this.search.valueFlag1 = this.search.valueFlag === '未配车' ? 0 : this.search.valueFlag === '未使用' ? 1 : this.search.valueFlag === '已使用' ? 2 : this.search.valueFlag === '已作废' ? 3 : this.search.valueFlag === '正使用' ? 4 : ''
          this.search.predictionType1 = this.search.predictionType === '批次预报' ? 0 : this.search.predictionType === '单次预报' ? 1 : this.search.predictionType === '联运预报' ? 2 : this.search.predictionType === '分检预报' ? 3 : ''
          this.axios.get('pass/systemBase/v1/pretrackscales/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&carNo=' + this.search.carNo + '&predictionNo=' + this.search.predictionNo
            + '&predictionType=' + this.search.predictionType1 + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&valueFlag=' + this.search.valueFlag1 + `&railwayNo=${this.search.railwayNo}` +
            `&contractNo=${this.search.contractNo}&forwardingUnitName=${this.search.forwardingUnitName}&customerSupplierName=${this.search.customerSupplierName}&receivingUintName=${this.search.receivingUintName}&startTime=${this.search.startTime}&endTime=${this.search.endTime}`)
            .then(res => {
              this.dataLoading = false;
              if (res.data.list.length < 64) {
                this.groupList = [8]
              } else {
                this.groupList = [8, 1]
              }
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
              // if (!val) {
              //   if (res.data.list.length > 0) {
              //     let firstRow = res.data.list[0]
              //     this.$refs.dataTable.setCurrentRow(firstRow)
              //     this.getDataList2(firstRow)
              //   }
              // }
              setTimeout(() => {
                this.$refs.dataTable.bodyWrapper.scrollTop = 4;
                this.getHeight()
              }, 300)
            }).catch(e => {
              this.dataLoading = false;
            });
        }
      })
    },
    historySearchData () {
      this.$refs['searchData1'].validate((valid) => {
        if (valid) {
          this.dataLoading = true;
          this.search.valueFlag1 = this.search.valueFlag === '未配车' ? 0 : this.search.valueFlag === '未使用' ? 1 : this.search.valueFlag === '已使用' ? 2 : this.search.valueFlag === '已作废' ? 3 : this.search.valueFlag === '正使用' ? 4 : ''
          this.search.predictionType1 = this.search.predictionType === '批次预报' ? 0 : this.search.predictionType === '单次预报' ? 1 : this.search.predictionType === '联运预报' ? 2 : this.search.predictionType === '分检预报' ? 3 : ''
          this.axios.get('pass/systemBase/v1/pretrackscales/selectView' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&carNo=' + this.search.carNo + '&predictionNo=' + this.search.predictionNo
            + '&predictionType=' + this.search.predictionType1 + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&valueFlag=' + this.search.valueFlag1 +
            `&customerSupplierName=${this.search.customerSupplierName}&receivingUintName=${this.search.receivingUintName}&startTime=${this.search.startTime}&endTime=${this.search.endTime}`)
            .then(res => {
              this.dataLoading = false;
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
              if (res.data.list.length > 0) {
                let firstRow = res.data.list[0]
                this.$refs.dataTable.setCurrentRow(firstRow)
                this.getDataList2(firstRow)
              }
            }).catch(e => {
              this.dataLoading = false;
            });
        }
      })
    },
    getDataList2 (row) {
      this.actualFirst = row
      if (row === undefined || row === null) {
        this.table.list2 = []
        return
      }
      this.dataLoading2 = true;
      this.axios.get('pass/systemBase/v1/peraddweights/' + '?pageNum=' + this.page2.pageNum + '&pageSize=' + this.page2.pageSize + '&predictionNo=' + row.predictionNo)
        .then(res => {
          this.dataLoading2 = false;
          this.table.list2 = res.data.list;
          this.page2.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading2 = false;
        });
    },
    tableRowClassName ({
      row,
      rowIndex
    }) {
      if (row.valueFlag === '3') {
        return 'error-row2';
      }
      return '';
    },
    getLoadPointNameItem () {
      this.axios.get('pass/systemBase/v1/meterbaseloadpoints/noPage' + '?validFlag=1')
        .then(res => {
          this.loadPointNameItem = res.data;
          this.baseData.loadPointName = res.data.length > 0 ? res.data[0].loadPointName : '';
        })
    },
    getMatterNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasematterinfos/noPage' + '?validFlag=1')
        .then(res => {
          this.matList = [...res.data];
          this.matterNameItem = [...this.matList].slice(0, 300);
          this.matterNameItem2 = [...this.matList].slice(0, 300);
          this.baseData.matterName = res.data[0].matterName;
        })
    },
    getCarrierUnitNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasecarrierunits/noPage' + '?validFlag=1')
        .then(res => {
          this.carrierUnitNameItem = res.data;
          this.baseData.carrierUnitName = res.data[0].carrierUnitName;
        })
    },
    getUtensilNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001010' + '&validFlag=1')
        .then(res => {
          this.utensilNameItem = res.data;
          this.baseData2.utensilName = res.data[0].baseName;
        })
    },
    getUtensilUtensilNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001009' + '&validFlag=1')
        .then(res => {
          this.utensilUtensilNameItem = res.data;
        })
    },
    getCustomerSupplierNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasecustomersuppliers/noPage' + '?validFlag=1')
        .then(res => {
          this.customerSupplierNameItem = res.data;
          this.customerUnitNameItem = [...res.data].slice(0, 300)
          this.baseData.customerSupplierName = res.data[0].customerSupplierName;
        })
    },
    getMeterTypeNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001006' + '&validFlag=1')
        .then(res => {
          this.meterTypeNameItem = res.data;
          this.baseData.meterTypeName = res.data[0].baseName;
        })
    },
    getMaterialNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001017' + '&validFlag=1')
        .then(res => {
          this.materialNameItem = res.data;
          this.baseData.materialName = res.data.length > 0 ? res.data[0].baseName : '';
        })
    },
    getSpecNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001018' + '&validFlag=1')
        .then(res => {
          this.specNameItem = res.data;
          this.baseData.specName = res.data.length > 0 ? res.data[0].baseName : '';
        })
    },
    getForwardingUnitNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasecustomersuppliers/selectOut')
        .then(res => {
          this.sdrList = [...res.data]
          this.forwardingUnitNameItem = res.data;
          this.baseData.forwardingUnitName = res.data.length > 0 ? res.data[0].companyName : '';
        })
    },
    getReceivingUintNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasecustomersuppliers/selectIn')
        .then(res => {
          this.rcvList = [...res.data]
          this.receivingUintNameItem = res.data;
          this.receivingSUnitNameItem = [...res.data].slice(0, 300)
          this.baseData.receivingUintName = res.data.length > 0 ? res.data[0].companyName : '';
        })
    },
    // 查询客商表里面的所有有效数据
    async getMeterbasecustomersupplier () {
      const { data: res } = await this.axios.get('pass/systemBase/v1/meterbasecustomersuppliers/like/?pageNum=1&pageSize=100000&checkFlag=1')
      // 给供应商，发货单位，收货单位赋值
      this.allList = [...res.list];
      this.provideList = [...res.list].slice(0, 300);
      this.rcvList = [...res.list].slice(0, 300);
      this.customerList = [...res.list].slice(0, 300);
      this.receiverList = [...res.list].slice(0, 300);
      this.editCustList = [...res.list].slice(0, 300);
      this.editReceList = [...res.list].slice(0, 300);
      this.editProList = [...res.list].slice(0, 300);
    }
  },
  components: {
    batchEditDialog
  }
}
</script>
<style>
.measure-self-picker .el-input__inner {
  padding: 0px 0px 0px 4px !important;
}

.measure-self-picker .el-icon-time {
  display: none;
}
</style>