<!--轨道衡计量预报管理-->
<template>
  <div class="systemBase">
    <div>
      <div style="margin-top: 10px; border-bottom: 1px solid #d5d5d5">
        <el-form
          ref="searchData1"
          :inline="true"
          :model="search"
          :rules="ruleValidateSearch"
        >
          <el-form-item label-width="70px" prop="predictionNo" label="预报编号">
            <el-input
              v-model="search.predictionNo"
              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="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 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="24">
          <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
                  size="mini"
                  type="primary"
                  plain
                  @click="showBatchDialog"
                  v-privilege="activeMenu + 'BATCHEDIT'"
                  >批量修改</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
                >
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="dataLoading"
                @row-click="rowChange"
                :row-class-name="tableRowClassName"
                ref="dataTable"
                highlight-current-row
                border
                :height="tableHeight"
                @row-dblclick="rowDblClick2"
                @selection-change="handleSelectionChange"
                :data="table.list"
                :exchangeFilterMap="{
                  valueFlag: {
                    '1': '未使用',
                    '2': '已使用',
                    '3': '已作废',
                    '4': '正使用',
                  },
                  predictionType: {
                    '0': '批次预报',
                    '1': '单次预报',
                    '2': '联运预报',
                    '3': '分检预报',
                  },
                  isChemical: { '0': '否', '1': '是' },
                }"
                :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="railwayNo"
                  label="车号"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="railwayCarriageNo"
                  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="customerSupplierName"
                  min-width="100"
                  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-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="sourceArea"
                  label="原产地"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="isChemical"
                  label="是否危化品"
                  min-width="90"
                  align="left"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.isChemical == 0">否</span>
                    <span v-else-if="scope.row.isChemical == 1">是</span>
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="limitWeight"
                  label="限载重量"
                  min-width="80"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="forwardingUnitName"
                  min-width="200"
                  label="发货单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="receivingUintName"
                  min-width="200"
                  label="收货单位"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="materialName"
                  min-width="100"
                  label="材质"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="specName"
                  min-width="100"
                  label="规格"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="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="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="memo"
                  min-width="100"
                  label="备注"
                  align="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  prop="railwayTypeName"
                  min-width="100"
                  label="轨道衡类型"
                  align="left"
                ></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>
            </div>
            <div class="common-foot-style">
              <el-pagination
                v-loading="dataLoading"
                @size-change="pageSizeChange"
                @current-change="pageCurrentChange"
                :current-page="page.pageNum"
                :page-sizes="[50, 100, 200, 500]"
                :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"
                    disabled
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="predictionType" label="预报类型">
                  <el-select
                    v-model="baseData.predictionType"
                    readOnly
                    disabled
                    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="railwayTypeName" label="轨道衡类型">
                  <el-select
                    v-model="baseData.railwayTypeName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                    @change="typeChange"
                  >
                    <el-option
                      v-for="(item, index) in railwayTypeNameItem"
                      :key="index"
                      :label="item.baseName"
                      :value="item.baseName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="railwayNo" label="车号">
                  <el-input
                    v-model="baseData.railwayNo"
                    size="small"
                    clearable
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="railwayModelNo" label="车型">
                  <el-select
                    v-model="baseData.railwayModelNo"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in railwayModelNameItem"
                      :key="index"
                      :label="item.baseName"
                      :value="item.baseCode"
                    >
                    </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"
                  >
                    <el-option
                      v-for="(item, index) in forwardingUnitNameItem"
                      :key="index"
                      :label="item.companyName"
                      :value="item.companyName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="loadPointName" label="卸货地点">
                  <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"
                  >
                    <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="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="receivingUintName" label="收货单位">
                  <el-select
                    v-model="baseData.receivingUintName"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in receivingUintNameItem"
                      :key="index"
                      :label="item.companyName"
                      :value="item.companyName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="contractNo" label="合 同  号">
                  <el-input
                    v-model="baseData.contractNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="isChemical" label="是否危化品">
                  <el-select
                    v-model="baseData.isChemical"
                    clearable
                    filterable
                    collapse-tags
                    size="small"
                    style="width: 120px"
                  >
                    <el-option
                      v-for="(item, index) in isChemicalItem"
                      :key="index"
                      :label="item.isChemical"
                      :value="item.id"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="limitWeight" label="限载重量">
                  <el-input
                    v-model="baseData.limitWeight"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </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="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"
                  >
                    <el-option
                      v-for="(item, index) in customerSupplierNameItem"
                      :key="index"
                      :label="item.customerSupplierName"
                      :value="item.customerSupplierName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item prop="railwayCarriageNo" label="车厢序号">
                  <el-input
                    v-model="baseData.railwayCarriageNo"
                    clearable
                    size="small"
                    style="width: 120px"
                    placeholder="请输入"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="sourceArea" label="原产地">
                  <el-input
                    v-model="baseData.sourceArea"
                    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"
                    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"
                    placeholder="选择日期"
                    size="small"
                  ></el-date-picker>
                </el-form-item>
                <el-form-item prop="station" label="发站">
                  <el-input
                    type="text"
                    size="mini"
                    v-model="baseData.station"
                    clearable
                    style="width: 120px"
                  ></el-input>
                </el-form-item>
                <el-form-item prop="arrival" label="到站">
                  <el-input
                    type="text"
                    size="mini"
                    v-model="baseData.arrival"
                    clearable
                    style="width: 120px"
                  ></el-input>
                </el-form-item>
                <el-row style="padding-right: 20px">
                  <el-col :span="12">
                    <el-form-item
                      prop="memo"
                      label="批次号"
                      style="width: 100%"
                      class="edit-row-wrap"
                    >
                      <el-input
                        style="width: 100%"
                        v-model="baseData.batchNo"
                        size="small"
                        clearable
                        placeholder="请输入"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      prop="memo"
                      label="备注"
                      style="width: 100%"
                      class="edit-row-wrap"
                    >
                      <el-input
                        style="width: 100%"
                        v-model="baseData.memo"
                        size="small"
                        type="textarea"
                        :rows="2"
                        clearable
                        placeholder="请输入"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </div>
          </div>
        </el-col>
      </el-row>
      <!-- 编辑弹窗 -->
      <batch-edit-dialog
        type="forecast"
        :showFlag="editDialogVisible"
        :baseData="batchEditData"
        :dataList="multipleSelection"
        @close="closeDialog"
      >
      </batch-edit-dialog>
    </div>
  </div>
