<!-- 过滤加权页面 -->
<template>
  <div class="examination"> 
    <div class="common-head-search">
      <el-form  :inline="true" @submit.native.prevent ref="searchForm" :model="searchForm" class="demo-form-inline sui-search-form">
        <el-form-item label="样品名称">
          <el-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="daterange"
           range-separator="至"
           start-placeholder="开始日期"
           end-placeholder="结束日期"
           size="small"
           style="width:300px"
           format="yyyy-MM-dd"
           value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" type="goon" size="mini" @click="searchData">查询</el-button>
          <el-button icon="el-icon-refresh" type="info" plain size="mini" @click="resetData">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-row>
      <el-col :span="9">
        <el-tabs type="border-card" v-model="activeName" @tab-click="tabClick">
          <el-tab-pane label="待接任务" name="first">
            <span slot="label">待接任务<el-badge :max="10" :hidden='total_main == 0' style="margin-top:-18px" :value="total_main"></el-badge></span>
            <div class="common-title-div" style="height:auto">
              <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" :loading='sampleLoading' v-privilege="activeMenu + 'recSample'" @click="recSample" size="mini">接样</el-button>
              </div>
            </div>
            <div class="common-table-div">
              <el-table
                ref="table1"
                :height="theight1"
                v-loading="tableLoading1"
                :data="tableData1"
                :summary-method="getSummaries2"
                show-summary
                border
                @selection-change="searchFollow"
                :header-cell-style="tableHeaderCellStyle"
                highlight-current-row
                :icorePanelShown="100"
                :icore-filter-flag="icoreFilterFlag"
                :exchangeFilterMap="{'lock_flag':{'0':'未锁定','1':'已锁定'}}"
                style="width: 100%;"
              >
                <el-table-column type="index" label="NO" align="center"></el-table-column>
                <el-table-column type="selection" width="55" align="center"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align='center' prop="matName" label="物料名称" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="testItemName" label="任务名称" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="120" align='center' prop="sampleNo" label="样品号" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="sampleTypeName" label="样品类型" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="functionName" label="任务类型" ></el-table-column>
              </el-table>
            </div>
            <div class="common-foot-style">
              <el-pagination
                @size-change="handleSizeChangeMain"
                @current-change="handleCurrentChangeMain"
                :current-page="pageIndex"
                :page-sizes="[10, 20, 30, 40, 100 , 200]"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total_main"
                background
              ></el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane label="已接任务" name="second">
            <div class="common-title-div" style="height:auto">
              <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" :loading='submitLoading' @click="subData" v-privilege="activeMenu + 'submit'" size="mini">提交</el-button>
              </div>
            </div>
            <div class="common-table-div">
               <el-table v-loading="tableLoading2" ref="table2" :cell-class-name="tableRowClassName" 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" align="center"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="id" label="编号"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="matName" label="物料名称"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="sampleTypeName" label="样品类型" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align="center" prop="stateFlagName" label="状态"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="testItemName" label="任务名称" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="120" align='center' prop="sampleNo" label="样品号" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testItemName" label="任务名称"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="stdName" label="方法" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="eqpName" label="仪器类型" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testPostName" label="分析岗位" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testDirection" label="测试部门" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="memo" label="备注" ></el-table-column>
              </el-table>
              <div class="common-foot-style">
                <el-pagination
                  @size-change="handleSizeChangeDep"
                  @current-change="handleCurrentChangeDep"
                  :current-page="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="thirdly">
            <div class="common-title-div" style="height:auto">
              <div class="common-title-name">
                <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" :cell-class-name="tableRowClassName" border @row-click="searchSubData" :height="theight2" highlight-current-row  :data="subList" :icore-filter-flag="icoreFilterFlag"
               :header-cell-style="tableHeaderCellStyle" :summary-method="getSummaries2" show-summary>
                <el-table-column type="index" label="NO" align="center"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="id" label="编号"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="matName" label="物料名称"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="sampleTypeName" label="样品类型" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align="center" prop="stateFlagName" label="状态"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="80" align='center' prop="testItemName" label="任务名称" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="120" align='center' prop="sampleNo" label="样品号" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testItemName" label="任务名称"></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="stdName" label="方法" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="eqpName" label="仪器类型" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testPostName" label="分析岗位" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testDirection" label="测试部门" ></el-table-column>
                <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="memo" label="备注" ></el-table-column>
              </el-table>
              <div class="common-foot-style">
                <el-pagination
                  @size-change="subSizeChangeDep"
                  @current-change="subCurrentChangeDep"
                  :current-page="subPageIndex"
                  :page-sizes="[10, 20, 30, 40, 100 , 200]"
                  :page-size="subPageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="subTotal"
                  background
                ></el-pagination>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <el-col :span="15">
        <div class="common-title-div" style="margin-top:40px;height:auto">
          <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='formulacomLoading' @click="formulacom" type="goon" v-privilege="activeMenu + 'formulacom'" size="mini">计算</el-button>
            <el-button icon="el-icon-check" :loading='saveLoading' @click="saveData" type="goon" v-privilege="activeMenu + 'save'" size="mini">保存</el-button>
          </div>
          <div>
          </div>
        </div>
        <div class="common-table-div">
           <el-table v-loading="tableLoading3"  border :height="theight3" highlight-current-row  :data="tableData3" :icore-filter-flag="icoreFilterFlag"
           :header-cell-style="tableHeaderCellStyle" @row-click="selectAnalyze" @row-dblclick='showCell' :row-class-name="tableRowName" :summary-method="getSummaries2" show-summary>
            <el-table-column type="index" label="NO" align="center"></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="testItemName" label="任务名称" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="anlyItemName" label="分析项目" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="anlyValue" label="报出值" >
              <template slot-scope="{row}">
                <el-input :disabled='analyzeVal.stateFlag != 0' type='number' :min="0" :controls="false" oninput ="value=value.replace(/[^0-9.]/g,'')" v-if="row.index === tabClickIndex" @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="true" sortable min-width="100" align="center" prop="dasValue" label="采集值" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="cptValue" label="计算值" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="reviseValue" label="修约值" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="unitName" label="单位"></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="formulaName" label="计算公式" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="reviseRuleName" label="修约规则" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="isReportName" label="是否报出" ></el-table-column>
            <el-table-column :show-overflow-tooltip="true" sortable min-width="100" align="center" prop="isAlarmName" label="是否报警" ></el-table-column>
          </el-table>
        </div>
      </el-col>  
    </el-row>
  </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 {
      searchForm: {
        times: '',
        matName: '',
        sampleTypeCode:'',
        eqpNo:''
      },
      checked:true,
      saveValue:'',
      saveMainData:[],
      sampleLoading:false,
      saveLoading:false,
      submitLoading:false,
      sampleTypeNameType: [],
      analyzeVal:{},
      analyzeValues:{},
      dialogTableVisible:false,
      formulacomLoading:false,
      theight1: 0,
      theight2: 0,
      theight3: 0,
      tableLoading1:false,
      tableLoading2:false,
      tableLoading3:false,
      tableLoading4:false,
      tabClickIndex:null,
      func:'',
      subPageIndex:1,
      subPageSize:50,
      subList:[],
      subTotal:0,
      subSaveData:{},
      originalData:[],
      tableData1:[],
      tableData2:[],
      tableData3:[],
      tableData4:[],
      pageIndex: 1,
      pageSize:100,
      total_main:0,
      pageIndex_dep: 1,
      pageSize_dep:100,
      total_dep:0,
      icoreFilterFlag: true,
      activeName:'first',
      activeMenu:''
    }
  },
  created() {
    this.theight2 = window.innerHeight - 230
    this.theight3 = window.innerHeight - 185 < 249 ? 249 : window.innerHeight - 185
    this.theight1 = window.innerHeight - 230
    this.searchForm.times = [this.getYNM(new Date()), this.getYNM(new Date())]
    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.searchData()
  },
  methods: {
    getYNM(date) {
      let year = date.getFullYear().toString();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      month = month < 10 ? "0" + month : month;
      day = day < 10 ? "0" + day : day;
      return `${year}-${month}-${day}`;
    },
    getSummaries2(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "总计";
        }
        if (index === 1) {
          sums[index] = data.length;
        } else if (column.property === "quantity") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].quantity ? data[i].quantity : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        } else if (column.property === "factweight") {
          let val = 0;
          for (let i in data) {
            val = this.floatComputed(
              data[i].factweight ? data[i].factweight : 0,
              val,
              "+"
            );
          }
          sums[index] = val;
        }
      });
      return sums;
    },
    resetData(){
      this.searchForm.matName = ''
      this.searchForm.sampleTypeCode = ''
      this.searchForm.eqpNo = ''
      this.searchForm.times = [this.getYNM(new Date()), this.getYNM(new Date())]
      this.searchData()
    },
    //点击选中样品信息数据
    searchFollow(val){
      this.saveMainData = val
    },
    //接样
    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)
      })
    },
    //提交
    subData(){
      if (JSON.stringify(this.analyzeVal)==="{}") {
        this.$message.warning("请先点击选中一条测试项目数据");
        return;
      }
      if (this.analyzeVal.stateFlag == 3) {
        this.$message.warning("已提交的数据不能进行提交操作,请选择状态为未处理的数据进行操作");
        return;
      }
      this.submitLoading = true
      this.saveLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/updateLimsSampleTestDList',this.tableData3,{individualType: 'json'}).then(res =>{
        if (res.code == 0 || res.code == 200) {
          this.axios.post('pass/testManagement/v1/limssampletests/submit?stId=' + this.analyzeVal.stId,{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.submitLoading = false
          }).catch(err =>{
            this.submitLoading = false
            this.$message.error(err.message)
          })
        }else{
          this.submitLoading = false
          this.$message.error(res.message)
        }
        this.saveLoading = false
      }).catch(err =>{
        this.saveLoading = false
        this.submitLoading = false
        this.$message.error(err.message)
      })
    },
    //计算
    formulacom(){ 
      if (this.tableData3.length < 1) {
        this.$message.warning("表格中无数据，无法进行计算");
        return;
      }
      if (this.subSaveData.stateFlag == 3) {
        this.$message.warning("已提交的数据不能进行计算,请选择状态为未处理的数据进行操作");
        return;
      }
      this.formulacomLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/formulacom',this.tableData3,{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.formulacomLoading = false
      }).catch(err =>{
        this.formulacomLoading = false
        this.$message.error(err.message)
      })
    },
    tabClick(tab, event){
      this.tableData3 = []
    },
    //保存
    saveData(){
      if (this.tableData3.length < 1) {
        this.$message.warning("表格中无数据，无法进行保存");
        return;
      }
      if (this.subSaveData.stateFlag == 3) {
        this.$message.warning("已提交的数据不能进行保存,请选择状态为未处理的数据进行操作");
        return;
      }
      this.saveLoading = true
      this.axios.post('pass/testManagement/v1/limssampletestds/updateLimsSampleTestDList',this.tableData3,{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.saveLoading = false
      }).catch(err =>{
        this.saveLoading = false
        this.$message.error(err.message)
      })
    },
    showCell(row){
      this.tabClickIndex = row.index
    },
    saveCell(row){
      this.tabClickIndex = null
    },
    tableRowName({row, rowIndex}){
      row.index = rowIndex
    },
    //查询操作
    searchData (){
      this.pageIndex = 1
      this.pageSize = 100
      this.subPageIndex = 1
      this.subPageSize = 100
      this.pageSize_dep = 100
      this.pageIndex_dep = 1
      this.subDataDep()
      this.DataMain()
      this.DataDep()
    },
    //查询样品信息表格
    DataMain () {
      // this.saveMainData = {} 
      let startTime = ''
      let endTime = ''
      if (!this.searchForm.times) {
        startTime = null
        endTime = null
      }else{
        startTime = this.searchForm.times[0] + ' 00:00:00'
        endTime = this.searchForm.times[1] + ' 23:59:59'
      }
      let obj = {
        'object':{
          'matName': this.searchForm.matName,
          'sampleTypeCode': this.searchForm.sampleTypeCode,
          'functionCode':'484005',
          'isCtrl':1,
          'stateFlag':1,
          'optNo':userId
        },
        "pageSize": this.pageSize,
        "pageIndex": this.pageIndex,
        'startTime': startTime,
        'endTime':  endTime 
      }
      this.tableLoading1 = true;
      this.axios.post('pass/testManagement/v1/limstasktests/queryLimsTaskTestPage',obj,{individualType: 'json'}).then(res =>{
        if (res.code == 0 || res.code == 200) {
          this.tableData1 = res.data.list
          this.total_main = res.data.total
        }else{
          this.$message.error(res.message)
        }
        this.tableLoading1 = false;
      }).catch(err =>{
        this.tableLoading1 = false;
        this.$message.error(err.message)
      })
    },
    //查询测试项目表格
    DataDep () { 
      this.tableData3 = []
      let startTime = ''
      let endTime = ''
      if (!this.searchForm.times) {
        startTime = ''
        endTime = ''
      }else{
        startTime = this.searchForm.times[0] + ' 00:00:00'
        endTime = this.searchForm.times[1] + ' 23:59:59'
      }
      let obj = {
        'object':{
          'matName': this.searchForm.matName,
          'sampleTypeCode': this.searchForm.sampleTypeCode,
          'isCtrl':1,
          'createNo':userId
        },
        'list':[0],
        'list2':[484005],
        "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' ? '已提交' : ''
          })
          
          // 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)
      })
    },
    subDataDep () { 
      this.tableData3 = []
      let startTime = ''
      let endTime = ''
      if (!this.searchForm.times) {
        startTime = ''
        endTime = ''
      }else{
        startTime = this.searchForm.times[0] + ' 00:00:00'
        endTime = this.searchForm.times[1] + ' 23:59:59'
      }
      let obj = {
        'object':{
          'matName': this.searchForm.matName,
          'sampleTypeCode': this.searchForm.sampleTypeCode,
          'isCtrl':1,
          'createNo':userId
        },
        'list':[3],
        'list2':[484005],
        "pageSize": this.subPageSize,
        "pageIndex": this.subPageIndex,
        '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.subList = res.data.list
          this.subTotal = res.data.total
          this.subList.forEach(item =>{
            item.stateFlagName = item.stateFlag == '0' ? '未处理' : item.stateFlag == '3' ? '已提交' : ''
          })
          
          // 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)
      })
    },
    //点击测试项目，查询分析项目
    searchAnalyze(row){
      //保存点击的样品信息数据，保存、提交操作时刷新
      this.analyzeVal = row
      this.subSaveData = {}
      this.depData(this.analyzeVal.id)
    },
    searchSubData(row){
      this.subSaveData = row
      this.analyzeVal = {}
      this.depData(this.subSaveData.id)
    },
    depData(id){
      this.tableLoading3 = true;
      this.axios.post('pass/testManagement/v1/limssampletestds/queryLimsSampleTestDList?stId='+id).then(res =>{
        if (res.code == 0 || res.code == 200) {
          this.tableData3 = res.data
          this.tableData3.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 ? '是' : ''
          })
        }else{
          this.$message.error(res.message)
        }
        this.tableLoading3 = false;
      }).catch(err =>{
        this.tableLoading3 = false;
        this.$message.error(err.message)
      })
    },
    //点击选中分析项目的值
    selectAnalyze(val){
      this.analyzeValues = val
      this.saveValue = this.analyzeValues.reviseValue
    },
    handleSizeChangeMain(pageSize) {
      this.pageIndex = 1;
      this.pageSize = pageSize;
      this.DataMain();
    },
    handleCurrentChangeMain(pageIndex) {
      this.pageIndex = pageIndex;
      this.DataMain();
    },
    handleSizeChangeDep(pageSize) {
      this.pageIndex_dep = 1;
      this.pageSize_dep = pageSize;
      this.DataDep();
    },
    handleCurrentChangeDep() {
      this.pageIndex_dep = pageIndex;
      this.DataDep();
    },
    subSizeChangeDep(pageSize) {
      this.subPageIndex = 1;
      this.subPageSize = pageSize;
      this.subDataDep();
    },
    subCurrentChangeDep(pageIndex) {
      this.subPageIndex = pageIndex;
      this.subDataDep();
    },
    tableRowClassName ({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 4) {
      if (row.stateFlag === '3') {
        return 'error-green';
      }
      return '';
      }
    },
    tableHeaderCellStyle () {
      return 'background-color: rgb(249,249,249) !important;color: rgb(73, 72, 72);border-bottom: 1px solid #DCDFE7;border-top:3px solid #3ac1ea;'
    }
  }
}
</script>
<style  scoped>
</style>
