<!--校秤计量配置管理-->
<template>
  <div class="systemBase">
    <div>
      <el-row>
        <el-col :span="10">
          <div class="common-title-div">计量点数据</div>
          <div class="common-table-div">
            <el-table
              ref="dataTable"
              border
              :height="tableHeight"
              highlight-current-row
              @selection-change="handleSelectionChange"
              :data="table.list2"
              :icore-filter-flag="icoreFilterFlag"
              @row-click="getDataList3"
            >
              <el-table-column
                type="index"
                label="序号"
                fixed="left"
                align="center"
              ></el-table-column>
              <el-table-column
                type="selection"
                width="55"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="baseSpotNo"
                label="计量点编号"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="baseSpotName"
                label="计量点名称"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="spotTypeName"
                label="计量点类型"
                align="center"
              ></el-table-column>
            </el-table>
          </div>
          <div class="common-foot-style">
            <el-pagination
              v-loading="dataLoading"
              @size-change="pageSizeChange1"
              @current-change="pageCurrentChange1"
              :current-page="page1.pageNum"
              :page-sizes="[100, 500, 1000]"
              :page-size="page1.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="page1.totalPage"
            >
            </el-pagination>
          </div>
        </el-col>
        <el-col :span="14">
          <div class="common-title-div" style="height: 45px">
            <div class="common-operation-button-div">
              <el-button
                size="mini"
                type="primary"
                icon="el-icon-circle-plus-outline"
                v-loading.fullscreen.lock="operateLoading"
                @click="selectData"
                v-privilege="activeMenu + 'ADD'"
                >新增</el-button
              >
              <!-- <el-button icon="el-icon-edit" type="primary" size="mini">修改</el-button> -->
              <el-button
                size="mini"
                type="danger"
                plain
                icon="el-icon-delete"
                v-loading.fullscreen.lock="operateLoading"
                @click="deleteData2"
                v-privilege="activeMenu + 'DELETE'"
                >删除</el-button
              >
              <!-- <el-button icon="el-icon-delete" type="primary" size="mini">取消</el-button> -->
            </div>
          </div>
          <div class="common-table-div">
            <el-table
              ref="dataTable2"
              border
              :height="tableHeight"
              highlight-current-row
              @selection-change="handleSelectionChange2"
              :data="table.list3"
              :icore-filter-flag="icoreFilterFlag"
            >
              <el-table-column
                type="index"
                label="序号"
                fixed="left"
                align="center"
              ></el-table-column>
              <el-table-column
                type="selection"
                width="55"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="baseSpotName"
                label="计量点名称"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="spotTypeName"
                label="计量点类型"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="calibrationNum"
                label="校秤有效次数"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="calibrationTypeName"
                label="校秤类型"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="mutualStrategyName"
                label="校秤策略"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="isMeter"
                label="是否允许计量"
                align="center"
              ></el-table-column>
              <el-table-column
                min-width="120px"
                :show-overflow-tooltip="true"
                sortable
                prop="upWeight"
                label="重量上限（kg）"
                align="right"
              >
                <template slot-scope="scope">
                  {{ Math.floor((scope.row.upWeight - 0) / 10) / 100 }}
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="common-foot-style">
            <el-pagination
              v-loading="dataLoading"
              @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>
        </el-col>
      </el-row>
      <div
        class="lineDiv"
        v-if="detailData"
        style="border-bottom: 1px solid #dcdcdc; height: 5px"
        ref="lineDiv"
      ></div>
      <div class="common-title-div">
        计量次数
        <div class="common-operation-button-div">
          <el-button
            icon="el-icon-circle-plus-outline"
            type="primary"
            size="mini"
            v-loading.fullscreen.lock="operateLoading"
            @click="addData"
            v-privilege="activeMenu + 'ADD2'"
            >新增</el-button
          >
          <el-button
            icon="el-icon-edit"
            type="primary"
            size="mini"
            v-loading.fullscreen.lock="operateLoading"
            @click="modifyData"
            v-privilege="activeMenu + 'UPDATE2'"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="danger"
            plain
            icon="el-icon-delete"
            v-loading.fullscreen.lock="operateLoading"
            @click="deleteData"
            v-privilege="activeMenu + 'DELETE2'"
            >删除</el-button
          >
        </div>
      </div>
      <div class="common-table-div">
        <el-table
          v-loading="dataLoading"
          @row-click="rowChange"
          ref="dataTable3"
          border
          :height="tableHeight"
          :icore-filter-flag="icoreFilterFlag"
          @selection-change="handleSelectionChange3"
          :data="table.list"
          highlight-current-row
        >
          <el-table-column
            type="index"
            label="序号"
            fixed="left"
            align="center"
          ></el-table-column>
          <el-table-column
            type="selection"
            width="55"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="calibrationNumNo"
            label="配置编号"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="spotTypeName"
            label="计量点类型"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="calibrationNum"
            label="校秤有效次数"
            align="right"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="calibrationTypeName"
            label="校秤类型"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="mutualStrategyName"
            label="校秤策略"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="isMeter"
            label="是否允许计量"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="upWeight"
            label="重量上限（kg）"
            align="right"
          >
            <template slot-scope="scope">
              {{ Math.floor((scope.row.upWeight - 0) / 10) / 100 }}
            </template>
          </el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="createManName"
            label="创建人"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="160px"
            :show-overflow-tooltip="true"
            sortable
            prop="createTime"
            label="创建时间"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="120px"
            :show-overflow-tooltip="true"
            sortable
            prop="updateManName"
            label="修改人"
            align="center"
          ></el-table-column>
          <el-table-column
            min-width="160px"
            :show-overflow-tooltip="true"
            sortable
            prop="updateTime"
            label="修改时间"
            align="center"
          ></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="border-top: 1px solid #d5d5d5"
      >
        配置编辑区
      </div>
      <div ref="editDiv" class="commom-edit-div">
        <el-form
          ref="baseData"
          :inline="true"
          :rules="ruleValidate"
          :model="baseData"
        >
          <el-form-item prop="spotTypeNo" label="计量点类型">
            <el-select
              v-model="baseData.spotTypeNo"
              clearable
              filterable
              collapse-tags
              placeholder="请选择计量点类型"
              size="small"
              style="width: 150px"
            >
              <el-option
                v-for="(item, index) in spotType"
                :key="index"
                :label="item.baseName"
                :value="item.baseCode"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="calibrationNum" label="校秤次数">
            <el-input
              v-model="baseData.calibrationNum"
              clearable
              size="small"
              style="width: 150px"
              placeholder="请输入校秤次数"
            ></el-input>
          </el-form-item>
          <el-form-item prop="calibrationTypeNo" label="校秤类型">
            <el-select
              v-model="baseData.calibrationTypeNo"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 150px"
              @change="calibrationTypeChange(baseData.calibrationTypeNo)"
            >
              <el-option
                v-for="(item, index) in calibrationType"
                :key="index"
                :label="item.baseName"
                :value="item.baseCode"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="mutualStrategyNo" label="校秤策略">
            <el-select
              v-model="baseData.mutualStrategyNo"
              clearable
              :readonly="isSelete"
              :disabled="isSelete"
              filterable
              collapse-tags
              size="small"
              style="width: 150px"
            >
              <el-option
                v-for="(item, index) in mutualStrategyNoType"
                :key="index"
                :label="item.baseName"
                :value="item.baseCode"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="isMeter" label="是否允许计量">
            <el-select
              v-model="baseData.isMeter"
              clearable
              filterable
              collapse-tags
              size="small"
              style="width: 150px"
              @change="isMeterChange(baseData.isMeter)"
            >
              <el-option
                v-for="(item, index) in isMeterType"
                :key="index"
                :label="item.isMeter"
                :value="item.isMeter"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="upWeight" label="重量上限（T）">
            <el-input
              v-model="baseData.upWeight"
              clearable
              size="small"
              :readonly="isInput"
              :disabled="isInput"
              style="width: 150px"
              placeholder="请输入重量"
            ></el-input>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import {
  meterbasecalibrationnums,
  meterbasespotinfos,
  meterbasecalibranumrels,
  combaseinfos
} from '../../../utils/api.js';
import {
  add,
  modify,
  Delete,
  DeleteOne,
  RecoveryOne,
  discardOne
} from '../../../utils/httpRequest.js';
import pinyinUtils from '../../../utils/pinyin/pinyinUtils.js'
export default {
  data () {
    return {
      dataLoading: false,
      operateLoading: false,
      baseData: {
        calibrationNum: '',
        spotTypeNo: '',
        calibrationTypeNo: '',
        upWeight: '',
        isMeter: '',
        mutualStrategyNo: ''
      },
      page: {
        pageSize: 500,
        pageNum: 1,
        totalPage: 0
      },
      page1: {
        pageSize: 500,
        pageNum: 1,
        totalPage: 0
      },
      page2: {
        pageSize: 500,
        pageNum: 1,
        totalPage: 0
      },
      isSelete: true,
      isInput: false,
      table: {
        list: [],
        list2: [],
        list3: []
      },
      spotType: [],
      calibrationType: [],
      mutualStrategyNoType: [],
      isMeterType: [
        { isMeter: '是' },
        { isMeter: '否' },
      ],
      multipleSelection: [],
      multipleSelection1: [],
      multipleSelection2: [],
      multipleSelection3: [],
      firstRow: {},
      tableHeight: 0,
      ruleValidate: {
        calibrationTypeNo: [
          {
            required: true,
            message: '该项不能为空',
            trigger: 'change'
          }
        ],
        spotTypeNo: [
          {
            required: true,
            message: '该项不能为空',
            trigger: 'change'
          }
        ],
        calibrationNum: [
          {
            required: true,
            message: '该项不能为空',
            trigger: 'change'
          }
        ],
        upWeight: [{
          required: false,
          validator: this.upWeightVerify,
          trigger: 'blur'
        }],
      },
      icoreFilterFlag: true,
      detailData: true,
      upWeight: '',
      activeMenu: ''
    }
  },
  created () {
    this.tableHeight = (window.innerHeight - 320) / 2 > 200 ? (window.innerHeight - 320) / 2 : 200;
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
  },
  mounted () {
    this.getDataList();
    this.getDataList2();
    // this.getDataList3();
    this.getMeteringTypeDataList()
    this.getCalibrationType()
    this.changeTableHeigh()
    this.getMutualStrategyNoType()
  },
  methods: {
    getCode (code, arr, codeKey, nameKey) {
      if (!code) {
        return '';
      }
      let targetRow = arr.find(item => {
        return item[codeKey] === code;
      });
      return targetRow ? targetRow[nameKey] : '';
    },
    upWeightVerify (rule, value, callback) {
      if (this.baseData.isMeter == '是') {
        if (this.baseData.upWeight == '') {
          callback(new Error('该项不能为空！'));
        } else {
          callback();
        }
      } else {
        callback();
      }
    },
    rowChange (row, column, event) {
      this.baseData = Object.assign({}, row)
      // 将重量转换为吨显示
      this.baseData.upWeight = Math.floor((this.baseData.upWeight - 0) / 10) / 100
      if (this.baseData.calibrationTypeNo == '001005002') {
        this.isSelete = false
      } else {
        this.isSelete = true
      }
      if (this.baseData.isMeter == '是') {
        this.isInput = false
        this.ruleValidate.upWeight[0].required = true
      } else {
        this.isInput = true
        this.ruleValidate.upWeight[0].required = false
      }
    },
    calibrationTypeChange (val) {
      this.baseData.mutualStrategyNo = ''
      if (val == '001005002') {
        this.isSelete = false
      } else {
        this.isSelete = true
      }
    },
    isMeterChange (val) {
      this.baseData.upWeight = ''
      if (val == '是') {
        this.isInput = false
        this.ruleValidate.upWeight[0].required = true
      } else {
        this.isInput = true
        this.ruleValidate.upWeight[0].required = false
      }
    },
    changeTableHeigh () {
      var tableDiv = this.$refs.dataTable.$el
      var tableDiv2 = this.$refs.dataTable2.$el
      var dtable = this.$refs.dataTable3.$el
      var oDiv = this.$refs.lineDiv
      oDiv.onmousedown = function (ev) {
        var theight = parseInt(tableDiv.offsetHeight)
        var theight2 = parseInt(tableDiv2.offsetHeight)//parseInt为了不指向对象
        var dheight = parseInt(dtable.offsetHeight)
        oDiv.style.cursor = 's-resize'
        var ev = ev || event;
        //鼠标按下坐标
        var mouseDownX = ev.clientX;
        var mouseDownY = ev.clientY;
        // IE8 取消默认行为-设置全局捕获
        if (oDiv.setCapture) {
          oDiv.setCapture();
        }
        document.onmousemove = function (ev) {
          var ev = ev || event;
          // 鼠标移动时的鼠标位置
          var mouseMoveX = ev.clientX;
          var mouseMoveY = ev.clientY;
          tableDiv.style.height = theight + (mouseMoveY - mouseDownY) + "px"
          tableDiv2.style.height = theight2 + (mouseMoveY - mouseDownY) + "px"
          dtable.style.height = dheight + (mouseDownY - mouseMoveY) + "px"
        }
      }
      document.onmouseup = function () {
        document.onmousemove = null;
        // 释放全局捕获
        if (oDiv.releaseCapture) {
          oDiv.releaseCapture();
        }
      }
      return false;
    },
    addData () {
      let _this = this;
      _this.$refs['baseData'].validate(async (valid) => {
        if (valid) {
          if (_this.baseData.upWeight - 0 > 200) {
            const res = await this.$confirm('当前新增数据重量上限大于200吨，是否继续进行新增', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).catch(e => { return e })
            if (res === 'cancel') {
              return;
            }
          }
          _this.operateLoading = true;
          let baseDataAdd = {};
          baseDataAdd.calibrationNum = _this.baseData.calibrationNum;
          baseDataAdd.spotTypeNo = _this.baseData.spotTypeNo;
          baseDataAdd.calibrationTypeNo = _this.baseData.calibrationTypeNo;
          baseDataAdd.spotTypeName = _this.getCode(this.baseData.spotTypeNo, this.spotType, 'baseCode', 'baseName')
          baseDataAdd.calibrationTypeName = _this.getCode(this.baseData.calibrationTypeNo, this.calibrationType, 'baseCode', 'baseName')
          baseDataAdd.mutualStrategyNo = _this.baseData.mutualStrategyNo;
          baseDataAdd.upWeight = _this.baseData.upWeight * 1000;
          baseDataAdd.isMeter = _this.baseData.isMeter;
          baseDataAdd.mutualStrategyName = _this.getCode(this.baseData.mutualStrategyNo, this.mutualStrategyNoType, 'baseCode', 'baseName')
          add(meterbasecalibrationnums, baseDataAdd, (e) => {
            _this.operateLoading = false;
            _this.getDataList();
            if (!e) {
              _this.$refs['baseData'].resetFields && _this.$refs['baseData'].resetFields();
            }
          })
        }
      });
    },
    selectData () {
      let _this = this;
      if (_this.multipleSelection1.length !== 1) {
        this.$message.warning('请选择一条计量点数据！');
      } else if (_this.multipleSelection.length !== 1) {
        this.$message.warning('请选择一条计量次数数据！');
      } else if (_this.multipleSelection1[0].spotTypeNo !== _this.multipleSelection[0].spotTypeNo) {
        this.$message.warning('请选择计量点类型相同的数据！');
      } else {
        _this.operateLoading = true;
        var m = 0;
        for (var i = 0; i < _this.multipleSelection1.length; i++) {
          for (var j = 0; j < _this.multipleSelection.length; j++) {
            _this.multipleSelection3[m] = { ..._this.multipleSelection1[i], ..._this.multipleSelection[j] }
            m++;
          }
        }
        // 将页面上输入的重量转为吨
        this.axios.post('pass/systemBase/v1/meterbasecalibranumrels/', this.multipleSelection3, { individualType: 'json' }).then(res => {
          if (res.succeed) {
            this.operateLoading = false
            this.$message.success('操作成功！');
            this.getDataList();
            this.getDataList3(this.firstRow);
            this.multipleSelection3 = [];
          } else {
            this.operateLoading = false
            this.$message.error(res.message)
          }
        }).catch(e => {
          s
          this.operateLoading = false
          this.$message.error(e.message)
        })
      }
    },
    modifyData () {
      let _this = this;
      _this.$refs['baseData'].validate((valid) => {
        if (valid) {
          if (this.upWeight !== this.baseData.upWeight) {
            this.$confirm('是否确认修改？修改数据将把原来的重量上限覆盖！', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              _this.operateLoading = true;
              _this.baseData.upWeight = _this.baseData.upWeight * 1000
              _this.baseData.spotTypeName = _this.getCode(this.baseData.spotTypeNo, this.spotType, 'baseCode', 'baseName')
              _this.baseData.calibrationTypeName = _this.getCode(this.baseData.calibrationTypeNo, this.calibrationType, 'baseCode', 'baseName')
              _this.baseData.mutualStrategyName = _this.getCode(this.baseData.mutualStrategyNo, this.mutualStrategyNoType, 'baseCode', 'baseName')
              modify(meterbasecalibrationnums + _this.baseData.calibrationNumNo + '/', _this.baseData, (e) => {
                _this.operateLoading = false;
                _this.getDataList();
                if (!e) {
                  _this.$refs['baseData'].resetFields && _this.$refs['baseData'].resetFields();
                }
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消修改'
              });
            });
          }
          else {
            _this.operateLoading = true;
            _this.baseData.spotTypeName = _this.getCode(this.baseData.spotTypeNo, this.spotType, 'baseCode', 'baseName')
            _this.baseData.calibrationTypeName = _this.getCode(this.baseData.calibrationTypeNo, this.calibrationType, 'baseCode', 'baseName')
            _this.baseData.mutualStrategyName = _this.getCode(this.baseData.mutualStrategyNo, this.mutualStrategyNoType, 'baseCode', 'baseName')
            modify(meterbasecalibrationnums + _this.baseData.calibrationNumNo + '/', _this.baseData, (e) => {
              _this.operateLoading = false;
              _this.getDataList();
              if (!e) {
                _this.$refs['baseData'].resetFields && _this.$refs['baseData'].resetFields();
              }
            })
          }
        }
      });
    },
    deleteData2 () {
      this.$confirm('确定删除选中的校称计量匹配信息？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          this.operateLoading = true;
          Delete(meterbasecalibranumrels, this.multipleSelection2, (e) => {
            this.operateLoading = false;
            if (!e) {
              this.getDataList3(this.firstRow);
              // this.getDataList2();
            }
          })
        })
        .catch(action => {
          this.$message({
            type: 'info',
            message: action === 'cancel' ? '放弃保存并离开页面' : '停留在当前页面'
          })
        });
    },
    deleteData () {
      this.$confirm('确定删除选中的计量时间配置吗？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          this.operateLoading = true;
          Delete(meterbasecalibrationnums, this.multipleSelection, (e) => {
            this.operateLoading = false;
            if (!e) {
              this.getDataList();
            }
          })
        })
        .catch(action => {
          this.$message({
            type: 'info',
            message: action === 'cancel' ? '放弃保存并离开页面' : '停留在当前页面'
          })
        });
    },
    handleSelectionChange3 (val) {
      this.multipleSelection = val;
    },
    handleSelectionChange (val) {
      this.multipleSelection1 = val;
      if (val.length > 1) {
        this.$refs.dataTable.setCurrentRow(this.multipleSelection1[val.length - 1])
        this.getDataList3(this.multipleSelection1[val.length - 1])
      }
    },
    handleSelectionChange2 (val) {
      this.multipleSelection2 = val;
    },
    getTableHeight (dom) {
      return (window.innerHeight - dom.offsetTop);
    },
    pageSizeChange (size) {
      this.page.pageSize = size;
      this.getDataList();
    },

    pageCurrentChange (index) {
      this.page.pageNum = index;
      this.getDataList();
    },
    pageSizeChange1 (size) {
      this.page1.pageSize = size;
      this.getDataList2();
    },

    pageCurrentChange1 (index) {
      this.page1.pageNum = index;
      this.getDataList2();
    },
    pageSizeChange2 (size) {
      this.page2.pageSize = size;
      this.getDataList3(this.firstRow);
    },

    pageCurrentChange2 (index) {
      this.page2.pageNum = index;
      this.getDataList3(this.firstRow);
    },
    getDataList () {
      this.dataLoading = true;
      this.axios.get(meterbasecalibrationnums + '?pageNum=' + this.page.pageNum + '&pageSize=' + this.page.pageSize)
        .then(res => {
          this.dataLoading = false;
          this.table.list = res.data.list;
          this.page.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getDataList2 () {
      this.dataLoading = true;
      this.axios.get(meterbasespotinfos + 'calibcorrelation' + '?pageNum=' + this.page1.pageNum + '&pageSize=' + this.page1.pageSize)
        .then(res => {
          this.dataLoading = false;
          this.table.list2 = res.data.list;
          if (res.data.list.length > 0) {
            let firstRow = res.data.list[0]
            this.$refs.dataTable.setCurrentRow(firstRow)
            this.getDataList3(firstRow)
          }
          this.page1.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getDataList3 (row) {
      this.firstRow = row
      this.dataLoading = true;
      this.axios.get(meterbasecalibranumrels + '?pageNum=' + this.page2.pageNum + '&pageSize=' + this.page2.pageSize + '&baseSpotNo=' + row.baseSpotNo)
        .then(res => {
          this.dataLoading = false;
          this.table.list3 = res.data.list;
          this.page2.totalPage = res.data.total;
        }).catch(e => {
          this.dataLoading = false;
        });
    },
    getMeteringTypeDataList () {
      this.axios.get(combaseinfos + 'noPage' + '?pBaseCode=001002' + '&validFlag=1')
        .then(res => {
          this.spotType = res.data;
          this.baseData.spotTypeNo = res.data[0].baseCode ? res.data[0].baseCode : ''
        })
    },
    getCalibrationType () {
      this.axios.get(combaseinfos + 'noPage' + '?pBaseCode=001005' + '&validFlag=1')
        .then(res => {
          this.calibrationType = res.data;
          this.baseData.calibrationTypeNo = res.data[0].baseCode ? res.data[0].baseCode : ''
        })
    },
    getMutualStrategyNoType () {
      this.axios.get(combaseinfos + 'noPage' + '?pBaseCode=001030' + '&validFlag=1')
        .then(res => {
          this.mutualStrategyNoType = res.data
        })
    },
  }
}
</script>

<style scoped>
.lineDiv:hover {
  cursor: s-resize;
}
.el-select {
  width: 100%;
}
</style>
