<template>
  <div class="mod-config">
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item label="BU">
        <bu-select v-model="searchData.buNo" style="width: 120px"></bu-select>
      </el-form-item>
      <el-form-item :label="'参数卡编码'">
        <el-input v-model="searchData.oriCodeNo" style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item >
        <span slot="label" style="" @click="getBaseList(105,1)"><a herf="#">测试料号</a></span>
        <el-input v-model="searchData.testPartNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'状态'">
        <el-input v-model="searchData.statusDesc" style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item label=" ">
        <el-button @click="search()" type="primary" style="margin-left: 2px;margin-top:0px">查询</el-button>
        <el-button @click="addOrUpdateHandle()" type="primary" style="margin-left: 2px;margin-top: 0px">新增</el-button>
        <download-excel
          :fields="fields()"
          :data="exportData"
          type="xls"
          :name="exportName"
          :header="exportHeader"
          :footer="exportFooter"
          :fetch="createExportData"
          :before-generate="startDownload"
          :before-finish="finishDownload"
          worksheet="导出信息"
          class="el-button el-button--primary el-button--medium">
          {{ '导出' }}
        </download-excel>
      </el-form-item>
    </el-form>
    <el-table
      :data="dataList1"
      :height="height"
      border
      ref="mainTable"
      @row-click="changeData"
      highlight-current-row
      v-loading="dataListLoading"
      style="width: 100%; ">
      <el-table-column
        v-for="(item,index) in columnList1" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed==''?false:item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        width="150"
        fixed="right"
        label="操作">
        <template slot-scope="scope">
<!--          <a type="text" size="small" @click="addRevModel(scope.row)" v-if="scope.row.statusDesc!=='已完成'">升版</a>-->
          <a type="text" size="small" @click="jumpDetail(scope.row)">详情</a>
          <a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)" v-if="scope.row.statusDesc!=='已完成'">修改</a>
          <a type="text" size="small" @click="deleteData(scope.row)" v-if="scope.row.statusDesc!=='已完成'">删除</a>
          <a type="text" size="small" v-if="scope.row.status === 'cg'" @click="issueModal(scope.row)">下达</a>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 1000]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
    <el-tabs style="font-size: 12px;min-height: 330px" class="customer-tab" v-model="activeName"  type="border-card"  @tab-click="refreshCurrentTabTable">
      <el-tab-pane label="基本信息" name="info">
        <el-form  label-position="top" label-width="100px" >
          <el-row :gutter="20">
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'物料编码'">
                <el-input v-model="infoData.testPartNo" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'物料类型'">
                <el-input v-model="infoData.partTypeDesc" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'版本号'">
                <el-input v-model="infoData.revNo" readonly ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'项目号'">
                <el-input v-model="infoData.projectId" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'ECN变更'">
                <el-input v-model="infoData.ecnFlag" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'ECN单据号'">
                <el-input v-model="infoData.ecnNo" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple">
              <el-form-item :label="'ECN文档链接'">
                <el-input v-model="infoData.ecnAddress" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'Select PE Engineer'">
                <el-input v-model="infoData.engineer" ref="peOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'Select Artwork'">
                <el-input v-model="infoData.technician" ref="csOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'CQC人员'">
                <el-input v-model="infoData.cqcOperatorName" ref="dccOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'FAI人员'">
                <el-input v-model="infoData.faiOperatorName" ref="mpOperatorName" placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'PE人员'">
                <el-input v-model="infoData.peOperaterName" ref="peOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'CS人员'">
                <el-input v-model="infoData.csOperaterName" ref="csOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'DCC人员'">
                <el-input v-model="infoData.dccOperaterName" ref="dccOperaterName"  placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'MP人员'">
                <el-input v-model="infoData.mpOperatorName" ref="mpOperatorName" placeholder="请选择人员" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple">
              <el-form-item :label="'备注信息'" style="height: 70px">
                <el-input
                  type="textarea"
                  v-model="infoData.remark "
                  :rows="3"
                  resize='none'
                  maxlength="120"
                  show-word-limit
                  readonly
                  style="height: 60px">
                </el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="客户信息" name="customerInfo">
        <el-form  label-position="top" label-width="100px" >
          <el-row :gutter="20">
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'客户代码'">
                <el-input v-model="customerData.customerId" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="6"><div class="grid-content bg-purple">
              <el-form-item :label="'客户名称'">
                <el-input v-model="customerData.customerName" readonly ></el-input>
              </el-form-item>
            </div></el-col>
            <el-col :span="12"><div class="grid-content bg-purple">
              <el-form-item :label="'客户描述'">
                <el-input v-model="customerData.customerDesc" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple">
              <el-form-item :label="'客户要求'" style="height: 70px">
                <el-input
                  type="textarea"
                  v-model="customerData.customerRemark "
                  :rows="3"
                  resize='none'
                  maxlength="120"
                  show-word-limit
                  readonly
                  style=";height: 60px">
                </el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple">
              <el-form-item :label="'客户图纸'" style="margin-top: 15px">
                <el-input v-model="customerData.pictureAddess" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple">
              <el-form-item :label="'客户图纸变更说明'">
                <el-input v-model="customerData.customerPictureChangeRemark" readonly  ></el-input>
              </el-form-item>
            </div></el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple" >
              <el-form-item :label="'转量产附档说明'" style="height: 70px">
                <el-input
                  type="textarea"
                  v-model="customerData.productionFileComments "
                  :rows="3"
                  resize='none'
                  maxlength="120"
                  show-word-limit
                  readonly
                  style="height: 60px">
                </el-input>
              </el-form-item>
            </div></el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="24"><div class="grid-content bg-purple" >
              <el-form-item :label="'其他特殊要求'" style="height: 70px;margin-top: 15px">
                <el-input
                  type="textarea"
                  v-model="customerData.remark "
                  :rows="3"
                  resize='none'
                  maxlength="120"
                  show-word-limit
                  readonly
                  style="height: 60px">
                </el-input>
              </el-form-item>
            </div></el-col>
          </el-row>
        </el-form>


