<!--样品跟踪界面-->
<template>
  <div class="examination">
    <div class="common-head-search">
      <el-form :inline="true">
        <el-form-item label="样品类型">
          <el-select
            v-model="search.sampleTypeCode"
            clearable
            filterable
            collapse-tags
            size="small"
            style="width: 200px"
            placeholder="请选择样品类型"
          >
            <el-option
              v-for="item in sampleTypeNameType"
              :key="item.baseName"
              :label="item.baseName"
              :value="item.baseCode"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="委托编号">
          <el-input
            v-model="search.carNo"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入委托编号"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="中心编号">
          <el-input
            v-model="search.sampleNo"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入中心编号"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <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[0]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
            placeholder="开始日期" size="mini" style="width: 140px">
          </el-date-picker>
          <span>至</span>
          <el-date-picker v-model="search.entrTime[1]" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"
            placeholder="结束日期" size="mini" style="width: 140px">
          </el-date-picker>
          <!-- <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 :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="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
              :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="carNo"
              label="委托编号"
              align="center"
              style="color: blue"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="140px"
              prop="sampleNo"
              label="中心编号"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="140px"
              prop="matName"
              label="样品名称"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="sampleTypeName"
              label="样品类型"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="smpDeliName"
              label="取样频次"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="100px"
              prop="testTypeName"
              label="检验类型"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="210px"
              prop="id"
              label="任务编号"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="210px"
              prop="entrId"
              label="委托主键"
              align="center"
            ></el-table-column>
            <el-table-column
              :show-overflow-tooltip="true"
              sortable
              min-width="80px"
              prop="entrTypeName"
              label="委托类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              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="100px"
              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-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="memo"
              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="[100, 300, 500, 1000, 1500]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            background
          >
          </el-pagination>
        </div>
      </el-col>
      <el-col :span="12">
        <div style="display: flex; flex-direction: column">
          <div style="flex: 1">
            <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"
                  align="center"
                  fixed="left"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="100px"
                  prop="stateFlagName"
                  label="状态"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="100px"
                  prop="validFlagName"
                  label="数据状态"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="200px"
                  prop="testItemName"
                  label="任务名称"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="200px"
                  prop="returnItem"
                  label="报出项"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="100px"
                  prop="itemTypeName"
                  label="任务类型"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="optMan"
                  label="任务领用人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="checkMan"
                  label="任务提交人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="checkTime"
                  label="任务提交时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="auditMan"
                  label="二审审核人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="auditTime"
                  label="二审审核时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="apprMan"
                  label="三审审核人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="apprTime"
                  label="三审审核时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="auditMan2"
                  label="四审审核人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="auditTime2"
                  label="四审审核时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="80px"
                  prop="doOrder"
                  label="执行顺序"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="180px"
                  prop="createMan"
                  label="任务创建人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  :show-overflow-tooltip="true"
                  min-width="100px"
                  prop="createTime"
                  label="创建时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  :show-overflow-tooltip="true"
                  sortable
                  min-width="100px"
                  prop="memo"
                  label="备注"
                  align="center"
                ></el-table-column>
              </el-table>
            </div>
          </div>
          <!-- <div style="flex: 1">
            <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 / 2 - 25"
                highlight-current-row
                :data="tableData3"
                :row-class-name="tableRowClassName2"
                :icore-filter-flag="icoreFilterFlag"
                :header-cell-style="tableHeaderCellStyle"
                :summary-method="getSummaries2"
                show-summary
              >
                <el-table-column
                  type="index"
                  label="NO"
                  align="center"
                  fixed="left"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="160"
                  prop="CAR_NO"
                  label="委托编号"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="120"
                  prop="SAMPLE_NO"
                  label="中心编号"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="120"
                  prop="MAT_NAME"
                  label="物料名称"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="120"
                  prop="MEMO"
                  label="委托备注"
                ></el-table-column>
                <el-table-column
                  v-for="col in cols"
                  :prop="col.ANLY_ITEM_NO"
                  show-overflow-tooltip
                  align="center"
                  :key="col.ANLY_ITEM_NO"
                  :label="col.ANLY_ITEM_NAME"
                >
                  <template slot-scope="scope">
                    <span
                      :style="redStyle(scope.row.SA_ID, col.ANLY_ITEM_NO)"
                      >{{ scope.row[col.ANLY_ITEM_NO] }}</span
                    >
                  </template>
                </el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="120"
                  prop="UPDATE_TIME"
                  label="开始时间"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  align="center"
                  width="120"
                  prop="CREATE_TIME"
                  label="结束时间"
                ></el-table-column>
              </el-table>
            </div>
          </div> -->
        </div>
      </el-col>
    </el-row>
    <div class="no-content-wrap" v-if="isShowNoContent">
      <img
        class="no-content-img"
        src="../../../../assets/img/no-content.png"
        alt=""
      />
      <p class="no-content-text">
        未查询到样品，请确认样品已完成制样并确认委托
      </p>
      <el-button type="goon" @click="hideNoContent">返回</el-button>
    </div>
  </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: "",
        carNo: "",
        entrTime: [],
        sampleTypeCode: "",
        matName: "",
        sampleNo: "",
        markNo: "",
        encryNo: "",
        entrId: "",
      },
      tableData1: [],
      tableData2: [],
      tableData3: [],
      sampleTypeNameType: [],
      tableLoading1: false,
      tableLoading2: false,
      tableLoading3: false,
      buttonLoading1: false,
      buttonLoading2: false,
      buttonLoading3: false,
      buttonLoading4: false,
      clickFlag: {},
      selectMain: [],
      selectDep: [],
      tableTop: 0,
      tableBot: 0,
      pageIndex: 1,
      pageSize: 500,
      total: 0,
      multipleSelection4: [],
      activeMenu: "",
      cols: ["无"],
      redDataCk: [], //显红的数据
      isSearch: false,
      isShowNoContent: false,
    };
  },
  created() {
    this.tableTop =
      window.innerHeight - 320 < 249 ? 249 : window.innerHeight - 320;
    this.tableBot =
      window.innerHeight - 320 < 249 ? 249 : window.innerHeight - 320;
    let timestamp = new Date().getTime() - 7 * 24 * 60 * 60 * 1000; // 默认前一周
    this.search.entrTime = [
      this.getYNM(new Date(timestamp)),
      this.getYNM(new Date()),
    ];
    // this.search.entrTime= [this.getYNM(new Date()), this.getYNM(new Date())]
    this.activeMenu = window.top.localStorage.getItem("activeMenu");
    this.axios
      .post(
        "pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",
        { validFlag: 1, baseCode: 4801 },
        { individualType: "json" }
      )
      .then((res) => {
        this.sampleTypeNameType = res.data;
        console.log("物料类型信息", this.sampleTypeNameType);
      });
  },
  mounted() {
    this.dataMain();
    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;
    },
    // 停用
    deleteData() {
      if (this.selectMain.length < 1) {
        this.$message.warning("请勾选您要停用的数据");
        return;
      }
      this.buttonLoading1 = true;
      let tempArr = [];
      this.selectMain.map((item) => {
        tempArr.push(item.id);
      });
      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;
      }
      this.buttonLoading2 = true;
      let tempArr = [];
      this.selectMain.map((item) => {
        tempArr.push(item.id);
      });
      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 = 500;
      this.isSearch = true;
      this.dataMain();
    },
    //查询检验任务信息
    dataMain() {
      this.clickFlag = {};
      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: {
          matName: this.search.matName,
          carNo: this.search.carNo,
          sampleNo: this.search.sampleNo,
          markNo: this.search.markNo,
          encryNo: this.search.encryNo,
          entrId: this.search.entrId,
          sampleTypeCode: this.search.sampleTypeCode,
        },
        pageIndex: this.pageIndex,
        pageSize: this.pageSize,
        startTime: startTime,
        endTime: endTime,
      };
      this.tableLoading1 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limstesttasks/queryLimsTestTasksInfo",
          tempobj,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.tableData1 = res.data.list;
            this.total = res.data.total;
            if (this.isSearch && this.total === 0) {
              this.isShowNoContent = true;
            }
            this.isSearch = false;
            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 ? '质保书' : ''
            });
            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.tableData2 = [];
      this.tableData3 = [];
      this.clickFlag = row;
      if (!row.id) {
        return;
      }
      this.tableLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limstesttaskds/queryLimsTestTaskDInfo?taskId=" +
            row.id,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.tableData2 = res.data;
            if (this.tableData2.length > 0) {
              this.tableData2.forEach((item) => {
                // 报出项
                const filteredLsidList = item.lsidList.filter((lsidItem) => lsidItem.isReport === '1');
                if (filteredLsidList.length) {
                  item.returnItem = filteredLsidList
                    .map((item) => item.anlyItemName)
                    .join(",");
                }
                item.validFlagName =
                  item.validFlag == 0
                    ? "无效"
                    : item.validFlag == 1
                    ? "有效"
                    : "";
                item.isAutoName =
                  item.isAuto == 0 ? "否" : item.isAuto == 1 ? "是" : "";
                if (
                  item.testItemNo === "T0013" ||
                  item.testItemNo === "T0014"
                ) {
                  item.stateFlagName =
                    item.stateFlag == 0
                      ? "未生成"
                      : item.stateFlag == 1
                      ? "已生成"
                      : item.stateFlag == 2
                      ? "待审核"
                      : item.stateFlag == 3
                      ? "已审核"
                      : "";
                } else {
                  item.stateFlagName =
                    item.stateFlag == 0
                      ? "未生成"
                      : item.stateFlag == 1
                      ? "已生成"
                      : item.stateFlag == 2
                      ? "已领用"
                      : item.stateFlag == 3
                      ? "已提交"
                      : item.stateFlag == 4
                      ? "二审已审"
                      : item.stateFlag == 5
                      ? "三审已审"
                      : "";
                }
              });
              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);
        });
      // this.tableLoading3 = true;
      // let obj = {
      //   matName: row.matName, // 样品名称
      //   sampleNo: row.sampleNo, // 中心编号
      // };
      // this.axios
      //   .post(
      //     "pass/baseManagement/v1/limssamplereleases/queryParameterMatName",
      //     obj,
      //     { individualType: "json" }
      //   )
      //   .then((res) => {
      //     if (res.code == 0 || res.code == 200) {
      //       const list = res.data;
      //       if (list && list.length) {
      //         let startTime = "";
      //         let endTime = "";
      //         if (!this.search.entrTime) {
      //           startTime = "";
      //           endTime = "";
      //         } else {
      //           startTime = this.search.entrTime[0];
      //           endTime = this.search.entrTime[1];
      //         }
      //         let obj2 = {
      //           sampleTypeCode: "",
      //           sampleNo: row.sampleNo,
      //           carNo: "",
      //           pageIndex: 1,
      //           pageSize: 100,
      //           stateFlag: 1,
      //           validFlag: 1,
      //           startTime: startTime,
      //           endTime: endTime,
      //           matNo: list[0].MAT_NO,
      //         };
      //         this.axios
      //           .post(
      //             "pass/baseManagement/v1/limssamplereleases/queryParameter",
      //             obj2,
      //             {
      //               individualType: "json",
      //             }
      //           )
      //           .then((res) => {
      //             if (res.code == 0 || res.code == 200) {
      //               if (res.data.head[0] != null) {
      //                 this.cols = res.data.head;
      //               } else {
      //                 this.cols = [];
      //               }
      //               this.tableData3 = res.data.badyData.list || [];
      //               if (this.tableData3.length > 0) {
      //                 this.$refs.dataTable3.setCurrentRow(this.tableData3[0]);
      //                 this.redDataCk = res.data.redMap || {};
      //               }
      //             } else {
      //               this.$message.error(res.message);
      //             }
      //             this.tableLoading3 = false;
      //           })
      //           .catch((err) => {
      //             this.tableLoading3 = false;
      //             this.$message.error(err.message);
      //           });
      //       } else {
      //         this.tableLoading3 = false;
      //       }
      //     } else {
      //       this.tableLoading3 = false;
      //       this.$message.error(res.message);
      //     }
      //   })
      //   .catch((err) => {
      //     this.tableLoading3 = false;
      //     this.$message.error(err.message);
      //   });
    },
    //点击测试项目信息表格，查询分析项目信息
    clickTwoTable(row) {
      return;
    },
    // 重置
    reset() {
      this.search.matName = "";
      this.search.sampleTypeCode = "";
      this.search.sampleNo = "";
      this.search.carNo = "";
      this.search.markNo = "";
      this.search.encryNo = "";
      this.search.entrId = "";
      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) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success(res.message);
            this.searchFollow(this.clickFlag);
          } else {
            this.$message.error(res.message);
          }
          this.buttonLoading4 = false;
        })
        .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;";
        try {
          this.$refs.dataTable.$el
            .getElementsByClassName("el-table__fixed")[0]
            .getElementsByTagName("td")[0]
            .appendChild(ss);
        } catch (e) {
          console.log(e);
        }
      });
    },
    addScreen2() {
      this.$nextTick(() => {
        let ss = document.createElement("div");
        ss.innerHTML = "筛选";
        ss.style = "text-align: center;";
        try {
          this.$refs.dataTable2.$el
            .getElementsByClassName("el-table__fixed")[0]
            .getElementsByTagName("td")[0]
            .appendChild(ss);
        } catch (e) {
          console.log(e);
        }
      });
    },
    addScreen3() {
      this.$nextTick(() => {
        let ss = document.createElement("div");
        ss.innerHTML = "筛选";
        ss.style = "text-align: center;";
        try {
          this.$refs.dataTable3.$el
            .getElementsByClassName("el-table__fixed")[0]
            .getElementsByTagName("td")[0]
            .appendChild(ss);
        } catch (e) {
          console.log(e);
        }
      });
    },
    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;";
    },
    // selectCellStyle({row, column, rowIndex, columnIndex}){
    //   let cellStyle;
    //   if (row.stateFlag === '0'){
    //     cellStyle = 'color : rgb(12,21,12);'
    //   }else if (row.stateFlag === '3') {
    //     cellStyle = 'color : rgb(103,194,58);'
    //   }else {
    //     cellStyle = 'color : green'
    //   }
    //   return cellStyle;
    // },
    redStyle(stId, anlyNo) {
      let arr = this.redDataCk[stId];
      if (!arr || arr.length < 1) {
        return {};
      }
      let obj = arr.find((ii) => ii == anlyNo);
      if (obj) {
        return { color: "red" };
      } else {
        return {};
      }
    },
    hideNoContent() {
      this.isShowNoContent = false;
    },
  },
};
</script>
<style scoped>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 180px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 100%;
}
.no-content-wrap {
  background: #fff;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.no-content-wrap .no-content-img {
  width: 300px;
  margin-bottom: 30px;
  margin-top: 100px;
}
.no-content-wrap .no-content-text {
  font-size: 18px;
  color: #333;
  margin-bottom: 30px;
}
</style>