</template>
<script>
import { formatDate } from '@/utils/util.js';
import batchEditDialog from '../../measurementDataManagement/components/trackDataManagement/staticTrackScale/common/batchEditDialog';
import threeApproveVue from '../../approveManagement/components/fiveApprove.vue';
import {
  getCookie
} from '@/utils/util.js';
import {
  cookieUserId,
  cookieUserName
} from '@/config/config.js';
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  data () {
    return {
      dataLoading: false,
      operateLoading: false,
      flag: 0,
      actualFirst: {},
      meterTypeNameItem: [],
      matterNameItem: [],
      matterNameItem2: [],
      valueFlagItem: [
        { valueFlag: '未使用' },
        { valueFlag: '已使用' },
        { valueFlag: '已作废' },
        { valueFlag: '正使用' }
      ],
      isChemicalItem: [
        { id: '0', isChemical: '否' },
        { id: '1', isChemical: '是' },
      ],
      predictionTypeItem: [
        { id: '0', predictionType: '批次预报' },
        { id: '1', predictionType: '单次预报' },
        { id: '2', predictionType: '联运预报' },
        { id: '3', predictionType: '分检预报' }
      ],//预报类型
      railwayTypeNameItem: [],//轨道衡类型
      railwayModelNameItem: [],//车型
      loadPointNameItem: [],//卸货地点
      materialNameItem: [],//材质
      forwardingUnitNameItem: [],//发货单位
      icoreFilterFlag: true,
      specNameItem: [],//规格
      receivingUintNameItem: [],//收货单位
      carrierUnitNameItem: [],//承运单位
      customerSupplierNameItem: [],//供应商
      page: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0
      },
      table: {
        list: []
      },
      modifyBaseDate: {},
      baseData: {
        isChemical: '0',
        loadPointName: '',
        railwayCarriageNo: '',
        sourceArea: '',
        noticeNo: '',
        predictionType: '单次预报',
        shipmentNetWeight: '',
        materialName: '',
        forwardingUnitName: '',
        railwayNo: '',
        meterTypeName: '',
        shipmentNum: '',
        specName: '',
        receivingUintName: '',
        contractNo: '',
        matterName: '',
        shipmentGrossWeight: '',
        railwayTypeName: '',//轨道衡
        carrierUnitName: '',
        customerSupplierName: '',
        trailerNo: '',
        memo: '',
        effectiveStartTime: '',
        effectiveEndTime: '',
        limitWeight: '',
        railwayModelNo: '',// 车型编号
        station: '', // 发站
        arrival: '' // 到站
      },
      multipleSelection: [],
      tableHeight: 0,
      search: {
        predictionNo: '',
        railwayNo: '',
        meterTypeName: '',
        predictionType: '',
        matterNo: '',
        valueFlag: '',
      },
      ruleValidateSearch: {},
      ruleValidateTable1: {
        //  effectiveEndTime: [{
        //   required: true,
        //   validator: this.effectiveEndTimeVerify,
        //   trigger: 'blur'
        // }],
        // effectiveStartTime: [{
        //   required: true,
        //   validator: this.effectiveStartTimeVerify,
        //   trigger: 'change'
        // }],
        railwayNo: [{
          required: true,
          message: '该项不能为空',
          trigger: 'change'
        }],
        railwayTypeName: [{
          required: true,
          message: '该项不能为空',
          trigger: 'change'
        }],
        meterTypeName: [{
          required: true,
          message: '该项不能为空',
          trigger: 'change'
        }],
      },
      activeMenu: '',
      matList: [],
      editDialogVisible: false,
      batchEditList: [],
      batchEditData: {}
    }
  },
  created () {
    this.tableHeight = (window.innerHeight - 120) / 2 > 300 ? (window.innerHeight - 120) / 2 : 300
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
  },
  mounted () {
    this.searchData();
    this.getLoadPointNameItem();
    this.getMatterNameItem();//物料
    this.getRailwayTypeNameItem();//轨道衡
    this.getCarrierUnitNameItem();//承运单位
    this.getCustomerSupplierNameItem();//供应商
    this.getMeterTypeNameItem();//业务类型
    this.getMaterialNameItem();//材质
    this.getSpecNameItem();//规格
    this.getForwardingUnitNameItem();//发货单位
    this.getReceivingUintNameItem();//收货单位
    this.getRailwayModelNameItem();//车型
  },
  methods: {
    getCode (code, arr, codeKey, nameKey) {
      if (!code) {
        return '';
      }
      let targetRow = arr.find(item => {
        return item[codeKey] === code;
      });
      return targetRow ? targetRow[nameKey] : '';
    },
    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)
      }
    },
    effectiveStartTimeVerify (rule, value, callback) {
      if (this.baseData.predictionType === '批次预报' && (this.baseData.effectiveStartTime === '' || this.baseData.effectiveStartTime === null)) {
        return callback(new Error('开始时间不能为空'))
      } else {
        return callback()
      }
    },
    effectiveEndTimeVerify (rule, value, callback) {
      if (this.baseData.predictionType === '批次预报' && (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();
      }
    },
    decisionPredictionType (val) {
      if (val === '批次预报') {
        this.ruleValidateTable1.effectiveEndTime[0].required = true
        // this.ruleValidateTable1.effectiveStartTime[0].required = true
      } else {
        this.ruleValidateTable1.effectiveEndTime[0].required = false
        // this.ruleValidateTable1.effectiveStartTime[0].required = false
      }
    },
    // 预报类型变化
    typeChange (val) {
      console.log(val, '选中预报类型变化')
      if (val) {
        switch (val) {
          case '静态轨道衡':
            // 车号，业务类型为必填项
            this.ruleValidateTable1.railwayNo[0].required = true
            break;
          case '动态轨道衡':
            // 车号，业务类型为选填项
            this.ruleValidateTable1.railwayNo[0].required = false
            break;
        }
      }
    },
    // 显示批量修改弹窗
    showBatchDialog () {
      // 是否满足修改的条件
      try {
        this.multipleSelection.forEach(item => {
          if (item.valueFlag - 0 !== 1) {
            if (item.valueFlag - 0 === 3) {
              throw new Error(`选中数据中存在已作废的预报，不能进行批量修改`)
            } else if (item.valueFlag - 0 === 4) {
              throw new Error(`选中数据中存在使用中的预报，请到一次计量数据维护页面直接修改一次计量数据`)
            } else {
              throw new Error(`选中数据中存在已洁净的预报，请到洁净计量数据维护页面直接修改洁净计量数据`)
            }
          }
        })
      } catch (e) {
        return this.$message.error(e.message)
      }
      if (this.multipleSelection.length === 0) {
        return this.$message.error('请选择要进行批量修改的数据')
      }
      this.editDialogVisible = true;
    },
    // 关闭批量修改弹窗
    closeDialog () {
      this.editDialogVisible = false
      this.multipleSelection = []
      this.$refs.dataTable.clearSelection();
      this.searchData(1)
    },
    refresh () {
      this.baseData = {
        loadPointName: '',
        railwayCarriageNo: '',
        sourceArea: '',
        noticeNo: '',
        predictionType: '批次预报',
        shipmentNetWeight: '',
        materialName: '',
        forwardingUnitName: '',
        railwayNo: '',
        meterTypeName: '',
        shipmentNum: '',
        specName: '',
        receivingUintName: '',
        contractNo: '',
        matterName: '',
        shipmentGrossWeight: '',
        railwayTypeName: '',//轨道衡
        carrierUnitName: '',
        customerSupplierName: '',
        trailerNo: '',
        memo: '',
        effectiveStartTime: '',
        effectiveEndTime: '',
        isChemical: '0',
        limitWeight: '',
        railwayModelNo: ''//车型编号
      }
      // this.baseData.loadPointName = this.loadPointNameItem[0].loadPointName
      // this.baseData.railwayTypeName = this.railwayTypeNameItem[0].baseName
      // this.baseData.matterName = this.matterNameItem[0].matterName//物料
      // this.baseData.carrierUnitName = this.carrierUnitNameItem[0].carrierUnitName//承运单位
      // this.baseData.customerSupplierName = this.customerSupplierNameItem[0].customerSupplierName//供应商
      // this.baseData.meterTypeName = this.meterTypeNameItem[0].baseName//
      // this.baseData.materialName = this.materialNameItem[0].baseName//材质
      // this.baseData.specName = this.specNameItem[0].baseName//规格
      // this.baseData.receivingUintName = this.receivingUintNameItem[0].companyName//收货单位
      // this.baseData.forwardingUnitName = this.forwardingUnitNameItem[0].companyName//发货单位
      // this.baseData.railwayModelNo = this.railwayModelNameItem[0].baseCode ? this.railwayModelNameItem[0].baseCode : ''
      this.$refs['baseData'].resetFields();
    },
    addData () {
      this.$refs['baseData'].validate((valid) => {
        if (valid) {
          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.railwayTypeNo = this.getCode(this.baseData.railwayTypeName, this.railwayTypeNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.railwayTypeName, this.railwayTypeNameItem, 'baseName', 'baseCode') : ''
          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.customerSupplierNameItem, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.customerSupplierName, this.customerSupplierNameItem, '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.forwardingUnitNameItem, 'companyName', 'companyNo') ? this.getCode(this.baseData.forwardingUnitName, this.forwardingUnitNameItem, 'companyName', 'companyNo') : ''
          this.baseData.receivingUintNo = this.getCode(this.baseData.receivingUintName, this.receivingUintNameItem, 'companyName', 'companyNo') ? this.getCode(this.baseData.receivingUintName, this.receivingUintNameItem, 'companyName', 'companyNo') : ''
          this.baseData.railwayModelName = this.getCode(this.baseData.railwayModelNo, this.railwayModelNameItem, 'baseCode', 'baseName') ? this.getCode(this.baseData.railwayModelNo, this.railwayModelNameItem, 'baseCode', 'baseName') : ''
          baseData2.predictionType = this.baseData.predictionType
          baseData2.railwayTypeNo = this.baseData.railwayTypeNo
          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.railwayCarriageNo = this.baseData.railwayCarriageNo
          baseData2.sourceArea = this.baseData.sourceArea
          baseData2.noticeNo = this.baseData.noticeNo
          baseData2.shipmentNetWeight = this.baseData.shipmentNetWeight
          baseData2.materialName = this.baseData.materialName
          baseData2.forwardingUnitName = this.baseData.forwardingUnitName
          baseData2.railwayNo = this.baseData.railwayNo
          baseData2.railwayNo = this.baseData.railwayNo
          baseData2.meterTypeName = this.baseData.meterTypeName
          baseData2.shipmentNum = this.baseData.shipmentNum
          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.railwayTypeName = this.baseData.railwayTypeName
          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.isChemical = this.baseData.isChemical
          baseData2.limitWeight = this.baseData.limitWeight
          baseData2.railwayModelName = this.baseData.railwayModelName
          baseData2.railwayModelNo = this.baseData.railwayModelNo
          baseData2.station = this.baseData.station
          baseData2.arrival = this.baseData.arrival
          baseData2.batchNo = this.baseData.batchNo
          this.axios.post('pass/systemBase/v1/prerailwayscales/add', baseData2, { individualType: 'json' }).then(res => {
            if (res.succeed) {
              this.$message.success('新增成功');
              this.searchData();
              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.$refs['baseData'].validate((valid) => {
        if (valid) {
          this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') ? this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'predictionType', 'id') : ''
          this.baseData.railwayTypeNo = this.getCode(this.baseData.railwayTypeName, this.railwayTypeNameItem, 'baseName', 'baseCode') ? this.getCode(this.baseData.railwayTypeName, this.railwayTypeNameItem, 'baseName', 'baseCode') : ''
          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.customerSupplierNameItem, 'customerSupplierName', 'customerSupplierNo') ? this.getCode(this.baseData.customerSupplierName, this.customerSupplierNameItem, '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.forwardingUnitNameItem, 'companyName', 'companyNo') ? this.getCode(this.baseData.forwardingUnitName, this.forwardingUnitNameItem, 'companyName', 'companyNo') : ''
          this.baseData.receivingUintNo = this.getCode(this.baseData.receivingUintName, this.receivingUintNameItem, 'companyName', 'companyNo') ? this.getCode(this.baseData.receivingUintName, this.receivingUintNameItem, 'companyName', 'companyNo') : ''
          this.baseData.railwayModelName = this.getCode(this.baseData.railwayModelNo, this.railwayModelNameItem, 'baseCode', 'baseName') ? this.getCode(this.baseData.railwayModelNo, this.railwayModelNameItem, 'baseCode', 'baseName') : ''
          this.baseData.updateManNo = userId;
          this.baseData.updateManName = userName;
          this.axios.post('pass/systemBase/v1/prerailwayscales/update', this.baseData, { individualType: 'json' }).then(res => {
            if (res.succeed) {
              this.$message.success('修改成功');
              this.searchData();
              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.multipleSelection.forEach(item => {
        item.updateManNo = userId
        item.updateManName = userName
      })
      this.axios.post('pass/systemBase/v1/prerailwayscales/recover', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('启用成功');
          this.searchData();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    discardData () {
      if (this.multipleSelection.length < 1) {
        this.$message.warning('请选择您要停用的数据！');
        return;
      }
      this.multipleSelection.forEach(item => {
        item.updateManNo = userId
        item.updateManName = userName
      })
      this.axios.post('pass/systemBase/v1/prerailwayscales/abolish', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('作废成功');
          this.searchData();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },
    combinedData () {
      if (this.multipleSelection.length < 1) {
        this.$message.warning('请选择您要混装的数据！');
        return;
      }
      this.axios.post('pass/systemBase/v1/prerailwayscales/combined', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('混装成功');
          this.searchData();
        } 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/prerailwayscales/remove', this.multipleSelection, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success('解除混装成功');
          this.searchData();
        } else {
          this.$message.error(res.message)
        }
      }).catch(e => {
        this.$message.error(e.message)
      })
    },//解除
    rowChange (row, column, event) {
      this.baseData = Object.assign({}, row);
      this.baseData.predictionType = this.getCode(this.baseData.predictionType, this.predictionTypeItem, 'id', 'predictionType');
      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.ruleValidateTable1.effectiveEndTime[0].required = true,
      //     this.ruleValidateTable1.effectiveStartTime[0].required = true
      // } else {
      //   this.ruleValidateTable1.effectiveEndTime[0].required = false,
      //     this.ruleValidateTable1.effectiveStartTime[0].required = false
      // }
    },
    handleSelectionChange (val) {
      this.multipleSelection = val;
      if (val.length > 0) {
        this.$refs.dataTable.setCurrentRow(this.multipleSelection[val.length - 1])
        this.rowChange(this.multipleSelection[val.length - 1])
        this.batchEditData = { ...val[0] }
        console.log(this.batchEditData)
      }
    },
    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) {
                console.log('haha', row)
                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.searchData();
    },
    pageCurrentChange (index) {
      this.page.pageNum = index;
      this.searchData();
    },
    searchDatas () {
      this.page.pageNum = 1;
      this.searchData()
    },
    searchData () {
      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/prerailwayscales/' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&railwayNo=' + this.search.railwayNo + '&predictionNo=' + this.search.predictionNo
            + '&predictionType=' + this.search.predictionType1 + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&valueFlag=' + this.search.valueFlag1 +
            '&railwayTypeName=静态轨道衡')
            .then(res => {
              this.dataLoading = false;
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
            }).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/prerailwayscales/selectView' + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize + '&railwayNo=' + this.search.railwayNo + '&predictionNo=' + this.search.predictionNo
            + '&predictionType=' + this.search.predictionType1 + '&meterTypeName=' + this.search.meterTypeName + '&matterNo=' + this.search.matterNo + '&valueFlag=' + this.search.valueFlag1)
            .then(res => {
              this.dataLoading = false;
              this.table.list = res.data.list;
              this.page.totalPage = res.data.total;
            }).catch(e => {
              this.dataLoading = 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[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;
        })
    },
    getCustomerSupplierNameItem () {
      this.axios.get('pass/systemBase/v1/meterbasecustomersuppliers/noPage' + '?validFlag=1')
        .then(res => {
          this.customerSupplierNameItem = res.data;
          // 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;
          this.baseData.meterTypeName = '中控倒运'
        })
    },
    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.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.receivingUintNameItem = res.data;
          // this.baseData.receivingUintName = res.data.length > 0 ? res.data[0].companyName : '';
        })
    },
    getRailwayTypeNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001019' + '&validFlag=1')
        .then(res => {
          this.railwayTypeNameItem = res.data;
          this.baseData.railwayTypeName = res.data.length > 0 ? res.data[0].baseName : '';
        })
    },
    getRailwayModelNameItem () {
      this.axios.get('pass/systemBase/v1/combaseinfos/noPage' + '?pBaseCode=001028' + '&validFlag=1')
        .then(res => {
          this.railwayModelNameItem = res.data;
          // this.baseData.railwayModelNo = res.data.length > 0 ? res.data[0].baseCode : '';
        })
    }
  },
  components: {
    batchEditDialog
  }
}
</script>
<style>
.edit-row-wrap .el-form-item__content {
  width: calc(100% - 85px) !important;
}
</style>
