
<!-- 检验任务(原料)页面 -->
<template>
  <div class="examination">
    <div class="common-head-search">
      <el-form :inline="true">
        <el-form-item label="物料名称">
          <el-input
            v-model="search.matName"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入物料名称"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="任务日期">
          <el-date-picker
            v-model="search.entrTime"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            size="small"
            style="width: 300px"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button
            icon="el-icon-search"
            type="goon"
            size="mini"
            @click="searchData"
            >查询</el-button
          >
          <el-button
            icon="el-icon-refresh"
            type="info"
            plain
            size="mini"
            @click="reset"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <el-row>
      <el-col>
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            检验任务信息
          </div>
          <div>
            <el-button
              icon="el-icon-check"
              type="goon"
              size="mini"
              :loading="copyLoading"
              v-privilege="activeMenu + 'copy'"
              @click="copyData"
              >复制</el-button
            >
            <el-button
              icon="el-icon-circle-close"
              :loading="buttonLoading1"
              type="danger"
              size="mini"
              v-privilege="activeMenu + 'disable'"
              @click="deleteData"
              >停用</el-button
            >
            <el-button
              icon="el-icon-check"
              :loading="buttonLoading2"
              type="goon"
              size="mini"
              v-privilege="activeMenu + 'effectivity'"
              @click="recoverData"
              >启用</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="tableLoading1"
            ref="dataTable"
            border
            :height="tableTop"
            highlight-current-row
            @selection-change="handleSelectionChange"
            @cell-click="searchFollow"
            :data="tableData1"
            :row-class-name="tableRowClassName"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :summary-method="getSummaries2"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              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
              min-width="80px"
              prop="stateFlagName"
              label="状态"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              min-width="80px"
              prop="validFlagName"
              label="数据状态"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="id"
              label="编号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="taskDate"
              label="任务日期"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="matName"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="suppName"
              label="发货单位"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="acceptName"
              label="收货单位"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="tmpName"
              label="样品模板"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="testPlanName"
              label="测试计划"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="taskName"
              label="方案号"
              align="center"
              style="color: blue"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="indexName" label="指标集" align="center" style="color:blue;"></el-table-column> -->
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="sampleTypeName"
              label="样品类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="140px"
              prop="entrTypeName"
              label="委托类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="isCiqName"
              label="是否商检"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="isBatchName"
              label="是否匹配"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="memo"
              label="备注"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="updateMan"
              label="修改人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="updateTime"
              label="修改时间"
              align="center"
            ></el-table-column>
          </el-table>
        </div>
        <!-- 分页一 -->
        <div class="common-foot-style">
          <el-pagination
            @size-change="pageSizeChange"
            @current-change="pageCurrentChange"
            :current-page="pageIndex"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            background
          >
          </el-pagination>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            测试项目信息
          </div>
          <div>
            <el-button
              icon="el-icon-circle-close"
              type="danger"
              :loading="buttonLoading3"
              size="mini"
              v-privilege="activeMenu + 'disableDep'"
              @click="deleteData2"
              >停用</el-button
            >
            <el-button
              size="mini"
              type="goon"
              icon="el-icon-remove-outline"
              :loading="buttonLoading4"
              v-privilege="activeMenu + 'effectivityDep'"
              @click="recoverData2"
              >启用</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="tableLoading2"
            ref="dataTable2"
            border
            :height="tableBot"
            highlight-current-row
            @selection-change="handleSelectionChange2"
            :data="tableData2"
            @cell-click="clickTwoTable"
            :row-class-name="tableRowClassName2"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :summary-method="getSummaries2"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              fixed="left"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              fixed="left"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="80px"
              prop="stateFlagName"
              label="状态"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="80px"
              prop="validFlagName"
              label="数据状态"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="testItemName"
              label="任务名称"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="80px"
              prop="itemTypeName"
              label="任务类型"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="doOrder"
              label="执行顺序"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="isAutoName"
              label="是否分配"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="stdName"
              label="标准号"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="pointName"
              label="地点名称"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="testLimit"
              label="任务时限"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="deptName"
              label="部门名称"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="sectionName"
              label="班组名称"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="testPostName"
              label="岗位"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="eqpTypeName"
              label="设备"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="memo"
              label="备注"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="updateMan"
              label="修改人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="updateTime"
              label="修改时间"
              align="center"
            ></el-table-column>
          </el-table>
        </div>
        <!-- <div class="common-foot-style">
          <el-pagination
          @size-change="pageSizeChange2"
          @current-change="pageCurrentChange"
          :current-page="page2.pageNum"
          :page-sizes="[10, 20, 50, 100, 200]"
          :page-size="page2.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="page2.totalPage" background>
          </el-pagination>
        </div> -->
      </el-col>
      <el-col :span="12">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            分析项目信息
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="tableLoading3"
            ref="dataTable3"
            border
            :height="tableBot"
            highlight-current-row
            :data="tableData3"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :summary-method="getSummaries2"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              fixed="left"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="testItemName"
              label="任务名称"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="anlyItemName"
              label="分析项目"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="isRepost1"
              label="是否报出"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="isAlarm1"
              label="是否报警"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="memo"
              label="备注"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="95px"
              prop="updateMan"
              label="修改人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="160px"
              prop="updateTime"
              label="修改时间"
              align="center"
            ></el-table-column>
          </el-table>
        </div>
        <!-- <div class="common-foot-style">
          <el-pagination
          @size-change="pageSizeChange"
          @current-change="pageCurrentChange3"
          :current-page="page3.pageNum"
          :page-sizes="[10, 20, 50, 100, 200]"
          :page-size="page3.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="page3.totalPage" background>
          </el-pagination>
        </div> -->
      </el-col>
    </el-row>
    <el-row>
      <el-col class="common-table-div" style="margin-bottom: 0; margin-top: 0">
        <el-steps :space="500" :active="1" style="margin-top: 20px">
          <el-step title="取样"></el-step>
          <el-step title="制样"></el-step>
          <el-step title="检验"></el-step>
          <el-step title="审核"></el-step>
          <el-step title="发布"></el-step>
          <el-step title="报告单"></el-step>
        </el-steps>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { getCookie, formatDate, isStartEndDate, } from '@/utils/util.js';
