<!-- 采集记录页面 -->
<template>
  <div class="examination">
    <div class="common-head-search">
      <el-form :inline="true" @submit.native.prevent ref="searchForm" :model="searchForm"
        class="demo-form-inline sui-search-form">
        <el-form-item label="设备类型">
          <el-select v-model="searchForm.eqpTypeCode" @change="selectFaclity" clearable @clear="cleareqpName" filterable
            collapse-tags size="small" style="width: 150px" placeholder="">
            <el-option v-for="item in facilityType" :key="item.baseCode" :label="item.baseName" :value="item.baseCode">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="设备名称">
          <el-select v-model="searchForm.eqpNo" clearable filterable collapse-tags size="small" style="width: 200px"
            placeholder="">
            <el-option v-for="item in eqpType" :key="item.eqpNo" :label="item.eqpName + ` (${item.eqpUseNo})`"
              :value="item.eqpNo">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="采集日期">
          <el-date-picker v-model="searchForm.times[0]" value-format="yyyy-MM-dd HH:mm:ss" format="" type="datetime"
            placeholder="开始日期" size="mini" style="width: 180px" :default-time="'00:00:00'">
          </el-date-picker>
          <span>至</span>
          <el-date-picker v-model="searchForm.times[1]" value-format="yyyy-MM-dd HH:mm:ss" format="" type="datetime"
            placeholder="结束日期" size="mini" style="width: 180px" :default-time="'23:59:59'">
          </el-date-picker>
          <!-- <el-date-picker
            v-model="searchForm.times"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            size="small"
            style="width: 350px"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00', '23:59:59']"
          >
          </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="resetData">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <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-back" type="danger" :loading="backDataLoading" v-privilege="activeMenu + 'backData'"
          size="mini" @click="backData">回退</el-button>
        <el-button icon="el-icon-check" type="goon" :loading="backDataLoading" size="mini" @click="save">保存</el-button>
        <el-button icon="el-icon-remove-outline" type="danger" :loading='deleteLoading' size="mini"
          v-privilege="activeMenu + 'backData'" @click="disable">停用</el-button>
        <el-button icon="el-icon-check" :loading='deleteLoading' @click="enable" type="goon"
          v-privilege="activeMenu + 'backData'" size="mini">启用</el-button>
        <el-button icon="el-icon-check" :loading='deleteLoading' @click="merge" type="goon"
          v-privilege="activeMenu + 'backData'" size="mini">合并</el-button>
        <el-button icon="el-icon-check" :loading='deleteLoading' @click="noMerge" type="danger"
          v-privilege="activeMenu + 'backData'" size="mini">撤回合并</el-button>
        <span>&nbsp;&nbsp;&nbsp;备注为一串数字的数据为子数据</span>
      </div>
    </div>
    <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
      <el-table v-loading="tableLoading2" ref="dataTable2" border :height="theight" highlight-current-row
        @selection-change="handleSelectionChange" :data="tableData2" :icore-filter-flag="icoreFilterFlag"
        :header-cell-style="tableHeaderCellStyle" @current-change="clickChange" @row-click="searchFollow"
        :cell-class-name="tableRowClassName" :summary-method="getSummaries2" show-summary>
        <el-table-column type="index" label="NO" align="center"></el-table-column>
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="stateFlagName" label="状态"
          min-width="80"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="createTime" label="采集日期"
          min-width="140"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="collSampleNo" label="采集样号"
          min-width="100">
          <!-- && scope.row.validFlag == 1 -->
          <template slot-scope="scope">
            <el-input class="item-input" type="text"
              v-if="scope.$index === tabClickIndex && scope.row.stateFlag != 1 && scope.row.validFlag != 0"
              @blur="saveCell" v-model="scope.row.collSampleNo" @keyup.enter.native="saveCell" size="small"
              style="width: 100%; text-align: center">
            </el-input>
            <span v-else>{{ scope.row.collSampleNo }}</span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="eqpName" label="采集设备"
          min-width="100"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="pointName" label="采集位置"
          min-width="100"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="archiveTime" label="已读时间"
          min-width="100"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="memo" label="备注"
          min-width="100"></el-table-column>
      </el-table>
      <div class="common-foot-style">
        <el-pagination @size-change="handleSizeChangeMain" @current-change="handleCurrentChangeMain"
          :current-page="pageIndex" :page-sizes="[10, 20, 30, 40, 100, 200]" :page-size="pageSize" size="mini"
          layout="total, sizes, prev, pager, next, jumper" :total="total_main" background></el-pagination>
      </div>
    </div>
    <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-remove-outline" type="danger" :loading='deleteLoading2' size="mini"
          v-privilege="activeMenu + 'backData'" @click="disableZi">停用</el-button>
        <el-button icon="el-icon-check" :loading='deleteLoading2' @click="enableZi" type="goon"
          v-privilege="activeMenu + 'backData'" size="mini">启用</el-button>
        <el-button icon="el-icon-check" type="goon" :loading="deleteLoading2" size="mini" @click="saveZi">保存</el-button>
      </div>
    </div>
    <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
      <el-table v-loading="tableLoading3" border :height="theight" highlight-current-row
        @selection-change="handleSelectionChange2" :data="tableData3" @current-change="clickChange2"
        :icore-filter-flag="icoreFilterFlag" :header-cell-style="tableHeaderCellStyle" :summary-method="getSummaries2"
        :cell-class-name="tableRowClassName2" show-summary>
        <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="validFlagName" label="状态"
          min-width="20"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="collIdD" label="采集项目编号"
          min-width="100"></el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="collItemName" label="采集项目名称"
          min-width="100">
          <template slot-scope="scope">
            <el-input class="item-input" :disabled="scope.row.validFlag != 1" type="text"
              v-if="scope.$index === tabClickIndex2 && biaoshi" v-model="scope.row.collItemName" size="small"
              style="width: 100%; text-align: center">
            </el-input>
            <span v-else>{{ scope.row.collItemName }}</span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" sortable align="center" prop="testValue" label="采集值"
          min-width="100"></el-table-column>
      </el-table>
    </div>
    <!-- <div class="common-foot-style">
      <el-pagination
        @size-change="handleSizeChangeMain"
        @current-change="handleCurrentChangeMain"
        :current-page="pageIndex"
        :page-sizes="[10, 20, 30, 40, 100 , 200]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total_main"
        size="mini"
        background
      ></el-pagination>
    </div> -->
  </div>
