<!-- 标准管理-样品模板维护 -->
<template>
  <div class="examination">
    <div class="common-head-search">
      <el-form :inline="true">
        <el-form-item label='模板类型'>
          <el-select v-model="search.tmpTypeCode" clearable filterable collapse-tags size="small" style="width:200px;margin-right: 10px;" placeholder="请选择查询内容">
            <el-option v-for="item in tmpTypeNameType" :key="item.baseCode" :label="item.baseName"
              :value="item.baseCode">
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label='样品类型'>
          <el-select v-model="search.sampleTypeCode" clearable filterable collapse-tags size="small" style="width:200px;margin-right: 10px;" placeholder="请选择查询内容">
            <el-option v-for="item in sampleTypeNameType" :key="item.baseCode" :label="item.baseName"
              :value="item.baseCode">
            </el-option>
          </el-select>
        </el-form-item> -->
          <el-form-item label='检验车间'>
          <el-select v-model="workshop.deptNo" clearable filterable collapse-tags size="small" style="width:200px;margin-right: 10px;" placeholder="请选择查询内容">
            <el-option v-for="item in workshoplist" :key="item.deptNo" :label="item.deptName"
              :value="item.deptNo">
            </el-option>
          </el-select>
        </el-form-item>
          <el-form-item label='检验班组'>
          <el-select v-model="team.sectionNo" clearable filterable collapse-tags size="small" style="width:200px;margin-right: 10px;" placeholder="请选择查询内容">
            <el-option v-for="item in teamlist" :key="item.sectionNo" :label="item.sectionName"
              :value="item.sectionNo">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label='物料名称'>
          <el-input v-model.trim="search.matName" clearable @keyup.enter.native="searchData1" size="small" placeholder="请输入查询内容" style="width: 200px;margin-right: 10px;"></el-input>
        </el-form-item>
        <el-form-item label='模板名称'>
          <el-input v-model.trim="search.tmpName" clearable @keyup.enter.native="searchData1" size="small" placeholder="请输入查询内容" style="width: 200px"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" type="goon" size="mini" @click="searchData1">查询</el-button>
          <el-button icon="el-icon-refresh" type="info" plain size="mini" @click="reset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="common-title-div">
      <div class="common-title-name">
        <img style="width: 25px; height: 25px" src='../../../../assets/img/imgScreen/logo.png' />
        样品模板
      </div>
      <div>
      <el-button icon="el-icon-circle-plus-outline" type="goon" size="mini" @click="addData">新增</el-button>
      <el-button icon="el-icon-edit" type="goon" size="mini" @click="modifyData">修改</el-button>
      <el-button icon="el-icon-remove-outline" type="danger" size="mini" @click="deleteData">停用</el-button>
      <el-button icon="el-icon-check" type="goon" size="mini" @click="recoverData">启用</el-button>
      </div>
    </div>
    <div class="common-table-div" style="margin-bottom:0">
       <el-table v-loading="dataLoading" ref="dataTable" border :height="heightTop" highlight-current-row @selection-change="handleSelectionChange"
       @current-change="handleCurrentChange" :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="tmpNo" label="模板编号" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="tmpName" label="模板名称" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="120px" prop="tmpTypeName" label="模板类型" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="sampleTypeName" label="样品类型" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="cretName" label="证书" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="90px" prop="companyName" label="检验单位" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="90px" prop="deptName" label="检验车间" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="90px" prop="sectionName" 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-column sortable :show-overflow-tooltip="true" min-width="90px" prop="validFlag1" label="数据状态" align="center"></el-table-column>
        <!-- <el-table-column sortable width="" prop="memo" label="备注" align="center"></el-table-column> -->
        <el-table-column sortable :show-overflow-tooltip="true" min-width="95px" prop="createMan" label="创建人" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="160px" prop="createTime" label="创建时间" align="center"></el-table-column>
      </el-table>
    </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>
    <div class="common-title-div" style="margin-bottom:0">
      <div class="common-title-name">
        <img style="width: 25px; height: 25px" src='../../../../assets/img/imgScreen/logo.png' />
        测试计划
      </div>
      <div>
      <el-button icon="el-icon-circle-plus-outline" type="goon" size="mini" @click="addData2">新增</el-button>
      <el-button icon="el-icon-edit" type="goon" size="mini" @click="modifyData2">修改</el-button>
      <el-button icon="el-icon-circle-plus-outline" type="goon" size="mini" @click="copyData2">复制</el-button>
      <el-button icon="el-icon-remove-outline" type="danger" size="mini" @click="deleteData2">停用</el-button>
      <el-button icon="el-icon-check" type="goon" size="mini" @click="recoverData2">启用</el-button>
      <el-button icon="el-icon-remove-outline" type="danger" size="mini" @click="deleteList">删除</el-button>
      </div>
    </div>
    <div class="common-table-div">
       <el-table v-loading="dataLoading2" ref="dataTable2" border :height="heightBot" highlight-current-row @selection-change="handleSelectionChange2" :data="table.list2" :icore-filter-flag="icoreFilterFlag"
       :header-cell-style="tableHeaderCellStyle" :row-class-name="tableRowClassName2" :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="90px"  prop="validFlag1" label="数据状态" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="testPlanNo" label="计划编号" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="testPlanName" label="计划名称" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="100px" prop="matName" label="物料名称" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="90px" prop="smpDeliName" label="取样频次" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="planCompanyName" label="计划单位" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="planDeptName" label="计划车间" align="center"></el-table-column>
          <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" label="任务集" align="center">
          <template slot-scope="scope">
          <keep-alive>
          <router-link style="color:blue" tag='a' :to="{path:'/testTaskMaintenance',query:{testPlanNo: scope.row.testPlanNo, searchData: search, tmpNo: tmpNo, pageList: page}}" >跳转到任务集页面</router-link>
          </keep-alive>
          </template>
        </el-table-column>
        <el-table-column sortable width="140px" label="指标集" align="center">
           <template slot-scope="scope">
          <keep-alive>
          <router-link style="color:blue" tag='a' :to="{path:'/testIndexMaintenance',query:{testPlanNo: scope.row.testPlanNo, searchData: search, tmpNo: tmpNo, pageList: page}}" >跳转到指标集页面</router-link>
          </keep-alive>
          </template>
        </el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="smpCompanyName" label="取样单位" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="smpDeptName" label="取样车间" align="center"></el-table-column>
        <!-- <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="sectionName" label="班组名称" align="center"></el-table-column> -->
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="pointName" label="采样点" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="testLimit" label="分析时限（小时）" align="center"></el-table-column>
        <el-table-column sortable :show-overflow-tooltip="true" min-width="140px" prop="memo" label="备注" align="center"></el-table-column>
      </el-table>
    </div>
    <el-dialog @close="closeDialog" :close-on-click-modal='false' :show-close='false' :visible.sync="dialogTableVisible">
        <div slot="title" class="titleBox" style="display: flex;">
        <i :class="tableType === 0? 'el-icon-document':'el-icon-edit-outline'" style="font-size: 20px"></i>
        <!-- <img style="width: 25px; height: 25px" src='../../../../assets/img/imgScreen/more.png' /> -->
        <span style="margin-left:10px;font-size:18px">{{tableTypeDsc}}</span>
        </div>
        <el-form :model="formData" label-width="110px" :rules="monitorRules" ref="monitorForm" >
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="tmpNo" label="模板编号">
                <el-input v-model="formData.tmpNo" style="width:100%" size="small" readonly disabled ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item prop="tmpName" label="模板名称">
                <el-input v-model="formData.tmpName" style="width:100%" size="small" readonly disabled ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="testPlanName" label="计划名称">
                <el-input v-model="formData.testPlanName" style="width:100%" size="small" ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item prop="testLimit" label="分析时限（h）">
                <el-input v-model="formData.testLimit" style="width:100%" size="small" ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="planCompanyNo" label="计划单位">
                <el-select v-model="formData.planCompanyNo"  filterable style="width:100%" collapse-tags @change="selectDepartment" size="small">
                  <el-option v-for="item in companyNameType" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item prop="smpCompanyNo" label="取样单位">
                <el-select v-model="formData.smpCompanyNo"  filterable style="width:100%" collapse-tags @change="selectDepartment2" size="small">
                  <el-option v-for="item in companyNameType2" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="planDeptNo" label="计划车间">
                <el-select v-model="formData.planDeptNo" clearable filterable style="width:100%" @change="smpSection" collapse-tags size="small" >
                  <el-option v-for="item in sectionNameType" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item prop="smpDeptNo" label="取样车间">
                <el-select v-model="formData.smpDeptNo" clearable filterable style="width:100%" @change="selectClass2" collapse-tags size="small" >
                  <el-option v-for="item in sectionNameType2" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="matClassNo" label="物料类型">
               <el-select v-model="formData.matClassNo" @change="selctMatName" style="width:100%" filterable collapse-tags size="small" >
                  <el-option v-for="(item,index) in matClassNameType" :key="index" :label="item.matClassName"
                    :value="item.matClassNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item  prop="smpSectionNo" label="取样班组">
                <el-select v-model="formData.smpSectionNo" clearable style="width:100%" @change="smpSection" collapse-tags size="small">
                  <el-option v-for="item in sectionClass2" :key="item.orgCode" :label="item.orgName" :value="item.orgCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
               <el-form-item prop="matNo" label="物料名称">
               <el-select v-model="formData.matNo" clearable  style="width:100%" filterable collapse-tags size="small" >
                  <el-option v-for="(item,index) in matNameType" :key="index" :label="item.matName"
                    :value="item.matNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item prop="pointNameTypeIndex" label="取样地点">
               <el-select v-model="formData.pointNo" style="width:100%" clearable filterable collapse-tags size="small" >
                  <el-option v-for="(item,index) in pointNameType" :key="index" :label="item.pointName"
                    :value="item.pointNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
               <el-form-item prop="sampleTypeCode" label="样品类型"> 
                <el-select v-model="formData.sampleTypeCode" style="width:100%" filterable collapse-tags size="small">
                  <el-option v-for="item in sampleTypeNameType" :key="item.baseCode" :label="item.baseName" :value="item.baseCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
               <el-form-item prop="smpDeliCode" label="取样频次">
                <el-select v-model="formData.smpDeliCode" style="width:100%" filterable collapse-tags size="small">
                  <el-option v-for="item in smpDeliType" :key="item.baseCode" :label="item.baseName" :value="item.baseCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='24'>
              <el-form-item prop="memo" label="备注">
                <el-input v-model="formData.memo" size="small" style="width: 100%"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      <span slot="footer" class="dialog-footer" v-if="tableType === 0">
        <el-button type="goon" size="mini" icon="el-icon-check" @click="addPlan()">下一步</el-button>
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button>
      </span>
       <span slot="footer" class="dialog-footer" v-if="tableType === 1">
        <el-button type="goon" size="mini" icon="el-icon-check" @click="modifyPlan()">确定</el-button>
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button>
      </span>
    </el-dialog>
    <el-dialog @close="closeDialog" :close-on-click-modal='false' :show-close='false' :visible.sync="dialogTableVisible2">
        <div slot="title" class="titleBox">
        <i :class="tableType2 === 0? 'el-icon-document':'el-icon-edit-outline'" style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px">{{tableTypeDsc2}}</span>
        </div>
        <el-form :model="formData2" label-width="90px" :rules="monitorRules2" ref="monitorForm2" >
          <el-row>
            <el-col>
              <el-form-item prop="testPlanName" label="测试方案名称">
                <el-input v-model="formData2.testPlanName" readonly disabled size="small" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item prop="taskName" label="测试任务名称">
                <el-input v-model="formData2.taskName" size="small" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item prop="testTypeCode" label="检验类型">
               <el-select v-model="formData2.testTypeCode" filterable collapse-tags size="small" style="width: 100%;">
                  <el-option v-for="(item,index) in testTypeNameType" :key="index" :label="item.baseName"
                    :value="item.baseCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item prop="memo" label="备注">
               <el-input v-model="formData2.memo" size="small" style="width: 100%;" placeholder="请输入"></el-input>
               </el-form-item>
            </el-col>
          </el-row>
        </el-form>
       <span slot="footer" class="dialog-footer">
        <el-button type="goon" size="mini" icon="el-icon-check" @click="dialogTableVisible = true;dialogTableVisible2 = false">上一步</el-button>
        <el-button type="goon" size="mini" icon="el-icon-check" @click="addDataTest()">下一步</el-button>
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button>
        <!-- <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button> -->
       </span>
    </el-dialog>
    <el-dialog @close="closeDialog" :close-on-click-modal='false' :show-close='false' width='80%' :visible.sync="dialogTableVisible3" customClass="boxWidth33">
        <div slot="title" class="titleBox">
        <i class='el-icon-document' style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px">{{tableTypeDsc3}}</span>
        </div>
        <el-row>
          <el-col :span='10'>
            <div>
                <div class="common-title-name">
                     <img style="width: 25px; height: 25px; margin-left: 20px" src='../../../../assets/img/imgScreen/logo.png' />
                     测试任务
                     <span style="font-size: 16px; margin-left: 30px">{{testNumber}}/{{pageTest.totalPage}}</span>
                     <el-input v-model="testItemName" size="small" placeholder="请输入查询内容" @keyup.enter.native="getDataLists()" style="width: 150px"></el-input>
                </div>
                <div class="common-table-div">
                     <el-table v-loading="dataLoading" ref="dataTable" border :height="300" highlight-current-row @selection-change="handleSelectionTest" :data="table.listTest"
                     :header-cell-style="tableHeaderCellStyle" :icore-filter-flag="icoreFilterFlag">
                      <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
                      <el-table-column type="selection" width="45" align="center"></el-table-column>
                      <el-table-column min-width="120px" sortable prop="testItemName" label="测试名称" align="center"></el-table-column>
                      <el-table-column min-width="120px" sortable prop="itemTypeName" label="项目类型" align="center"></el-table-column>
                     </el-table>
                </div>
                <div style="margin-top: 20px; margin-left: 10px">
                    <el-pagination  @size-change="pageSizeTest" @current-change="pageCurrentTest"
                      :current-page="pageTest.pageNum" :page-sizes="[10, 20, 50, 100, 200]" :page-size="pageTest.pageSize" layout="total, sizes, prev, pager, next"
                      :total="pageTest.totalPage" background>
                    </el-pagination>
                </div>
            </div>
          </el-col>
          <el-col :span='4'>
            <div style="margin-top: 70px;margin-left: 20px">
              <el-button type="goon" size="mini" icon="el-icon-arrow-right" @click="rightData">右移</el-button>
              <el-button type="goon" size="mini" icon="el-icon-arrow-left" @click="leftData" style="margin-top: 20px">删除</el-button>
              <el-button type="goon" size="mini" icon="el-icon-arrow-up" @click="upData" style="margin-top: 20px">上移</el-button>
              <el-button type="goon" size="mini" icon="el-icon-arrow-down" @click="downData" style="margin-top: 20px">下移</el-button>
            </div>
          </el-col>
          <el-col :span='10'>
            <div>
                <div class="common-title-name">
                     <img style="width: 25px; height: 25px; margin-left: 20px" src='../../../../assets/img/imgScreen/logo.png' />
                     选择任务
                     <span style="font-size: 16px; margin-left: 70px">{{selectNumber}}/{{table.list3.length}}</span>
                </div>
                <div class="common-table-div">
                     <el-table v-loading="dataLoading2" ref="dataTable2" border :height="300" highlight-current-row @selection-change="handleSelectionTest2" :data="table.list3"
                     :header-cell-style="tableHeaderCellStyle">
                      <el-table-column type="index" label="NO" fixed="left" align="center"></el-table-column>
                      <el-table-column type="selection" width="45" align="center"></el-table-column>
                      <el-table-column min-width="120px"  prop="testItemName" label="测试名称" align="center"></el-table-column>
                      <el-table-column min-width="120px"  prop="itemTypeName" label="项目类型" align="center"></el-table-column>
                     </el-table>
                </div>
            </div>
          </el-col>
        </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="goon" size="mini" icon="el-icon-check" @click="dialogTableVisible2 = true;dialogTableVisible3 = false">上一步</el-button>
        <el-button type="goon" size="mini" icon="el-icon-check" @click="addDataCase()">下一步</el-button>
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button>
      </span>
    </el-dialog>
    <el-dialog @close="closeDialog" :close-on-click-modal='false' :show-close='false' :visible.sync="dialogTableVisible4" customClass="customWidth_standas">
        <div slot="title" class="titleBox">
        <i :class="tableType4 === 0? 'el-icon-document':'el-icon-edit-outline'" style="font-size: 20px"></i>
        <span style="margin-left:10px;font-size:18px">{{tableTypeDsc4}}</span>
        </div>
        <el-form :model="formData4" label-width="80px" :rules="monitorRules4" ref="monitorForm4">
          <el-row>
            <el-col :span='12'>
              <el-form-item  prop="testPlanName" label="测试计划">
                <el-input v-model="formData4.testPlanName" readOnly disabled size="small" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item  prop="taskName" label="测试任务">
                <el-input v-model="formData4.taskName" readOnly disabled size="small" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item prop="indexName" label="指标名称">
                <el-input v-model="formData4.indexName" placeholder="请输入" size="small" style="width: 100%;"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item label="产品标准">
                <el-select v-model="formData4.stdNo" filterable clearable collapse-tags size="small" style="width: 100%;">
                  <el-option v-for="(item,index) in stdNameType" :key="index" :label="item.stdName"
                    :value="item.stdNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='12'>
              <el-form-item label="牌号">
                <el-select v-model="formData4.gradeNo" clearable filterable collapse-tags size="small" style="width: 100%;">
                  <el-option v-for="(item,index) in gradeNameType" :key="index" :label="item.gradeName"
                    :value="item.gradeNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span='12'>
              <el-form-item label="判定类型">
                <el-select v-model="formData4.judgeTypeCode" clearable filterable collapse-tags size="small" style="width: 100%;">
                  <el-option v-for="(item,index) in judgeTypeNameType" :key="index" :label="item.baseName"
                    :value="item.baseCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span='24'>
              <el-form-item prop="memo" label="备注">
               <el-input v-model="formData4.memo" size="small" style="width: 100%;" placeholder="请输入"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
         </el-form>
       <span slot="footer" class="dialog-footer">
        <el-button type="goon" size="mini" icon="el-icon-check" @click="dialogTableVisible3 = true;dialogTableVisible4 = false">上一步</el-button>
        <el-button type="goon" icon="el-icon-check" size="mini" @click="addTarget()">确定</el-button>
        <el-button size="mini" type="goon" icon="el-icon-remove-outline" @click="cancel">取消</el-button>
      </span>
    </el-dialog>
    <div is="alertComponets" :showFlag="showFlag" :Params="Params" @refresh='refresh'></div>
  </div>