import {
  cookieUserId,
  cookieUserName
} from '@/config/config.js';
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  data () {
    return {
      icoreFilterFlag: true,
      taskId: '',
      testItemNo: '',
      search: {
        mode: '',
        entrTime: []
      },
      tableData1: [],
      tableData2: [],
      tableData3: [],
      copyLoading: false,
      tableLoading1: false,
      tableLoading2: false,
      tableLoading3: false,
      buttonLoading1: false,
      buttonLoading2: false,
      buttonLoading3: false,
      buttonLoading4: false,
      clickFlag: {},
      selectMain: [],
      selectDep: [],
      tableTop: 0,
      tableBot: 0,
      pageIndex: 1,
      pageSize: 100,
      total: 0,
      multipleSelection4: [],
      activeMenu: ''
    }
  },
  created () {
    this.tableTop = window.innerHeight / 2 - 140 < 249 ? 249 : window.innerHeight / 2 - 150;
    this.tableBot = window.innerHeight / 2 - 150 < 249 ? 249 : window.innerHeight / 2 - 150;
    this.search.entrTime = [this.getYNM(new Date()), this.getYNM(new Date())]
    this.activeMenu = window.top.localStorage.getItem('activeMenu')
  },
  mounted () {
    this.searchData()
    this.addScreen();
    this.addScreen2();
    this.addScreen3();
  },
  methods: {
    getYNM (date) {
      let year = date.getFullYear().toString();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      month = month < 10 ? "0" + month : month;
      day = day < 10 ? "0" + day : day;
      return `${year}-${month}-${day}`;
    },
    getSummaries2 (param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "总计";
        }
        if (index === 1) {
          sums[index] = data.length;
        } else if (column.property === "quantity") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].quantity ? data[i].quantity : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        } else if (column.property === "factweight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].factweight ? data[i].factweight : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        }
      });
      return sums;
    },
    //复制
    copyData () {
      if (this.selectMain.length != 1) {
        this.$message.warning('请勾选一条您要复制的数据')
        return
      }
      this.copyLoading = true
      this.axios.post('pass/testManagement/v1/limstesttasks/copyLimsTestTask?id=' + this.selectMain[0].id, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message);
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.copyLoading = false
      }).catch(err => {
        this.copyLoading = false
        this.$message.error(err.message)
      })
    },
    // 停用
    deleteData () {
      if (this.selectMain.length < 1) {
        this.$message.warning('请勾选您要停用的数据')
        return
      }
      let tempArr = []
      this.selectMain.map(item => {
        tempArr.push(item.id)
      })
      this.buttonLoading1 = true
      this.axios.post('pass/testManagement/v1/limstesttasks/invalid', tempArr, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message);
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.buttonLoading1 = false
      }).catch(err => {
        this.buttonLoading1 = false
        this.$message.error(err.message)
      })
    },
    // 恢复
    recoverData () {
      if (this.selectMain.length < 1) {
        this.$message.warning('请勾选您要启用的数据')
        return
      }
      let tempArr = []
      this.selectMain.map(item => {
        tempArr.push(item.id)
      })
      this.buttonLoading2 = true
      this.axios.post('pass/testManagement/v1/limstesttasks/valid', tempArr, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message);
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.buttonLoading2 = false
      }).catch(err => {
        this.buttonLoading2 = false
        this.$message.error(err.message)
      })
    },
    // 查询
    searchData () {
      this.selectMain = []
      this.pageIndex = 1
      this.pageSize = 100
      this.dataMain()
    },
    //查询检验任务信息
    dataMain () {
      this.tableData2 = []
      this.tableData3 = []
      let startTime = ''
      let endTime = ''
      if (!this.search.entrTime) {
        startTime = ''
        endTime = ''
      } else {
        startTime = this.search.entrTime[0] + ' 00:00:00'
        endTime = this.search.entrTime[1] + ' 23:59:59'
      }
      let tempobj = {
        'object': {
          "sampleTypeCode": "480102",
          "matName": this.search.matName
        },
        'pageIndex': this.pageIndex,
        'pageSize': this.pageSize,
        'startTime': startTime,
        'endTime': endTime
      }
      this.tableLoading1 = true
      this.axios.post('pass/testManagement/v1/limstesttasks/queryLimsTestTasks', tempobj, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData1 = res.data.list;
          this.total = res.data.total;
          this.tableData1.forEach(item => {
            item.validFlagName = item.validFlag == 0 ? '无效' : item.validFlag == 1 ? '有效' : ''
            item.stateFlagName = item.stateFlag == 0 ? '编辑' : item.stateFlag == 1 ? '取样' : item.stateFlag == 2 ? '制样' : item.stateFlag == 3 ? '检验' : item.stateFlag == 4 ? '审核' : item.stateFlag == 5 ? '发布' : item.stateFlag == 6 ? '质保书' : ''
            item.isCiqName = item.isCiq == 0 ? '否' : item.isCiq == 1 ? '是' : ''
            item.isBatchName = item.isBatch == 0 ? '否' : item.isBatch == 1 ? '是' : ''
          })
          if (this.tableData1.length > 0) {
            this.$refs.dataTable.setCurrentRow(this.tableData1[0])
            this.searchFollow(this.tableData1[0])
          }
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading1 = false
      }).catch(e => {
        this.tableLoading1 = false;
        this.$message.error(e.message)
      });
    },
    //点击检验任务信息表格数据，查询测试项目信息数据
    searchFollow (row) {
      this.clickFlag = row
      this.tableLoading2 = true
      this.axios.post('pass/testManagement/v1/limstesttaskds/queryLimsTestTaskDs?taskId=' + row.id, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData2 = res.data
          this.tableData2.forEach(item => {
            item.validFlagName = item.validFlag == 0 ? '无效' : item.validFlag == 1 ? '有效' : ''
            item.isAutoName = item.isAuto == 0 ? '否' : item.isAuto == 1 ? '是' : ''
            item.stateFlagName = item.stateFlag == 0 ? '未执行' : item.stateFlag == 1 ? '已生成' : item.stateFlag == 2 ? '已领用' : item.stateFlag == 3 ? '已提交' : ''
          })
          if (this.tableData2.length > 0) {
            this.$refs.dataTable2.setCurrentRow(this.tableData2[0])
            this.clickTwoTable(this.tableData2[0])
          }
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading2 = false
      }).catch(err => {
        this.tableLoading2 = false
        this.$message.error(err.message)
      })
    },
    //点击测试项目信息表格，查询分析项目信息
    clickTwoTable (row) {
      this.tableLoading3 = false
      this.tableData3 = row.lsidList
      this.tableData3.forEach(item => {
        item.isReport1 = item.isReport == 0 ? '否' : item.isReport == 1 ? '是' : ''
        item.isAlarm1 = item.isAlarm == 0 ? '否' : item.isAlarm == 1 ? '是' : ''
      })
    },
    // 重置
    reset () {
      this.search.matName = '';
      this.search.entrTime = [this.getYNM(new Date()), this.getYNM(new Date())]
      this.searchData();
    },
    // 删除
    deleteData2 () {
      if (this.selectDep.length < 1) {
        this.$message.warning('请勾选测试任务信息表中您要停用的数据')
        return
      }
      let tempArr = []
      this.selectDep.map(item => {
        tempArr.push(item.id)
      })
      this.buttonLoading3 = true
      this.axios.post('pass/testManagement/v1/limstesttaskds/invalid', tempArr, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message)
          this.searchFollow(this.clickFlag)
        } else {
          this.$message.error(res.message)
        }
        this.buttonLoading3 = false
      }).catch(err => {
        this.buttonLoading3 = false
        this.$message.error(err.message)
      })
    },
    // 取消
    recoverData2 () {
      if (this.selectDep.length < 1) {
        this.$message.warning('请勾选测试任务信息表中您要启用的数据')
        return
      }
      let tempArr = []
      this.selectDep.map(item => {
        tempArr.push(item.id)
      })
      this.buttonLoading4 = true
      this.axios.post('pass/testManagement/v1/limstesttaskds/valid', tempArr, { individualType: 'json' }).then(res => {
        this.buttonLoading4 = false
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message)
          this.searchFollow(this.clickFlag)
        } else {
          this.$message.error(res.message)
        }
      }).catch(err => {
        this.buttonLoading4 = false
        this.$message.error(err.message)
      })
    },
    pageSizeChange (size) {
      this.pageIndex = 1
      this.pageSize = size;
      this.dataMain();
    },
    pageCurrentChange (index) {
      this.pageIndex = index;
      this.dataMain();
    },
    //勾选主表数据
    handleSelectionChange (val) {
      this.selectMain = val;
    },
    handleSelectionChange2 (val) {
      this.selectDep = val
    },
    addScreen () {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen2 () {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable2.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    addScreen3 () {
      this.$nextTick(() => {
        let ss = document.createElement('div');
        ss.innerHTML = '筛选';
        ss.style = 'text-align: center;'
        this.$refs.dataTable3.$el.getElementsByClassName('el-table__fixed')[0].getElementsByTagName('td')[0].appendChild(ss);
      });
    },
    tableRowClassName ({ row, column, rowIndex, columnIndex }) {
      if (row.validFlag !== '1') {
        return 'error-row';
      }
    },
    tableRowClassName2 ({ row, column, rowIndex, columnIndex }) {
      if (row.validFlag !== '1') {
        return 'error-row';
      }
      return '';
    },
    // 表格上横线
    tableHeaderCellStyle () {
      return 'color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;'
    }
  }
}
</script>
<style scoped>
</style>