<!--        <el-form :inline="true" label-position="top" label-width="100px" style="height: 70px;margin-top: 15px">-->
<!--          <el-form-item :label="'客户应用/要求'">-->
<!--            <el-input-->
<!--              type="textarea"-->
<!--              v-model="customerData.remark "-->
<!--              :rows="3"-->
<!--              resize='none'-->
<!--              maxlength="120"-->
<!--              show-word-limit-->
<!--              readonly-->
<!--              style="width: 926px;height: 60px">-->
<!--            </el-input>-->
<!--          </el-form-item>-->
<!--        </el-form>-->
      </el-tab-pane>
      <!-- 审批信息 -->
      <el-tab-pane label="审批信息" name="approvalInformation">
        <approval-information ref="approvalTable" v-model:data-list="approvalList" :height="240"></approval-information>
      </el-tab-pane>
    </el-tabs>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="search" v-drag></add-or-update>

    <el-dialog  width="500px"
                :title="'升版'"
                :close-on-click-modal="false"
                :visible.sync="revNoFlag">
      <el-form :inline="true" label-position="top" label-width="100px" >
        <el-form-item :label="'参数卡编码'">
          <el-input v-model="revNoData.oriCodeNo" style="width: 130px" disabled></el-input>
        </el-form-item>
        <el-form-item :label="'版本号'">
          <el-input v-model="revNoData.oldRevNo" style="width: 130px" disabled></el-input>
        </el-form-item>
        <el-form-item :label="'项目物料'">
          <el-input v-model="revNoData.testPartNo" style="width: 130px" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" label-width="100px" >
        <el-form-item :label="'版本号'">
          <el-input v-model="revNoData.revNo" style="width: 130px" ></el-input>
        </el-form-item>
      </el-form>
      <el-form label-position="top" style="margin-top: 60px; margin-left: 0px;text-align:center">
        <el-button type="primary" @click="upBMRevNo()">{{'确定'}}</el-button>
        <el-button type="primary" @click="revNoFlag = false">{{'关闭'}}</el-button>
      </el-form>
    </el-dialog>

    <Chooselist ref="baseList"  @getBaseData="getBaseData"></Chooselist>
  </div>
</template>