</template>
<script>
import {
  getCookie
} from '@/utils/util.js';
import {
  cookieUserId,
  cookieUserName
} from '@/config/config.js';
import alertComponets from './alertComponents';
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
  components: {alertComponets},
  data () {
    return {
      table: {
        list: [],
        list2: [],
        listTest:[],
        list3:[]
      },
      //检测班组
      teamlist:[],
      team:{
         sectionNo:'',
         sectionName:''
      },
      //检测车间
      workshoplist:[],
      workshop:{
        deptNo:'',
        deptName:''
      },
      dialogTableVisible:false,
      testItemName: '',
      tableType:0,
      tableTypeDsc:'新增测试计划信息',
      formData:{matNo:'',planDeptNo:'',smpDeptNo:'',smpSectionNo:'',tmpNo:''},
      monitorRules: {
        testPlanName:[{ required: true, message: '该项不能为空', trigger: ['blur'] }],
        sampleTypeCode:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        smpDeliCode:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        matNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        matClassNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        companyNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        deptNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        smpCompanyNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        planCompanyNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        planDeptNo:[{ required: true, message: '该项不能为空', trigger: 'change' }],
        smpDeptNo:[{ required: true, message: '该项不能为空', trigger: 'change' }]
      },
      companyNameType:[],
      sectionNameType:[],
      sectionClass:[],
      companyNameType2:[],
      sectionNameType2:[],
      sectionClass2:[],
      matClassNameType:[],
      matNameType:[],
      pointNameType:[],
      smpDeliType:[],
      //模板
      dialogTableVisible2:false,
      tableType2:0,
      tableTypeDsc2:'新增测试任务集',
      testTypeNameType:[],
      formData2:{},
      monitorRules2:{
        taskName: [{ required: true, message: '该项不能为空', trigger: 'blur' }],
        testTypeCode: [{ required: true, message: '该项不能为空', trigger: 'change' }]
      },
      dialogTableVisible3:false,
      tableTypeDsc3:'新增测试方案集',
      testNumber:0,
      testList:[],
      selectNumber:0,
      saveObj:{},
      dialogTableVisible4:false,
      tableType4:0,
      tableTypeDsc4:'新增测试指标集',
      formData4:{indexName:'默认指标集'},
      monitorRules4:{
        taskName: [{ required: true, message: '该项不能为空', trigger: 'change' }],
        indexName: [{ required: true, message: '该项不能为空', trigger: 'blur' }]
      },
      stdNameType:[],
      gradeNameType:[],
      judgeTypeNameType:[],
      dataLoading: false,
      dataLoading2: false,
      icoreFilterFlag: true,
      page: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      pageTest: {
        pageSize: 50,
        pageNum: 1,
        totalPage: 0
      },
      tmpNo: '',
      showFlag: false,
      Params: {},
      showFlag2: false,
      showFlag3: false,
      showFlag4: true,
      showFlag5: false,
      Params2: {},
      Params3: {},
      Params4: {},
      sampleType:[],
      tmpTypeNameType: [],
      sampleTypeNameType: [],
      multipleSelection3: [],
      multipleSelection4: [],
      search: {
        tmpName: '',
        tmpTypeName: '',
        sampleTypeName: '',
        matName: '' // 物料名称
      },
      heightTop:0,
      heightBot:0
    }
  },
  created(){
    this.heightTop = window.innerHeight/2 - 130 < 249  ? 249 : window.innerHeight/2 - 130;
    this.heightBot = window.innerHeight/2 - 130 < 249  ? 249 : window.innerHeight/2 - 130;
    this.search = this.$route.query.searchData ? this.$route.query.searchData : {};
    this.tmpNo = this.$route.query.tmpNo ? this.$route.query.tmpNo : '';
    this.page = this.$route.query.pageList ? this.$route.query.pageList : {pageSize: 50, pageNum: 1, totalPage: 0};
  },
  mounted () {
   //获取公司
    this.axios.post("pass/baseManagement/v1/sysorgs/querySysOrgCompanyAll",{}, {individualType: 'json'}).then(response => {
      this.companyNameType = response.data
      this.companyNameType2 = response.data
    });
    //物料类型
    this.axios.get('pass/baseManagement/v1/limsbasematerialsclasss/'+ '?validFlag=1').then(res => {
      this.matClassNameType = res.data.list;
    })
     //样品类型
    this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4801}, {individualType: 'json'}).then(res => {
        this.sampleTypeNameType = res.data;
      })
    //取样频次
    this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4818}, {individualType: 'json'}).then(res => {
      this.smpDeliType = res.data;
    })
    // //取样地点
    // this.axios.get('pass/baseManagement/v1/limsbasepoints/'+ '?validFlag=1').then(res => {
    //   this.pointNameType = res.data.list;
    // })
    this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4803}, {individualType: 'json'}).then(res => {
      this.testTypeNameType = res.data;
    })
    //产品标准
    this.axios.post('pass/baseManagement/v1/limsstdinfos/queryLimsStdInfoList/',{object:{validFlag:1},pageIndex:1, pageSize:9999},{individualType: 'json'}).then(res => {
      this.stdNameType = res.data.list;
    })
    //牌号
     this.axios.post('pass/baseManagement/v1/limsbasegrades/queryLimsBaseGradePage',{object:{validFlag:1,grandTypeCode:'',gradeName:''},pageIndex:1, pageSize:9999}, {individualType: 'json'}).then(res => {
        this.gradeNameType = res.data.list;
      })
    //判定类型
    this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4816}, {individualType: 'json'}).then(res => {
      this.judgeTypeNameType = res.data;
    })
    //检测车间
      this.axios.get("pass/baseManagement/v1/limsstdsmptmps/DuplicationDEPT").then(res => {
      this.workshoplist = res.data;
    })
     //检测班组
      this.axios.get("pass/baseManagement/v1/limsstdsmptmps/DuplicationSection").then(res => {
        console.log("检测班组",res)
       this.teamlist = res.data;
    })
    this.getDataListTest()
    this.getDataList();
    this.tmpNo == '' ? '': this.getDataList2(this.tmpNo)
    // this.getDataList2();
    this.gettmpTypeNameTypeList ()
    this.getsampleTypeNameList ()
  },
  methods: {
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
        }
        if (index === 1) {
          sums[index] = data.length;
        } 
      });
      return sums;
    },
    showplan(){
      dialogTableVisible = true;dialogTableVisible2 = false;
      console.log(this.formData);
    },
    selctMatName(val){
      this.matNameType = []
      this.formData.clearFlag ? '' : this.formData.matNo = ''
      if (!val) {
        return 
      }
      //物料名称
     this.axios.post('pass/baseManagement/v1/limsbasematerialss/queryLimsBaseMaterialsPage/',{object:{validFlag:1,matClassNo:val},pageIndex:1,pageSize:99999},{individualType: 'json'}).then(res => {
      this.matNameType = res.data.list;
    })
    },
    getDataLists(){
         this.pageTest.pageNum = 1
         this.getDataListTest()
    },
     getDataListTest () {
          let obj = {
            object:{
              validFlag:1,
              testItemName:this.testItemName
            },
            pageIndex:this.pageTest.pageNum,
            pageSize:this.pageTest.pageSize
          }
        this.dataLoading = true;
        this.axios.post('pass/baseManagement/v1/limsstdtestitems/queryLimsStdTestItemPage',obj,{individualType: 'json'}).then(res => {
              this.dataLoading = false;
              this.table.listTest = res.data.list;
              this.pageTest.totalPage = res.data.total;
            }).catch(e => {
              this.dataLoading = false;
            });
    },
    //根据选中的公司，查询部门名称数据
    selectDepartment(val){
      this.sectionNameType = []
      // this.pointNameType = []
      this.companyNameType.find(item =>{
        if(val === item.orgCode){
          this.sectionNameType = item.sysOrgList
          this.formData.clearFlag ? '' : this.formData.planDeptNo = ''
        }
      })
      // let obj = {
      //   object:{companyNo:val,pointTypeCode:'480401',validFlag:1},
      //   pageIndex:1,
      //   pageSize:9999
      // }
    //   this.axios.post("pass/baseManagement/v1/limsbasepoints/queryLimsBasePointPage",obj, {individualType: 'json'}).then(response => {
    //   this.pointNameType = response.data.list
    // });
    },
    //根据选中的部门名称，查询班组名称
    // selectClass(val){
    //   this.sectionClass = []
    //   this.sectionNameType.find(item =>{
    //     if(val === item.orgCode){
    //       this.sectionClass = item.sysOrgList
    //       this.formData.clearFlag ? '' : this.formData.sectionNo = ''
    //     }
    //   })
    // },
    selectDepartment2(val){
      this.sectionNameType2 = []
      this.pointNameType = []
      this.companyNameType2.find(item =>{
        if(val === item.orgCode){
          this.sectionNameType2 = item.sysOrgList
          this.formData.clearFlag ? '' : this.formData.smpDeptNo = ''
        }
      })
      let obj = {
        object:{companyNo:val,pointTypeCode:'480401',validFlag:1},
        pageIndex:1,
        pageSize:9999
      }
      this.axios.post("pass/baseManagement/v1/limsbasepoints/queryLimsBasePointPage",obj, {individualType: 'json'}).then(response => {
      this.pointNameType = response.data.list
    });
    },
    //根据选中的部门名称，查询班组名称
    selectClass2(val){
      this.sectionClass2 = []
      this.sectionNameType2.find(item =>{
        if(val === item.orgCode){
          this.sectionClass2 = item.sysOrgList
          this.formData.clearFlag ? '' : this.formData.smpSectionNo = ''
        }
      })
    },
    smpSection () {
      this.$forceUpdate()
    },
    getCode (code, arr, codeKey, nameKey) {
      if (!code) {
        return '';
      }
      let targetRow = arr.find(item => {
        return item[codeKey] === code;
      });
      // console.log(targetRow, 'targetRow');
      return targetRow ? targetRow[nameKey] : '';
    },
    addPlan () {
      let _this = this;
       _this.$refs['monitorForm'].validate((valid) => {
        if (valid) {
      this.formData.createMan = userName
      this.formData.createNo = userId
      this.formData.planCompanyName = this.getCode(this.formData.planCompanyNo,this.companyNameType,'orgCode','orgName')
      this.formData.planDeptName = this.getCode(this.formData.planDeptNo,this.sectionNameType,'orgCode','orgName')
      // this.formData.sectionName = this.getCode(this.formData.sectionNo,this.sectionClass,'orgCode','orgName')
      this.formData.smpCompanyName = this.getCode(this.formData.smpCompanyNo,this.companyNameType2,'orgCode','orgName')
      this.formData.smpDeptName = this.getCode(this.formData.smpDeptNo,this.sectionNameType2,'orgCode','orgName')
      this.formData.smpSectionName = this.getCode(this.formData.smpSectionNo,this.sectionClass2,'orgCode','orgName')
      this.formData.matClassName = this.getCode(this.formData.matClassNo,this.matClassNameType,'matClassNo','matClassName')
      this.formData.matName = this.getCode(this.formData.matNo,this.matNameType,'matNo','matName')
      this.formData.pointName = this.getCode(this.formData.pointNo,this.pointNameType,'pointNo','pointName')
      this.formData.smpDeliName = this.getCode(this.formData.smpDeliCode,this.smpDeliType,'baseCode','baseName')
      this.formData.sampleTypeName = this.getCode(this.formData.sampleTypeCode,this.sampleTypeNameType,'baseCode','baseName')
      this.formData2.testPlanName = this.formData.testPlanName
      this.dialogTableVisible = false;
      this.dialogTableVisible2 = true;
      // _this.axios.post('pass/baseManagement/v1/limsstdtestplans/saveLimsStdTestPlan',this.formData, {individualType: 'json'}).then(res => {
      //    if (res.succeed) {
      //      this.formData.testPlanNo  = this.formData.testPlanNo ? this.formData.testPlanNo : res.data
      //      this.formData2.testPlanNo = this.formData.testPlanNo
      //      this.formData2.testPlanName = this.formData.testPlanName
      //      _this.dialogTableVisible = false;
      //     this.$message.success('测试计划添加成功！')
      //     _this.dialogTableVisible2 = true;
      //    } else {
      //     this.$message.error(res.message)
      //    }
      //    }).catch(e => {
      //     this.$message.error(e.message)
      //   })
        }
       })
    },
    //修改测试计划
    modifyPlan () {
      let _this = this;
      _this.$refs['monitorForm'].validate((valid) => {
        if (valid) {
      this.formData.planCompanyName = this.getCode(this.formData.planCompanyNo,this.companyNameType,'orgCode','orgName')
      this.formData.planDeptName = this.getCode(this.formData.planDeptNo,this.sectionNameType,'orgCode','orgName')
      // this.formData.sectionName = this.getCode(this.formData.sectionNo,this.sectionClass,'orgCode','orgName')
      this.formData.matClassName = this.getCode(this.formData.matClassNo,this.matClassNameType,'matClassNo','matClassName')
      this.formData.smpCompanyName = this.getCode(this.formData.smpCompanyNo,this.companyNameType2,'orgCode','orgName')
      this.formData.smpDeptName = this.getCode(this.formData.smpDeptNo,this.sectionNameType2,'orgCode','orgName')
      this.formData.smpSectionName = this.getCode(this.formData.smpSectionNo,this.sectionClass2,'orgCode','orgName')
      this.formData.matName = this.getCode(this.formData.matNo,this.matNameType,'matNo','matName')
      this.formData.pointName = this.getCode(this.formData.pointNo,this.pointNameType,'pointNo','pointName')
      this.formData.smpDeliName = this.getCode(this.formData.smpDeliCode,this.smpDeliType,'baseCode','baseName')
      this.formData.sampleTypeName = this.getCode(this.formData.sampleTypeCode,this.sampleType,'baseCode','baseName')
      _this.axios.put('pass/baseManagement/v1/limsstdtestplans/', this.formData, {individualType: 'json'}).then(res => {
         if (res.succeed) {
           _this.dialogTableVisible = false;
          this.$message.success('修改成功')
           this.getDataList2(this.tmpNo)
         } else {
          this.$message.error(res.message)
         }
         }).catch(e => {
          this.$message.error(e.message)
        })
        }
       })
    },
    addDataTest(){
      let _this = this;
      _this.$refs['monitorForm2'].validate((valid) => {
        if (valid) {
          this.formData2.createMan = userName;
          this.formData2.createNo = userId;
          this.formData2.testTypeName = this.getCode(this.formData2.testTypeCode,this.testTypeNameType,'baseCode','baseName')
          let obj = {taskName:this.formData2.taskName,testPlanNo:this.formData2.testPlanNo,testPlanName:this.formData2.testPlanName}
          this.saveObj = Object.assign({},obj)
          this.dialogTableVisible2 = false;
          this.dialogTableVisible3 = true
         //  _this.axios.post('pass/baseManagement/v1/limsstdtasks/saveLimsStdTask', this.formData2, {individualType: 'json'}).then(res => {
          //     if (res.succeed) {
          //      _this.dialogTableVisible2 = false;
          //      this.$message.success('测试方案集添加成功')
          //      this.formData2.taskNo = this.formData2.taskNo ? this.formData2.taskNo : res.data
          //      let obj = {taskName:this.formData2.taskName,taskNo:this.formData2.taskNo,testPlanNo:this.formData2.testPlanNo,testPlanName:this.formData2.testPlanName}
          //      this.saveObj = Object.assign({},obj)
          //      this.dialogTableVisible3 = true
          //     } else {
          //      this.$message.error(res.message)
          //     }
          //     }).catch(e => {
          //      this.$message.error(e.message)
          //    })
        }
       })
    },
    modifyDataTest () {
        let _this = this;
        _this.$refs['monitorForm2'].validate((valid) => {
        if (valid) {
        _this.dialogTableVisible = false;
         for (var i = 0; i < _this.monitorForm.tableData.length; i++) {
        _this.monitorForm.tableData[i].updateMan = userName;
        _this.monitorForm.tableData[i].updateNo = userId;
        }
        _this.monitorForm.tableData[0].testPlanNo = _this.formData.testPlanNo;
        _this.monitorForm.tableData[0].testPlanName = _this.formData.testPlanName;
        _this.monitorForm.tableData[0].testTypeCode= _this.testTypeNameType[_this.testTypeNameTypeIndex].baseCode;
        _this.monitorForm.tableData[0].testTypeName = _this.testTypeNameType[_this.testTypeNameTypeIndex].baseName;
        _this.monitorForm.tableData[0].taskName = _this.formData.taskName;
        _this.monitorForm.tableData[0].memo = _this.formData.memo;
        _this.axios.put('pass/baseManagement/v1/limsstdtasks/', _this.monitorForm.tableData[0], {individualType: 'json'}).then(res => {
           if (res.succeed) {
            this.$message.success('修改成功')
            _this.$emit('refresh')
           } else {
            this.$message.error(res.message)
           }
           }).catch(e => {
            this.$message.error(e.message)
          })
        }
        })
    },
    upData () {
        if (this.selectList.length === 1) {
            this.selectList.forEach((item, index) => {
              // 遍历源数据
              this.table.list3.forEach((itemI, indexI) => {
                // 如果选中数据跟元数据某一条标识相等，删除对应的源数据
                if (item.indexof === itemI.indexof) {
                  this.index = indexI
                }
              })
            })
            if (this.index > 0) {
                let upDate = this.table.list3[this.index - 1];
                this.table.list3.splice(this.index - 1, 1);
                this.table.list3.splice(this.index, 0, upDate);
            } else {
                this.$message.warning('已经是第一条，不可上移!');
            }
        } else {
           this.$message.warning('请在右边框选择一条上移的数据！')
        }
    },
    downData () {
        if (this.selectList.length === 1) {
             this.selectList.forEach((item, index) => {
             // 遍历源数据
             this.table.list3.forEach((itemI, indexI) => {
             // 如果选中数据跟元数据某一条标识相等，删除对应的源数据
             if (item.indexof === itemI.indexof) {
               this.index = indexI
             }
           })
          })
          if ((this.index) === this.table.list3.length - 1) {
             this.$message.warning('已经是最后一条了，不可下移!');
              // let upDate = this.table.list2[this.index - 1];
              // this.table.list2.splice(this.index - 1, 1);
              // this.table.list2.splice(this.index, 0, upDate);
          } else {
             let downDate = this.table.list3[this.index + 1];
             this.table.list3.splice(this.index + 1, 1);
             this.table.list3.splice(this.index, 0, downDate);
          }
         } else {
           this.$message.warning('请在右边框选择一条下移的数据！')
         }
       },
       rightData () {
         if (this.testList.length > 0) {
            let newnewList = []
            newnewList = JSON.parse(JSON.stringify(this.testList))
            newnewList.map(item =>{
              this.table.list3.push(item)
            })
            for (let i = 0; i < this.table.list3.length; i++) {
             this.table.list3[i].indexof = i
            }
         } else {
           this.$message.warning('请在左边框勾选您要选择的测试任务！')
         }
       },
       leftData () {
         if (this.selectList.length > 0) {
         this.selectList.forEach((item, index) => {
          // 遍历源数据
         this.table.list3.forEach((itemI, indexI) => {
            // 如果选中数据跟元数据某一条标识相等，删除对应的源数据
            if (item.indexof === itemI.indexof) {
              this.table.list3.splice(indexI, 1)
            }
          })
        })
         } else {
           this.$message.warning('请在右边边框勾选您要删除的任务！')
         }
       },
      handleSelectionTest (val) {
         this.testNumber = val.length;
         this.testList = val;
       },
       handleSelectionTest2 (val) {
         this.selectNumber = val.length;
         this.selectList = val;
       },
       pageSizeTest (size) {
         this.pageTest.pageSize = size;
         this.getDataListTest();
       },
    pageCurrentTest (index) {
      this.pageTest.pageNum = index;
      this.getDataListTest();
    },
    addDataCase(){
      if (this.table.list3.length <= 0) {
        this.$message.warning('请先选择数据右移到选择任务表中')
        return
      }
      this.table.list3.forEach(item => {
          //  item.taskNo = this.saveObj.taskNo;
           item.taskName = this.saveObj.taskName;
          //  item.updateMan = this.userName;
          //  item.updateNo = this.userId;
         })
        this.formData4.taskName = this.saveObj.taskName;
        this.formData4.testPlanNo = this.saveObj.testPlanNo;
        this.formData4.testPlanName = this.saveObj.testPlanName;
         this.dialogTableVisible3 = false;
         this.dialogTableVisible4 = true
        //  this.axios.post('pass/baseManagement/v1/limsstdtaskds/next', this.table.list3, {individualType: 'json'}).then(res => {
        //    if (res.succeed) {
        //      this.dialogTableVisible3 = false;
        //     this.$message.success('测试任务添加成功')
        //     this.formData4.taskNo = this.saveObj.taskNo;
        //     this.formData4.taskName = this.saveObj.taskName;
        //     this.formData4.testPlanNo = this.saveObj.testPlanNo;
        //     this.formData4.testPlanName = this.saveObj.testPlanName;
        //     this.dialogTableVisible4 = true
        //    } else {
        //     this.$message.error(res.message)
        //    } 
        //    }).catch(e => {
        //     this.$message.error(e.message)
        // })
    },
    addTarget(){
      let _this = this;
      _this.$refs['monitorForm4'].validate((valid) => {
          if (valid) {
            this.formData4.createMan = userName
            this.formData4.createNo = userId
            this.formData4.stdName = this.getCode(this.formData4.stdNo,this.stdNameType,'stdNo','stdName')  
            this.formData4.gradeName = this.getCode(this.formData4.gradeNo,this.gradeNameType,'gradeNo','gradeName')
            this.formData4.judgeTypeName = this.getCode(this.formData4.judgeTypeCode,this.judgeTypeNameType,'baseCode','baseName')
            let obj = {
              limsStdTestPlan:this.formData,
              limsStdTask:this.formData2,
              limsStdTaskDS:this.table.list3,
              limsStdIndex:this.formData4
            } 
            _this.axios.post('pass/baseManagement/v1/limsstdtestplans/addLimsStdTestPlanAll', obj, {individualType: 'json'}).then(res => {
              if (res.code == 200 || res.code == 0) {
                _this.dialogTableVisible4 = false;
                this.$message.success('测试指标集添加成功')
                this.getDataList2(this.tmpNo)
                this.cancel()
                } else {
                 this.$message.error(res.message)
                }
                }).catch(e => {
                 this.$message.error(e.message)
               })
          }
         })
    },
    modifyTarget(){
    },
    cancel(){
      this.formData = {matNo:'',planDeptNo:'',smpDeptNo:'',smpSectionNo:''}
      this.tableType =0,
      this.tableTypeDsc ='新增测试计划信息',
      this.dialogTableVisible = false,
      this.tableType2 =0,
      this.tableTypeDsc2 ='新增测试任务集',
      this.formData2 ={},
      this.dialogTableVisible2 = false,
      this.tableTypeDsc3 ='新增测试方案集',
      this.saveObj ={},
      this.dialogTableVisible3 = false,
      this.tableType4 =0,
      this.tableTypeDsc4 ='新增测试指标集',
      this.formData4 ={indexName:'默认指标集'}
      this.dialogTableVisible4 = false
      this.table.list3 = [],
      this.saveObj = {}
    },
    closeDialog () {
      // this.formData={matNo:'',deptNo:'',sectionNo:''}
    },
    refresh () {
      let _this = this;
      _this.getDataList();
      _this.getDataList2(_this.tmpNo);
      // _this.multipleSelection.splice(0, 1);
      // _this.multipleSelection2 = []
      // console.log(_this.multipleSelection)
    },
    refresh2 () {
      let _this = this;
      _this.getDataList2(_this.tmpNo);
     },
    refresh6 (testPlan) {
      let _this = this;
      _this.Params = null
      _this.Params = null
      _this.Params3 = testPlan
      console.log('jsdak',_this.Params3)
      if (_this.Params3 !== undefined) {
        _this.showFlag3 = !_this.showFlag3
      }
    },
    refresh3 (solutionSet) {
      let _this = this;
      // _this.showFlag4 = false
      _this.Params = null
      _this.Params4 = solutionSet
      console.log('solutionSet',_this.Params4)
      if (_this.Params4 !== undefined) {
      _this.showFlag4 = !_this.showFlag4
      }
    },
    refresh4 () {
      let _this = this;
      _this.showFlag5 = !_this.showFlag5
      // if (_this.Params4 !== undefined) {
      // _this.showFlag5 = !_this.showFlag5
      // }
    },
    refresh5 () {
      let _this = this;
      _this.getDataList2(_this.tmpNo);
    },
    addData () {
      let _this = this;
      _this.showFlag = !_this.showFlag;
      // _this.showFlag4 = !_this.showFlag4
      _this.Params = null;
    },
    modifyData () {
      let _this = this;
      if (_this.multipleSelection3.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
      } else {
        _this.showFlag = !_this.showFlag;
        _this.Params = _this.multipleSelection3
      }
    },
    deleteData () {
       let _this = this;
        if (_this.multipleSelection3.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
       } else {
        for (var j= 0; j < _this.multipleSelection3.length; j++) {
          if (_this.multipleSelection3[j].validFlag === '0') {
          this.$message.warning('请勾选状态为已启用的数据！')  
          return 
          }
        }
        _this.dialogTableVisible = false;
        // _this.multipleSelection = []
        // _this.multipleSelection.push(_this.multipleSelection3)
        for (var i = 0; i < _this.multipleSelection3.length; i++) {
        _this.multipleSelection3[i].updateMan = userName;
        _this.multipleSelection3[i].updateNo = userId
        }
        _this.axios.post('pass/baseManagement/v1/limsstdsmptmps/abolish', _this.multipleSelection3, {individualType: 'json'}).then(res => {
        if (res.succeed) {
         this.$message.success('停用操作成功');
         _this.refresh()
        } else {
         this.$message.error(res.message)
        }
        }).catch(e => {
         this.$message.error(e.message)
       })
       }
    },
    recoverData () {
       let _this = this;
        if (_this.multipleSelection3.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
        } else {
          for (var j= 0; j < _this.multipleSelection3.length; j++) {
          if (_this.multipleSelection3[j].validFlag === '1') {
          this.$message.warning('请勾选状态为已停用的数据！')  
          return 
          }
        }
        _this.dialogTableVisible = false;
        for (var i = 0; i < _this.multipleSelection3.length; i++) {
        _this.multipleSelection3[i].updateMan = userName;
        _this.multipleSelection3[i].updateNo = userId
        }
        _this.axios.post('pass/baseManagement/v1/limsstdsmptmps/recover', _this.multipleSelection3, {individualType: 'json'}).then(res => {
        if (res.succeed) {
         this.$message.success('启用成功');
         _this.refresh()
        } else {
         this.$message.error(res.message)
        }
        }).catch(e => {
         this.$message.error(e.message)
       })
      }
    },
    addData2 () {
      let _this = this;
      if (_this.multipleSelection3.length !== 1) {
       this.$message.warning('请选择一条样品模板信息数据！')
       return
      }
      this.tableType = 0;
      this.tableTypeDsc = '新增测试计划信息';
      let obj = {
        tmpNo:this.multipleSelection3[0].tmpNo,
        tmpName:this.multipleSelection3[0].tmpName,
        sampleTypeCode:this.multipleSelection3[0].sampleTypeCode,
        planCompanyNo:this.multipleSelection3[0].companyNo,
        planDeptNo:this.multipleSelection3[0].deptNo,
        // sectionNo:this.multipleSelection3[0].sectionNo
        }
      this.formData = Object.assign({clearFlag:true,matNo:''},obj)
      this.selectDepartment(this.formData.planCompanyNo)
      // this.selectClass(this.formData.deptNo)
      this.formData.clearFlag = false
      this.dialogTableVisible = true;
    },
    deleteList(){  //删除
      let _this = this;
       if (_this.multipleSelection4.length < 1) {
        this.$message.warning('请勾选您要删除的数据！')
      } else {
        for (var j= 0; j < _this.multipleSelection4.length; j++) {
          if (_this.multipleSelection4[j].validFlag === '0') {
          this.$message.warning('请勾选状态为已启用的数据！')  
          return 
          }
        }
        _this.dialogTableVisible = false;
        for (var i = 0; i < _this.multipleSelection4.length; i++) {
        _this.multipleSelection4[i].updateMan = userName;
        _this.multipleSelection4[i].updateNo = userId
        }
        for(var i = 0; i < _this.multipleSelection4.length; i++){
          _this.axios.post('pass/baseManagement/v1/limsstdtestplans/deleteLimsStdTestPlanAll?testPlanNo='+this.multipleSelection4[i].testPlanNo, {individualType: 'json'}).then(res => {
            if (res.succeed) {
            this.$message.success('删除操作成功');
            this.getDataList2(this.tmpNo);
            } else {
            this.$message.error(res.message)
            }
            }).catch(e => {
            this.$message.error(e.message)
          })
        }
      }
    },
    modifyData2 () {
      let _this = this;
     if (_this.multipleSelection4.length !== 1) {
        this.$message.warning('请勾选您要修改的一条数据！')
        return
      }
      this.formData = Object.assign({clearFlag:true},this.multipleSelection4[0])
      this.selctMatName(this.formData.matClassNo)
      this.selectDepartment(this.formData.planCompanyNo)
      this.selectDepartment2(this.formData.smpCompanyNo)
      this.selectClass2(this.formData.smpDeptNo)
      this.formData.clearFlag = false;
      this.tableType = 1;
      this.tableTypeDsc = '修改测试计划信息';
      this.dialogTableVisible = true
    },
    copyData2 () {
       let _this = this;
     if (_this.multipleSelection4.length != 1) {
        this.$message.warning('请勾选一条您要复制的数据！')
      } else {
         _this.axios.post('pass/baseManagement/v1/limsstdtestplans/copyLimsStdTestPlanAll?id='+this.multipleSelection4[0].id, {individualType: 'json'}).then(res => {
           if (res.succeed) {
            this.$message.success('复制成功')
            this.getDataList2(this.tmpNo);
           } else {
            this.$message.error(res.message)
           }
           }).catch(e => {
            this.$message.error(e.message)
          })
      }
    },
    deleteData2 () {
       let _this = this;
       if (_this.multipleSelection4.length < 1) {
        this.$message.warning('请勾选您要停用的数据！')
      } else {
        for (var j= 0; j < _this.multipleSelection4.length; j++) {
          if (_this.multipleSelection4[j].validFlag === '0') {
          this.$message.warning('请勾选状态为已启用的数据！')  
          return 
          }
        }
        _this.dialogTableVisible = false;
        for (var i = 0; i < _this.multipleSelection4.length; i++) {
        _this.multipleSelection4[i].updateMan = userName;
        _this.multipleSelection4[i].updateNo = userId
        }
        _this.axios.post('pass/baseManagement/v1/limsstdtestplans/abolish', _this.multipleSelection4, {individualType: 'json'}).then(res => {
        if (res.succeed) {
         this.$message.success('停用操作成功');
         this.getDataList2(this.tmpNo);
        } else {
         this.$message.error(res.message)
        }
        }).catch(e => {
         this.$message.error(e.message)
       })
      }
    },
    recoverData2 () {
       let _this = this;
        if (_this.multipleSelection4.length < 1) {
        this.$message.warning('请勾选您要启用的数据！')
      } else {
        for (var j= 0; j < _this.multipleSelection4.length; j++) {
          if (_this.multipleSelection4[j].validFlag === '1') {
          this.$message.warning('请勾选状态为已停用的数据！')  
          return 
          }
        }
        _this.dialogTableVisible2 = false;
        for (var i = 0; i < _this.multipleSelection4.length; i++) {
        _this.multipleSelection4[i].updateMan = userName;
        _this.multipleSelection4[i].updateNo = userId
        }
        _this.axios.post('pass/baseManagement/v1/limsstdtestplans/recover', _this.multipleSelection4, {individualType: 'json'}).then(res => {
        if (res.succeed) {
         this.$message.success('启用成功');
         this.getDataList2(this.tmpNo);
        } else {
         this.$message.error(res.message)
        }
        }).catch(e => {
         this.$message.error(e.message)
       })
      }
    },
    searchData1 () {
      let _this = this;
      _this.page.pageNum = 1;
      _this.getDataList()
    },
    reset () {
      let _this = this;
      _this.search.tmpName = '';
      _this.search.tmpTypeName = '';
      _this.search.sampleTypeName = '';
      _this.searchData();
      _this.gettmpTypeNameTypeList ()
    },
    handleSelectionChange (val) {
      this.multipleSelection3 = val;
      if (val.length > 0 ){
        this.tmpNo = val[val.length-1].tmpNo;
        this.getDataList2(this.tmpNo);
      }
    },
    pageSizeChange (size) {
      let _this = this;
      _this.page.pageSize = size;
      _this.getDataList();
    },
    pageCurrentChange (index) {
      let _this = this;
      _this.page.pageNum = index;
      _this.getDataList();
    },
    handleSelectionChange2 (val) {
      // this.multipleSelection2 = [];
      // this.multipleSelection2.push(val);
      this.multipleSelection4 = val;
    },
    handleCurrentChange (val) {
      if (val){
        if (val.tmpNo === null) {
          this.tmpNo = '';
        } else {
          this.tmpNo = val.tmpNo;
        }
        this.getDataList2(this.tmpNo)
      } else {
        this.table.list2 = [];
      }
    },
    getDataList () {
      let _this = this;
      let obj ={
        object:{
          tmpName:_this.search.tmpName,
          tmpTypeCode:_this.search.tmpTypeCode,
          sampleTypeCode:_this.search.sampleTypeCode,
          deptNo: _this.workshop.deptNo,
          sectionNo:_this.team.sectionNo
        },
        mode:_this.search.matName, // 物料名称过滤，模糊查询
        pageIndex:_this.page.pageNum,
        pageSize:_this.page.pageSize
      }
      console.log("参数获取",obj)
      _this.dataLoading = true;
      _this.axios.post('pass/baseManagement/v1/limsstdsmptmps/queryLimsStdSmpTmpPage',obj,{individualType: 'json'}).then(res => {
        _this.dataLoading = false;
        _this.table.list = res.data.list;
        for (let i = 0; i < _this.table.list.length; i++) {
          if (_this.table.list[i].validFlag === '0') {
            _this.table.list[i].validFlag1 = '无效'
          } else if (_this.table.list[i].validFlag === '1') {
            _this.table.list[i].validFlag1 = '有效'
          }
        }
        _this.page.totalPage = res.data.total;
      }).catch(e => {
        _this.dataLoading = false;
      });
    },
   getDataList2 (tmpNo) {
      this.dataLoading2 = true;
      let obj = {
        object:{tmpNo:tmpNo},
        pageIndex: 1,
        pageSize: 100
      }
      this.axios.post('pass/baseManagement/v1/limsstdtestplans/queryLimsStdTestPlanPage',obj, {individualType: 'json'}).then(res => {
        this.dataLoading2 = false;
        this.table.list2 = res.data.list;
        for (let i = 0; i < this.table.list2.length; i++) {
          if (this.table.list2[i].validFlag === '0') {
            this.table.list2[i].validFlag1 = '无效'
          } else if (this.table.list2[i].validFlag === '1') {
            this.table.list2[i].validFlag1 = '有效'
          }
        }
      }).catch(e => {
        this.dataLoading2 = false;
      });
    },
   gettmpTypeNameTypeList () {
      this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4811}, {individualType: 'json'}).then(res => {
              this.dataLoading = false;
              this.tmpTypeNameType = res.data
            })
   },
   getsampleTypeNameList () {
      this.axios.post("pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode",{validFlag:1,baseCode:4801}, {individualType: 'json'}).then(res => {
              this.dataLoading = false;
              this.sampleTypeNameType = res.data
            })
   },
    tableRowClassName ({row, column, rowIndex, columnIndex}) {
      if (row.validFlag !== '1') {
        return 'error-row';
      }
      return '';
    },
    tableRowClassName2 ({row, column, rowIndex, columnIndex}) {
      if (row.validFlag !== '1') {
        return 'error-row';
      }
      return '';
      
    },
    tableHeaderCellStyle () {
      return 'color: rgb(255,255,255);border-bottom: 1px solid #DCDFE7;'
    }
  }
}
</script>
<style  scoped>
.boxWidth33{
  width: 900px !important
}
</style>