</template>
<script>
export default {
  data() {
    return {
      searchForm: {
        eqpTypeCode: "",
        eqpNo: "",
        times: "",
      },
      facilityType: [],
      eqpType: [],
      theight: 0,
      theight2: 0,
      theight3: 0,
      tableLoading1: false,
      tableLoading2: false,
      tableLoading3: false,
      backDataLoading: false,
      deleteLoading: false,
      deleteLoading2: false,
      multipleSelection: [],
      multipleSelection2: [],
      tableData1: [],
      tableData2: [],
      tableData3: [],
      pageIndex: 1,
      pageSize: 100,
      total_main: 0,
      icoreFilterFlag: true,
      activeMenu: "",
      tabClickIndex: 999999,
      tabClickIndex2: 999999,
      biaoshi: true
    };
  },
  created() {
    this.theight =
      window.innerHeight / 2 - 110 < 249 ? 249 : window.innerHeight / 2 - 110;
    this.searchForm.times = [
      this.getYNM(new Date()) + " 00:00:00",
      this.getYNM(new Date()) + " 23:59:59",
    ];
    this.activeMenu = window.top.localStorage.getItem("activeMenu");
  },
  mounted() {
    this.axios
      .post(
        "pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",
        { validFlag: 1, baseCode: 4808 },
        { individualType: "json" }
      )
      .then((res) => {
        this.facilityType = res.data;
      });
    this.searchData();
  },
  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;
    },
    enableZi() { //启用子项目
      if (this.multipleSelection2.length < 1) {
        this.$message.warning("请先勾选要启用的数据");
        return;
      }
      try {
        this.multipleSelection2.forEach((item) => {
          if (item.validFlag == "1") {
            throw new Error("有效数据不能再次启用");
          }
          item.validFlag = '1'
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollectds/enable",
          this.multipleSelection2,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success(res.message);
            this.searchFollow2(this.multipleSelection2[0].collId);
          } else {
            this.$message.error(res.message);
          }
          this.deleteLoading2 = false;
        })
        .catch((err) => {
          this.deleteLoading2 = false;
          this.$message.error(err.message);
        });
    },
    disableZi() { //停用子项目
      if (this.multipleSelection2.length < 1) {
        this.$message.warning("请先勾选要停用的数据");
        return;
      }
      try {
        this.multipleSelection2.forEach((item) => {
          if (item.validFlag == "0") {
            throw new Error("无效数据不能再次停用");
          }
          item.validFlag = '0'
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollectds/enable",
          this.multipleSelection2,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success(res.message);
            this.searchFollow2(this.multipleSelection2[0].collId);
          } else {
            this.$message.error(res.message);
          }
          this.deleteLoading2 = false;
        })
        .catch((err) => {
          this.deleteLoading2 = false;
          this.$message.error(err.message);
        });
    }, //保存子项目
    saveZi() {
      if (this.multipleSelection2.length < 1) {
        this.$message.warning("请先勾选要保存的数据");
        return;
      }
      try {
        this.multipleSelection2.forEach((item) => {
          if (item.validFlag == "0") {
            throw new Error("无效的数据不能做保存！");
          }
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollectds/save",
          this.multipleSelection2,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success(res.message);
            this.searchFollow2(this.multipleSelection2[0].collId);
          } else {
            this.$message.error(res.message);
          }
          this.deleteLoading2 = false;
        })
        .catch((err) => {
          this.deleteLoading2 = false;
          this.$message.error(err.message);
        });
    },
    merge() { //合并
      if (this.multipleSelection.length < 2) {
        this.$message.warning("请先勾选要合并的两条的数据");
        return;
      }
      try {
        this.multipleSelection.forEach((item) => {
          if (item.stateFlag == "1" || item.validFlag == '0') {
            throw new Error("请选择有效且未读的数据！");
          }
          let arr1 = this.multipleSelection;
          let arr2 = this.multipleSelection;
          let falg = false
          arr1.forEach((item1, index1) => {
            arr2.forEach((item, index) => {
              if (index1 != index) {
                if (item1.collSampleNo != item.collSampleNo) {
                  falg = true
                }
              }
            })
          })
          if (falg) {
            throw new Error("请选择相同的采集样号！");
          }
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/merge",
          this.multipleSelection,
          { 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.deleteLoading = false;
        })
        .catch((err) => {
          this.deleteLoading = false;
          this.$message.error(err.message);
        });
    },
    noMerge() { //撤回合并
      if (this.multipleSelection.length > 1 || this.multipleSelection.length < 1) {
        this.$message.warning("请先勾选要撤回合并一条数据");
        return;
      }
      try {
        this.multipleSelection.forEach((item) => {
          if (item.stateFlag == "1" || item.validFlag == '1' || item.memo == "" || item == "合并的主数据") {
            throw new Error("请选择合并的子数据！");
          }
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/noMerge",
          this.multipleSelection[0],
          { 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.deleteLoading = false;
        })
        .catch((err) => {
          this.deleteLoading = false;
          this.$message.error(err.message);
        });
    },
    enable() { //启用
      if (this.multipleSelection.length < 1) {
        this.$message.warning("请先勾选要启用的数据");
        return;
      }
      try {
        this.multipleSelection.forEach((item) => {
          if (item.stateFlag == "1" || item.validFlag == '1') {
            throw new Error("选中的数据存在已读或者启用！");
          }
          item.validFlag = '1'
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.deleteLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/enable",
          this.multipleSelection,
          { 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.deleteLoading = false;
        })
        .catch((err) => {
          this.deleteLoading = false;
          this.$message.error(err.message);
        });
    },
    disable() { //停用
      if (this.multipleSelection.length < 1) {
        this.$message.warning("请先勾选要停用的数据");
        return;
      }
      try {
        this.multipleSelection.forEach((item) => {
          if (item.stateFlag == "1" || item.validFlag == '0') {
            throw new Error("选中的数据存在已读或者停用！");
          }
          item.validFlag = '0'
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }
      this.deleteLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/enable",
          this.multipleSelection,
          { 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.deleteLoading = false;
        })
        .catch((err) => {
          this.deleteLoading = false;
          this.$message.error(err.message);
        });
    }, //保存
    save() {
      if (this.multipleSelection.length < 1) {
        this.$message.warning("请先勾选要保存的数据");
        return;
      }
      try {
        this.multipleSelection.forEach((item) => {
          if (item.stateFlag == "1" || item.validFlag == '0') {
            throw new Error("选中的数据存在已读或者停用！");
          }
        });
      } catch (e) {
        return this.$message.warning(e.message)
      }

      this.backDataLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/save",
          this.multipleSelection,
          { 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.backDataLoading = false;
        })
        .catch((err) => {
          this.backDataLoading = false;
          this.$message.error(err.message);
        });
    },
    //回退
    backData() {
      if (this.multipleSelection.length < 1) {
        this.$message.warning("请先勾选要回退的数据");
        return;
      }
      let flag = this.multipleSelection[0].stateFlag;
      for (let item of this.multipleSelection) {
        if (item.stateFlag != flag) {
          this.$message.warning("请选择同一状态的数据");
          return;
        }
      }
      this.backDataLoading = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/updatestate",
          this.multipleSelection,
          { 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.backDataLoading = false;
        })
        .catch((err) => {
          this.backDataLoading = false;
          this.$message.error(err.message);
        });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSelectionChange2(val) {
      this.multipleSelection2 = val;
    },
    cleareqpName(val) {
      this.searchForm.eqpNo = "";
    },
    selectFaclity(val) {
      this.eqpType = [];
      this.searchForm.eqpNo = "";
      if (!val) {
        return;
      }
      this.axios
        .post(
          "pass/baseManagement/v1/limslrceqpinfos/queryeqpName",
          { eqpTypeCode: val },
          { individualType: "json" }
        )
        .then((res) => {
          this.eqpType = res.data;
        });
    },
    resetData() {
      this.searchForm.eqpTypeCode = "";
      this.searchForm.eqpNo = "";
      this.searchForm.times = [
        this.getYNM(new Date()) + " 00:00:00",
        this.getYNM(new Date()) + " 23:59:59",
      ];
      this.searchData();
    },
    searchData() {
      this.pageIndex = 1;
      this.pageSize = 100;
      this.DataMain();
    },
    DataMain() {
      let startTime = "";
      let endTime = "";
      if (!this.searchForm.times) {
        startTime = "";
        endTime = "";
      } else {
        startTime = this.searchForm.times[0];
        endTime = this.searchForm.times[1];
      }
      let obj = {
        object: {
          eqpTypeCode: this.searchForm.eqpTypeCode,
          eqpNo: this.searchForm.eqpNo,
        },
        startTime: startTime,
        endTime: endTime,
        pageIndex: this.pageIndex,
        pageSize: this.pageSize,
      };
      this.tableLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollects/queryLimsDataCollect",
          obj,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.tableData2 = res.data.list;
            this.total_main = res.data.total;
            this.tableData2.forEach((item) => {
              if (item.validFlag == '0') {
                item.stateFlagName = '已停用'
              } else {
                item.stateFlagName =
                  item.stateFlag == 1
                    ? "已读"
                    : item.stateFlag == 0
                      ? "未读"
                      : "";
              }
            });
            if (this.tableData2.length > 0) {
              this.$refs.dataTable2.setCurrentRow(this.tableData2[0]);
              this.searchFollow(this.tableData2[0]);
            }
            console.log("原始记录时间", res);
          } else {
            this.$message.error(res.message);
          }
          this.tableLoading2 = false;
        })
        .catch((err) => {
          this.tableLoading2 = false;
          this.$message.error(err.message);
        });
    },
    // 表格文本框失焦回调
    saveCell() { },
    clickChange2(row) {
      let uindex = this.tableData3.findIndex(
        (item) => item.collIdD === row.collIdD
      );
      console.log(uindex);
      this.tabClickIndex2 = uindex;
    },
    clickChange(row) {
      console.log(row);
      let uindex = this.tableData2.findIndex(
        (item) => item.collId === row.collId
      );
      console.log(uindex);
      this.tabClickIndex = uindex;
      if (row.validFlag == '0') {
        this.biaoshi = false
      } else {
        if (row.stateFlag == '1') {
          this.biaoshi = false
        } else {
          this.biaoshi = true
        }
      }
    },
    //点击主表信息，查询子表
    searchFollow(row) {
      this.tableLoading3 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollectds/queryLimsDataCollectD",
          { collId: row.collId },
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.tableData3 = res.data;
            this.tableData3.forEach((item) => {
              if (item.validFlag == '0') {
                item.validFlagName = '已停用'
              } else if (item.validFlag == '1') {
                item.validFlagName = '有效'
              }
            })
          } else {
            this.$message.error(res.message);
          }
          this.tableLoading3 = false;
        })
        .catch((err) => {
          this.tableLoading3 = false;
          this.$message.error(err.message);
        });
    },
    searchFollow2(row) {
      this.tableLoading3 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limsdatacollectds/queryLimsDataCollectD",
          { collId: row },
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.tableData3 = res.data;
            this.tableData3.forEach((item) => {
              if (item.validFlag == '0') {
                item.validFlagName = '已停用'
              } else if (item.validFlag == '1') {
                item.validFlagName = '有效'
              }
            })
          } else {
            this.$message.error(res.message);
          }
          this.tableLoading3 = false;
        })
        .catch((err) => {
          this.tableLoading3 = false;
          this.$message.error(err.message);
        });
    },
    handleSizeChangeMain(pageSize) {
      this.pageIndex = 1;
      this.pageSize = pageSize;
      this.DataMain();
    },
    handleCurrentChangeMain(pageIndex) {
      this.pageIndex = pageIndex;
      this.DataMain();
    },
    tableHeaderCellStyle() {
      return "color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;";
    },
    tableRowClassName({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 2) {
        if (row.stateFlag == "1") {
          return "error-green";
        }
        if (row.validFlag == '0') {
          return "error-row"
        }
      }
    },
    tableRowClassName2({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 2) {
        if (row.validFlag == '0') {
          return "error-row"
        }
      }
    }
  },
};
</script>
<style>
.item-input .el-input__inner {
  text-align: center;
}
</style>
