<!--审核修改界面-->
<template>
  <div class="examination testManagement">
    <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-input
            v-model="searchForm.sampleNo"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入查询内容"
            style="width: 150px"
          ></el-input>
        </el-form-item>
        <el-form-item label="批次号">
          <el-input
            v-model="searchForm.batchNo"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入查询内容"
            style="width: 150px"
          ></el-input>
        </el-form-item>
        <el-form-item label="样品名称">
          <el-input
            v-model="searchForm.matName"
            @keyup.enter.native="searchData()"
            size="small"
            placeholder="请输入查询内容"
            style="width: 150px"
          ></el-input>
        </el-form-item>
        <el-form-item label="样品类型">
          <el-select
            v-model="searchForm.sampleTypeCode"
            clearable
            filterable
            collapse-tags
            size="small"
            style="width: 150px"
            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-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>
    <el-row>
      <el-col :span="10">
        <el-tabs
          type="border-card"
          v-model="activeName"
          class="testManagement_left"
        >
          <el-tab-pane label="一审数据" name="second">
            <div class="common-title-div" style="height: auto">
              <div class="common-title-name" style="margin-right: 10px">
                <img
                  style="width: 25px; height: 25px"
                  src="../../../assets/img/imgScreen/logo.png"
                />
                主数据
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="tableLoading2"
                ref="table2"
                :row-class-name="tableRowClassName"
                @selection-change="SelectionValues"
                @current-change="handleCurrentChange"
                border
                @row-click="searchAnalyze"
                :height="theight2"
                highlight-current-row
                :data="tableData2"
                :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="45"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="sampleNo"
                  label="样品号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="batchNo"
                  label="批次号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="150"
                  align="center"
                  prop="matName"
                  label="物料名称"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="180"
                  align="center"
                  prop="testItemName"
                  label="测试项目"
                ></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
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testOrder"
                  label="测试顺序"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="sampleTypeName"
                  label="样品类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="id"
                  label="编号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="stdName"
                  label="方法"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="eqpName"
                  label="仪器类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testPostName"
                  label="分析岗位"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testDirection"
                  label="测试部门"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="memo"
                  label="备注"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="createMan"
                  label="创建人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="createTime"
                  label="创建时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="updateMan"
                  label="修改人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="updateTime"
                  label="修改时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="stateFlagName"
                  label="状态"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="validFlagName"
                  label="数据状态"
                ></el-table-column>
              </el-table>
              <div class="common-foot-style">
                <el-pagination
                  @size-change="handleSizeChangeDep"
                  @current-change="DataDep()"
                  :current-page.sync="pageIndex_dep"
                  :page-sizes="[10, 20, 30, 40, 100, 200]"
                  :page-size="pageSize_dep"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total_dep"
                  background
                ></el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="二审数据" name="third">
            <div class="common-title-div" style="height: auto">
              <div class="common-title-name" style="margin-right: 10px">
                <img
                  style="width: 25px; height: 25px"
                  src="../../../assets/img/imgScreen/logo.png"
                />
                主数据
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="tableLoading4"
                ref="table4"
                :row-class-name="tableRowClassName"
                @selection-change="SelectionValues4"
                @current-change="handleCurrentChange"
                border
                @row-click="searchResultD"
                :height="theight2"
                highlight-current-row
                :data="tableData4"
                :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="45"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="sampleNo"
                  label="样品号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="batchNo"
                  label="批次号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="150"
                  align="center"
                  prop="matName"
                  label="物料名称"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="180"
                  align="center"
                  prop="testItemName"
                  label="测试项目"
                ></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
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testOrder"
                  label="测试顺序"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="sampleTypeName"
                  label="样品类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="id"
                  label="编号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="stdName"
                  label="方法"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="eqpName"
                  label="仪器类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testPostName"
                  label="分析岗位"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testDirection"
                  label="测试部门"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="memo"
                  label="备注"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="createMan"
                  label="创建人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="createTime"
                  label="创建时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="updateMan"
                  label="修改人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="updateTime"
                  label="修改时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="stateFlagName"
                  label="状态"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="validFlagName"
                  label="数据状态"
                ></el-table-column>
              </el-table>
              <div class="common-foot-style">
                <el-pagination
                  @size-change="handleSizeChange4"
                  @current-change="Data4()"
                  :current-page.sync="pageIndex4"
                  :page-sizes="[10, 20, 30, 40, 100, 200]"
                  :page-size="pageSize4"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total4"
                  background
                ></el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="三审数据" name="stop">
            <div class="common-title-div" style="height: auto">
              <div class="common-title-name" style="margin-right: 10px">
                <img
                  style="width: 25px; height: 25px"
                  src="../../../assets/img/imgScreen/logo.png"
                />
                主数据
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="tableLoading42"
                ref="table42"
                :row-class-name="tableRowClassName"
                @selection-change="SelectionValues42"
                @current-change="handleCurrentChange"
                border
                @row-click="searchReleaseD"
                :height="theight2"
                highlight-current-row
                :data="tableData42"
                :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="45"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="sampleNo"
                  label="样品号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="115"
                  align="center"
                  prop="batchNo"
                  label="批次号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="150"
                  align="center"
                  prop="matName"
                  label="物料名称"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="180"
                  align="center"
                  prop="testItemName"
                  label="测试项目"
                ></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
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testOrder"
                  label="测试顺序"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="sampleTypeName"
                  label="样品类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="id"
                  label="编号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="stdName"
                  label="方法"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="eqpName"
                  label="仪器类型"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testPostName"
                  label="分析岗位"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="testDirection"
                  label="测试部门"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="memo"
                  label="备注"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="createMan"
                  label="创建人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="createTime"
                  label="创建时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="80px"
                  prop="updateMan"
                  label="修改人"
                  align="center"
                ></el-table-column>
                <el-table-column
                  sortable
                  show-overflow-tooltip
                  min-width="140px"
                  prop="updateTime"
                  label="修改时间"
                  align="center"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="stateFlagName"
                  label="状态"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="validFlagName"
                  label="数据状态"
                ></el-table-column>
              </el-table>
              <div class="common-foot-style">
                <el-pagination
                  @size-change="handleSizeChange5"
                  @current-change="Data5()"
                  :current-page.sync="pageIndex42"
                  :page-sizes="[10, 20, 30, 40, 100, 200]"
                  :page-size="pageSize42"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total42"
                  background
                ></el-pagination>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <el-col :span="14">
        <el-tabs type="border-card" v-model="activeName2">
          <el-tab-pane
            :label="
              analyzeVal.matName
                ? '【 ' +
                  analyzeVal.matName +
                  ' 】 - 【 ' +
                  analyzeVal.testItemName +
                  ' 】'
                : '未选择数据'
            "
            name="first2"
          >
            <div style="height: auto; padding-top: 1px" 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"
                  :loading="saveLoading"
                  @click="saveData"
                  type="goon"
                  v-privilege="activeMenu + 'save'"
                  size="mini"
                >保存</el-button>
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                v-loading="tableLoading3"
                border
                :height="theight3"
                @selection-change="selectMultiples"
                highlight-current-row
                @row-click="clickRow"
                :data="tableData3"
                :icore-filter-flag="icoreFilterFlag"
                :header-cell-style="tableHeaderCellStyle"
                @row-dblclick="showCell"
                :row-class-name="tableRowName"
                :cell-class-name="fxTableRowClassName"
                :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="45"
                  fixed="left"
                  align="center"
                ></el-table-column>
                <!-- <el-table-column show-overflow-tooltip sortable min-width="100" align="center" prop="testItemName" label="测试项目" ></el-table-column> -->
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="180"
                  fixed="left"
                  align="center"
                  prop="anlyItemName"
                  label="分析项目"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="anlyValue"
                  label="报出值"
                >
                  <template slot-scope="{row}">
                 <el-select v-if="row.index === tabClickIndex && !row.showInput" clearable allow-create v-model="row.anlyValue" filterable size="small">
                   <el-option v-for="(item,index) in row.defaultList" :key="index" :label="item" :value="item">
                   </el-option>
                 </el-select>
                 <el-input  type='number' :controls="false" v-if="row.index === tabClickIndex && row.showInput"
                           @blur="saveCell" v-model="row.anlyValue" @keyup.enter.native="saveCell" size="small" style="width: 100%;">
                 </el-input>
                 <span v-else>{{row.anlyValue}}</span>
               </template>
                </el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="reviseValue"
                  label="录入值"
                >
                  <template slot-scope="{ row }">
                    <el-select
                      v-if="row.index === tabClickIndex && !row.showInput"
                      clearable
                      allow-create
                      v-model="row.reviseValue"
                      filterable
                      size="small"
                    >
                      <el-option
                        v-for="(item, index) in row.defaultList"
                        :key="index"
                        :label="item"
                        :value="item"
                      >
                      </el-option>
                    </el-select>
                    <el-input
                      type="number"
                      :controls="false"
                      v-else-if="row.index === tabClickIndex && row.showInput"
                      @blur="saveCell"
                      v-model="row.reviseValue"
                      @keyup.enter.native="saveCell"
                      size="small"
                      style="width: 100%"
                    >
                    </el-input>
                    <span v-else>{{ row.reviseValue }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="dasValue"
                  label="采集值"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="cptValue"
                  label="计算值"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="memo"
                  label="备注"
                >
                  <template slot-scope="{ row }">
                    <el-input
                      v-model="row.memo"
                      @blur="saveCell"
                      @keyup.enter.native="saveCell"
                      size="small"
                      style="width: 100%"
                    ></el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="unitName"
                  label="单位"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="formulaName"
                  label="计算公式"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="reviseRuleName"
                  label="修约规则"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="isReportName"
                  label="是否报出"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="100"
                  align="center"
                  prop="isAlarmName"
                  label="是否报警"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="minSign"
                  label="最小符号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="minValue"
                  label="最小值"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="maxSign"
                  label="最大符号"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="maxValue"
                  label="最大值"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="maxLimit"
                  label="方法上限值"
                ></el-table-column>
                <el-table-column
                  show-overflow-tooltip
                  sortable
                  min-width="80"
                  align="center"
                  prop="minLimit"
                  label="方法下限值"
                ></el-table-column>
              </el-table>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
    <!-- 分析项目删除撤回 -->
    <el-dialog
      :close-on-click-modal="false"
      @close="closebatch"
      width="100%"
      :visible.sync="recallShow"
      top="0"
    >
      <div slot="title" class="titleBox">
        <i class="el-icon-document" style="font-size: 20px"></i>
        <span style="margin-left: 10px; font-size: 18px">分析项目撤回</span>
      </div>
      <div class="common-table-div">
        <el-table
          v-loading="tableLoading5"
          border
          :height="theight3"
          @selection-change="selectMultiples"
          highlight-current-row
          @row-click="clickRow"
          :data="tableData5"
          :icore-filter-flag="icoreFilterFlag"
          :header-cell-style="tableHeaderCellStyle"
          @row-dblclick="showCell"
          :cell-class-name="fxTableRowClassName"
          :row-class-name="tableRowName"
          :summary-method="getSummaries2"
          show-summary
        >
          <el-table-column
            type="index"
            label="NO"
            align="center"
          ></el-table-column>
          <el-table-column
            type="selection"
            width="45"
            align="center"
          ></el-table-column>
          <!-- <el-table-column show-overflow-tooltip sortable min-width="100" align="center" prop="testItemName" label="测试项目" ></el-table-column> -->
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="180"
            align="center"
            prop="anlyItemName"
            label="分析项目"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="anlyValue"
            label="报出值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="dasValue"
            label="采集值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="cptValue"
            label="计算值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="reviseValue"
            label="录入值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="unitName"
            label="单位"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="formulaName"
            label="计算公式"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="reviseRuleName"
            label="修约规则"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="isReportName"
            label="是否报出"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="100"
            align="center"
            prop="isAlarmName"
            label="是否报警"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="minSign"
            label="最小符号"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="minValue"
            label="最小值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="maxSign"
            label="最大符号"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="maxValue"
            label="最大值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="maxLimit"
            label="方法上限值"
          ></el-table-column>
          <el-table-column
            show-overflow-tooltip
            sortable
            min-width="80"
            align="center"
            prop="minLimit"
            label="方法下限值"
          ></el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button
          type="goon"
          size="mini"
          icon="el-icon-check"
          :loading="batchLoading"
          @click="recall()"
        >撤回</el-button
        >
        <el-button
          size="mini"
          type="goon"
          icon="el-icon-remove-outline"
          @click="closebatch"
        >取消</el-button
        >
      </span>
    </el-dialog>
    <div
      is="alertComponents"
      :showFlag="showFlag"
      :Params="Params"
      @refresh="refresh"
    ></div>
    <div
      is="resurveyAlert"
      :showFlag="resetShowFlag"
      :Params="Params"
      @refresh="refresh2"
    ></div>
    <div
      is="dataCollectionAlert"
      :showFlag="dataCollectionFlag"
      :Params2="Params2"
      @refresh="refresh3"
    ></div>
  </div>
</template>
<script>
import { getCookie, formatDate } from '@/utils/util.js';
import { cookieUserId, cookieUserName } from '@/config/config.js'
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  data () {
    return {
      dataType:1,
      searchForm: {
        times: '',
        matName: '',
        sampleTypeCode: '',
        eqpNo: '',
        sampleNo:'',
        batchNo:''
      },
      autoCollData: {
        eqpTypeCode: '',
        eqpNo: ''
      },
      gangwei: '',
      showFlag: false,
      resetShowFlag: false,
      deleteFlag: false,
      dataCollectionFlag: false,
      Params: {},
      Params2: [],
      autoColl: {
        eqpTypeCode: [{ required: true, message: '不能为空', trigger: 'change' },],
        eqpNo: [{ required: true, message: '不能为空', trigger: 'change' }],
      },
      table: {
        listTests: [],
        collectionData: [],
        selectCollectionData: [],
        sampleData: []
      },
      activeName: 'second',
      activeName2: 'first2',
      backLoading: false,
      withdrawLoading: false,
      batchDataLoading: false,
      buttonLoading1: false,
      buttonLoading2: false,
      batchLoading: false,
      addByLoading: false,
      addKbLoading: false,
      addGlyLoading: false,
      testTable: [],
      cols: [],
      tableData: [],
      resultData: [],
      collectionLoading: false,
      autoColletLoading: false,
      batchShow: false,
      eqpType: [],
      autoEqpType: [],
      facilityType: [],
      selectVal: [],
      selectVal4: [],
      selectVal42: [],
      selectMul: [],
      selectRecall: [],
      testShow: false,
      checked: true,
      interval: null,
      saveValue: '',
      saveMainData: [],
      cllotData: [],
      addRetestLoading: false,
      dataLoading: false,
      sampleLoading: false,
      saveLoading: false,
      errorLoading: false,
      submitLoading: false,
      isAutoColl: false,
      sampleTypeNameType: [],
      analyzeVal: {},
      analyzeValues: {},
      formulacomLoading: false,
      isOneHint: false,
      theight1: 0,
      theight2: 0,
      theight3: 0,
      theight4: 0,
      testItemName2: '',
      pageTests: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      addByShow: false,
      deleteLoading: false,
      collectionShow: false,
      recallShow: false,
      addCollectionLoading: false,
      tableLoading1: false,
      tableLoading2: false,
      tableLoading3: false,
      tableLoading4: false,
      tableLoading42: false,
      tableLoading5: false,
      selectLine: {},
      tabClickIndex: null,
      func: '',
      originalData: [],
      tableData1: [],
      tableData2: [],
      tableData3: [],
      tableData4: [],
      tableData42: [],
      tableData5: [],
      pageIndex: 1,
      pageSize: 100,
      total_main: 0,
      pageIndex_dep: 1,
      pageSize_dep: 100,
      total_dep: 0,
      pageIndex4: 1,
      pageSize4: 100,
      pageIndex42: 1,
      pageSize42: 100,
      total4: 0,
      total42: 0,
      scale: '',
      allFacility: [],
      scaleId: null,
      inputLoading: false,
      values: '',
      saveAnaly: {},
      timeId: null,
      icoreFilterFlag: true,
      heightTop: 0,
      activeMenu: '',
      dialog: {
        show: false,
        form: {
          data: {
            sampleNo: ''
          },
          rules: {
            sampleNo: [
              { required: true, message: '该项不能为空', trigger: 'blur' }
            ]
          }
        }
      },
      dialog2: {
        show: false,
        form: {
          data: {
            sampleNum: '6', // 标准点数量
            yuansu: ''
          },
          rules: {
            sampleNum: [
              { required: true, message: '该项不能为空', trigger: 'blur' }
            ]
          }
        }
      }
    }
  },
  created () {
    this.theight1 = window.innerHeight - 185 < 249 ? 249 : window.innerHeight - 230
    this.theight2 = window.innerHeight - 185 < 249 ? 249 : window.innerHeight - 230
    this.theight3 = window.innerHeight - 230 < 249 ? 249 : window.innerHeight - 230
    this.theight4 = window.innerHeight - 140 < 249 ? 249 : window.innerHeight - 140
    this.heightTop = window.innerHeight / 2 - 130 < 249 ? 249 : window.innerHeight / 2 - 130
    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: 4801 }, { individualType: 'json' }).then(res => {
      this.sampleTypeNameType = res.data
    })
    this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode", { validFlag: 1, baseCode: 4808 }, { individualType: 'json' }).then(res => {
      this.facilityType = res.data
    })
    this.axios.get('pass/baseManagement/v1/limslrceqpinfos/like/' + '?pageNum=1' + '&pageSize=9999' + '&eqpTypeName=' + '' + '&stateFlag=' + '').then(res => {
      this.allFacility = res.data.list
    })
    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}`;
    },
    refresh () {
      this.searchAnalyze(this.analyzeVal)
    },
    refresh2 () {
      this.searchData()
    },
    refresh3 () {
      // console.log('批量采集执行完毕');
    },
    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;
        }
      });
      return sums;
    },
    //分析项目删除撤回
    deleteRecall () {
      if (this.selectLine.length < 1) {
        this.$message.warning("请选择一条需要撤回的主数据！");
        return
      }
      this.axios.post('pass/testManagement/v1/limssampletestds/queryLimsSampleTestDList2?stId=' + this.selectLine.id).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData5 = res.data
          this.tableData5.forEach(item => {
            item.anlyValue = item.anlyValue ? item.anlyValue : item.defaultValue
            item.isReportName = item.isReport == 0 ? '否' : item.isReport == 1 ? '是' : ''
            item.isAlarmName = item.isAlarm == 0 ? '否' : item.isAlarm == 1 ? '是' : ''
          })
          console.log("查询撤回的数据", res.data)
        } else {
          this.$message.error(res.message)
        }
        this.recallShow = !this.recallShow
        this.tableLoading5 = false;
      }).catch(err => {
        this.tableLoading5 = false;
        this.$message.error(err.message)
      })
    },
    recall () {
      if (this.selectRecall.length < 1) {
        this.$message.warning("请勾选需要撤回的数据！");
        return;
      }
      let tempIds = this.selectRecall.map(item => item.stIdD)
      this.deleteLoading = true
      let obj = {
        id: tempIds,
        validFlag: '1'
      }
      this.axios.post('pass/testManagement/v1/limssampletestds/delete', obj, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message)
          this.searchAnalyze(this.analyzeVal)
        } else {
          this.$message.error(res.message)
        }
        this.deleteLoading = false
        this.recallShow = !this.recallShow
      }).catch(e => {
        this.deleteLoading = false
        this.$message.error(e.message)
      })
    },
    addAnaly () {
      if (JSON.stringify(this.analyzeVal) == '{}') {
        this.$message.warning("请选择一条需要新增的主数据！");
        return;
      }
      if (this.analyzeVal.stateFlag == 3) {
        this.$message.warning("选中的已接收数据为已提交的数据，不能进行新增！,请选择状态为未处理的数据进行操作");
        return;
      }
      this.showFlag = !this.showFlag;
      this.Params = this.analyzeVal;
    },
    clickRow (val) {
      this.saveAnaly = val
    },
    selectAuto (val) {
      this.autoEqpType = []
      this.scale = ''
      this.autoCollData.eqpNo = ''
      if (!val) {
        return
      }
      this.axios.post('pass/baseManagement/v1/limslrceqpinfos/queryeqpName', { eqpTypeCode: val }, { individualType: 'json' }).then(res => {
        this.autoEqpType = res.data;
      })
    },
    resetData () {
      this.searchForm.matName = ''
      this.searchForm.sampleTypeCode = ''
      this.searchForm.eqpNo = ''
      this.searchForm.times = [this.getYNM(new Date()) + ' 00:00:00', this.getYNM(new Date()) + ' 23:59:59']
      this.searchForm.batchNo = ''
      this.searchForm.sampleNo = ''
      this.searchData()
    },
    SelectionValues (val) {
      this.selectVal = val
    },
    // 已提交、无效数据，多选
    SelectionValues4 (val) {
      this.selectVal4 = val
    },
    SelectionValues42 (val) {
      this.selectVal42 = val
    },
    selectMultiples (val) {
      this.selectMul = val
      this.selectRecall = val
    },
    //点击选中样品信息数据
    searchFollow (val) {
      this.saveMainData = val
    },
    //获取选中已接任务数据
    handleCurrentChange (val) {
      this.selectLine = val
    },
    //异常申报
    abnormal () {
      if (this.selectMul.length < 1) {
        this.$message.warning('请先勾选您要异常申报的数据')
        return
      }
      let obj = {
        limsSampleTest: this.selectLine,
        limsSampleTestDList: this.selectMul,
        limsObjHeat: {
          declareNo: userId,
          declareName: userName,
          objTypeName: '检验异常',
          objTypeCode: '482603',
          objFlag: '0',
          validFlag: '1',
          createMan: userName,
          createNo: userId
        }
      };
      this.errorLoading = true;
      this.$confirm('确认要申报' + this.selectMul.length + '条异常吗', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.axios.post('pass/testManagement/v1/limsobjheats/toDeclare/', obj, { individualType: 'json' }).then(res => {
          if (res.code == 500) {
            this.$message.error(res.message);
            this.errorLoading = false;
          } else {
            this.$message.success(res.message)
            this.errorLoading = false;
          }
        }).catch(err => {
          this.errorLoading = false;
          this.$message.error(err.message)
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        })
        this.errorLoading = false;
      });
    },
    //撤回已提交数据
    backWithdraw () {
      if (this.selectVal4.length < 1) {
        this.$message.warning('请先勾选您要撤回的数据')
        return
      }
      for (let item of this.selectVal4) {
        if (item.validFlag == '0') {
          this.$message.warning('请选择有效数据')
          return
        }
      }
      this.withdrawLoading = true
      this.axios.post('pass/testManagement/v1/limssampletests/withdraw', this.selectVal4, { 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.withdrawLoading = false
      }).catch(err => {
        this.withdrawLoading = false
        this.$message.error(err.message)
      })
    },
    //接样
    recSample () {
      if (this.saveMainData.length < 1) {
        this.$message.warning('请先勾选您要接样的数据')
        return
      }
      this.sampleLoading = true
      this.axios.post('pass/testManagement/v1/limssampletests/pickUpSample', this.saveMainData, { 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.sampleLoading = false
      }).catch(err => {
        this.sampleLoading = false
        this.$message.error(err.message)
      })
    },
    autoSubmit (val) {
      if (!this.values) {
        this.$message.warning('请先用扫码枪扫描标签')
        return
      }
      if (!this.timeId) {
        this.timeId = setTimeout(() => {
          this.inputLoading = true
          this.axios.post('pass/testManagement/v1/limssampletests/pickUpSampleScan?tkId=' + this.values, { 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.$nextTick(() => {
              this.$refs.autoInput.focus()
            })
            this.values = ''
            this.inputLoading = false
          }).catch(e => {
            this.$nextTick(() => {
              this.$refs.autoInput.focus()
            })
            this.values = ''
            this.inputLoading = false
          }).catch(e => {
            this.$nextTick(() => {
              this.$refs.autoInput.focus()
            })
            this.values = ''
            this.inputLoading = false
            this.$message.error(e.message)
          })
          this.timeId = null;
        }, 1000);
      }
    },
    autoScale (val) {
      if (!this.scale) {
        this.$message.warning('请先用扫码枪扫描二维码')
        return
      }
      if (!this.scaleId) {
        this.scaleId = setTimeout(() => {
          this.autoCollData.eqpTypeCode = ''
          this.autoEqpType = this.allFacility
          this.autoCollData.eqpNo = this.scale
          this.scaleId = null;
        }, 1000);
      }
    },
    //扫码接样
    changeval () {
      if (!this.values) {
        this.$message.warning('请先用扫码枪扫描标签')
        return
      }
      this.inputLoading = true
      this.axios.post('pass/testManagement/v1/limssampletests/pickUpSampleScan?tkId=' + this.values, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.values = ''
          this.$message.success(res.message);
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.inputLoading = false
      }).catch(e => {
        this.inputLoading = false
        this.$message.error(e.message)
      })
    },
    stopall () {
      if (this.interval != null) {
        clearInterval(this.interval);
      }
      this.autoColletLoading = false
    },
    changeIsOneHint (val) {
      this.isOneHint = val;
    },
    realTimeCollect (val) {
      if (val && this.tableData3.length <= 0) {
        this.$message.warning('测试分析项目不能为空')
        this.stopall()
        return
      }
      if (val && this.autoCollData.eqpNo && this.autoCollData.eqpTypeCode) {
        this.isAutoColl = true
        let arr = []
        if (this.interval) {
          clearInterval(this.interval);
        }
        this.tableData3.forEach(item => {
          arr.push(item.anlyItemName)
        })
        this.startTime(arr.length, true, 10000)
      } else {
        this.$message.warning('请选择【设备类型】【设备名称】，不能为空')
        this.stopall()
        // this.checked  = false
        return
      }
    },
    startTime (tableLength, openOff, times) {
      let that = this
      var timesRun = 0;
      that.interval = setInterval(function () {
        timesRun += 1;
        if (!openOff) {
          clearInterval(that.interval);
        }
        if (!tableLength) {
          clearInterval(that.interval);
        }
        if (timesRun > tableLength) {
          clearInterval(that.interval);
        }
        that.autoCollet();
      }, times);
    },
    subData () {
      if (this.selectVal.length < 1) {
        this.$message.warning('请勾选您要提交的数据')
        return
      }
      for (let item of this.selectVal) {
        if (item.stateFlag != 0) {
          this.$message.warning('请选择状态为未处理的数据')
          return
        }
        if (item.validFlag == '0') {
          this.$message.warning('请选择有效数据')
          return
        }
      }
      this.$confirm('确认是否提交?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.isOneHint) {
          this.subDataAndHintOne()
        } else {
          this.subData3()
        }
      })
    },
    // 提交, 批量、同步执行
    async subData2 () {
      this.saveLoading = true
      this.submitLoading = true
      let cg = 0; // 成功
      let sb = 0; // 失败
      let qx = 0; // 取消
      let sbwl = [] // 失败的物料
      let ids = [] //需要提交的数据的id
      for (let i = 0; i < this.selectVal.length; i++) {
        let item = this.selectVal[i];
        ids.push(item.stId)
      }
      try {
        let tishi = [];
        const cfs = await this.axios.post('pass/testManagement/v1/limssampletests/queryBySample_No', ids, { individualType: 'json' });
        if (cfs.code == 0 || cfs.code == 200) {
          let b = true;
          for (let i = 0; i < cfs.data.length; i++) {
            if (cfs.data[i]) {
              b = false;
              tishi.push(this.selectVal[i].matName);
            }
          }
          if (b) {
            let b2 = true;
            const res = await this.axios.post('pass/testManagement/v1/limssampletests/errorWarningRemind', ids, { individualType: 'json' });
            if (res.code == 0 || res.code == 200) {
              for (let i = 0; i < ids.length; i++) {
                if (res.data.get(i)) {
                  b2 = false;
                }
              }
              if (b2) {

              }
              if (res.data) {

              } else {
                const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit' + ids, { individualType: 'json' });
                if (res4.code == 0 || res4.code == 200) {
                  cg++;
                } else {
                  sbwl.push(item.matName);
                  sb++;
                }
              }
            }
          } else {
            this.$confirm(item.matName + "," + tishi + '，这条数据重复，是否重复提交？', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(

            ).catch((err) => {
              // 选择 取消
              qx++;
            });
          }
        }
      } catch (err) {
        sbwl.push(item.matName);
        sb++;
        console.log('eeeeee');
      }
    },
    async subData3 () {
      this.saveLoading = true
      this.submitLoading = true
      let cg = 0; // 成功
      let sb = 0; // 失败
      let qx = 0; // 取消
      let sbwl = [] // 失败的物料centerPersonnelScheduling
      for (let i = 0; i < this.selectVal.length; i++) {
        let item = this.selectVal[i];
        try {
          const cfs = await this.axios.post('pass/testManagement/v1/limssampletests/queryBySample_No?stId=' + item.stId, { individualType: 'json' });
          if (cfs.code == 0 || cfs.code == 200) {
            if (cfs.data) {
              await this.$confirm(item.matName + "," + item.testItemName + '，这条数据重复，是否重复提交？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(async () => {
                const res = await this.axios.post('pass/testManagement/v1/limssampletests/errorWarningRemind?stId=' + item.stId, { individualType: 'json' });
                if (res.code == 0 || res.code == 200) {
                  if (res.data) {
                    if (res.data.code == 0) {
                      let temp = res.data.object
                      const res2 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                      if (res2.code == 0 || res2.code == 200) {
                        cg++;
                      } else {
                        sbwl.push(res2.message);
                        sb++;
                      }
                    } else {
                      await this.$confirm('第' + (i + 1) + '条数据, ' + `${res.data.message},是否继续?`, '超差预警提醒', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                      }).then(async () => {
                        const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                        if (res4.code == 0 || res4.code == 200) {
                          cg++;
                        } else {
                          sbwl.push(res4.message);
                          sb++;
                          this.$message.error('第' + (i+1) + '条数据提交失败：' + res4.message)
                        }
                      }).catch((err) => {
                        // 选择 取消
                        qx++;
                      });
                    }
                  } else {
                    const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                    if (res4.code == 0 || res4.code == 200) {
                      cg++;
                    } else {
                      sbwl.push(res4.message);
                      sb++;
                      this.$message.error('第' + (i+1) + '条数据提交失败：' + res4.message)
                    }
                  }
                } else {
                  sbwl.push(item.matName);
                  sb++;
                  this.$message.error('第' + (i + 1) + '条数据提交失败：' + res.message)
                }
              }).catch((err) => {
                // 选择 取消
                qx++;
              });
            } else {
              const res = await this.axios.post('pass/testManagement/v1/limssampletests/errorWarningRemind?stId=' + item.stId, { individualType: 'json' });
              console.log('res.data=' + res.data + ",res.code=" + res.code);
              if (res.code == 0 || res.code == 200) {
                if (res.data) {
                  if (res.data.code == 0) {
                    let temp = res.data.object
                    const res2 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                    if (res2.code == 0 || res2.code == 200) {
                      cg++;
                    } else {
                      sbwl.push(res2.message);
                      sb++;
                    }
                  } else {
                    await this.$confirm('第' + (i + 1) + '条数据, ' + `${res.data.message},是否继续?`, '超差预警提醒', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(async () => {
                      const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                      if (res4.code == 0 || res4.code == 200) {
                        cg++;
                      } else {
                        sbwl.push(res4.message);
                        sb++;
                      }
                    }).catch((err) => {
                      // 选择 取消
                      qx++;
                    });
                  }
                } else {
                  const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                  if (res4.code == 0 || res4.code == 200) {
                    cg++;
                  } else {
                    sbwl.push(res4.message);
                    sb++;
                  }
                }
              } else {
                sbwl.push(item.matName);
                sb++;
                //this.$message.error('第' + (i+1) + '条数据提交失败：' + res.message)
              }
            }
          } else {
            sbwl.push(item.matName);
            sb++;
          }
        } catch (err) {
          sbwl.push(item.matName);
          sb++;
        }
      }
      this.saveLoading = false
      this.submitLoading = false
      //console.log('cg', cg);
      //console.log('sb', sb);
      if (sb == 0 && qx == 0) {
        this.$message.success('执行完毕，成功提交 ' + cg + ' 条数据');
      } else {
        this.$message.warning('执行完毕，成功提交 ' + cg + ' 条数据，失败 ' + sb + ' 条：[' + sbwl + '], 取消' + qx + ' 条');
      }
      this.searchData()
    },
    // 在检验数据是否重复提交时只提醒一次
    async subDataAndHintOne () {
      this.saveLoading = true
      this.submitLoading = true
      let cg = 0; // 成功
      let sb = 0; // 失败
      let qx = 0; // 取消
      let sbwl = [] // 失败的物料centerPersonnelScheduling
      let stIds = []
      let needcheck = true;  //记录是不是第一次提醒
      for (let k = 0; k < this.selectVal.length; k++) {
        stIds.push(this.selectVal[k].stId);
      }
      let param = { 'needcheck': needcheck, 'stIds': stIds };
      for (let i = 0; i < this.selectVal.length; i++) {
        let item = this.selectVal[i];
        try {
          console.log(i + ":" + param.needcheck);
          const cfs = await this.axios.post('pass/testManagement/v1/limssampletests/queryRepetable', param, { individualType: 'json' });
          if (cfs.code == 0 || cfs.code == 200) {
            param.needcheck = false;        //false 表示待提交的样全部已经进行了查重，不需要再次查重
            var hintInfo = cfs.message;
            var msgArr = hintInfo.split("&");
            if (cfs.data) {
              let flag = await this.$confirm(msgArr[0], '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => { }).catch(err => {
                qx++;
                return 'cancel'
              });
              if (flag !== 'cancel') {
                const res = await this.axios.post('pass/testManagement/v1/limssampletests/errorWarningRemind?stId=' + item.stId, { individualType: 'json' });
                if (res.code == 0 || res.code == 200) {
                  if (res.data) {
                    if (res.data.code == 0) {
                      let temp = res.data.object
                      const res2 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                      if (res2.code == 0 || res2.code == 200) {
                        cg++;
                      } else {
                        sbwl.push(res2.message);
                        sb++;
                      }
                    } else {
                      await this.$confirm('第' + (i + 1) + '条数据, ' + `${res.data.message},是否继续?`, '超差预警提醒', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                      }).then(async () => {
                        const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                        if (res4.code == 0 || res4.code == 200) {
                          cg++;
                        } else {
                          sbwl.push(res4.message);
                          sb++;
                        }
                      }).catch((err) => {
                        // 选择 取消
                        qx++;
                      });
                    }
                  } else {
                    const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                    if (res4.code == 0 || res4.code == 200) {
                      cg++;
                    } else {
                      sbwl.push(res4.message);
                      sb++;
                    }
                  }
                } else {
                  sbwl.push(item.matName);
                  sb++;
                  this.$message.error('第' + (i + 1) + '条数据提交失败：' + res.message)
                }
              } else {
                break;
              }
            } else {
              const res = await this.axios.post('pass/testManagement/v1/limssampletests/errorWarningRemind?stId=' + item.stId, { individualType: 'json' });
              console.log('res.data=' + res.data + ",res.code=" + res.code);
              if (res.code == 0 || res.code == 200) {
                if (res.data) {
                  if (res.data.code == 0) {
                    let temp = res.data.object
                    const res2 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                    if (res2.code == 0 || res2.code == 200) {
                      cg++;
                    } else {
                      sbwl.push(res2.message);
                      sb++;
                    }
                  } else {
                    await this.$confirm('第' + (i + 1) + '条数据, ' + `${res.data.message},是否继续?`, '超差预警提醒', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(async () => {
                      const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                      if (res4.code == 0 || res4.code == 200) {
                        cg++;
                      } else {
                        sbwl.push(res4.message);
                        sb++;
                      }
                    }).catch((err) => {
                      // 选择 取消
                      qx++;
                    });
                  }
                } else {
                  const res4 = await this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + item.stId, { individualType: 'json' });
                  if (res4.code == 0 || res4.code == 200) {
                    cg++;
                  } else {
                    sbwl.push(res4.message);
                    sb++;
                  }
                }
              } else {
                sbwl.push(item.matName);
                sb++;
                //this.$message.error('第' + (i+1) + '条数据提交失败：' + res.message)
              }
            }
          } else {
            sbwl.push(item.matName);
            sb++;
          }
        } catch (err) {
          sbwl.push(item.matName);
          sb++;
          console.log('eeeeee');
        }
      }
      this.saveLoading = false
      this.submitLoading = false
      //console.log('cg', cg);
      //console.log('sb', sb);
      if (sb == 0 && qx == 0) {
        this.$message.success('执行完毕，成功提交 ' + cg + ' 条数据');
      } else {
        // this.$message.warning('执行完毕，成功提交 ' + cg + ' 条数据，失败 ' + sb + ' 条：['+sbwl+'], 取消' + qx + ' 条');
        this.$message.warning('执行完毕，成功提交 ' + cg + ' 条数据，失败 ' + sb + ' 条：[' + sbwl + '], 取消' + msgArr[1] + ' 条');
      }
      this.searchData()
    },
    // 增加任务
    retest () {
      let selectlength = 0;
      if (this.selectVal.length < 1) {
        this.$message.warning('请勾选您要增加任务的数据')
        return
      }
      for (let i = 0; i < this.selectVal.length; i++) {
        if (this.selectVal[i].testItemName != this.selectVal[0].testItemName) {
          this.$message.warning("增加任务的勾选数据中有测试项目不相同的数据，请重新勾选");
          return
        }
      }
      // if(this.selectlength>0){

      // }
      if (this.selectVal[0].stateFlag == 3) {
        this.$message.warning("已提交的数据不能增加任务,请选择状态为未处理的数据进行操作");
        return;
      }
      this.resetShowFlag = !this.resetShowFlag
      this.Params = Object.assign([{}], this.selectVal)
      // if (JSON.stringify(this.analyzeVal)==="{}") {
      //   this.$message.warning("请先点击选中一条测试项目数据");
      //   return
      // }
      // if (this.analyzeVal.stateFlag == 3) {
      //   this.$message.warning("已提交的数据不能增加任务,请选择状态为未处理的数据进行操作");
      //   return;
      // }
      // this.resetShowFlag = !this.resetShowFlag
      // this.Params = Object.assign({}, this.analyzeVal)
    },
    //自动采集数据
    autoCollet () {
      if (JSON.stringify(this.analyzeVal) === "{}") {
        this.$message.warning("请先点击选中一条需要自动采集的已接收表格中的数据！");
        return;
      }
      if (this.analyzeVal.stateFlag == 3) {
        this.$message.warning("已提交的数据不能进行自动采集,请选择状态为未处理的数据！");
        return;
      }
      this.$refs.autoCollData.validate((valid) => {
        if (valid) {
          let obj = {
            eqpNo: this.autoCollData.eqpNo,
            stId: this.analyzeVal.stId
          }
          this.autoColletLoading = true
          this.axios.post('pass/testManagement/v1/limssampletests/voluntarilygather', obj, { individualType: 'json' }).then(res => {
            if (res.code == 0 || res.code == 200) {
              if (this.interval != null) {
                clearInterval(this.interval);
              }
              this.$message.success(res.message)
              this.formulacom();
            } else {
              this.$message.error(res.message)
            }
            this.autoColletLoading = false
          }).catch(err => {
            console.log("异常")
            this.autoColletLoading = false
            this.$message.error(err.message)
          })
        }
      })
    },
    // 批量采集弹窗
    collectData () {
      if (this.selectVal.length < 1) {
        this.$message.warning('请勾选测试项目的数据')
        return
      }
      for (let item of this.selectVal) {
        if (item.stateFlag != 0) {
          this.$message.warning('请选择状态为未处理的数据')
          return
        }
        if (item.validFlag == '0') {
          this.$message.warning('请勾选有效数据')
          return
        }
      }
      this.dataCollectionFlag = !this.dataCollectionFlag
      this.Params2 = this.selectVal
    },
    // 撤销采集数据
    backCollect () {
      if (this.selectVal.length < 1) {
        this.$message.warning('请勾选数据')
        return
      }
      for (let item of this.selectVal) {
        if (item.stateFlag != 0) {
          this.$message.warning('请选择状态为未处理的数据')
          return
        }
        if (item.validFlag == '0') {
          this.$message.warning('请选择有效数据')
          return
        }
      }
      this.backLoading = true
      this.axios.post('pass/testManagement/v1/limssampletests/backCollect', this.selectVal, { individualType: 'json' }).then(res => {
        if (res.succeed) {
          this.$message.success(res.message);
          this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.backLoading = false
      }).catch(e => {
        this.backLoading = false
        this.$message.error(e.message)
      })
    },
    //批量录入
    batchData () {
      if (this.selectVal.length < 1) {
        this.$message.warning('请勾选测试项目的数据')
        return
      }
      let temp = []
      this.selectVal.map(item => {
        temp.push(item.stId)
      })
      this.batchDataLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/transitionData', temp, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          if (res.data.badyData.length > 0) {
            // 增加第一行用于批量修改
            let obj = Object.assign({}, res.data.badyData[0]);
            for (let key in obj) {
              obj[key] = ''
            }
            let arr = res.data.badyData;
            arr.splice(0, 0, obj);
            this.cols = res.data.head
            this.tableData = arr
            this.testTable = res.data.headBabyData
          }
          this.batchShow = true
          this.$nextTick(() => {
            this.$refs['tablePllr'].bodyWrapper.scrollTop = 0
          })
        } else {
          this.$message.error(res.message)
        }
        this.batchDataLoading = false
      }).catch(e => {
        this.batchDataLoading = false
        this.$message.error(e.message)
      })
    },
    // 计算并提交
    submitBatch () {
      this.batchShow = false
      let temp = []
      this.resultData = []
      // 第一行不提交
      let arr = this.tableData.slice(0);
      arr.splice(0, 1);
      arr.forEach((item, index) => {
        let obj = Object.assign(item)
        delete obj.index
        //将对象转化成数组、循环获取到index
        let tempArr = Object.keys(obj)
        tempArr.forEach((items, indexs) => {
          // console.log('名字'+items +'数值'+ obj[items]+'数组的id'+this.testTable[index][items]);
          this.resultData.push({ anlyValue: obj[items], stIdD: this.testTable[index][items] })
        })
      })
      let tempData = []
      this.selectVal.map(item => {
        tempData.push(item.stId)
      })
      this.batchLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/batchUpdateLimsSampleTestDList', this.resultData, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          if (this.isOneHint) {
            this.subDataAndHintOne();
          } else {
            this.subData3();
          }
        } else {
          this.$message.error(res.message)
        }
        this.batchLoading = false
      }).catch(err => {
        this.batchLoading = false
        this.$message.error(err.message)
      })
      // let temp = []
      // this.resultData = []
      // // 第一行不提交
      // let arr = this.tableData.slice(0);
      // arr.splice(0,1);
      // arr.forEach((item,index) =>{
      //   let obj = Object.assign(item)
      //   delete obj.index
      //   //将对象转化成数组、循环获取到index
      //   let tempArr = Object.keys(obj)
      //   tempArr.forEach((items,indexs) =>{
      //     // console.log('名字'+items +'数值'+ obj[items]+'数组的id'+this.testTable[index][items]);
      //     this.resultData.push({anlyValue:obj[items],stIdD:this.testTable[index][items]})

      //   })
      // })
      // let tempData = []
      // this.selectVal.map(item =>{
      //   tempData.push(item.stId)
      // })
      // this.batchLoading = true
      // this.axios.post('pass/testManagement/v1/limssampletestds/batchUpdateLimsSampleTestDList',this.resultData,{individualType: 'json'}).then(res =>{
      //   if (res.code == 0 || res.code == 200) {
      //     this.axios.post('pass/testManagement/v1/limssampletests/formulacomByStIds',tempData,{individualType: 'json'}).then(res =>{
      //       if (res.code == 0 || res.code == 200) {
      //         this.piliangtijiao = tempData;
      //         console.log(this.piliangtijiao)
      //         this.subData30()
      //         // for(let i=0;i<tempData.length;i++){
      //           // this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + tempData[i],{individualType: 'json'}).then(res => {
      //           //   if(res.code== 0 || res.code == 200) {
      //           //     this.$message.success(res.message);
      //           //   } else {
      //           //     this.$message.error(res.message)
      //           //   }
      //           //   if(i == tempData.length-1){
      //           //     setTimeout(() => {
      //           //       this.searchData();
      //           //     }, 500);
      //           //   }
      //           // }).catch(e => {
      //           //   this.$message.error(e.message)
      //           // })
      //         // }
      //       }else{
      //         this.$message.error(res.message)
      //       }
      //     }).catch(err =>{
      //       this.$message.error(err.message)
      //     })
      //     this.closebatch()
      //   }else{
      //     this.$message.error(res.message)
      //   }
      //   this.batchLoading = false
      // }).catch(err =>{
      //   this.batchLoading = false
      //   this.$message.error(err.message)
      // })
    },
    //保存批量数据
    saveBatch () {
      let temp = []
      this.resultData = []
      // 第一行不提交
      let arr = this.tableData.slice(0);
      arr.splice(0, 1);
      arr.forEach((item, index) => {
        let obj = Object.assign(item)
        delete obj.index
        //将对象转化成数组、循环获取到index
        let tempArr = Object.keys(obj)
        tempArr.forEach((items, indexs) => {
          // console.log('名字'+items +'数值'+ obj[items]+'数组的id'+this.testTable[index][items]);
          this.resultData.push({ anlyValue: obj[items], stIdD: this.testTable[index][items] })
        })
      })
      let tempData = []
      this.selectVal.map(item => {
        tempData.push(item.stId)
      })
      this.batchLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/batchUpdateLimsSampleTestDList', this.resultData, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message)
          this.axios.post('pass/testManagement/v1/limssampletests/formulacomByStIds', tempData, { individualType: 'json' }).then(res => {
            if (res.code == 0 || res.code == 200) {
              this.$message.success(res.message)
            } else {
              this.$message.error(res.message)
            }
          }).catch(err => {
            this.$message.error(err.message)
          })
          this.searchData()
          this.closebatch()
        } else {
          this.$message.error(res.message)
        }
        this.batchLoading = false
      }).catch(err => {
        this.batchLoading = false
        this.$message.error(err.message)
      })
    },
    closebatch () {
      this.batchShow = false
      this.batchLoading = false
      this.recallShow = false
      this.cols = []
      this.tableData = []
      this.testTable = []
    },
    closeBly () {
      this.dialog.show = false
      this.addByShow = false
      this.dialog.form.data.sampleNo = '';
    },
    inputData (val, index, prop) {

      let that = this;
      // 修改第一行数据，联动修改同列其他行数据
      if (index == 0 && that.tableData.length > 1) {
        for (let i = 1; i < that.tableData.length; i++) {
          that.tableData[i][prop] = val;
        }
      }
    },
    //保存
    saveData () {
      if (this.tableData3.length < 1) {
        this.$message.warning("表格中无数据，无法进行保存");
        return;
      }
      this.saveLoading = true
      let url = '';
      if (this.dataType == 1){
        url = 'pass/testManagement/v1/limssampletestds/updateLimsSampleTestDList2';
      }else if (this.dataType == 2){
        url = 'pass/testManagement/v1/limssampleresultds/updateLimsSampleResultDList'
      }else if (this.dataType == 3){
        url = 'pass/testManagement/v1/limssamplereleaseds/updateLimsSampleReleaseDList'
      }
      this.axios.post(url, this.tableData3, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.$message.success(res.message)
          this.searchAnalyze(this.analyzeVal)
          // this.searchData()
        } else {
          this.$message.error(res.message)
        }
        this.saveLoading = false
      }).catch(err => {
        this.saveLoading = false
        this.$message.error(err.message)
      })
    },
    //查询操作
    searchData () {
      this.pageIndex = 1
      this.pageSize = 100
      this.pageSize_dep = 100
      this.pageIndex_dep = 1
      this.DataDep() //一审数据
      this.Data4() //  二审数据
      this.Data5() // 三审数据
    },
    // //一审数据
    DataDep () {
      this.tableData3 = []
      let startTime = ''
      let endTime = ''
      this.analyzeVal = {}
      if (!this.searchForm.times) {
        startTime = ''
        endTime = ''
      } else {
        startTime = this.searchForm.times[0]
        endTime = this.searchForm.times[1]
      }
      let obj = {
        object: {
          matName: this.searchForm.matName,
          sampleTypeCode: this.searchForm.sampleTypeCode,
          sampleNo:this.searchForm.sampleNo,
          batchNo:this.searchForm.batchNo,
          validFlag: '1',
          createNo: null
        },
        'list': [3], // 已接任务、未处理状态
        'list2': [484003], // 测试分析模块
        "pageSize": this.pageSize_dep,
        "pageIndex": this.pageIndex_dep,
        'startTime': startTime,
        'endTime': endTime
      }
      this.tableLoading2 = true;
      this.axios.post('pass/testManagement/v1/limssampletests/queryLimsSampleTestPage', obj, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData2 = res.data.list
          this.total_dep = res.data.total
          this.tableData2.forEach(item => {
            item.stateFlagName = item.stateFlag == '0' ? '未处理' : item.stateFlag == '3' ? '已提交' : ''
            item.validFlagName = item.validFlag == 0 ? '无效' : item.validFlag == 1 ? '有效' : ''
          })
          if (this.tableData2.length > 0) {
            this.$refs.table2.setCurrentRow(this.tableData2[0])
            this.searchAnalyze(this.tableData2[0])
          }
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading2 = false;
      }).catch(err => {
        this.tableLoading2 = false;
        this.$message.error(err.message)
      })
    },
    // 二审数据
    Data4 () {
      let startTime = ''
      let endTime = ''
      if (!this.searchForm.times) {
        startTime = ''
        endTime = ''
      } else {
        startTime = this.searchForm.times[0]
        endTime = this.searchForm.times[1]
      }
      let obj = {
        object: {
          matName: this.searchForm.matName,
          sampleTypeCode: this.searchForm.sampleTypeCode,
          sampleNo: this.searchForm.sampleNo,
          batchNo : this.searchForm.batchNo,
          createNo: null
        },
        mode: '1',
        "pageSize": this.pageSize4,
        "pageIndex": this.pageIndex4,
        'startTime': startTime,
        'endTime': endTime
      }
      this.tableLoading4 = true;
      this.axios.post('pass/testManagement/v1/limssampleresults/queryLimsSampleResultPage', obj, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData4 = res.data.list
          this.total4 = res.data.total
          this.tableData4.forEach(item => {
            item.stateFlagName = item.stateFlag == '4' ? '未审核' : item.stateFlag == '5' ? '已审核' : ''
            item.validFlagName = item.validFlag == 0 ? '无效' : item.validFlag == 1 ? '有效' : ''
          })
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading4 = false;
      }).catch(err => {
        this.tableLoading4 = false;
        this.$message.error(err.message)
      })
    },
    //三审数据
    Data5 () {
      let startTime = ''
      let endTime = ''
      if (!this.searchForm.times) {
        startTime = ''
        endTime = ''
      } else {
        startTime = this.searchForm.times[0]
        endTime = this.searchForm.times[1]
      }
      let obj2 = {
        object: {
          matName: this.searchForm.matName,
          sampleTypeCode: this.searchForm.sampleTypeCode,
          sampleNo: this.searchForm.sampleNo,
          batchNo:this.searchForm.batchNo,
          createNo: null
        },
        mode: '1', // mode 0 表示查询无效数据
        'list2': [], // 测试分析模块
        "pageSize": this.pageSize42,
        "pageIndex": this.pageIndex42,
        'startTime': startTime,
        'endTime': endTime
      }
      this.tableLoading42 = true;
      this.axios.post('pass/testManagement/v1/limssamplereleases/queryLimsSampleReleasePage', obj2, { individualType: 'json' }).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData42 = res.data.list
          this.total42 = res.data.total
          this.tableData42.forEach(item => {
            item.stateFlagName = item.stateFlag == '5' ? '未审核' : item.stateFlag == '6' ? '已审核' : ''
            item.validFlagName = item.validFlag == 0 ? '无效' : item.validFlag == 1 ? '有效' : ''
          })
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading42 = false;
      }).catch(err => {
        this.tableLoading42 = false;
        this.$message.error(err.message)
      })
    },
    //TODO 查询一审子数据
    searchAnalyze (row) {
      this.dataType= 1;
      this.isAutoColl = false;
      this.stopall();
      //保存点击的样品信息数据，保存、提交操作时刷新
      this.saveAnaly = {}
      this.analyzeVal = row
      this.tableLoading3 = true;
      this.axios.post('pass/testManagement/v1/limssampletestds/queryLimsSampleTestDList?stId=' + this.analyzeVal.id).then(res => {
        if (res.code == 0 || res.code == 200) {
          this.tableData3 = res.data
          this.tableData3.forEach(item => {
            item.showInput = item.unitName == '无' ? false : true
            item.defaultList = item.defaultValue ? item.defaultValue.split('#') : []
            item.anlyValue = item.anlyValue ? item.anlyValue : item.defaultList[0]
            item.isReportName = item.isReport == 0 ? '否' : item.isReport == 1 ? '是' : ''
            item.isAlarmName = item.isAlarm == 0 ? '否' : item.isAlarm == 1 ? '是' : ''
          })
        } else {
          this.$message.error(res.message)
        }
        this.tableLoading3 = false;
      }).catch(err => {
        this.tableLoading3 = false;
        this.$message.error(err.message)
      })
    },
    //TODO 查询二审子数据
    searchResultD(row){
      this.dataType = 2;
      let srId = row.id;
      this.axios.post('pass/testManagement/v1/limssampleresultds/queryLimsSampleResultDList?srId='+srId).then(res => {
        if (res.code == 0 || res.code == 200){
          this.tableData3 = res.data;
          this.tableData3.forEach(item => {
            item.showInput = item.unitName == '无' ? false : true
            item.defaultList = item.defaultValue ? item.defaultValue.split('#') : []
            item.anlyValue = item.anlyValue ? item.anlyValue : item.defaultList[0]
            item.isReportName = item.isReport == 0 ? '否' : item.isReport == 1 ? '是' : ''
            item.isAlarmName = item.isAlarm == 0 ? '否' : item.isAlarm == 1 ? '是' : ''
          })
        }else {
          this.$message.warning(res.message);
        }
      }).catch(ex => {
        this.$message.error(ex.message);
      })
    },
    //TODO 查询三审子数据
    searchReleaseD(row){
      this.dataType = 3;
      let saId = row.id;
      this.axios.post('pass/testManagement/v1/limssamplereleaseds/queryLimsSampleReleaseDList?saId='+saId).then(res => {
        if (res.code == 0 || res.code == 200){
          this.tableData3 = res.data;
          this.tableData3.forEach(item => {
            item.showInput = item.unitName == '无' ? false : true
            item.defaultList = item.defaultValue ? item.defaultValue.split('#') : []
            item.anlyValue = item.anlyValue ? item.anlyValue : item.defaultList[0]
            item.isReportName = item.isReport == 0 ? '否' : item.isReport == 1 ? '是' : ''
            item.isAlarmName = item.isAlarm == 0 ? '否' : item.isAlarm == 1 ? '是' : ''
          })
        }else {
          this.$message.warning(res.message);
        }
      }).catch(ex => {
        this.$message.error(ex.message);
      })
    },
    //表格数据右移
    rightData2 (row) {
      //新增的数据清空id
      row.cretNoD = ''
      this.table.addTest.push(row)
    },
    showCell (row) {
      this.tabClickIndex = row.index
    },
    saveCell (row) {
      this.tabClickIndex = null
    },
    tableRowName ({ row, rowIndex }) {
      row.index = rowIndex
      if (row.warning) {
        return 'error-row'
      }
    },
    handleSizeChangeMain (pageSize) {
      this.pageIndex = 1;
      this.pageSize = pageSize;
      this.DataMain();
    },
    handleSizeChangeDep (pageSize) {
      this.pageIndex_dep = 1;
      this.pageSize_dep = pageSize;
      this.DataDep();
    },
    handleSizeChange4 (pageSize) {
      this.pageIndex4 = 1;
      this.pageSize4 = pageSize;
      this.Data4();
    },
    handleSizeChange5 (pageSize) {
      this.pageIndex42 = 1;
      this.pageSize42 = pageSize;
      this.Data5();
    },
    SizeTest (size) {
      this.pageTests.pageSize = size;
      this.getDataListTest2();
    },
    pageChangeTest (index) {
      this.pageTests.pageNum = index;
      this.getDataListTest2();
    },
    tableRowClassName ({ row, rowIndex }) {
      if (row.validFlag !== '1') {
        return 'error-row';
      }
      return ''
      // if (columnIndex === 0) {
      //   if (row.validFlag !== '1') {
      //       return 'error-row';
      //   } else if (row.stateFlag === '3') {
      //     return 'error-green';
      //   }
      // }
      // return ''
    },
    tableRowBatch ({ row, column, rowIndex, columnIndex }) {
    },
    fxTableRowClassName ({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 3) {
        //最大符号与最小符号必须同时存在，最大值与最小值必须有一项要有值，否则直接return不进入判断
        if (row.maxSign && row.minSign && (row.maxValue || row.minValue)) {
          if (row.maxSign == '<=' && row.minSign == '>=') {
            if (Number(row.anlyValue) <= Number((row.maxValue ? row.maxValue : Infinity)) && Number(row.anlyValue) >= Number((row.minValue ? row.minValue : 0))) {
              return 'error-green';
            } else {
              return 'error-row';
            }
          }
          if (row.maxSign == '<=' && row.minSign == '>') {
            if (Number(row.anlyValue) <= Number((row.maxValue ? row.maxValue : Infinity)) && Number(row.anlyValue) > Number((row.minValue ? row.minValue : 0))) {
              return 'error-green';
            } else {
              return 'error-row';
            }
          }
          if (row.maxSign == '<' && row.minSign == '>=') {
            if (Number(row.anlyValue) < Number((row.maxValue ? row.maxValue : Infinity)) && Number(row.anlyValue) >= Number((row.minValue ? row.minValue : 0))) {
              return 'error-green';
            } else {
              return 'error-row';
            }
          }
          if (row.maxSign == '<' && row.minSign == '>') {
            if (Number(row.anlyValue) < Number((row.maxValue ? row.maxValue : Infinity)) && Number(row.anlyValue) > Number((row.minValue ? row.minValue : 0))) {
              return 'error-green';
            } else {
              return 'error-row';
            }
          }
        }
        return '';
      } else if (column.property === 'reviseValue') {
        return 'error-blue';
      }
    },
    tableHeaderCellStyle () {
      return 'background-color: rgb(249,249,249) !important;color: rgb(73, 72, 72);border-bottom: 1px solid #DCDFE7;border-top:3px solid #3ac1ea;'
    },
    keyDown (event, row, rindex) {
      let tdTarget = event.target;
      let pid = tdTarget.id;
      if (!pid) {
        return true;
      }
      let ids = pid.split("--");
      if (ids.length != 2) {
        return true;
      }
      let columnId = ids[0];
      let index = ids[1];
      let that = this;
      while (tdTarget.tagName !== 'TD') {
        tdTarget = tdTarget.parentElement;
      }
      if (event.keyCode === 13) {
        this.jisuanRow(row, rindex)
      }
      // 如果按下键盘下键或者回车键
      if (event.keyCode === 40 || event.keyCode === 13) {
        let ind = Number(index) + 1;
        let id = '#' + columnId + '--' + ind;
        let input = $(id);
        if (input) {
          this.$refs.tablePllr.setCurrentRow(this.tableData[ind]);
          input.focus();
          input.select(); // 选中内容
          event.stopPropagation();
          event.stopImmediatePropagation();
          event.preventDefault();
          return false;
        }
      } else if (event.keyCode === 38) { // 键盘上键
        let ind = Number(index) - 1;
        let id = '#' + columnId + '--' + ind;
        let input = $(id);
        if (input) {
          this.$refs.tablePllr.setCurrentRow(this.tableData[ind]);
          input.focus();
          input.select(); // 选中内容
          event.stopPropagation();
          event.stopImmediatePropagation();
          event.preventDefault();
          return false;
        }
      } else if (event.keyCode === 37) { // 键盘左键
        let input = $(tdTarget).prev().find('input') && $(tdTarget).prev().find('input')[0];
        if (input) {
          input.focus();
          input.select(); // 选中内容
          event.stopPropagation();
          event.stopImmediatePropagation();
          event.preventDefault();
          return false;
        }
      } else if (event.keyCode === 39) { // 键盘右键
        let input = $(tdTarget).next().find('input')[0];
        if (input) {
          input.focus();
          input.select(); // 选中内容
          event.stopPropagation();
          event.stopImmediatePropagation();
          event.preventDefault();
          return false;
        }
      }
    },
    // 删除数据（前端删除）
    delData (row, index) {
      let that = this;
      // console.log(row, index)
      that.tableData.splice(index, 1);
      that.testTable.splice(index - 1, 1);
      let srow = that.selectVal[index - 1];
      that.selectVal.splice(index - 1, 1);
      that.$refs.table2.toggleRowSelection(srow, false);
    }
  }
}
</script>
<style  scoped>
</style>
<style lang="less">
.testManagement {
  .buttons {
    .el-button {
      margin: 2px 3px 0 0;
    }
  }
  .textOverflow {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .testManagement_left {
    .el-table .el-table__body tr.error-row {
      background-color: rgb(253, 89, 89) !important;
    }
    .el-table .el-table__body tr.error-row > td {
      background-color: rgb(253, 89, 89) !important;
    }
    .el-table .el-table__body tr.error-green {
      background-color: rgb(202, 249, 130) !important;
    }
    .el-table .el-table__body tr.error-green > td {
      background-color: rgb(202, 249, 130) !important;
    }
  }
  .testManagement-pllr {
    .el-table .el-table__body tr.current-row > td {
      //background-color: rgba(26, 75, 236, 0.2) !important;
      background-color: rgba(64, 158, 255, 0.3) !important;
    }
  }
}
</style>