<script>
  import {
    getTechnicalCustomerInfoData,
    technicalSpecificationListSearch,
    deleteTechnicalSpecificationList,
    upBMRevNo,
    issueChange, // 下达
  } from "@/api/sampleManagement/technicalSpecificationList.js"
  import Chooselist from '@/views/modules/common/Chooselist'
  import AddOrUpdate from './com_technical-add-or-update'
  import BuSelect from "../base/BuSelect.vue";
  import {
    getNodeAuthority, // 获取节点权限
    getApprovalList, // 查询审批信息
  } from '@/api/changeManagement/changeManagement.js'
  import ApprovalInformation from "../changeManagement/approvalInformation.vue";
  export default {
    components: {
      ApprovalInformation,
      Chooselist,
      AddOrUpdate,
      BuSelect,
    },
    data() {
      return {
        approvalList:[],
        activeName:'info',
        addOrUpdateVisible:false,
        height:200,
        dataList1: [],
        searchData: {
          page: 1,
          limit: 100,
          site: this.$store.state.user.site,
          userName: this.$store.state.user.name,
          testPartNo: '',
          oriCodeNo: '',
          statusDesc: '',
          codeNo:'',
          buNo:'',
        },
        pageIndex: 1,
        pageSize: 100,
        totalPage: 0,
        dataListLoading: false,
        currentRow:'',
        exportList:[],
        columnList1:[
          {
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1BuNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "buNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "BU",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1OriCodeNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "oriCodeNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "参数卡编码",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1RevNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "revNo",
            headerAlign: "center",
            align: "left",
            columnLabel: "版本号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1ProofingNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "proofingNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "打样单号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1Status',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "statusDesc",
            headerAlign: "center",
            align: "left",
            columnLabel: "状态",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1FinalPartNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "finalPartNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "最终产品编码",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1TestPartNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "testPartNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "项目料号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 140
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1TestPartNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "projectId",
            headerAlign: "center",
            align: "center",
            columnLabel: "项目号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          // },{
          //   userId: this.$store.state.user.name,
          //   functionId: 103002,
          //   serialNumber: '103002Table1TestPartNo',
          //   tableId: "103002Table1",
          //   tableName: "技术参数卡列表",
          //   columnProp: "buNo",
          //   headerAlign: "center",
          //   align: "center",
          //   columnLabel: "BU",
          //   columnHidden: false,
          //   columnImage: false,
          //   columnSortable: false,
          //   sortLv: 0,
          //   status: true,
          //   fixed: '',
          //   columnWidth: 80
          // },{
          //   userId: this.$store.state.user.name,
          //   functionId: 103002,
          //   serialNumber: '103002Table1TestPartNo',
          //   tableId: "103002Table1",
          //   tableName: "技术参数卡列表",
          //   columnProp: "buDesc",
          //   headerAlign: "center",
          //   align: "left",
          //   columnLabel: "BU名称",
          //   columnHidden: false,
          //   columnImage: false,
          //   columnSortable: false,
          //   sortLv: 0,
          //   status: true,
          //   fixed: '',
          //   columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1PartName',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "partDesc",
            headerAlign: "center",
            align: "left",
            columnLabel: "物料描述",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1ECNFlag',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "ecnFlag",
            headerAlign: "center",
            align: "center",
            columnLabel: "ECN变更",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1EcnNo',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "ecnNo",
            headerAlign: "center",
            align: "center",
            columnLabel: "ECN单据号",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1CreateDate',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "createDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "创建时间",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1CreateBy',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "createBy",
            headerAlign: "center",
            align: "left",
            columnLabel: "创建人",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1UpdateDate',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "updateDate",
            headerAlign: "center",
            align: "center",
            columnLabel: "上次修改日期",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1UpdateBy',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "updateBy",
            headerAlign: "center",
            align: "left",
            columnLabel: "修改人",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },{
            userId: this.$store.state.user.name,
            functionId: 103002,
            serialNumber: '103002Table1ecnAddress',
            tableId: "103002Table1",
            tableName: "技术参数卡列表",
            columnProp: "ecnAddress",
            headerAlign: "center",
            align: "left",
            columnLabel: "ECN文档链接",
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200
          },
        ],
        infoData:{
          testPartNo:'',
          partTypeDesc:'',
          revNo:'',
          projectId:'',
          ecnFlag:'',
          ecnNo:'',
          ecnAddress:'',
          quotationOfficer:'',
          engineer:'',
          technician:'',
          remark:'',
        },
        customerData:{
          customerId:'',
          customerName:'',
          customerDesc:'',
          finalCustomer:'',
          customerRemark:'',
          remark:'',
        },
        dataRole: {
          partTypeDesc: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ],
          partName: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ],
        },
        revNoFlag:false,
        revNoData: {
          site:'',
          oriCodeNo:'',
          oldCodeNo:'',
          oldRevNo:'',
          revNo:'',
          testPartNo:'',
        },
        // 导出 start
        exportData: [],
        exportName: '技术参数卡清单'+this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["技术参数卡清单"],
        exportFooter: [],
        // 导出 end
      }
    },
    mounted() {
      this.$nextTick(() => {
        this.height = window.innerHeight - 520;
      })
    },
    activated() {
      if (this.$route.params.codeNo){
        this.searchData.oriCodeNo = this.$route.params.codeNo;
        this.search();
        setTimeout(() => {
          this.searchData.oriCodeNo = '';
        }, 200)
      }
      if (this.$route.params.nowCodeNo){
        this.searchData.codeNo = this.$route.params.nowCodeNo;
        this.search();
        setTimeout(() => {
          this.searchData.codeNo = '';
        }, 200)
      }
    },
    methods: {
      // 下达
      issueModal (row) {
        this.$confirm(`是否确认下达?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: row.site,
            userName: this.$store.state.user.name,
            codeNo: row.codeNo,
            menuId: this.$route.meta.menuId
          }
          issueChange(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.search()
              this.$message({message: '操作成功', type: 'success'})
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },

      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.search()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.search()
      },
      search(){
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        technicalSpecificationListSearch(this.searchData).then(({data}) => {
          if (data.code == 0) {
            this.dataList1 = data.page.list
            this.pageIndex = data.page.currPage
            this.pageSize = data.page.pageSize
            this.totalPage = data.page.totalCount
            if(this.dataList1.length>0){
              this.$refs.mainTable.setCurrentRow(this.dataList1[0]);
              this.changeData(this.dataList1[0])
            }
          }
          this.dataListLoading = false
        })
      },
      changeData(row) {
        this.currentRow = JSON.parse(JSON.stringify(row));
        this.infoData=row;
        this.refreshCurrentTabTable ();
      },
      // 获取基础数据列表S
      getBaseList (val, type) {
        this.tagNo = val
        this.tagNo1 = type
        this.$nextTick(() => {
          let strVal = ''
          if (val === 1013) {
            if(type==1) {
              strVal = this.dataForm.partType
            }
          }
          if (val === 105) {
            if(type==1) {
              strVal = this.searchData.testPartNo
            }
          }
          this.$refs.baseList.init(val, strVal)
        })
      },
      refreshCurrentTabTable () {
        if (this.activeName == 'customerInfo') {
          this.getTechnicalCustomerInfoData();
        }
        if (this.activeName === 'approvalInformation') {
          this.getApprovalList()
        }
      },
      getTechnicalCustomerInfoData(){
        let inData={
          id:this.currentRow.id
        }
        getTechnicalCustomerInfoData(inData).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code == 0) {
            this.customerData = data.row;
          } else {
            this.customerData = [];
          }
        });
      },
      /* 列表方法的回调 */
      getBaseData (val) {
        if (this.tagNo === 1013) {
          if(this.tagNo1==1) {
            this.dataForm.partType = val.Base_id
            this.dataForm.partTypeDesc = val.Base_desc
          }
        }
        if (this.tagNo === 105) {
          if(this.tagNo1==1) {
            this.searchData.testPartNo = val.Test_part_no
          }
        }
      },
      // 新增 / 修改
      addOrUpdateHandle (id) {
        this.addOrUpdateVisible = true
        this.$nextTick(() => {
          this.$refs.addOrUpdate.init(id)
        })
      },
      jumpDetail(row){
        let inData={
          site:this.$store.state.user.site,
          codeNo:row.codeNo,
          buNo:row.buNo,
          username:this.$store.state.user.name};
        localStorage.setItem('tsfData', JSON.stringify(inData))
        window.open('#/BMPage');
        // this.$router.replace('sampleManagement-technicalSpecificationDetail/technicalSpecificationDetail')
      },

      deleteData(row){
        this.$confirm('确定要删除这条数据?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteTechnicalSpecificationList(row).then(({data}) => {
            if (data && data.code === 0) {
              this.$message.success( '操作成功')
              this.search();
            } else {
              this.$message.error(data.msg)
            }
          })
        }).catch(() => {
        })
      },
      addRevModel(row){
        this.revNoData={
          site:row.site,
          oriCodeNo:row.oriCodeNo,
          oldCodeNo:row.codeNo,
          oldRevNo:row.revNo,
          revNo:'',
          testPartNo:row.testPartNo,
        }
        this.revNoFlag=true;
      },
      upBMRevNo(){
        this.$confirm('确定要升版?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          upBMRevNo(this.revNoData).then(({data}) => {
            if (data && data.code === 0) {
              this.$message.success( '操作成功')
              this.revNoFlag=false;
              this.search();
            } else {
              this.$message.error(data.msg)
            }
          })
        }).catch(() => {
        })
      },
      //导出excel
      async createExportData() {
        this.searchData.limit = -1
        this.searchData.page = 1
        await technicalSpecificationListSearch(this.searchData).then(({data}) => {
          this.exportList= data.page.list;
        })

        return this.exportList;
      },
      startDownload() {
        //  this.exportData = this.dataList

      },
      finishDownload() {
      },
      fields() {
        let json = "{"
        this.columnList1.forEach((item, index) => {
          if (index == this.columnList1.length - 1) {
            json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
          } else {
            json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
          }
        })
        json += "}"
        let s = eval("(" + json + ")")

        return s
      },
      getApprovalList () {
        if (Object.keys(this.currentRow).length !== 0) {
          let tempData = {
            site: this.$store.state.user.site,
            menuId: this.$route.meta.menuId,
            documentNo:this.currentRow.codeNo
          }
          getApprovalList(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.approvalList = data.rows
            } else {
              this.approvalList = []
            }
          })
        }
      },
    },
  }
</script>

<style scoped>

</style>
