<!--字段，查询列表，点击事件全部没有做-->
<template>
  <div class="examination">
    <div class="common-head-search">
      <el-form :inline="true">
        <el-form-item label="样品类型">
          <el-select
            v-model="search.sampleTypeCode"
            clearable
            filterable
            collapse-tags
            size="small"
            style="width: 200px"
            placeholder="请选择查询内容"
          >
            <el-option
              v-for="item in sampleType"
              :key="item.baseCode"
              :label="item.baseName"
              :value="item.baseCode"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="物料名称">
          <el-input
            v-model="search.matName"
            size="small"
            placeholder="请输入查询内容"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="中心编号">
          <el-input
            v-model="search.sampleNo"
            size="small"
            placeholder="请输入查询内容"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="委托编号">
          <el-input
            v-model="search.carNo"
            size="small"
            placeholder="请输入查询内容"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="委托日期">
          <el-date-picker
            v-model="search.declareTime"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            size="small"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button
            icon="el-icon-search"
            type="goon"
            size="mini"
            @click="searchData"
            >查询</el-button
          >
          <el-button
            icon="el-icon-refresh"
            type="info"
            plain
            size="mini"
            @click="reset"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <el-tabs
      type="border-card"
      v-model="activeName"
      class="testManagement_left"
    >
      <el-tab-pane label="样品信息" name="first">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            样品信息表
          </div>
          <div>
            <el-button
              icon="el-icon-check"
              type="goon"
              size="mini"
              :loading="creteLoading"
              @click="createData"
              >生成</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="dataLoading1"
            ref="dataTable1"
            border
            :height="theight1"
            @selection-change="handleSelectionChange1"
            highlight-current-row
            @row-click="clickRow1"
            :data="table.list3"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :cell-class-name="tableRowClassName"
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="car" label="委托编号" align="center"></el-table-column> -->
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="sampleNo"
              label="中心编号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="matName"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="entrTime"
              label="委托时间"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="auditMan"
              label="审核人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="auditTime"
              label="审核时间"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="memo"
              label="备注"
              align="center"
            ></el-table-column>
          </el-table>
        </div>
        <div class="common-foot-style">
          <el-pagination
            v-loading="dataLoading1"
            @size-change="pageSizeChange1"
            @current-change="pageCurrentChange1"
            :current-page="page1.pageNum"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="page1.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page1.totalPage"
            background
          >
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="已生成信息" name="second">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            生成报告信息表
          </div>
          <div>
            <el-button
              icon="el-icon-check"
              type="goon"
              size="mini"
              :loading="creteLoading1"
              @click="submitData"
              >提交</el-button
            >
            <el-button
              icon="el-icon-back"
              type="danger"
              size="mini"
              :loading="creteLoading1"
              @click="withdrawData"
              >撤回</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="dataLoading"
            ref="1"
            border
            :height="theight1"
            @selection-change="handleSelectionChange"
            highlight-current-row
            @row-click="clickRow"
            :data="table.list"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :cell-class-name="tableRowClassName"
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="SAMPLE_NO" label="中心编号" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="CAR_NO" label="委托编号" align="center"></el-table-column> -->
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="MAT_NAME"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="150px"
              prop="ARCHIVE_ID"
              label="报告流水号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="cretTypeName"
              label="证书类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="200px"
              prop="SAVE_PATH"
              label="证书PDF"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="SAVE_PATH"
              label="下载/预览源文件"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="imgPreView(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewY(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="SAVE_PATH"
              label="下载/预览PDF"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="
                      imgPreViewDownloadPdf(scope.row, scope.row.SAVE_PATH)
                    "
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewPdf(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="140px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="updateMan" label="修改人" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="updateTime" label="修改时间" align="center"></el-table-column> -->
          </el-table>
        </div>
        <div class="common-foot-style">
          <el-pagination
            v-loading="dataLoading"
            @size-change="pageSizeChange"
            @current-change="pageCurrentChange"
            :current-page="page.pageNum"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="page.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page.totalPage"
            background
          >
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="报告信息" name="third1">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            已提交报告信息表
          </div>
          <div>
            <el-button
              icon="el-icon-check"
              type="goon"
              size="mini"
              :loading="creteLoading1"
              @click="approvalData"
              >审核</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="dataLoading"
            ref="1"
            border
            :height="theight1"
            @selection-change="handleSelectionChange6"
            highlight-current-row
            @row-click="clickRow6"
            :data="table.list6"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :cell-class-name="tableRowClassName"
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="SAMPLE_NO" label="中心编号" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="CAR_NO" label="委托编号" align="center"></el-table-column> -->
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="MAT_NAME"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="150px"
              prop="ARCHIVE_ID"
              label="报告流水号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="cretTypeName"
              label="证书类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="200px"
              prop="SAVE_PATH"
              label="证书PDF"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="SAVE_PATH"
              label="下载/预览"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="imgPreView(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewY(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="SAVE_PATH"
              label="下载/预览PDF"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="
                      imgPreViewDownloadPdf(scope.row, scope.row.SAVE_PATH)
                    "
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewPdf(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="140px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="updateMan" label="修改人" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="updateTime" label="修改时间" align="center"></el-table-column> -->
          </el-table>
        </div>
        <div class="common-foot-style">
          <el-pagination
            v-loading="dataLoading"
            @size-change="pageSizeChange6"
            @current-change="pageCurrentChange6"
            :current-page="page6.pageNum"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="page6.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page6.totalPage"
            background
          >
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="已审核信息" name="third">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            已审核信息表
          </div>
          <div>
            <el-button
              icon="el-icon-check"
              type="goon"
              size="mini"
              :loading="creteLoading1"
              @click="examinationData"
              >批准</el-button
            >
            <el-button
              icon="el-icon-back"
              type="danger"
              size="mini"
              :loading="creteLoading1"
              @click="withdrawData2"
              >撤回到样品信息</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="dataLoading"
            ref="1"
            border
            :height="theight1"
            @selection-change="handleSelectionChange4"
            highlight-current-row
            @row-click="clickRow4"
            :data="table.list4"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :cell-class-name="tableRowClassName"
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="MAT_NAME"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="150px"
              prop="ARCHIVE_ID"
              label="报告流水号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="cretTypeName"
              label="证书类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="200px"
              prop="SAVE_PATH"
              label="证书PDF"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="SAVE_PATH"
              label="下载/预览"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="imgPreView(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewY(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="SAVE_PATH"
              label="下载/预览PDF"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="
                      imgPreViewDownloadPdf(scope.row, scope.row.SAVE_PATH)
                    "
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewPdf(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="140px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
          </el-table>
        </div>
        <div class="common-foot-style">
          <el-pagination
            v-loading="dataLoading"
            @size-change="pageSizeChange4"
            @current-change="pageCurrentChange4"
            :current-page="page4.pageNum"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="page4.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page4.totalPage"
            background
          >
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="已批准信息" name="fourth">
        <div class="common-title-div">
          <div class="common-title-name">
            <img
              style="width: 25px; height: 25px"
              src="../../../../assets/img/imgScreen/logo.png"
            />
            已批准报告信息表
          </div>
          <div>
            <!-- <el-button icon="el-icon-upload2" type="goon" size="mini" :loading='creteLoading1' @click="printData">打印</el-button> -->
            <el-date-picker
              v-model="timeFile"
              type="date"
              @change="aaaaa"
              size="small"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              placeholder="选择日期"
            >
            </el-date-picker>
            <el-button
              icon="el-icon-download"
              type="goon"
              size="mini"
              v-if="exportFlag"
              :loading="exportFileLoading"
              @click="exportFile"
              >导出报告发放登记表</el-button
            >
          </div>
        </div>
        <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
          <el-table
            v-loading="dataLoading"
            ref="1"
            border
            :height="theight1"
            @selection-change="handleSelectionChange5"
            highlight-current-row
            @row-click="clickRow5"
            :data="table.list5"
            :icore-filter-flag="icoreFilterFlag"
            :header-cell-style="tableHeaderCellStyle"
            :cell-class-name="tableRowClassName"
            :summary-method="getSummaries"
            show-summary
          >
            <el-table-column
              type="index"
              label="NO"
              align="center"
            ></el-table-column>
            <el-table-column
              type="selection"
              width="55"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="SAMPLE_NO" label="中心编号" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="CAR_NO" label="委托编号" align="center"></el-table-column> -->
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="MAT_NAME"
              label="物料"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="150px"
              prop="ARCHIVE_ID"
              label="报告流水号"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="120px"
              prop="cretTypeName"
              label="证书类型"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="200px"
              prop="SAVE_PATH"
              label="证书PDF"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="SAVE_PATH"
              label="下载/预览"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="imgPreView(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewY(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="100px"
              prop="SAVE_PATH"
              label="下载/预览PDF"
              align="center"
              ><template slot-scope="scope">
                <el-tooltip content="下载pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="goon"
                    size="mini"
                    icon="el-icon-download"
                    circle
                    @click="
                      imgPreViewDownloadPdf(scope.row, scope.row.SAVE_PATH)
                    "
                  >
                  </el-button>
                </el-tooltip>
                <el-tooltip content="预览pdf" placement="bottom" effect="light">
                  <el-button
                    :disabled="!scope.row.SAVE_PATH"
                    type="warning"
                    size="mini"
                    icon="el-icon-view"
                    circle
                    @click="imgPreViewPdf(scope.row, scope.row.SAVE_PATH)"
                  >
                  </el-button>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="80px"
              prop="createMan"
              label="创建人"
              align="center"
            ></el-table-column>
            <el-table-column
              sortable
              :show-overflow-tooltip="true"
              min-width="140px"
              prop="createTime"
              label="创建时间"
              align="center"
            ></el-table-column>
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="80px" prop="updateMan" label="修改人" align="center"></el-table-column> -->
            <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="updateTime" label="修改时间" align="center"></el-table-column> -->
          </el-table>
        </div>
        <div class="common-foot-style">
          <el-pagination
            v-loading="dataLoading"
            @size-change="pageSizeChange5"
            @current-change="pageCurrentChange5"
            :current-page="page5.pageNum"
            :page-sizes="[10, 20, 50, 100, 200]"
            :page-size="page5.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page5.totalPage"
            background
          >
          </el-pagination>
        </div>
      </el-tab-pane>
    </el-tabs>
    <div class="common-title-div">
      <div class="common-title-name">
        <img
          style="width: 25px; height: 25px"
          src="../../../../assets/img/imgScreen/logo.png"
        />
        检验明细表
      </div>
    </div>
    <div class="common-table-div" style="margin-bottom: 0; margin-top: 0">
      <el-table
        v-loading="dataLoading2"
        ref="12"
        border
        :height="theight2"
        highlight-current-row
        :data="table.list2"
        :icore-filter-flag="icoreFilterFlag"
        :header-cell-style="tableHeaderCellStyle"
        :summary-method="getSummaries"
        show-summary
      >
        <el-table-column
          type="index"
          label="NO"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="120px"
          prop="testItemName"
          label="任务名称"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="120px"
          prop="anlyItemName"
          label="分析项目"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="100px"
          prop="anlyValue"
          label="检验值"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="80px"
          prop="unitName"
          label="单位"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="80px"
          prop="dspOrder"
          label="排序"
          align="center"
        ></el-table-column>
        <el-table-column
          sortable
          :show-overflow-tooltip="true"
          min-width="100px"
          prop="memo"
          label="备注"
          align="center"
        ></el-table-column>
      </el-table>
    </div>
    <div>
      <div id="docx">
        <div ref="file"></div>
      </div>
      <div id="xlsx">
        <el-tabs v-model="activeName1" v-if="DialogVisible" type="border-card">
          <el-tab-pane
            v-for="(item, index) in excelSheet"
            :key="index"
            :label="item.name"
            :name="item.name"
          >
            <div class="table" v-html="item.innerHTML"></div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>
<script>
import { getCookie } from "@/utils/util.js";
import { cookieUserId, cookieUserName } from "@/config/config.js";
import pdf from "vue-pdf";
import XLSX from "xlsx";
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  data() {
    return {
      fromDaiban: null,
      table: {
        list: [],
        list2: [],
        list3: [],
        list4: [],
        list5: [],
        list6: [],
      },
      dataLoading: false,
      dataLoading1: false,
      dataLoading2: false,
      creteLoading: false,
      creteLoading1: false,
      icoreFilterFlag: true,
      exportFileLoading: false,
      firstRow: "",
      activeName: "first",
      DialogVisible: false,
      exportFlag: false,
      excelSheet: [],
      timeFile: "",
      activeName1: "",
      page: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0,
      },
      page1: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0,
      },
      page2: {
        pageSize: 990,
        pageNum: 1,
        totalPage: 0,
      },
      page4: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0,
      },
      page5: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0,
      },
      page6: {
        pageSize: 100,
        pageNum: 1,
        totalPage: 0,
      },
      sampleType: [],
      saveData: {},
      saveData4: {},
      saveData5: {},
      saveData6: {},
      multipleSelection1: [],
      multipleSelection3: [],
      multipleSelection4: [],
      multipleSelection5: [],
      multipleSelection6: [],
      search: {
        matName: "",
        sampleNo: "",
        carNo: "",
        sampleTypeCode: "",
        declareTime: "",
      },
      theight1: 0,
      theight2: 0,
    };
  },
  created() {
    this.theight1 =
      window.innerHeight / 2 - 130 < 249 ? 249 : window.innerHeight / 2 - 100;
    this.theight2 =
      window.innerHeight / 2 - 130 < 249 ? 249 : window.innerHeight / 2 - 100;
    this.search.declareTime = [
      this.getYNM(new Date()),
      this.getYNM(new Date()),
    ];

    this.fromDaiban = JSON.parse(sessionStorage.getItem("fromDaiban"));
    sessionStorage.removeItem("fromDaiban");

    if (this.fromDaiban) {
      this.search.declareTime = [
        this.fromDaiban.startTime.split(" ")[0],
        this.fromDaiban.endTime.split(" ")[0],
      ];
      if (this.fromDaiban.status == 1) {
        this.activeName = "second";
        0;
      } else if (this.fromDaiban.status == 2) {
        this.activeName = "third";
      } else if (this.fromDaiban.status == 3) {
        this.activeName = "fourth";
      }
    } else {
      this.search.declareTime = [
        this.getYNM(new Date()),
        this.getYNM(new Date()),
      ];
    }
  },
  mounted() {
    this.axios
      .post(
        "pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",
        { validFlag: 1, baseCode: 4801 },
        { individualType: "json" }
      )
      .then((res) => {
        this.sampleType = res.data;
      });
    this.searchData();
  },
  methods: {
    getYNM(date) {
      let year = date.getFullYear().toString();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      month = month < 10 ? "0" + month : month;
      day = day < 10 ? "0" + day : day;
      return `${year}-${month}-${day}`;
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        if (index === 1) {
          sums[index] = data.length;
        }
      });
      return sums;
    },
    //下载文件
    imgPreView(row, fileName) {
      this.axios
        .get(
          "pass/baseManagement/v1/file/download/" + fileName,
          { responseType: "blob" },
          { headers: { "content-type": "application/x-www-form-urlencoded" } }
        )
        .then((res) => {
          let blob = new Blob([res]);
          let elink = document.createElement("a");
          elink.download = fileName;
          elink.style.display = "none";
          elink.target = "_blank";
          elink.href = URL.createObjectURL(blob);
          document.body.appendChild(elink);
          elink.click();
          URL.revokeObjectURL(elink.href); // 释放URL对象
          document.body.removeChild(elink);
        })
        .catch((e) => {
          return this.$message.error(e.message);
        });
    },
    imgPreViewY(row, fileName) {
      let aaa = fileName.substr(fileName.indexOf(".") + 1);
      if (aaa == "pdf") {
        this.axios
          .get(
            "pass/baseManagement/v1/file/download/" + fileName,
            { responseType: "blob" },
            { headers: { "content-type": "application/x-www-form-urlencoded" } }
          )
          .then((res) => {
            const binaryData = [];
            binaryData.push(res);
            this.srcUrl = window.URL.createObjectURL(
              new Blob(binaryData, { type: "application/pdf" })
            );
            window.open(this.srcUrl, fileName);
            window.URL.revokeObjectURL(this.srcUrl);
          })
          .catch((e) => {
            return this.$message.error(e.message);
          });
      } else if (aaa == "xlsx") {
        this.axios
          .get(
            "pass/baseManagement/v1/file/download/" + fileName,
            { responseType: "arraybuffer" },
            { headers: { "content-type": "application/x-www-form-urlencoded" } }
          )
          .then((res) => {
            this.excelSheet = [];
            this.showFlag(false);
            let workbook = XLSX.read(new Uint8Array(res), { type: "array" });
            this.tableToHtml(workbook);
          })
          .catch((e) => {
            return this.$message.error(e.message);
          });
      } else {
        docx.renderAsync(new Blob(), this.$refs.file);
        return this.$message.error("不支持这个类型的文件展示！");
      }
    },
    imgPreViewDownloadPdf(row, fileName) {
      this.axios
        .get(
          "pass/baseManagement/v1/file/download/pdf/" + fileName,
          { responseType: "blob" },
          { headers: { "content-type": "application/x-www-form-urlencoded" } }
        )
        .then((res) => {
          const binaryData = [];
          binaryData.push(res);
          this.srcUrl = window.URL.createObjectURL(
            new Blob(binaryData, { type: "application/pdf" })
          );
          this.downFile(this.srcUrl, row.ARCHIVE_ID + ".pdf");
          window.URL.revokeObjectURL(this.srcUrl);
        })
        .catch((e) => {
          return this.$message.error(e.message);
        });
    },
    imgPreViewPdf(row, fileName) {
      this.axios
        .get(
          "pass/baseManagement/v1/file/download/pdf/" + fileName,
          { responseType: "blob" },
          { headers: { "content-type": "application/x-www-form-urlencoded" } }
        )
        .then((res) => {
          const binaryData = [];
          binaryData.push(res);
          this.srcUrl = window.URL.createObjectURL(
            new Blob(binaryData, { type: "application/pdf" })
          );
          window.open(this.srcUrl);
          window.URL.revokeObjectURL(this.srcUrl);
        })
        .catch((e) => {
          return this.$message.error(e.message);
        });
    },
    downFile(url, fileName) {
      const x = new XMLHttpRequest();
      x.open("GET", url, true);
      x.responseType = "blob";
      x.onload = function () {
        const url = window.URL.createObjectURL(x.response);
        const a = document.createElement("a");
        a.href = url;
        a.download = fileName;
        a.click();
      };
      x.send();
    },
    tableToHtml(workbook) {
      const sheetList = workbook.SheetNames.filter(
        (v) => v.indexOf("数据源") === -1
      );
      this.activeName1 = sheetList[0];
      sheetList.forEach((sheet) => {
        const worksheet = workbook.Sheets[sheet];
        if (worksheet) {
          const innerHTML = XLSX.utils.sheet_to_html(worksheet);
          this.excelSheet.push({
            name: sheet,
            innerHTML: innerHTML,
          });
        } else {
          this.excelSheet.push({
            name: sheet,
            innerHTML: "暂无数据",
          });
        }
      });
      this.DialogVisible = true;
    },
    showFlag(docx) {
      if (docx) {
        document.getElementById("docx").style.display = "block";
        document.getElementById("xlsx").style.display = "none";
      } else {
        document.getElementById("docx").style.display = "none";
        document.getElementById("xlsx").style.display = "block";
      }
    },
    createData() {
      if (this.multipleSelection1.length < 1) {
        this.$message.warning("请先勾选中要生成的报告信息表数据");
        return;
      }
      this.creteLoading = true;
      let arr = [];
      this.multipleSelection1.forEach((a) => {
        arr.push(a.saId);
      });
      this.axios({
        method: "post",
        url: "pass/baseManagement/v1/limscretprods/generate",
        data: arr,
        individualType: "json",
      })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            let fileRow = {};
            fileRow = res.data;
            // this.axios.get('pass/baseManagement/v1/file/download/'+ fileRow.fileName ,{responseType: 'blob'},{headers: {'content-type': 'application/x-www-form-urlencoded'}}).then(res => {
            //   let blob = new Blob([res]);
            //   let fileName = fileRow.fileName;
            //   let elink = document.createElement('a');
            //   elink.download = fileName;
            //   elink.style.display = 'none';
            //   elink.target = "_blank";
            //   elink.href = URL.createObjectURL(blob);
            //   document.body.appendChild(elink);
            //   elink.click();
            //   URL.revokeObjectURL(elink.href); // 释放URL对象
            //   document.body.removeChild(elink);
            // })
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading = false;
        })
        .catch((e) => {
          this.creteLoading = false;
          this.$message.error(e.message);
        });
    },
    aaaaa() {
      if (this.timeFile) {
        this.exportFlag = true;
      } else {
        this.exportFlag = false;
      }
    },
    exportFile() {
      if (this.multipleSelection5.length < 1) {
        this.$message.warning("请先勾选中要生成的报告信息表数据");
        return;
      }
      if (this.timeFile == "") {
        this.$message.warning("请先选择时间");
        return;
      }
      this.exportFileLoading = true;
      let str = [];
      this.multipleSelection5.forEach((s) => {
        str.push(s.ARCHIVE_ID);
      });
      let map = {
        list: str,
        mode: this.timeFile,
      };
      let result = JSON.stringify(map);
      this.axios
        .get(
          `pass/baseManagement/v1/limscretprods/newFile/` +
            encodeURIComponent(result, "UTF-8"),
          { responseType: "blob" },
          { headers: { "content-type": "application/x-www-form-urlencoded" } }
        )
        .then((res) => {
          if (res) {
            let blob = new Blob([res], {
              type: "application/octet-stream;charset=UTF-8",
            });
            let elink = document.createElement("a");
            elink.download = "BBWXCLJC-4-20-01.docx";
            elink.style.display = "none";
            elink.target = "_blank";
            elink.href = URL.createObjectURL(blob);
            document.body.appendChild(elink);
            elink.click();
            URL.revokeObjectURL(elink.href); // 释放URL对象
            document.body.removeChild(elink);
          } else {
            return this.$message.error("有问题！");
          }
          this.exportFileLoading = false;
        })
        .catch((e) => {
          this.exportFileLoading = false;
          return this.$message.error(e.message);
        });
    },
    printData() {
      if (this.multipleSelection3.length < 1) {
        this.$message.warning("请先勾选中要生成的报告信息表数据");
        return;
      }
      // this.creteLoading1 = true;
      // this.axios.get('pass/baseManagement/v1/file/download/' + this.multipleSelection3.SAVE_PATH,{responseType: 'blob'},{headers: {'content-type': 'application/x-www-form-urlencoded'}}).then(res => {
      //           let blob = new Blob([res],{type:'application/pdf'});
      //           var date = (new Date()).getTime()
      //           var ifr = document.createElement('iframe')
      //           ifr.style.frameborder = 'no'
      //           ifr.style.display = 'none'
      //           ifr.style.pageBreakBefore = 'always'
      //           ifr.setAttribute('id', 'printPdf' + date)
      //           ifr.setAttribute('name', 'printPdf' + date)
      //           ifr.src = window.URL.createObjectURL(blob)
      //           document.body.appendChild(ifr)
      //           this.doPrint('printPdf' + date)
      //           window.URL.revokeObjectURL(ifr.src) // 释放URL 对象
      //           this.creteLoading1 = false;

      //           // let elink = document.createElement('a');
      //           // elink.download = fileName;
      //           // elink.style.display = 'none';
      //           // elink.target = "_blank";
      //           // elink.href = URL.createObjectURL(blob);
      //           // document.body.appendChild(elink);
      //           // elink.click();
      //           // URL.revokeObjectURL(elink.href); // 释放URL对象
      //           // document.body.removeChild(elink);
      //       }).catch(e => {
      //           this.creteLoading1 = false;
      //           return this.$message.error(e.message)
      //       })
    },
    submitData() {
      if (this.multipleSelection3.length == 0) {
        this.$message.warning("请先勾选中要审核的报告信息表数据");
        return;
      }
      this.creteLoading1 = true;
      this.axios
        .post(
          "pass/baseManagement/v1/limscretprods/submitData",
          this.multipleSelection3,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success("操作成功！");
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading1 = false;
        })
        .catch((e) => {
          this.creteLoading1 = false;
          this.$message.error(e.message);
        });
    },
    approvalData() {
      if (this.multipleSelection6.length == 0) {
        this.$message.warning("请先勾选中要审核的报告信息表数据");
        return;
      }
      this.creteLoading1 = true;
      this.axios
        .post(
          "pass/baseManagement/v1/limscretprods/approvalList",
          this.multipleSelection6,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success("操作成功！");
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading1 = false;
        })
        .catch((e) => {
          this.creteLoading1 = false;
          this.$message.error(e.message);
        });
    },
    withdrawData() {
      if (this.multipleSelection3.length == 0) {
        this.$message.warning("请先勾选中要撤回的报告信息表数据");
        return;
      }
      this.creteLoading1 = true;
      this.axios
        .post(
          "pass/baseManagement/v1/limscretprods/withdrawList",
          this.multipleSelection3,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success("操作成功！");
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading1 = false;
        })
        .catch((e) => {
          this.creteLoading1 = false;
          this.$message.error(e.message);
        });
    },
    withdrawData2() {
      if (this.multipleSelection4.length == 0) {
        this.$message.warning("请先勾选中要撤回的报告信息表数据");
        return;
      }
      this.creteLoading1 = true;
      this.axios
        .post(
          "pass/baseManagement/v1/limscretprods/withdrawList",
          this.multipleSelection4,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success("操作成功！");
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading1 = false;
        })
        .catch((e) => {
          this.creteLoading1 = false;
          this.$message.error(e.message);
        });
    },
    examinationData() {
      if (this.multipleSelection4.length == 0) {
        this.$message.warning("请先勾选中要审批的报告信息表数据");
        return;
      }
      this.creteLoading1 = true;
      this.axios
        .post(
          "pass/baseManagement/v1/limscretprods/examinationList",
          this.multipleSelection4,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.$message.success("操作成功！");
            this.searchData();
          } else {
            this.$message.error(res.message);
          }
          this.creteLoading1 = false;
        })
        .catch((e) => {
          this.creteLoading1 = false;
          this.$message.error(e.message);
        });
    },
    doPrint(val) {
      var ordonnance = document.getElementById(val).contentWindow;
      setTimeout(() => {
        // window.print()
        ordonnance.print();
        this.creteLoading1 = false;
      }, 100);
    },
    searchData() {
      this.page.pageNum = 1;
      this.page.pageSize = 50;
      this.page1.pageNum = 1;
      this.page1.pageSize = 50;
      this.getDataList1();
      this.getDataList();
      this.getDataList6();
      this.getDataList4();
      this.getDataList5();
    },
    getDataList() {
      let starTime = "";
      let endTime = "";
      this.saveData = {};
      this.table.list2 = [];
      if (
        !this.search.declareTime ||
        (!this.search.declareTime[0] && !this.search.declareTime[1])
      ) {
        starTime = "";
        endTime = "";
      } else {
        starTime = this.search.declareTime[0] + " 00:00:00";
        endTime = this.search.declareTime[1] + " 23:59:59";
      }
      let obj = {
        object: {
          SAMPLE_TYPE_CODE: this.search.sampleTypeCode,
          MAT_NAME: this.search.matName,
          CAR_NO: this.search.carNo,
          SAMPLE_NO: this.search.sampleNo,
          cretTypeCode: 482001,
          ARCHIVE_FLAG: "1",
        },
        startTime: starTime,
        endTime: endTime,
        pageIndex: this.page.pageNum,
        pageSize: this.page.pageSize,
      };
      this.dataLoading = true;
      this.axios
        .post("pass/baseManagement/v1/limscretprods/querylimcretprod", obj, {
          individualType: "json",
        })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list = res.data.list;
            this.page.totalPage = res.data.total;
            // if (this.table.list.length > 0) {
            //   this.$refs.dataTable.setCurrentRow(this.table.list[0])
            //   this.clickRow(this.table.list[0])
            // }
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading = false;
        })
        .catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.message);
        });
    },
    getDataList6() {
      let starTime = "";
      let endTime = "";
      this.saveData = {};
      this.table.list2 = [];
      if (
        !this.search.declareTime ||
        (!this.search.declareTime[0] && !this.search.declareTime[1])
      ) {
        starTime = "";
        endTime = "";
      } else {
        starTime = this.search.declareTime[0] + " 00:00:00";
        endTime = this.search.declareTime[1] + " 23:59:59";
      }
      let obj = {
        object: {
          SAMPLE_TYPE_CODE: this.search.sampleTypeCode,
          MAT_NAME: this.search.matName,
          CAR_NO: this.search.carNo,
          SAMPLE_NO: this.search.sampleNo,
          cretTypeCode: 482001,
          ARCHIVE_FLAG: "4",
        },
        startTime: starTime,
        endTime: endTime,
        pageIndex: this.page6.pageNum,
        pageSize: this.page6.pageSize,
      };
      this.dataLoading = true;
      this.axios
        .post("pass/baseManagement/v1/limscretprods/querylimcretprod", obj, {
          individualType: "json",
        })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list6 = res.data.list;
            this.page6.totalPage = res.data.total;
            // if (this.table.list.length > 0) {
            //   this.$refs.dataTable.setCurrentRow(this.table.list[0])
            //   this.clickRow(this.table.list[0])
            // }
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading = false;
        })
        .catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.message);
        });
    },
    getDataList4() {
      let starTime = "";
      let endTime = "";
      this.saveData4 = {};
      this.table.list4 = [];
      if (
        !this.search.declareTime ||
        (!this.search.declareTime[0] && !this.search.declareTime[1])
      ) {
        starTime = "";
        endTime = "";
      } else {
        starTime = this.search.declareTime[0] + " 00:00:00";
        endTime = this.search.declareTime[1] + " 23:59:59";
      }
      let obj = {
        object: {
          SAMPLE_TYPE_CODE: this.search.sampleTypeCode,
          MAT_NAME: this.search.matName,
          CAR_NO: this.search.carNo,
          SAMPLE_NO: this.search.sampleNo,
          cretTypeCode: 482001,
          ARCHIVE_FLAG: "2",
        },
        startTime: starTime,
        endTime: endTime,
        pageIndex: this.page4.pageNum,
        pageSize: this.page4.pageSize,
      };
      this.dataLoading = true;
      this.axios
        .post("pass/baseManagement/v1/limscretprods/querylimcretprod", obj, {
          individualType: "json",
        })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list4 = res.data.list;
            this.page4.totalPage = res.data.total;
            // if (this.table.list.length > 0) {
            //   this.$refs.dataTable.setCurrentRow(this.table.list[0])
            //   this.clickRow(this.table.list[0])
            // }
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading = false;
        })
        .catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.message);
        });
    },
    getDataList5() {
      let starTime = "";
      let endTime = "";
      this.saveData5 = {};
      this.table.list5 = [];
      if (
        !this.search.declareTime ||
        (!this.search.declareTime[0] && !this.search.declareTime[1])
      ) {
        starTime = "";
        endTime = "";
      } else {
        starTime = this.search.declareTime[0] + " 00:00:00";
        endTime = this.search.declareTime[1] + " 23:59:59";
      }
      let obj = {
        object: {
          SAMPLE_TYPE_CODE: this.search.sampleTypeCode,
          MAT_NAME: this.search.matName,
          CAR_NO: this.search.carNo,
          SAMPLE_NO: this.search.sampleNo,
          cretTypeCode: 482001,
          ARCHIVE_FLAG: "3",
        },
        startTime: starTime,
        endTime: endTime,
        pageIndex: this.page5.pageNum,
        pageSize: this.page5.pageSize,
      };
      this.dataLoading = true;
      this.axios
        .post("pass/baseManagement/v1/limscretprods/querylimcretprod", obj, {
          individualType: "json",
        })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list5 = res.data.list;
            this.page5.totalPage = res.data.total;
            // if (this.table.list.length > 0) {
            //   this.$refs.dataTable.setCurrentRow(this.table.list[0])
            //   this.clickRow(this.table.list[0])
            // }
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading = false;
        })
        .catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.message);
        });
    },
    getDataList1() {
      let starTime = "";
      let endTime = "";
      this.saveData = {};
      this.table.list2 = [];
      if (
        !this.search.declareTime ||
        (!this.search.declareTime[0] && !this.search.declareTime[1])
      ) {
        starTime = "";
        endTime = "";
      } else {
        starTime = this.search.declareTime[0] + " 00:00:00";
        endTime = this.search.declareTime[1] + " 23:59:59";
      }
      let obj = {
        object: {
          sampleTypeCode: this.search.sampleTypeCode,
          matName: this.search.matName,
          sampleNo: this.search.sampleNo,
          validFlag: "1",
        },
        startTime: starTime,
        endTime: endTime,
        mode: this.search.carNo,
        pageIndex: this.page1.pageNum,
        pageSize: this.page1.pageSize,
      };
      this.dataLoading1 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limssamplereleases/queryLimsSampleReleasePageByAuditTime",
          obj,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list3 = res.data.list;
            this.page1.totalPage = res.data.total;
            if (this.table.list3.length > 0) {
              this.$refs.dataTable1.setCurrentRow(this.table.list3[0]);
              this.clickRow1(this.table.list3[0]);
            }
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading1 = false;
        })
        .catch((e) => {
          this.dataLoading1 = false;
          this.$message.error(e.message);
        });
    },
    //点击选中报告信息表数据
    clickRow(val) {
      this.saveData = val;
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.getDataList2(this.saveData.id);
    },
    clickRow4(val) {
      this.saveData4 = val;
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.getDataList2(this.saveData4.id);
    },
    clickRow5(val) {
      this.saveData5 = val;
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.getDataList2(this.saveData5.id);
    },
    clickRow6(val) {
      this.saveData6 = val;
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.getDataList2(this.saveData6.id);
    },
    getDataList2(objId) {
      let id = objId ? objId : "";
      let obj = {
        object: {
          ctId: id,
        },
        pageIndex: this.page2.pageNum,
        pageSize: this.page2.pageSize,
      };
      this.dataLoading2 = true;
      this.axios
        .post("pass/baseManagement/v1/limscretprodds/querylimsCprodd", obj, {
          individualType: "json",
        })
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list2 = res.data.list;
            this.page2.totalPage = res.data.total;
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading2 = false;
        })
        .catch((e) => {
          this.dataLoading2 = false;
          this.$message.error(e.message);
        });
    },
    clickRow1(val) {
      this.page2.pageNum = 1;
      this.page2.pageSize = 50;
      this.getDataList3(val.id);
    },
    getDataList3(objId) {
      this.dataLoading2 = true;
      this.axios
        .post(
          "pass/testManagement/v1/limssamplereleaseds/queryLimsSampleReleaseDList?saId=" +
            objId,
          { individualType: "json" }
        )
        .then((res) => {
          if (res.code == 0 || res.code == 200) {
            this.table.list2 = res.data;
          } else {
            this.$message.error(res.message);
          }
          this.dataLoading2 = false;
        })
        .catch((e) => {
          this.dataLoading2 = false;
          this.$message.error(e.message);
        });
    },
    reset() {
      this.search.matName = "";
      this.search.sampleTypeCode = "";
      this.search.declareTime = [
        this.getYNM(new Date()),
        this.getYNM(new Date()),
      ];
      this.searchData();
    },
    handleSelectionChange(val) {
      this.multipleSelection3 = val;
    },
    handleSelectionChange1(val) {
      this.multipleSelection1 = val;
    },
    handleSelectionChange4(val) {
      this.multipleSelection4 = val;
    },
    handleSelectionChange5(val) {
      this.multipleSelection5 = val;
    },
    handleSelectionChange6(val) {
      this.multipleSelection6 = val;
    },
    pageSizeChange(size) {
      this.page.pageSize = size;
      this.getDataList();
    },
    pageCurrentChange(index) {
      this.page.pageNum = index;
      this.getDataList();
    },
    pageSizeChange1(size) {
      this.page1.pageSize = size;
      this.getDataList1();
    },
    pageCurrentChange1(index) {
      this.page1.pageNum = index;
      this.getDataList1();
    },
    pageSizeChange2(size) {
      this.page2.pageSize = size;
      this.getDataList2(this.saveData.objId);
    },
    pageCurrentChange2(index) {
      this.page2.pageNum = index;
      this.getDataList2(this.saveData.objId);
    },
    pageSizeChange4(size) {
      this.page4.pageSize = size;
      this.getDataList4(this.saveData4.objId);
    },
    pageCurrentChange4(index) {
      this.page4.pageNum = index;
      this.getDataList4(this.saveData4.objId);
    },
    pageSizeChange5(size) {
      this.page5.pageSize = size;
      this.getDataList5(this.saveData5.objId);
    },
    pageCurrentChange5(index) {
      this.page5.pageNum = index;
      this.getDataList5(this.saveData5.objId);
    },
    pageSizeChange6(size) {
      this.page6.pageSize = size;
      this.getDataList6(this.saveData6.objId);
    },
    pageCurrentChange6(index) {
      this.page6.pageNum = index;
      this.getDataList6(this.saveData6.objId);
    },
    addScreen() {
      this.$nextTick(() => {
        let ss = document.createElement("div");
        ss.innerHTML = "筛选";
        ss.style = "text-align: center;";
        this.$refs.dataTable.$el
          .getElementsByClassName("el-table__fixed")[0]
          .getElementsByTagName("td")[0]
          .appendChild(ss);
      });
    },
    addScreen2() {
      this.$nextTick(() => {
        let ss = document.createElement("div");
        ss.innerHTML = "筛选";
        ss.style = "text-align: center;";
        this.$refs.dataTable2.$el
          .getElementsByClassName("el-table__fixed")[0]
          .getElementsByTagName("td")[0]
          .appendChild(ss);
      });
    },
    tableRowClassName({ row, column, rowIndex, columnIndex }) {
      // if (columnIndex === 8) {
      // if (row.validFlag !== '1') {
      //   return 'error-row';
      // }
      // return '';
      // }
    },
    tableHeaderCellStyle() {
      return "color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;";
    },
  },
};
</script>
<style scoped></style>
