<template>
  <div class="mod-config">
    <!-- 条件查询 -->
    <el-form :inline="true" label-position="top" :model="searchData">
      <el-form-item :label="'BU'">
        <el-select v-model="searchData.buNo" placeholder="请选择" clearable style="width: 75px">
          <el-option
            v-for = "i in buList"
            :key = "i.buNo"
            :label = "i.buDesc"
            :value = "i.buNo">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'检验单号'">
        <el-input v-model="searchData.inspectionNo" clearable style="width: 140px"></el-input>
      </el-form-item>
      <el-form-item :label="'单据号'">
        <el-input v-model="searchData.poOrderNo" clearable style="width: 150px"></el-input>
      </el-form-item>
      <el-form-item :label="'单据行号'">
        <el-input v-model="searchData.poItemNo" clearable style="width: 75px"></el-input>
      </el-form-item>
      <el-form-item :label="'物料编码'">
        <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'物料名称'">
        <el-input v-model="searchData.partDesc" clearable style="width: 200px"></el-input>
      </el-form-item>
      <el-form-item :label="'SKU'">
        <el-input v-model="searchData.sku" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'PN'">
        <el-input v-model="searchData.cinvSourceCode" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'物料类别'">
        <el-input v-model="searchData.invdefinetype" clearable style="width: 120px"></el-input>
      </el-form-item>
    </el-form>
    <el-form :inline="true" label-position="top" :model="searchData">
      <el-form-item :label="'供应商'">
        <el-input v-model="searchData.supplierDesc" clearable style="width: 200px"></el-input>
      </el-form-item>
      <el-form-item :label="'质检员'">
        <el-input v-model="searchData.inspectorName" clearable style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'状态'">
        <el-select v-model="searchData.states" multiple style="width: 340px">
          <el-option label="未开始" value="未开始"></el-option>
          <el-option label="待检验" value="待检验"></el-option>
          <el-option label="待审核" value="待审核"></el-option>
          <el-option label="已完成" value="已完成"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'检验结论'">
        <el-select v-model="searchData.inspectionResult" clearable style="width: 80px">
          <el-option label="合格" value="合格"></el-option>
          <el-option label="不合格" value="不合格"></el-option>
          <el-option label="免检" value="免检"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'处置措施'">
        <el-select v-model="searchData.disposalMeasures" clearable style="width: 90px">
          <el-option
            v-for = "i in disposalMeasuresOptions"
            :key = "i.id"
            :label = "i.disposalMeasures"
            :value = "i.disposalMeasures">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'采购类型'">
        <el-select v-model="searchData.orderType" clearable style="width: 90px">
          <el-option label="采购订单" value="采购订单"></el-option>
          <el-option label="委外订单" value="委外订单"></el-option>
<!--          <el-option-->
<!--            v-for = "i in orderTypeList"-->
<!--            :key = "i.orderType"-->
<!--            :label = "i.orderType"-->
<!--            :value = "i.orderType">-->
<!--          </el-option>-->
        </el-select>
      </el-form-item>
      <el-form-item :label="'送检类型'">
        <el-select v-model="searchData.submissionType" clearable style="width: 90px">
          <el-option label="厂内使用" value="厂内使用"></el-option>
          <el-option label="外协使用" value="外协使用"></el-option>
          <el-option label="其他" value="其他"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <el-form :inline="true" label-position="top" :model="searchData">
      <el-form-item :label="'送检日期'">
        <el-date-picker style="width: 160px" v-model="searchData.startDate2" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="开始日期"></el-date-picker>
        -
        <el-date-picker style="width: 160px" v-model="searchData.endDate2" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item :label="'检验时间'">
        <el-date-picker style="width: 160px" v-model="searchData.startDate" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="开始日期"></el-date-picker>
        -
        <el-date-picker style="width: 160px" v-model="searchData.endDate" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item :label="' '">
        <el-button v-if="!authSearch" type="primary" :loading="searchLoading" @click="getDataList">查询</el-button>
        <el-button v-if="!authCheck" type="primary" @click="submitResult">审核</el-button>
        <el-button v-if="!authCancelCheck" type="primary" @click="cancelApproval">取消审核</el-button>
        <el-button v-if="!authDelete" type="primary" @click="deleteModal">删除</el-button>
        <el-button v-if="!authOverLoad" type="primary" @click="overLoadModal">任务重载</el-button>
        <el-button type="primary" @click="printList">打印</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
      :height="height"
      :data="dataList"
      border
      ref="IQCTable"
      @row-click="IQCClickRow"
      @selection-change="selectionIQC"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        :selectable="selectFlag"
        width="50">
      </el-table-column>
      <el-table-column
        prop="state"
        header-align="center"
        align="center"
        label="状态">
        <template slot-scope="scope">
          <div :style="{fontWeight:'bold', color: scope.row.state === '待检验' ? 'red' : scope.row.state === '待审核' ? '#ffa500e0' : scope.row.state === '已完成' ? '#3ac252' : ''}">
            {{ scope.row.state }}
          </div>
        </template>
      </el-table-column>
      <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
        fixed="right"
        header-align="center"
        align="center"
        width="130"
        label="操作">
        <template slot-scope="scope">
          <el-link style="cursor: pointer" v-if="!authDetail && scope.row.state === '未开始'" @click="actionModal(scope.row)">开始检验</el-link>
          <el-link style="cursor: pointer" v-if="!authDetail && scope.row.state !== '未开始'" @click="detailModal(scope.row)">检验单</el-link>
          <el-link style="cursor: pointer" v-if="!authFile" @click="getFileContentData(scope.row)">工作文件</el-link>
<!--          <a type="text" size="small" @click="submitResult(scope.row)">审核</a>-->
<!--          <a type="text" size="small" @click="deleteModal(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, 200, 500]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    <!-- 检验单详情页 -->
    <el-dialog title="检验明细清单" :close-on-click-modal="false" v-drag :visible.sync="detailInformationFlag" width="1200px">
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'物料编码'">
          <el-input v-model="detailData.partNo" disabled style="width: 100px"></el-input>
        </el-form-item>
        <el-form-item :label="'物料类别'">
          <el-input v-model="detailData.invdefinetype" readonly style="width: 100px"></el-input>
        </el-form-item>
        <el-form-item :label="'PN'">
          <el-input v-model="detailData.cinvSourceCode" readonly style="width: 100px"></el-input>
        </el-form-item>
        <el-form-item :label="'SKU'">
          <el-input v-model="detailData.sku" readonly style="width: 100px"></el-input>
        </el-form-item>
        <el-form-item :label="'物料名称'">
          <el-input v-model="detailData.partDesc" disabled style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item :label="'单位'">
          <el-input v-model="detailData.umId" disabled style="width: 60px"></el-input>
        </el-form-item>
        <el-form-item>
          <span v-if="detailData.submitFlag === 'Y'" slot="label">协同人员</span>
          <span v-else style="cursor: pointer" slot="label" @click="getOperatorList"><a>协同人员</a></span>
          <el-input v-model="detailData.operatorName" readonly style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item>
          <span v-if="detailData.submitFlag === 'Y'" slot="label">责任人</span>
          <span v-else style="cursor: pointer" slot="label" @click="getResponsiblePersonList"><a>责任人</a></span>
          <el-input v-model="detailData.responsiblePersonName" readonly style="width: 150px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'到货数量'">
          <el-input-number :controls="false" :step="0" v-model="detailData.rollQty" disabled style="width: 81px"></el-input-number>
        </el-form-item>
        <el-form-item :label="'送检数量'">
          <el-input-number :controls="false" :step="0" v-model="detailData.rollCount" style="width: 81px" @change="noRollCountChange"></el-input-number>
        </el-form-item>
        <el-form-item :label="'抽样数量'">
          <el-input-number :controls="false" :step="0" v-model="detailData.samplingQty" style="width: 81px" @change="noSamplingQtyChange"></el-input-number>
        </el-form-item>
        <el-form-item :label="'合格数量'">
          <el-input-number :controls="false" :step="0" :min="0" :max="Number(detailData.samplingQty) || 0" v-if="detailData.submitFlag === 'Y'" v-model="detailData.passQty" disabled style="width: 81px" @change="noPassQtyChange"></el-input-number>
          <el-input-number :controls="false" :step="0" :min="0" :max="Number(detailData.samplingQty) || 0" v-else v-model="detailData.passQty" style="width: 81px" @change="noPassQtyChange"></el-input-number>
        </el-form-item>
        <el-form-item :label="'不合格数量'">
          <el-input-number :controls="false" :step="0" :min="0" :max="Number(detailData.samplingQty) || 0" v-if="detailData.submitFlag === 'Y'" v-model="detailData.notPassQty" disabled style="width: 81px"></el-input-number>
          <el-input-number :controls="false" :step="0" :min="0" :max="Number(detailData.samplingQty) || 0" v-else v-model="detailData.notPassQty" style="width: 81px" @change="noNotPassQtyChange"></el-input-number>
        </el-form-item>
        <el-form-item :label="'不合格项目数量'">
          <el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="detailData.unqualifiedQty" disabled style="width: 81px" @change="noBatchQualifiedQtyChange"></el-input-number>
          <el-input-number :controls="false" :step="0" v-else v-model="detailData.unqualifiedQty" style="width: 81px" @change="noUnqualifiedQtyChange"></el-input-number>
        </el-form-item>
        
        <el-form-item :label="'批次不合格数'">
          <el-input-number :controls="false" :step="0" :min="0" v-model="detailData.noBatchQualifiedQty" style="width: 81px" @change="noBatchQualifiedQtyChange"></el-input-number>
        </el-form-item>
        <el-form-item :label="'批次合格数'">
          <el-input-number :controls="false" :step="0" :min="0" v-model="detailData.batchQualifiedQty" disabled style="width: 81px"></el-input-number>
        </el-form-item>
        <el-form-item style="margin-top: 13px;margin-left: 332px">
          <el-button v-if="detailData.submitFlag !== 'Y'" :loading="loadFlag" @click="dataAcquisition">
            <svg t="1739002700745" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="38076" width="22" height="22"><path d="M922.000696 762.746435V465.363478l55.652174-0.111304v299.542261c0 131.695304-106.562783 239.571478-236.922435 239.571478H285.42887C155.158261 1004.365913 48.484174 896.623304 48.484174 764.794435V465.252174h59.258435v299.542261c0 101.843478 77.022609 179.712 177.775304 179.712H740.841739c100.61913 0 181.158957-79.916522 181.158957-181.76z" fill="#1D293F" p-id="38077"></path><path d="M290.148174 192.556522c20.301913-20.925217 30.47513-48.617739 30.47513-83.099826 0-72.548174-36.285217-108.833391-108.722087-108.833392H141.401043v223.365566h70.255305c32.055652-0.111304 58.167652-10.529391 78.491826-31.432348z m-105.227131-7.635479V39.446261h23.596522c19.70087 0 35.661913 6.166261 47.994435 18.632348 12.354783 12.466087 18.387478 29.740522 18.387478 52.001391 0 22.973217-5.921391 41.22713-17.652869 54.650435s-27.937391 20.190609-48.617739 20.190608H184.921043zM634.434783 595.366957h-84.057044V498.866087a102.511304 102.511304 0 0 0 74.262261-98.54887c0-56.230957-45.478957-102.310957-101.10887-102.310956-55.629913 0-101.086609 46.08-101.086608 102.310956 0 46.08 30.586435 85.25913 72.192 97.947826v96.990609h-81.252174c-16.829217-43.78713-50.688-99.283478-81.65287-143.070609a101.331478 101.331478 0 0 0 14.269218-52.001391c0-56.230957-45.946435-102.310957-102.177392-102.310956s-102.177391 46.08-102.177391 102.310956c0 56.230957 45.946435 102.310957 102.177391 102.310957 15.716174 0 30.72-3.628522 44.009739-10.017392 21.170087 34.326261 42.829913 74.351304 57.811479 102.778435h-73.906087l128.333913 130.493218 94.675478-108.966957v145.853217h-111.616l148.034783 148.858435 130.715826-148.858435h-111.504696v-129.402434l91.180522 92.516174 113.307826-130.248348h-53.203478c14.758957-28.42713 36.173913-68.452174 57.210434-102.800696 13.178435 6.41113 27.937391 10.039652 43.542261 10.039652 55.629913 0 101.086609-46.08 101.086609-102.310956 0-56.230957-45.456696-102.310957-101.086609-102.310957-55.652174 0-101.220174 46.08-101.220174 102.310957a102.4 102.4 0 0 0 14.135653 52.001391c-30.72 43.653565-64.200348 99.283478-80.896 142.937044z m-390.611479-148.48a46.614261 46.614261 0 0 1-46.436174-46.458435c0-25.510957 20.925217-46.436174 46.436174-46.436174s46.436174 20.925217 46.436174 46.436174-20.925217 46.436174-46.436174 46.436174z m279.819131 0c-25.266087 0-45.946435-20.925217-45.946435-46.458435 0-25.510957 20.702609-46.436174 45.968696-46.436174 25.266087 0 45.946435 20.925217 45.946434 46.436174s-20.680348 46.436174-45.946434 46.436174z m278.639304-93.005914c25.288348 0 45.968696 20.925217 45.968696 46.436174s-20.702609 46.436174-45.968696 46.436174c-25.266087 0-45.946435-20.925217-45.946435-46.436174s20.680348-46.436174 45.946435-46.436174zM395.130435 172.722087h74.128695l15.248696 51.155478h47.415652L458.707478 0.623304h-51.155478L332.8 223.98887h47.170783l15.11513-51.266783z m32.768-114.777044c1.825391-6.032696 3.027478-12.332522 3.517217-18.854956h1.202087c0.601043 8.102957 1.691826 14.514087 3.138783 19.456l23.218087 77.401043h-54.405566l23.329392-78.002087z m168.96 165.932522h43.631304V39.446261h58.189913V0.623304h-159.877565v38.956522h58.056348v184.297739z m169.894956-51.155478h74.128696l15.248696 51.155478h47.415652L830.330435 0.623304h-51.155478l-74.752 223.365566h47.193043l15.09287-51.266783z m32.768-114.777044c1.825391-6.032696 3.027478-12.332522 3.517218-18.854956h1.202087c0.601043 8.102957 1.691826 14.514087 3.161043 19.456l23.218087 77.401043h-54.427826l23.329391-78.002087z" fill="#FD9F01" p-id="38078"></path></svg>
          </el-button>
          <el-button @click="getFileContentData(detailData)">
            <svg t="1739002974630" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="59598" width="22" height="22"><path d="M807.3216 889.5488H221.184c-78.7456 0-142.848-64.1024-142.848-142.848V286.976c0-78.7456 64.1024-142.848 142.848-142.848h178.8416c20.7872 0 40.7552 8.8064 54.784 24.1664l77.568 85.0944c2.4064 2.6112 5.8368 4.1472 9.3696 4.1472h265.5232c78.7456 0 142.848 64.1024 142.848 142.848v346.2656c0.0512 78.7968-64.0512 142.8992-142.7968 142.8992zM221.184 205.568c-44.9024 0-81.408 36.5056-81.408 81.408v459.6736c0 44.9024 36.5056 81.408 81.408 81.408h586.1376c44.9024 0 81.408-36.5056 81.408-81.408V400.4352c0-44.9024-36.5056-81.408-81.408-81.408h-265.5232c-20.7872 0-40.7552-8.8064-54.784-24.1664L409.3952 209.7152c-2.4064-2.6112-5.8368-4.1472-9.3696-4.1472H221.184z" fill="#6FB1F9" p-id="59599"></path><path d="M466.0224 453.8368H249.0368c-16.9472 0-30.72-13.7728-30.72-30.72s13.7728-30.72 30.72-30.72h216.9856c16.9472 0 30.72 13.7728 30.72 30.72s-13.7728 30.72-30.72 30.72z" fill="#6FB1F9" p-id="59600"></path></svg>
          </el-button>
          <el-button @click="subDetailUpload">
            <svg t="1739002903501" class="icon" viewBox="0 0 1550 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="50418" width="22" height="22"><path d="M985.000229 727.917714c20.48 0 34.113829-13.663086 34.113828-34.143085 0-10.24-3.393829-17.056914-10.24-23.873829l-204.8-204.8c-6.816914-6.846171-13.633829-10.24-23.873828-10.24-10.24 0-17.086171 3.393829-23.903086 10.24l-204.8 204.8c-6.816914 6.816914-10.24 13.633829-10.24 23.873829 0 20.48 13.663086 34.143086 34.143086 34.143085 10.24 0 17.056914-3.423086 23.873828-10.24l146.783086-146.783085v395.966171c0 20.48 13.663086 34.113829 34.143086 34.113829s34.113829-13.633829 34.113828-34.113829V570.894629l146.783086 146.783085c6.816914 6.816914 13.663086 10.24 23.903086 10.24z m282.799542-353.045943c0-10.24 1.287314-17.086171 0-27.296914C1240.502857 128.117029 1043.0464 29.257143 858.199771 29.257143 701.205943 29.257143 564.662857 117.994057 496.405943 247.720229 469.079771 240.874057 441.782857 234.057143 414.485943 234.057143 281.365943 234.057143 175.542857 307.112229 175.542857 440.232229c0 17.056914 3.423086 34.113829 6.816914 51.2C97.514057 535.786057 29.257143 585.5232 29.257143 723.031771c0 170.656914 136.543086 277.942857 307.2 277.942858H585.142857c20.48 0 34.143086-13.633829 34.143086-34.113829S605.622857 932.717714 585.142857 932.717714h-248.685714c-133.12 0-238.943086-76.565943-238.943086-209.685943 0-82.797714 37.566171-131.657143 105.325714-166.765714l58.046172-20.48-13.663086-61.44c-3.423086-10.24-3.423086-23.873829-3.423086-34.113828 0-95.583086 75.103086-137.918171 170.686172-137.918172 20.48 0 37.536914 3.423086 58.016914 10.24l54.623086 20.48 27.296914-51.2c61.44-112.64 179.317029-198.100114 303.776914-184.32 184.846629 20.48 309.511314 71.68 341.343086 250.0608 1.199543 6.787657 0 10.24 0 17.056914v6.846172l-3.423086 47.776914 44.383086 20.48c110.094629 34.6112 222.354286 143.36 222.354286 249.183086 0 150.176914-122.88 243.799771-273.056914 243.799771h-214.571886c-20.48 0-34.113829 13.663086-34.113829 34.143086s13.633829 34.113829 34.113829 34.113829h214.571886c187.713829 0 341.313829-124.342857 341.313828-312.056686 0-144.530286-121.270857-269.663086-263.314286-314.046172z" fill="#6C5FFC" p-id="50419"></path></svg>
          </el-button>
        </el-form-item>
<!--        <el-form-item label="检验员">-->
<!--          <el-select v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectorNo" disabled placeholder="请选择" style="width: 100px">-->
<!--            <el-option-->
<!--              v-for = "i in options"-->
<!--              :key = "i.inspectorNo"-->
<!--              :label = "i.inspectorName"-->
<!--              :value = "i.inspectorNo">-->
<!--            </el-option>-->
<!--          </el-select>-->
<!--          <el-select v-else v-model="detailData.inspectorNo" disabled placeholder="请选择" style="width: 100px">-->
<!--            <el-option-->
<!--              v-for = "i in options"-->
<!--              :key = "i.inspectorNo"-->
<!--              :label = "i.inspectorName"-->
<!--              :value = "i.inspectorNo">-->
<!--            </el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->
      </el-form>
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'检验结论'">
          <el-select v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectionResult" disabled style="width: 100px" placeholder="请选择">
            <el-option label="合格" value="合格"></el-option>
            <el-option label="不合格" value="不合格"></el-option>
          </el-select>
          <el-select v-else v-model="detailData.inspectionResult" @change="resultChange" style="width: 100px" placeholder="请选择">
            <el-option label="合格" value="合格"></el-option>
            <el-option label="不合格" value="不合格"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="'质检备注'">
          <el-input v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectionRemark" disabled style="width: 293px"></el-input>
          <el-input v-else v-model="detailData.inspectionRemark" style="width: 293px"></el-input>
        </el-form-item>
        <el-form-item v-show="detailData.inspectionResult === '不合格'" style="margin-top: 5px">
          <el-form-item :label="'处置措施'">
            <el-select v-if="detailData.submitFlag === 'Y'" clearable v-model="detailData.disposalMeasures" disabled style="width: 100px">
              <el-option
                v-for = "i in disposalMeasuresOptions"
                :key = "i.id"
                :label = "i.disposalMeasures"
                :value = "i.disposalMeasures">
              </el-option>
            </el-select>
            <el-select v-else clearable v-model="detailData.disposalMeasures" style="width: 100px">
              <el-option
                v-for = "i in disposalMeasuresOptions"
                :key = "i.id"
                :label = "i.disposalMeasures"
                :value = "i.disposalMeasures">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="'处置说明'">
            <el-input v-if="detailData.submitFlag === 'Y'" v-model="detailData.disposalRemark" disabled style="width: 293px"></el-input>
            <el-input v-else v-model="detailData.disposalRemark" style="width: 293px"></el-input>
          </el-form-item>
        </el-form-item>
      </el-form>
      <!-- 展示列表 -->
      <div class="rq ">
        <el-table
          :height="500"
          :data="detailList"
          border
          style="width: 100%;">
          <el-table-column
            prop=""
            header-align="center"
            align="center"
            min-width="90"
            label="操作">
            <template slot-scope="scope">
              <el-button class="el-icon-picture" type="primary" @click="uploadImageModal(scope.row)"></el-button>
              <el-button style="margin-left: 2px" class="el-icon-s-platform" type="primary" :loading="loadFlag" @click="dataAcquisitionByItem(scope.row)"></el-button>
            </template>
          </el-table-column>
          <el-table-column
            v-for="(item,index) in detailColumnList" :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
            prop=""
            header-align="center"
            align="right"
            min-width="80"
            label="实测值">
            <template slot-scope="scope">
              <el-input :ref="`textValue${scope.$index}`" v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numberValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" type="number" @change="updateItemResult(scope.row)" style="height: 11px; width: 98%"></el-input>
              <el-input :ref="`textValue${scope.$index}`" v-else v-model="scope.row.textValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" style="height: 11px; width: 98%"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop=""
            header-align="center"
            align="center"
            min-width="80"
            label="检验明细">
            <template slot-scope="scope">
              <el-button v-if="scope.row.subDetailRecordNum > 0" type="success" @click="subDetailModal(scope.row) ">点击输入</el-button>
              <el-button v-else type="primary" @click="subDetailModal(scope.row) ">点击输入</el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop=""
            header-align="center"
            align="right"
            min-width="80"
            label="抽样数量">
            <template slot-scope="scope">
              <el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.samplingQty" disabled style="height: 11px; width: 98%"></el-input-number>
              <el-input-number :controls="false" :step="0" v-else :ref="`samplingQty${scope.$index}`" v-model="scope.row.samplingQty" @keyup.enter.native="focusNextInput(scope.$index, 'samplingQty')" style="height: 11px; width: 98%"></el-input-number>
            </template>
          </el-table-column>
          <el-table-column
            prop=""
            header-align="center"
            align="right"
            min-width="80"
            label="不合格数量">
            <template slot-scope="scope">
              <el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.unqualifiedQuantity" disabled style="height: 11px; width: 98%"></el-input-number>
              <el-input-number :controls="false" :step="0" v-else :ref="`unqualifiedQuantity${scope.$index}`" v-model="scope.row.unqualifiedQuantity" @keyup.enter.native="focusNextInput(scope.$index, 'unqualifiedQuantity')" style="height: 11px; width: 98%"></el-input-number>
            </template>
          </el-table-column>
          <el-table-column
            prop=""
            header-align="center"
            align="right"
            min-width="90"
            label="项目检验结论">
            <template slot-scope="scope">
              <el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.itemResult" disabled style="height: 11px;padding: 0px" >
                <el-option label="合格" value="Y" style="color: green"></el-option>
                <el-option label="不合格" value="N" style="color: red"></el-option>
              </el-select>
              <el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-else v-model="scope.row.itemResult" style="height: 11px;padding: 0px" placeholder="合格">
                <el-option label="合格" value="Y" style="color: green"></el-option>
                <el-option label="不合格" value="N" style="color: red"></el-option>
              </el-select>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button v-if="detailData.state === '待检验'" type="primary" :loading="transferLoadFlag" @click="Transfer('1')">应用</el-button>
        <el-button v-if="detailData.state === '待检验' || detailData.state === '待审核'" type="primary" :loading="transferLoadFlag" @click="Transfer('2')">保存</el-button>
        <el-button type="primary" @click="detailInformationFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="任务重载-更换物料" :close-on-click-modal="false" v-drag :visible.sync="iqcRecordOverFlag" width="425px">
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'物料编码'">
          <span  slot="label" @click="overLoadSearchPartInfo()"><a herf="#">物料编码:</a></span>
          <el-input v-model="iqcRecordOverPartNo" disabled style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item :label="'物料名称'">
          <el-input v-model="iqcRecordOverPartDesc" disabled style="width: 230px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'供应商编码'">
          <span  slot="label" @click="getManufacturerList()"><a herf="#">供应商编码:</a></span>
          <el-input v-model="iqcRecordOverSupplierNo" disabled style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item :label="'供应商'">
          <el-input v-model="iqcRecordOverSupplierDesc" disabled style="width: 230px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:35px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="overLoadModal3">确定</el-button>
        <el-button type="primary" @click="iqcRecordOverFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="物料属性" :close-on-click-modal="false" v-drag :visible.sync="iqcRecordOverFlag2" width="350px">
      <el-form :inline="true" label-position="top">
        <el-form-item label="BU" prop="bu">
          <el-select v-model="iqcRecordOverModal.buDesc" disabled style="width: 295px">
            <el-option
              v-for = "i in userBuList"
              :key = "i.buNo"
              :label = "i.sitename"
              :value = "i.buDesc">
              <span style="float: left;width: 100px">{{ i.sitename }}</span>
              <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
                {{ i.buDesc }}
              </span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="'物料编码'">
          <el-input v-model="iqcRecordOverModal.partNo"  style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item :label="'物料名称'">
          <el-input v-model="iqcRecordOverModal.partDesc"  style="width: 120px"></el-input>
          <el-button type="primary" @click="overLoadSearchPartInfo()" >查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="300"
        :data="overLoadPartList"
        @row-dblclick="getRowData1"
        border
        style="width: 100%;">
        <el-table-column
          prop="partNo"
          header-align="center"
          align="center"
          width="100"
          label="物料编码">
        </el-table-column>
        <el-table-column
          prop="partDesc"
          header-align="center"
          align="center"
          width="240"
          label="物料名称">
        </el-table-column>
      </el-table>
      <el-footer style="height:35px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="iqcRecordOverFlag2 = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 供应商 -->
    <el-dialog title="供应商清单" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="520px">
      <div class="rq">
        <el-form :inline="true" label-position="top">
          <el-form-item :label="'供应商编码:'">
            <el-input v-model="manufacturerData.manufacturerID" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="'供应商名称:'">
            <el-input v-model="manufacturerData.manufacturerName" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="' '">
            <el-button type="primary" @click="getManufacturerList()">查询</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :height="300"
          :data="manufacturerList"
          ref="manufacturerTable"
          @row-dblclick="manufacturerClickRow"
          border
          style="width: 100%;">
          <el-table-column
            prop="manufacturerID"
            header-align="center"
            align="center"
            label="供应商编码">
          </el-table-column>
          <el-table-column
            prop="manufacturerName"
            header-align="center"
            align="center"
            label="供应商名称">
          </el-table-column>
        </el-table>
      </div>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="manufacturerModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 文件清单 -->
    <el-dialog title="文件清单" :close-on-click-modal="false" v-drag :visible.sync="fileFlag" width="800px">
      <el-form :inline="true" label-position="top">
        <el-form-item v-if="detailInformationFlag">
          <el-button type="primary" @click="addUploadFileModal">上传文件</el-button>
        </el-form-item>
      </el-form>
      <iqc-file-table :columns="fileColumnList" :data-list="fileContentList" :query-loading="fileLoading" @file-deleted="() => getFileContentData(fileRow)"></iqc-file-table>
      <el-footer style="height:35px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="fileFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 子明细信息 -->
    <el-dialog title="子明细信息" :close-on-click-modal="false" v-drag :visible.sync="subDetailFlag" width="1102px">
      <el-button type="success" icon="el-icon-plus" size="mini" @click="handleAddBtn(subDetailData)">添加</el-button>
      <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteBtn(subDetailData)">删除</el-button>
      <el-button type="primary" icon="el-icon-more" size="mini" @click="batchHandleAdd(subDetailData)">批量新增</el-button>
      <div class="rq ">
        <el-table
          :height="400"
          :data="templateTableData"
          border
          v-loading="subDetailLoading"
          element-loading-text="拼命加载中"
          :row-class-name="rowClassName"
          @selection-change="handleDetailSelectionChange"
          style="width: 100%;">
          <el-table-column type="selection" align="center" width="40"></el-table-column>
          <el-table-column label="序号" align="center" prop="num" width="50"></el-table-column>
          <el-table-column prop="samplingLocation" header-align="center" align="center" :required="true" label="抽样位置A" width="120">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].samplingLocation" readonly placeholder="请输入抽样位置A"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `a`" v-model="templateTableData[row.xh-1].samplingLocation" @keyup.enter.native="nextFocus1(row.xh-1)" placeholder="请输入抽样位置A"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="samplingLocationB" header-align="center" align="center" :required="true" label="抽样位置B" width="120">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].samplingLocationB" readonly placeholder="请输入抽样位置B"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `b`" v-model="templateTableData[row.xh-1].samplingLocationB" @keyup.enter.native="nextFocus2(row.xh-1)" placeholder="请输入抽样位置B"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="subDetailValue" header-align="center" align="center" :required="true" label="实测值A" width="150">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].subDetailValue" readonly placeholder="请输入实测值A"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `c`" v-model="templateTableData[row.xh-1].subDetailValue" @keyup.enter.native="nextFocus3(row.xh-1)" placeholder="请输入实测值A"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="subDetailValueB" header-align="center" align="center" :required="true" label="实测值B" width="150">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].subDetailValueB" readonly placeholder="请输入实测值B"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `d`" v-model="templateTableData[row.xh-1].subDetailValueB" @keyup.enter.native="nextFocus4(row.xh-1)" placeholder="请输入实测值B"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="subDetailValueC" header-align="center" align="center" :required="true" label="实测值C" width="150">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].subDetailValueC" readonly placeholder="请输入实测值C"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `e`" v-model="templateTableData[row.xh-1].subDetailValueC" @keyup.enter.native="nextFocus5(row.xh-1)" placeholder="请输入实测值C"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="subDetailValueD" header-align="center" align="center" :required="true" label="实测值D" width="150">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].subDetailValueD" readonly placeholder="请输入实测值D"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `f`" v-model="templateTableData[row.xh-1].subDetailValueD" @keyup.enter.native="nextFocus6(row.xh-1)" placeholder="请输入实测值D"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="subDetailValueE" header-align="center" align="center" :required="true" label="实测值E" width="150">
            <template slot-scope="{row}">
              <el-input v-if="templateTableData[row.xh-1].isSubmit === 'Y'" v-model="templateTableData[row.xh-1].subDetailValueE" readonly placeholder="请输入实测值E"></el-input>
              <el-input v-else :ref="`${row.xh-1}` + `g`" v-model="templateTableData[row.xh-1].subDetailValueE" @keyup.enter.native="nextFocus7(row.xh-1)" placeholder="请输入实测值E"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页-->
        <el-pagination
          @size-change="sizeChangeHandle2"
          @current-change="currentChangeHandle2"
          :current-page="pageIndex2"
          :page-sizes="[20, 50, 100, 200, 500]"
          :page-size="pageSize2"
          :total="tableData.length"
          layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
      </div>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button v-if="detailData.submitFlag !== 'Y'" type="primary" :loading="subDetailVisiable" @click="saveSubDetailResult">保存</el-button>
        <el-button type="primary" @click="subDetailFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 批量新增子明细操作-->
    <el-dialog title="批量新增" :close-on-click-modal="false" v-drag :visible.sync="batchHandleAddModalFlag" width="510px">
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'默认抽样位置A'">
          <el-input v-model="batchAddData.samplingLocation" style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item :label="'默认抽样位置B'">
          <el-input v-model="batchAddData.samplingLocationB" style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item :label="'抽样数量'">
          <el-input type="number" v-model="batchAddData.samplingNumber" style="width: 150px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="batchHandleAddModal">保存</el-button>
        <el-button type="primary" @click="batchHandleAddModalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 机修人员清单 -->
    <el-dialog title="人员清单" :close-on-click-modal="false" v-drag :visible.sync="operatorModelFlag" width="820px">
      <div class="rq">
        <el-form :inline="true" label-position="top" :model="operatorData">
          <el-form-item v-if="operatorData.flag !== '2' || detailData.buNo !== '04-MHM'" :label="'所属角色'">
            <el-select v-model="operatorData.roleId" placeholder="请选择" style="width: 120px" @change="getOperatorList2">
              <el-option
                v-for = "i in roleList"
                :key = "i.roleId"
                :label = "i.roleName"
                :value = "i.roleId">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="'用户编码'">
            <el-input v-model="operatorData.adminID" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="'用户姓名'">
            <el-input v-model="operatorData.adminName" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="' '">
            <el-button type="primary" @click="getOperatorList2">查询</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :height="300"
          :data="operatorList"
          ref="operatorTable"
          @row-click="operatorClickRow"
          @selection-change="selectionChangeHandle2"
          border
          style="width: 100%;">
          <el-table-column
            type="selection"
            header-align="center"
            align="center"
            width="50">
          </el-table-column>
          <el-table-column
            v-for="(item,index) in operatorDetailList" :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>
      </div>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="confirmOperator">确认</el-button>
        <el-button type="primary" @click="operatorModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 配置项目设备 -->
    <el-dialog title="检验项目" :close-on-click-modal="false" v-drag :visible.sync="ItemObjectModelFlag" width="666px">
      <el-table
        :height="350"
        :data="itemObjectList"
        border
        style="width: 100%; ">
        <el-table-column
          v-for="(item,index) in itemObjectColumnList" :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"
          min-width="100"
          label="设备">
          <template slot-scope="scope">
            <el-select v-model="scope.row.equipmentNo" style="height: 11px" placeholder="请选择设备">
              <el-option
                v-for = "i in scope.row.objectList"
                :key = "i.objectID"
                :label = "i.objectDesc"
                :value = "i.objectID">
              </el-option>
            </el-select>
          </template>
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="actionModal2">保存</el-button>
        <el-button type="primary" @click="ItemObjectModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

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

    <!-- 上传文件的modal -->
    <qcFAIUploadFile ref="qcFAIUploadFile" @refreshPageTables="()=>{this.getFileContentData(this.detailData)}" v-drag></qcFAIUploadFile>

    <!-- 上传文件的modal -->
    <comQcItemImageUploadFile ref="comQcItemImageUploadFile" @refreshPageTables2="getInspectionFormData" v-drag></comQcItemImageUploadFile>

    <!-- 子明细导入 -->
    <subDetailUpload @changeEvent="changeMyString" ref="subDetailUpload" @refreshPageTables="getInspectionFormData" v-drag></subDetailUpload>

    <!-- 打印标签 -->
    <qr-code ref="qrCode"></qr-code>

  </div>
</template>

<script>
  import {
    qcIQCInspectionSearch, // IQC检验记录查询
    iqcDetailSearch, // iqc检验记录查询
    inspectorSearch, // 检验员查询
    selectIQCSubDetailedRecord, // 查询子明细记录
    checkIQCSubDetailValue, // 检查子明细中的实测值是否在规定范围
    saveIQCDetailedRecord, // 新增明细信息
    checkIQCIsSubmit, // 检查是否已提交
    saveIQCSubDetailed, // 新增子明细信息
    saveIQCSubmitResult, // 审核
    iqcRecordDelete, // 删除检验记录
    disposalMeasuresSearch, // 获取处置措施列表
    iqcRecordOverLoad, // 重载检验单
    getSiteAndBuByUserName,
    getSiteAndBuByUserName2,
    orderTypeSearch, // 获取采购类型
    actionIQCInspection, // 开始检验
    dataAcquisition, // 数据采集
    getIQCItemObjectList, // 查询项目设备
    dataAcquisitionByItem, // 根据项目数据采集
    cancelApproval, // 取消审核
    overLoadSearchPartInfo, // 查询物料属性信息
    getEamPropertiesItemByItemNo,
    getCollectorDataByItem,
    getResponsibleOperatorList,
  } from "@/api/qc/qc.js" 
  import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  import Chooselist from '@/views/modules/common/Chooselist_eam'
  import {getInspectionFile} from '@/api/eam/eam_object_list.js'
  import {
    deleteObjectFile,
    getUserRoleList, // 获取用户角色列表
    getOperatorList
  } from '@/api/eam/eam.js'
  import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  import {qcPrint} from '@/api/qc/qcPrint.js'
  import qcFAIUploadFile from "./qc_FAI_upload_file"
  import comQcItemImageUploadFile from "./com_qc_itemImage_upload_file"
  import subDetailUpload from "./sub_detail_upload"
  import QrCode from "../common/QrCode.vue";
  import IqcFileTable from "./IQCFileTable.vue";
  import {getManufacturerList, searchPartAttributeDetails} from "../../../api/qc/qc";
  export default {
    components: {
      IqcFileTable,
      QrCode,
      Chooselist,
      qcFAIUploadFile,
      comQcItemImageUploadFile,
      subDetailUpload
    },
    computed: {
      templateTableData () {
        let start = (this.pageIndex2 - 1) * this.pageSize2
        let end = start + this.pageSize2
        if (end > this.tableData.length){
          end = this.tableData.length
        }
        return this.tableData.slice(start,end)
      },
    },
    watch: {
          detailData: {
          deep: true,
          handler: function (newV, oldV) {
            const samplingQty = Number(this.detailData.samplingQty)
            const passQty = Number(this.detailData.passQty)
            if (!Number.isNaN(samplingQty) && !Number.isNaN(passQty) && passQty > samplingQty) {
              this.$set(this.detailData, 'passQty', samplingQty)
              return
            }
            if (this.detailData.inspectionResult === '不合格') {
              if (this.detailData.disposalMeasures === '让步接收') {
                this.detailData.batchQualifiedQty = this.detailData.rollQty
              } else if (this.detailData.disposalMeasures === '返工返修' || this.detailData.disposalMeasures === '拒收退回') {
                this.detailData.batchQualifiedQty = 0
              } else if (this.detailData.disposalMeasures === '挑选使用') {
                this.detailData.batchQualifiedQty = this.detailData.rollQty - this.detailData.notPassQty
              }
            } else if (this.detailData.inspectionResult === '合格'){
              this.detailData.batchQualifiedQty = this.detailData.rollQty
            }
          }
      },
      detailList: {
        deep: true,
        handler: function (newV, oldV) {
          let num2 = 0
          for (let i = 0; i < this.detailList.length; i++) {
            if (this.detailList[i].itemResult === 'N') {
              num2++
            }
          }
          this.detailData.unqualifiedQty = num2
        }
      },
    },
    data () {
      return {
        loadFlag: false,
        transferLoadFlag: false,
        // 是否收藏
        favorite: false,
        // 导出 start
        exportData: [],
        exportName: "IQC检验录入" + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["IQC检验录入"],
        exportFooter: [],
        exportList: [],
        // 导出 end
        submitData: {
          site: '',
          inspectionNo: '',
          isQualified: '',
          isQualifiedChinese: '',
          submitList: [],
          updateBy: this.$store.state.user.name,
        },
        tagNo:'',
        searchData: {
          site: '',
          userName: this.$store.state.user.name,
          inspectionNo: '',
          inspectionTypeNo:'105',
          isQualified: '',
          buNo: '',
          startDate: '',
          endDate: '',
          startDate2: '',
          endDate2: '',
          partNo:'',
          partDesc:'',
          cinvSourceCode:'',
          sku:'',
          state: '',
          inspectionResult: '',
          supplierDesc: '',
          disposalMeasures: '',
          inspectorName: '',
          page: 1,
          limit: 10,
          poOrderNo: '',
          poItemNo: '',
          orderType: '',
          states: ['未开始','待检验'],
          submissionType: '',
          invdefinetype: ''
        },
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0,
        pageIndex2: 1,
        pageSize2: 20,
        totalPage2: 0,
        height: 200,
        dataList: [],
        dataListSelections: [],
        submitFlag: false,
        modalData: {
          flag:'',
          functionType:'',
          site: '',
          bu: '',
          inspectionNo:'',
          workOrderNumber: '',
          workOrderQuantity: '',
          reelNumber: '',
          partNo: '',
          cinvSourceCode:'',
          rollingQuantity: '',
          sampleQuantity: '',
          detailCodeNo:'',
          detailCodeDesc:'',
          inspectionTypeNo:'105',
          inspectionTypeName:'IQC',
          inspectorNo:'',
          inspectorName:'',
          isQualified:'',
          isQualifiedChinese:'',
          invdefinetype: '',
        },
        // 展示列集
        // columnList1: [],
        columnList1: [
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1BuDesc',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'buDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: 'BU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1InspectionNo',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectionNo',
            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: 301006,
            serialNumber: '301006Table1InspectionResult',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectionResult',
            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: 301006,
            serialNumber: '301006Table1TaskDate',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'taskDate',
            headerAlign: "center",
            align: "center",
            columnLabel: '送检日期',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1InspectionCycle',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectionCycle',
            headerAlign: "center",
            align: "right",
            columnLabel: '检验周期(h)',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1RollNo',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'rollNo',
            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: 301006,
            serialNumber: '301006Table1PartNo',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'partNo',
            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: 301006,
            serialNumber: '301006Table1PartDesc',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'partDesc',
            headerAlign: "center",
            align: "left",
            columnLabel: '物料名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 300,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1SKU',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'sku',
            headerAlign: "center",
            align: "center",
            columnLabel: 'SKU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1CinvSourceCode',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'cinvSourceCode',
            headerAlign: "center",
            align: "center",
            columnLabel: 'PN',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1Invdefinetype',
            tableId: "301006Table1",
            tableName: "IPQC检验记录表",
            columnProp: 'invdefinetype',
            headerAlign: "center",
            align: "left",
            columnLabel: '物料类别',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1Umid',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'umId',
            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: 301006,
            serialNumber: '301006Table1RollQty',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'rollQty',
            headerAlign: "center",
            align: "right",
            columnLabel: '到货数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1RollCount',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'rollCount',
            headerAlign: "center",
            align: "right",
            columnLabel: '送检数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1SamplingQty',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'samplingQty',
            headerAlign: "center",
            align: "right",
            columnLabel: '抽样数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1PoOrderNo',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'poOrderNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '单据号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 130,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1OrderType',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'orderType',
            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: 301006,
            serialNumber: '301006Table1SubmissionType',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'submissionType',
            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: 301006,
            serialNumber: '301006Table1PoItemNo',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'poItemNo',
            headerAlign: "center",
            align: "right",
            columnLabel: '单据行号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1SupplierDesc',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'supplierDesc',
            headerAlign: "center",
            align: "left",
            columnLabel: '供应商',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1InspectionRemark',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectionRemark',
            headerAlign: "center",
            align: "left",
            columnLabel: '质检备注',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1DisposalMeasures',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'disposalMeasures',
            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: 301006,
            serialNumber: '301006Table1DisposalRemark',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'disposalRemark',
            headerAlign: "center",
            align: "left",
            columnLabel: '处置说明',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1ActionDate',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'actionDate',
            headerAlign: "center",
            align: "center",
            columnLabel: '开始检验时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1InspectorDate',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectorDate',
            headerAlign: "center",
            align: "center",
            columnLabel: '检验时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1SubmitDate',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'submitDate',
            headerAlign: "center",
            align: "center",
            columnLabel: '审核时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1CancelCheckDate',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'cancelCheckDate',
            headerAlign: "center",
            align: "center",
            columnLabel: '取消审核时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 170,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table1InspectorName',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'inspectorName',
            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: 301006,
            serialNumber: '301006Table1SubmissionRemark',
            tableId: "301006Table1",
            tableName: "IQC检验记录表",
            columnProp: 'submissionRemark',
            headerAlign: "center",
            align: "left",
            columnLabel: '送检备注',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
        ],
        detailColumnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2ItemNo',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'itemNo',
            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: 301006,
            serialNumber: '301006Table2ItemDesc',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'itemDesc',
            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: 301006,
            serialNumber: '301006Table2SamplingLevelDesc',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'samplingLevelDesc',
            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: 301006,
            serialNumber: '301006Table2SamplingProgrammeDesc',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'samplingProgrammeDesc',
            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: 301006,
            serialNumber: '301006Table2MethodName',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'methodName',
            headerAlign: "center",
            align: "left",
            columnLabel: '检验方法',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2MethodRemark',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'methodRemark',
            headerAlign: "center",
            align: "left",
            columnLabel: '检验方法说明',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2ObjectDesc',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'objectDesc',
            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: 301006,
            serialNumber: '301006Table2Aql',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'aql',
            headerAlign: "center",
            align: "right",
            columnLabel: 'AQL',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2Ac',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'ac',
            headerAlign: "center",
            align: "right",
            columnLabel: 'AC',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2Re',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 're',
            headerAlign: "center",
            align: "right",
            columnLabel: 'RE',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2DefaultValue',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'defaultValue',
            headerAlign: "center",
            align: "right",
            columnLabel: '标准值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2MaxValue',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'maxValue',
            headerAlign: "center",
            align: "right",
            columnLabel: '最大值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2MinValue',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'minValue',
            headerAlign: "center",
            align: "right",
            columnLabel: '最小值',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301006,
            serialNumber: '301006Table2ValueType',
            tableId: "301006Table2",
            tableName: "检验单明细表",
            columnProp: 'valueType',
            headerAlign: "center",
            align: "center",
            columnLabel: '检测值类型',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
        ],
        fileColumnList: [
          {
            columnProp: 'fileName',
            headerAlign: "center",
            align: "center",
            columnLabel: '文件名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'createdBy',
            headerAlign: "center",
            align: 'center',
            columnLabel: '上传人',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: false
          },
          {
            columnProp: 'createDate',
            headerAlign: "center",
            align: 'center',
            columnLabel: '上传时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: false
          },
          {
            columnProp: 'orderRef3',
            headerAlign: "center",
            align: 'center',
            columnLabel: '备注',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: false
          },
        ],
        detailData: {
          site: '',
          buNo: '',
          inspectionNo: '',
          partNo: '',
          partDesc: '',
          cinvSourceCode:'',
          sku:'',
          rollQty: '',
          samplingQty: '',
          unqualifiedQty: 0,
          unqualifiedQuantity: '',
          disposalMeasures: '',
          disposalRemark: '',
          inspectionResult: '',
          inspectorNo: '',
          inspectionRemark: '',
          submitFlag: '',
          supplierNo: '',
          umId: '',
          rollCount: '',
          poOrderNo: '',
          poItemNo: '',
          operator: '',
          operatorName: '',
          responsiblePerson: '',
          responsiblePersonName: '',
          invdefinetype: '',
          state: '',
          passQty: '',
          notPassQty: '',
          batchQualifiedQty: '',
          noBatchQualifiedQty:'',
        },
        detailInformationFlag: false,
        iqcRecordOverFlag: false,
        iqcRecordOverFlag2: false,
        manufacturerModelFlag: false,
        manufacturerData: {
          site: '',
          manufacturerID: '',
          manufacturerName: ''
        },
        iqcRecordOverPartNo: '',
        iqcRecordOverPartDesc: '',
        iqcRecordOverSupplierNo: '',
        iqcRecordOverSupplierDesc: '',
        iqcRecordOverModal:{
          attributeType: 'A',
          userName: this.$store.state.user.name,
          page: 1,
          limit: 1000,
          partNo: '',
          partDesc: ''
        },
        overLoadPartList: [],
        manufacturerList: [],
        detailList: [],
        saveInformationData: {
          site: '',
          buNo: '',
          cinvSourceCode:'',
          inspectionNo:'',
          disposalMeasures: '',
          disposalRemark: '',
          inspectorNo: '',
          inspectionRemark: '',
          itemList:[],
          unqualifiedQty: '',
          rollCount: '',
          samplingQty: '',
          poOrderNo: '',
          poItemNo: '',
          partNo: '',
          partDesc: '',
          sku: '',
          operator: '',
          operatorName: '',
          responsiblePerson: '',
          responsiblePersonName: '',
          subDetailList: [],
          type: '',
          passQty: '',
          notPassQty: '',
          batchQualifiedQty: ''
        },
        // 子明细数据对象
        tableData: [],
        checkedDetail: [],
        subDetailFlag: false,
        subDetailData: {
          site: '',
          buNo: '',
          inspectionNo: '',
          itemNo: '',
          itemDesc: '',
          defaultValue: '',
          maxValue: '',
          minValue: '',
          valueTypeDb: '',
          subDetailValues:[],
          page: 1,
          limit: 10,
        },
        options: [],
        fileFlag: false,
        fileContentList: [],
        fileRow: {},
        IQCSelections: [],
        batchHandleAddModalFlag: false,
        batchAddData: {
          samplingLocation: '',
          samplingLocationB: '',
          samplingNumber: ''
        },
        disposalMeasuresOptions: [],
        orderTypeList: [],
        userBuList: [],
        buList: [],
        authSearch: false,
        authCheck: false,
        authCancelCheck: false,
        authOverLoad: false,
        authDelete: false,
        authDetail: false,
        authFile: false,
        menuId: this.$route.meta.menuId,
        roleList: [],
        defaultCollaborativeRoleName: 'IQC操作员',
        operatorList: [],
        operatorData: {
          flag: '',
          site: '',
          bu: '',
          adminID: '',
          adminName: '',
          roleName: '',
          roleId: '',
          userName: this.$store.state.user.name
        },
        operatorModelFlag: false,
        dataListSelections2: [],
        operatorDetailList: [
          {
            columnProp: 'adminID',
            headerAlign: "center",
            align: "center",
            columnLabel: '用户账号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'adminName',
            headerAlign: "center",
            align: "center",
            columnLabel: '用户名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'email',
            headerAlign: "center",
            align: "center",
            columnLabel: '邮箱',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'phone',
            headerAlign: "center",
            align: "center",
            columnLabel: '手机号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
        ],
        acquisitionList: [],
        ItemObjectModelFlag: false,
        itemObjectList: [],
        itemObjectColumnList: [
          {
            columnProp: 'itemNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '项目编码',
            columnHidden: false,
            columnImage: false,
            status: true,
          },
          {
            columnProp: 'itemDesc',
            headerAlign: "center",
            align: "left",
            columnLabel: '项目名称',
            columnHidden: false,
            columnImage: false,
            status: true,
          },
        ],
        actionData: {
          site: '',
          buNo: '',
          inspectionNo: ''
        },
        fileLoading: false,
        subDetailLoading: false,
        searchLoading: false,
        subDetailVisiable: false,
      }
    },

    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight - 250
      })
    },

    created () {
      // 按钮控制
      this.getButtonAuthData()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName2()
      this.favoriteIsOk()
      this.disposalMeasuresSearch()
      //this.orderTypeSearch()
      // 动态列
      this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
      this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
      if (!this.authSearch) {
        // 获取数据列表
        this.getDataList()
      }
      // 获取用户角色
      this.getUserRoleList()
    },

    methods: {

      // 获取用户的bu
      getSiteAndBuByUserName2 () {
        let tempData = {
          username: this.$store.state.user.name,
        }
        getSiteAndBuByUserName2(tempData).then(({data}) => {
          if (data.code === 0) {
            this.buList = data.rows
          }
        })
      },

      // 批量打印标签
      printList () {
        if (this.IQCSelections.length === 0) {
          this.$message.warning('请勾选要打印的检验单！')
          return
        }
        const inspectionNos = this.$refs.qrCode.init(this.IQCSelections.map(item => item.inspectionNo))
        for (let i = 0; i < inspectionNos.length; i++) {
          this.IQCSelections[i].qrCode = inspectionNos[i]
        }
        qcPrint(this.IQCSelections)
      },

      // 数据采集
      dataAcquisition () {
        this.loadFlag = true
        let tempDate = {
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          inspectionNo: this.detailData.inspectionNo,
          flag: 'iqc'
        }
        dataAcquisition(tempDate).then(({data}) => {
          if (data.code === 0) {
            // this.acquisitionList = data.rows
            this.changeMyString(data.rows)
            this.$message({
              message: '数据采集成功',
              type: 'success',
              duration: 1500
            })
          } else {
            this.$message({
              message: data.msg,
              type: 'warning',
              duration: 1500
            })
          }
          this.loadFlag = false
        }).catch(()=>{
          this.loadFlag = false
        })
      },

      // 根据项目数据采集
      dataAcquisitionByItem (row) {
        let params = {
          site: row.site,
          buNo: row.buNo,
          itemNo: row.itemNo,
        }
        this.loadFlag = true
        getEamPropertiesItemByItemNo(params).then(({data}) => {
          if (data.code === 0) {
            let itemData = data.itemData
            console.log("this", itemData);
            console.log("itemData.colss)",itemData.collectionFlag == 'Y' && itemData.collectionMethod.includes('thickness'));
            
            
            if(itemData.collectionFlag == 'Y' && itemData.collectionMethod.includes('thickness')){
              let param = {
                site: row.site,
                sopType: 'iqc',
                bu: row.buNo,
                itemNo: row.itemNo,
                inspectionNo: row.inspectionNo,
              }
              getCollectorDataByItem(param).then(({data}) => {
                if (data.code === 0 && data.rows.length > 0) {
                  this.changeMyString(data.rows)
                  this.$message({
                    message: '数据采集成功',
                    type: 'success',
                    duration: 1500
                  })
                } else {
                  this.$message({
                    message: data.msg||'未采集到数据',
                    type: 'warning',
                    duration: 1500
                  })
                }
                this.loadFlag = false
              })
            }else{
              let tempDate = {
          site: row.site,
          buNo: row.buNo,
          inspectionNo: row.inspectionNo,
          templateId: row.templateId,
          itemNo: row.itemNo,
          flag: 'iqc'
        }
        dataAcquisitionByItem(tempDate).then(({data}) => {
          if (data.code === 0) {
            this.changeMyString(data.rows)
            this.$message({
              message: '数据采集成功',
              type: 'success',
              duration: 1500
            })
          } else {
            this.$message({
              message: data.msg,
              type: 'warning',
              duration: 1500
            })
          }
          this.loadFlag = false
        }).catch(()=>{
          this.loadFlag = false
        })
            }
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
        
      },

      // 获取用户角色
      getUserRoleList () {
        getUserRoleList().then(({data}) => {
          if (data.code === 0) {
            this.roleList = data.rows
          } else {
            this.roleList = []
          }
        })
      },

      // 获取协同人员列表
      getOperatorList () {
        this.operatorData.flag = '1'
        this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo
        const tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';')
        this.$nextTick(() => this.$refs.operatorTable.clearSelection())
        this.setDefaultCollaborativeRole(() => {
          this.$nextTick(() => {
            this.fetchCollaborativeOperatorData(tempDataList, true)
          })
        })
      },

      isMhmResponsibleBu () {
        return this.detailData.buNo === '04-MHM'
      },

      // 协同人员：04-MHM 默认页面角色，其他 BU 默认系统管理员
      setDefaultCollaborativeRole (callback) {
        const apply = () => {
          if (this.roleList.length > 0) {
            const roleName = this.isMhmResponsibleBu() ? this.defaultCollaborativeRoleName : '系统管理员'
            const match = this.roleList.find(item => item.roleName === roleName)
            const role = match || this.roleList[0]
            this.$set(this.operatorData, 'roleId', role.roleId != null && role.roleId !== '' ? Number(role.roleId) : '')
          } else {
            this.$set(this.operatorData, 'roleId', '')
          }
          callback && callback()
        }
        if (this.roleList.length > 0) {
          apply()
        } else {
          getUserRoleList().then(({ data }) => {
            this.roleList = (data && data.code === 0) ? (data.rows || []) : []
            apply()
          })
        }
      },

      // 协同人员：始终走 getOperatorList（sys_user），不用 getResponsibleOperatorList
      fetchCollaborativeOperatorData (tempDataList, showDialog) {
        this.operatorData.roleName = ''
        getOperatorList(this.operatorData).then(({ data }) => {
          if (data && data.code === 0) {
            this.operatorList = data.rows
            this.operatorList.forEach(val => {
              if (tempDataList.includes(val.adminID)) {
                this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true))
              }
            })
            if (showDialog) {
              this.operatorModelFlag = true
            }
          } else if (showDialog) {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          } else {
            this.operatorList = []
          }
        })
      },

      fetchResponsibleOperatorData (tempDataList, showDialog) {
        let request
        if (this.isMhmResponsibleBu()) {
          this.operatorData.roleName = ''
          request = getResponsibleOperatorList(this.operatorData)
        } else {
          request = getOperatorList(this.operatorData)
        }
        request.then(({ data }) => {
          if (data && data.code === 0) {
            this.operatorList = data.rows
            this.operatorList.forEach(val => {
              if (tempDataList.includes(val.adminID)) {
                this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true))
              }
            })
            if (showDialog) {
              this.operatorModelFlag = true
            }
          } else if (showDialog) {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          } else {
            this.operatorList = []
          }
        })
      },

      // 获取责任人员列表
      getResponsiblePersonList () {
        this.operatorData.flag = '2'
        this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo
        const tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';')
        this.$nextTick(() => this.$refs.operatorTable.clearSelection())
        const openDialog = () => {
          this.fetchResponsibleOperatorData(tempDataList, true)
        }
        if (this.isMhmResponsibleBu()) {
          this.operatorData.roleId = ''
          openDialog()
        } else {
          if (this.roleList.length > 0) {
            let filterList = this.roleList.filter(item => item.roleName === '机修人员')
            if (filterList.length > 0) {
              this.operatorData.roleId = filterList[0].roleId
            } else {
              this.operatorData.roleId = this.roleList[0].roleId
            }
          } else {
            this.operatorData.roleId = ''
          }
          openDialog()
        }
      },

      // 查询机修人员列表
      getOperatorList2 () {
        if (this.operatorData.flag === '1') {
          let tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';')
          this.fetchCollaborativeOperatorData(tempDataList, false)
        } else {
          let tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';')
          this.fetchResponsibleOperatorData(tempDataList, false)
        }
      },

      // 点击行选中复选框
      operatorClickRow (row) {
        this.$refs.operatorTable.toggleRowSelection(row)
      },

      // 多选
      selectionChangeHandle2 (val) {
        this.dataListSelections2 = val
      },

      // 确认多选协同人员
      confirmOperator () {
        if (this.dataListSelections2.length === 0 && this.operatorData.flag === '1') {
          this.$message.warning('请勾选人员！')
          return
        }
        if (this.operatorData.flag === '1') {
          for (let i = 0; i < this.dataListSelections2.length; i++) {
            if (!this.detailData.operator.split(';').includes(this.dataListSelections2[i].adminID)) {
              this.detailData.operatorName = this.detailData.operatorName + ";" + this.dataListSelections2[i].adminName
              this.detailData.operator = this.detailData.operator + ";" + this.dataListSelections2[i].adminID
            }
          }
          if (this.detailData.operator.charAt(0) === ';') {
            this.detailData.operator = this.detailData.operator.substring(1)
            this.detailData.operatorName = this.detailData.operatorName.substring(1)
          }
        } else {
          const adminIds = []
          const adminNames = []
          for (let i = 0; i < this.dataListSelections2.length; i++) {
            adminIds.push(this.dataListSelections2[i].adminID)
            adminNames.push(this.dataListSelections2[i].adminName)
          }
          this.detailData.responsiblePerson = adminIds.join(';')
          this.detailData.responsiblePersonName = adminNames.join(';')
        }
        this.operatorData = {
          flag: '',
          site: '',
          bu: '',
          adminID: '',
          adminName: '',
          roleName: '',
          roleId: '',
          userName: this.$store.state.user.name
        }
        this.operatorModelFlag = false
      },


      // // 实测值内容改变事件
      // changeValue (row) {
      //   if (row.minValue == null && row.maxValue != null) {
      //     if (row.numberValue > row.maxValue) {
      //       row.itemResult = 'N'
      //     } else {
      //       row.itemResult = 'Y'
      //     }
      //   } else if (row.maxValue == null && row.minValue != null) {
      //     if (row.numberValue < row.minValue) {
      //       row.itemResult = 'N'
      //     } else {
      //       row.itemResult = 'Y'
      //     }
      //   } else if (row.minValue != null && row.maxValue != null) {
      //     if (row.numberValue < row.minValue || row.numberValue > row.maxValue) {
      //       row.itemResult = 'N'
      //     } else {
      //       row.itemResult = 'Y'
      //     }
      //   }
      // },

      // 获取用户的bu
      getSiteAndBuByUserName () {
        let tempData = {
          username: this.$store.state.user.name,
        }
        getSiteAndBuByUserName(tempData).then(({data}) => {
          if (data.code === 0) {
            this.userBuList = data.rows
          }
        })
      },

      // 子明细导入
      subDetailUpload () {
        let currentData = {
          flag: 'IQC',
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          inspectionNo: this.detailData.inspectionNo
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.subDetailUpload.init(currentData)
        })
      },

      // 获取处置措施列表
      disposalMeasuresSearch () {
        let tempData = {
          inspectionTypeNo: '105'
        }
        disposalMeasuresSearch(tempData).then(({data}) => {
          if (data.code === 0) {
            this.disposalMeasuresOptions = data.rows
          }
        })
      },

      // 获取采购类型列表
      orderTypeSearch () {
        orderTypeSearch().then(({data}) => {
          if (data.code === 0) {
            this.orderTypeList = data.rows
          }
        })
      },

      selectFlag () {
        return true
      },

      // 单机选中
      IQCClickRow (row) {
        this.$refs.IQCTable.toggleRowSelection(row)
      },

      // 复选
      selectionIQC (val) {
        this.IQCSelections = val
      },

      // 刷新派设备文档的列表
      getFileContentData (row) {
        this.fileRow = row
        let currentData = {
          orderRef1: row.site,
          orderRef2: row.inspectionNo,
          orderRef4: row.buNo,
          partNo: row.partNo
        }
        this.fileLoading = true
        getInspectionFile(currentData).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code === 0) {
            this.fileContentList = data.rows
          } else {
            this.fileContentList = []
          }
          this.fileLoading = false
        }).catch(()=>{
          this.fileLoading = false
        })
        this.fileFlag = true
      },

      // 新增文件的modal
      addUploadFileModal () {
        let currentData = {
          titleCon: 'IQC文件上传',
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          createBy: this.$store.state.user.name,
          inspectionNo: this.detailData.inspectionNo,
          remark: '',
          folder: 'qcIQC',
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.qcFAIUploadFile.init(currentData)
        })
      },

      // 上传项目图片
      uploadImageModal (row) {
        let currentData = {
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          createBy: this.$store.state.user.name,
          inspectionNo: this.detailData.inspectionNo,
          itemNo: row.itemNo,
          folder: 'IQCItemImageFile'
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.comQcItemImageUploadFile.init(currentData)
        })
      },

      // 获取基础数据列表S
      getBaseList (val,type) {
        this.tagNo = val
        this.$nextTick(() => {
          let strVal = ''
          if (val === 1037) {
            strVal = this.modalData.detailCodeNo
            this.$refs.baseList.init(val, strVal)
          }
          if (val === 1040) {
            strVal = this.modalData.inspectorNo
            this.$refs.baseList.init(val, strVal)
          }
        })
      },

      // 列表方法的回调
      getBaseData (val) {
        if (this.tagNo === 1037) {
          this.modalData.detailCodeNo = val.code_no
          this.modalData.detailCodeDesc = val.code_desc
        }
        if (this.tagNo === 1040) {
          this.modalData.inspectorNo = val.inspector_no
          this.modalData.inspectorName = val.inspector_name
        }
      },

      // 获取主信息数据列表
      getDataList () {
        this.searchLoading = true
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        qcIQCInspectionSearch(this.searchData).then(({data}) => {
          if (data.code === 0) {
            this.dataList = data.page.list
            this.pageIndex = data.page.currPage
            this.pageSize = data.page.pageSize
            this.totalPage = data.page.totalCount
            this.searchLoading = false
          } else {
            this.searchLoading = false
          }
        }).catch(()=>{
          this.searchLoading = false
        })
      },

      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },

      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },

      // 子明细每页数
      sizeChangeHandle2 (val) {
        this.pageSize2 = val
      },

      // 子明细当前页
      currentChangeHandle2 (val) {
        this.pageIndex2 = val
      },

      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },

      // 查询检验类型
      inspectorSearch () {
        inspectorSearch().then(({data}) => {
          if (data.code === 0) {
            this.options = data.rows
          }
        })
      },

      async Transfer (type) {
        if (type === '2') {
          if (this.detailData.inspectionResult === '' || this.detailData.inspectionResult == null) {
            this.$message.warning('请选择检验结论！')
            return
          }
          if (this.detailData.inspectionResult === '不合格' && (this.detailData.disposalMeasures == null || this.detailData.disposalMeasures === '')) {
            this.$message.warning('请选择处置措施！')
            return
          }
          if (this.detailList.length > 0 && this.detailData.inspectionResult === '不合格') {
            const flag = this.detailList.some(item => item.itemResult === 'N')
            if (!flag) {
              this.$message.warning('请选择不合格项目！')
              return
            }
          }
          if (this.detailData.inspectionResult !== '不合格') {
            this.detailData.disposalMeasures = ''
            this.detailData.disposalRemark = ''
          }
        }
        this.saveDetailInformation(type)
      },

      // 新增明细信息
      saveDetailInformation (type) {
        this.saveInformationData.site = this.detailData.site
        this.saveInformationData.buNo = this.detailData.buNo
        this.saveInformationData.inspectionNo = this.detailData.inspectionNo
        this.saveInformationData.disposalMeasures = this.detailData.disposalMeasures
        this.saveInformationData.disposalRemark = this.detailData.disposalRemark
        this.saveInformationData.inspectorNo = this.$store.state.user.name
        this.saveInformationData.inspectionResult = this.detailData.inspectionResult
        this.saveInformationData.inspectionRemark = this.detailData.inspectionRemark
        this.saveInformationData.rollCount = this.detailData.rollCount
        this.saveInformationData.samplingQty = this.detailData.samplingQty
        this.saveInformationData.unqualifiedQty = this.detailData.unqualifiedQty
        this.saveInformationData.poOrderNo = this.detailData.poOrderNo
        this.saveInformationData.poItemNo = this.detailData.poItemNo
        this.saveInformationData.partNo = this.detailData.partNo
        this.saveInformationData.partDesc = this.detailData.partDesc
        this.saveInformationData.sku = this.detailData.sku
        this.saveInformationData.operator = this.detailData.operator
        this.saveInformationData.responsiblePerson = this.detailData.responsiblePerson
        this.saveInformationData.itemList = JSON.parse(JSON.stringify(this.detailList))
        this.saveInformationData.type = type
        this.saveInformationData.passQty = this.detailData.passQty == null ? 0 : this.detailData.passQty
        this.saveInformationData.notPassQty = this.detailData.notPassQty == null ? 0 : this.detailData.notPassQty
        this.saveInformationData.batchQualifiedQty = this.detailData.batchQualifiedQty == null ? 0 : this.detailData.batchQualifiedQty
        this.transferLoadFlag = true
        // this.saveInformationData.subDetailList = this.acquisitionList
        saveIQCDetailedRecord(this.saveInformationData).then(({data}) => {
          if (data && data.code === 0) {
            this.getDataList()
            this.detailInformationFlag = false
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
          this.transferLoadFlag = false
        }).catch(()=>{
          this.transferLoadFlag = false
        })
      },

      // 开始检验
      actionModal (row) {
        this.actionData = {
          site: row.site,
          buNo: row.buNo,
          inspectionNo: row.inspectionNo
        }
        getIQCItemObjectList(this.actionData).then(({data}) => {
          if (data && data.code === 0) {
            if (data.rows.length === 0) {
              this.actionModal2()
            } else {
              this.itemObjectList = data.rows
              this.ItemObjectModelFlag = true
            }
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 开始检验
      actionModal2 () {
        this.$confirm(`确认开始检验?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: this.actionData.site,
            buNo: this.actionData.buNo,
            inspectionNo: this.actionData.inspectionNo,
            actionBy: this.$store.state.user.name,
            state: '待检验',
            equipmentList: this.itemObjectList
          }
          actionIQCInspection(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
              this.ItemObjectModelFlag = false
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },

      // 明细记录信息查询
      detailModal (row) {
        this.detailData.site = row.site
        this.detailData.buNo = row.buNo
        this.detailData.inspectionNo = row.inspectionNo
        this.detailData.partNo = row.partNo
        this.detailData.partDesc = row.partDesc
        this.detailData.cinvSourceCode = row.cinvSourceCode
        this.detailData.sku = row.sku
        this.detailData.rollQty = row.rollQty
        this.detailData.samplingQty = row.samplingQty
        this.detailData.unqualifiedQty = row.unqualifiedQty
        this.detailData.unqualifiedQuantity = row.unqualifiedQuantity
        this.detailData.submitFlag = row.submitFlag
        this.detailData.disposalMeasures = row.disposalMeasures
        this.detailData.disposalRemark = row.disposalRemark
        this.detailData.inspectionResult = row.inspectionResult
        this.detailData.inspectorNo = row.inspectorNo
        this.detailData.inspectionRemark = row.inspectionRemark
        this.detailData.umId = row.umId
        this.detailData.rollCount = row.rollCount
        this.detailData.poOrderNo = row.poOrderNo
        this.detailData.poItemNo = row.poItemNo
        this.detailData.operator = row.operator
        this.detailData.operatorName = row.operatorName
        this.detailData.responsiblePerson = row.responsiblePerson
        this.detailData.responsiblePersonName = row.responsiblePersonName
        this.detailData.invdefinetype = row.invdefinetype
        this.detailData.state = row.state
        
        // if (row.state === '待检验') {
        //   this.detailData.passQty = row.samplingQty
        // } else {
        //   this.detailData.passQty = row.passQty
        //   this.detailData.notPassQty = row.notPassQty
        // }
        //2025/9/8 海波更改 合格数量 不合格数量
        this.detailData.passQty = row.passQty
        this.detailData.notPassQty = row.notPassQty
        this.detailData.noBatchQualifiedQty = this.detailData.samplingQty - this.detailData.passQty
        this.detailData.batchQualifiedQty = row.batchQualifiedQty
        this.getInspectionFormData()
        this.inspectorSearch()
        // this.acquisitionList = []
        this.detailInformationFlag = true
      },

      // 检验单明细
      getInspectionFormData () {
        iqcDetailSearch(this.detailData).then(({data}) => {
          if (data && data.code === 0) {
            this.detailList = data.rows
          } else {
            this.detailList = []
          }
        })
      },

      // 子明细记录信息查询
      subDetailModal (row) {
        this.subDetailLoading = true
        this.subDetailData = row
        this.pageIndex2 = 1
        selectIQCSubDetailedRecord(this.subDetailData).then(({data}) => {
          if (data.code === 0) {
            this.tableData = data.rows
          }
          this.subDetailLoading = false
        }).catch(()=>{
          this.subDetailLoading = false
        })
        this.batchAddData = {
          samplingLocation: '',
          samplingLocationB: '',
          samplingNumber: ''
        }
        this.subDetailFlag = true
      },

      // 子明细分页查询
      subDetailModal2 () {
        selectIQCSubDetailedRecord(this.subDetailData).then(({data}) => {
          if (data.code === 0) {
            this.tableData = data.rows
          }
        })
      },

      // 删除检验记录
      deleteModal () {
        let tempData1 = '' // 记录是待审核和已完成状态的单号,不允许删除
        if (this.IQCSelections.length === 0) {
          this.$message.warning('请勾选要删除的检验单！')
          return
        }
        for (let i = 0; i < this.IQCSelections.length; i++) {
          if (this.IQCSelections[i].state === '待审核' || this.IQCSelections[i].state === '已完成') {
            tempData1 = tempData1 + this.IQCSelections[i].inspectionNo + '、'
          }
        }
        if (tempData1 !== '') {
          tempData1 = tempData1.substring(0, tempData1.length - 1)
          this.$message.warning('检验单号 ' + tempData1 + ', 待审核和已完成的单据不允许删除！')
          return
        }
        this.$confirm(`是否删除该 `+ this.IQCSelections.length +` 条检验记录?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: '',
            submitList: this.IQCSelections
          }
          iqcRecordDelete(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.IQCSelections = []
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
        })
      },

      // 任务重载
      overLoadModal () {
        if (this.IQCSelections.length === 0) {
          this.$message.warning('请勾选要重载的检验单！')
          return
        }
        if (this.IQCSelections.length === 1 && this.IQCSelections[0].buNo == '02-Hardtag' && (this.IQCSelections[0].state=='待检验'|| this.IQCSelections[0].state=='未开始') &&this.IQCSelections[0].partNo.substring(0,1) === '4') {
          this.iqcRecordOverPartNo = this.IQCSelections[0].partNo
          this.iqcRecordOverPartDesc = this.IQCSelections[0].partDesc
          this.iqcRecordOverSupplierNo = this.IQCSelections[0].supplierNo
          this.iqcRecordOverSupplierDesc = this.IQCSelections[0].supplierDesc
          this.iqcRecordOverFlag = true
        } else {
          if (this.IQCSelections.every(val => val.state === '待检验' || val.state === '未开始')) {
            this.$confirm(`是否重载该 `+ this.IQCSelections.length +` 条检验单?`, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              let tempData = {
                site: '',
                submitList: this.IQCSelections
              }
              this.overLoadModal2(tempData)
              // iqcRecordOverLoad(tempData).then(({data}) => {
              //   if (data && data.code === 0) {
              //     this.getDataList()
              //     this.IQCSelections = []
              //     this.$message({
              //       message: '操作成功',
              //       type: 'success',
              //       duration: 1500,
              //       onClose: () => {}
              //     })
              //   } else {
              //     this.$alert(data.msg, '错误', {
              //       confirmButtonText: '确定'
              //     })
              //   }
              // })
            })
          } else {
            this.$message.warning('检验单必须为待检验状态！')
            return
          }
        }
      },
      overLoadModal2(tempData){
        iqcRecordOverLoad(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.getDataList()
            this.IQCSelections = []
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },
      overLoadModal3(){
        let IQCSelections = this.IQCSelections
        IQCSelections[0].partNo = this.iqcRecordOverPartNo
        IQCSelections[0].partDesc = this.iqcRecordOverPartDesc
        IQCSelections[0].supplierNo = this.iqcRecordOverSupplierNo
        let tempData = {
          site: '',
          submitList: IQCSelections
        }
        this.overLoadModal2(tempData)
        this.iqcRecordOverFlag = false
      },
      overLoadSearchPartInfo(){
        this.iqcRecordOverModal.buDesc = '硬标'
        overLoadSearchPartInfo(this.iqcRecordOverModal).then(({data})=>{
          if (data && data.code === 0) {
            this.overLoadPartList = data.list
          }
        })
        this.iqcRecordOverFlag2 = true
      },
      // 获取供应商列表
      getManufacturerList () {
        this.manufacturerData.site = '3'
        getManufacturerList(this.manufacturerData).then(({data}) => {
          if (data && data.code === 0) {
            this.manufacturerList = data.rows
            this.manufacturerModelFlag = true
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },
      getRowData1(row){
        this.iqcRecordOverPartNo = row.partNo
        this.iqcRecordOverPartDesc = row.partDesc
        let param = {
          site: '3',
          buNo: '02-Hardtag',
          partNo: this.iqcRecordOverPartNo,
          attributeNo: this.iqcRecordOverPartNo,
          partDesc: this.iqcRecordOverPartDesc,
          inspectionTypeNo: '105',
          attributeType: 'A'
        }
        //查询选择的物料属性  对应的检验模板 供应商信息
        searchPartAttributeDetails(param).then(({data}) => {
          console.log(data.rows.length)
          if (data.rows.length > 0) {
            this.iqcRecordOverSupplierNo = data.rows[0].manufacturerID
            this.iqcRecordOverSupplierDesc = data.rows[0].manufacturerName
          }
        })
        this.iqcRecordOverFlag2 = false
      },
      manufacturerClickRow(row){
        this.iqcRecordOverSupplierNo = row.manufacturerID
        this.iqcRecordOverSupplierDesc = row.manufacturerName
        this.manufacturerModelFlag = false
      },
      // 审核按钮
      submitResult () {
        let tempData1 = '' // 记录不是待审核状态的单号
        let tempData2 = '' // 记录处置措施未填写的单号
        if (this.IQCSelections.length === 0) {
          this.$message.warning('请勾选要审核的检验单！')
          return
        }
        for (let i = 0; i < this.IQCSelections.length; i++) {
          if (this.IQCSelections[i].state !== '待审核'){
            tempData1 = tempData1 + this.IQCSelections[i].inspectionNo + '、'
          }
          if (this.IQCSelections[i].inspectionResult === '不合格' && (this.IQCSelections[i].disposalMeasures === '' || this.IQCSelections[i].disposalMeasures == null)) {
            tempData2 = tempData2 + this.IQCSelections[i].inspectionNo + '、'
          }
        }
        if (tempData1 !== '') {
          tempData1 = tempData1.substring(0, tempData1.length - 1)
          this.$message.warning('检验单号 ' + tempData1 + ', 不是待审核状态！')
          return
        }
        if (tempData2 !== '') {
          tempData2 = tempData2.substring(0, tempData2.length - 1)
          this.$message.warning('检验单号 ' + tempData2 + ', 的处置措施未选择！')
          return
        }
        // this.submitData.site = row.site
        // this.submitData.inspectionNo = row.inspectionNo
        // this.submitData.inspectionResult = row.inspectionResult
        // if (row.inspectionResult == '不合格' && (row.disposalMeasures == '' || row.disposalMeasures == null)){
        //   this.$alert('处置措施未选择！', '错误', {
        //     confirmButtonText: '确定'
        //   })
        //   return false
        // }
        this.$confirm(`已确认单据信息无误，确定审核该 ` + this.IQCSelections.length + ` 条记录`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.submitData.submitList = this.IQCSelections
          saveIQCSubmitResult(this.submitData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.IQCSelections = []
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },

      // 取消审核
      cancelApproval () {
        let tempData1 = '' // 记录不是已完成状态的单号
        let tempData2 = '' // 记录免检的单号
        if (this.IQCSelections.length === 0) {
          this.$message.warning('请勾选要取消审核的检验单！')
          return
        }
        for (let i = 0; i < this.IQCSelections.length; i++) {
          if (this.IQCSelections[i].state !== '已完成') {
            tempData1 = tempData1 + this.IQCSelections[i].inspectionNo + '、'
          }
          if (this.IQCSelections[i].inspectionResult === '免检') {
            tempData2 = tempData2 + this.IQCSelections[i].inspectionNo + '、'
          }
        }
        if (tempData1 !== '') {
          tempData1 = tempData1.substring(0, tempData1.length - 1)
          this.$message.warning('检验单号 ' + tempData1 + ' ,不是已完成状态！')
          return
        }
        if (tempData2 !== '') {
          tempData2 = tempData2.substring(0, tempData2.length - 1)
          this.$message.warning('检验单号 ' + tempData2 + ' , 免检的单据不允许取消审核！')
          return
        }
        this.$confirm(`确定取消审核该 ` + this.IQCSelections.length + ` 条记录`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.submitData.submitList = this.IQCSelections
          cancelApproval(this.submitData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.IQCSelections = []
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        })
      },

      // 子明细方法
      // 表格的新增
      rowClassName ({ row, rowIndex }) {
        row.xh = rowIndex + 1
        row.num = this.tableData.indexOf(row) + 1
      },

      // 单选框选中数据
      handleDetailSelectionChange(selection) {
        this.checkedDetail = selection
      },

      // 点击新增更多
      handleAddBtn (td) {
        checkIQCIsSubmit(td).then(({data}) => {
          if (data.flag !== 1) {
            let obj = {
              subDetailValue: '',
              samplingLocation: '',
              samplingLocationB: '',
              subDetailValueB: '',
              subDetailValueC: '',
              subDetailValueD: '',
              subDetailValueE: '',
            }
            this.tableData.push(obj)
          } else {
            this.$alert("记录已提交！", '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 批量新增操作
      batchHandleAdd (td) {
        checkIQCIsSubmit(td).then(({data}) => {
          if (data.flag !== 1) {
            this.batchHandleAddModalFlag = true
          } else {
            this.$alert("记录已提交！", '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 批量新增行
      batchHandleAddModal () {
        for (let i = 0; i < this.batchAddData.samplingNumber; i++) {
          let obj = {
            samplingLocation: this.batchAddData.samplingLocation,
            samplingLocationB: this.batchAddData.samplingLocationB,
            subDetailValue: '',
            subDetailValueB: '',
            subDetailValueC: '',
            subDetailValueD: '',
            subDetailValueE: '',
          }
          this.tableData.push(obj)
        }
        this.batchHandleAddModalFlag = false
      },

      // 回车事件
      nextFocus1 (index) {
        let a1 = `${index + 1}` + `a`
        this.$nextTick(() => {
          this.$refs[a1].focus()
        })
      },

      nextFocus2 (index) {
        let a2 = `${index + 1}` + `b`
        this.$nextTick(() => {
          this.$refs[a2].focus()
        })
      },

      nextFocus3 (index) {
        let a3 = `${index + 1}` + `c`
        this.$nextTick(() => {
          this.$refs[a3].focus()
        })
      },
      nextFocus4 (index) {
        let a = `${index + 1}` + `d`
        this.$nextTick(() => {
          this.$refs[a].focus()
        })
      },
      nextFocus5 (index) {
        let a = `${index + 1}` + `e`
        this.$nextTick(() => {
          this.$refs[a].focus()
        })
      },
      nextFocus6 (index) {
        let a = `${index + 1}` + `f`
        this.$nextTick(() => {
          this.$refs[a].focus()
        })
      },
      nextFocus7 (index) {
        let a = `${index + 1}` + `g`
        this.$nextTick(() => {
          this.$refs[a].focus()
        })
      },
      focusNextInput (index, type) {
        let aaa = ''
        if (this.detailList.length - 1 === index) {
          aaa = `${type}0`
        } else {
          aaa = `${type}${index + 1}`
        }
        this.$nextTick(() => {
          this.$refs[aaa].focus()
        })
      },
      updateItemResult(row){
        if (row.maxValue == null && row.minValue == null&&row.defaultValue==null) {
          return;
        }
        if (row.maxValue == null && row.minValue == null) {
          if (row.numberValue!=row.defaultValue){
            row.itemResult = 'N'
          }
        }else if (row.maxValue != null && row.minValue != null){
          if (row.numberValue>row.maxValue ||row.numberValue<row.minValue){
            row.itemResult = 'N'
          }else {
            row.itemResult = 'Y'
          }
        }else if(row.maxValue != null){
          if ( row.numberValue>row.maxValue) {
            row.itemResult = 'N'
          }else {
            row.itemResult = 'Y'
          }
        }else if(row.minValue != null){
          if ( row.numberValue<row.minValue) {
            row.itemResult = 'N'
          }else {
            row.itemResult = 'Y'
          }
        }
      },

      //删除
      handleDeleteBtn (td) {
        checkIQCIsSubmit(td).then(({data}) => {
          if (data.flag !== 1) {
            if (this.checkedDetail.length === 0) {
              this.$alert("请先选择要删除的数据", "提示", {
                confirmButtonText: "确定",
              })
            } else {
              this.$confirm("请是否确认删除该子明细记录?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
                callback: (action) => {
                  if (action === "confirm") {
                    let val = this.checkedDetail
                    val.forEach((val, index) => {
                      this.tableData.splice(this.tableData.indexOf(val), 1)
                      if (this.templateTableData.length === 0) {
                        this.pageIndex2--
                      }
                    })
                    this.$message({
                      message: "删除成功！",
                      type: "success",
                    })
                    return
                  } else {
                    this.$message({
                      message: "已取消删除操作",
                      type: "warning",
                    })
                    return
                  }
                },
              })
            }
          } else {
            this.$alert("记录已提交！", '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 新增子明细记录
      saveSubDetailResult () {
        for (let i = 0; i < this.tableData.length; i++) {
          if(this.tableData[i].subDetailValue === '' || this.tableData[i].subDetailValue == null){
            this.$message.warning('序号' + (i+1) +'未填写实测值！')
            return
          }
        }
        this.subDetailData.subDetailValues = this.tableData
        this.subDetailVisiable = true
        saveIQCSubDetailed(this.subDetailData).then(({data}) => {
          if (data && data.code === 0) {
            if (data.count > 0) {
              this.subDetailData.itemResult = 'N'
              this.subDetailData.unqualifiedQuantity = data.count
            }
            if (this.subDetailData.subDetailValues.length > 0) {
              this.subDetailData.subDetailRecordNum = 1
            } else {
              this.subDetailData.subDetailRecordNum = -1
              this.subDetailData.unqualifiedQuantity = 0
              this.subDetailData.itemResult = 'Y'
            }
            this.subDetailFlag = false
            this.tableData = []
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {}
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        }).finally(() => {
          this.subDetailVisiable = false
        })
      },

      // 检验结论改变事件
      resultChange () {
        if (this.detailData.inspectionResult === '不合格') {
          this.detailData.passQty = 0
          this.syncPassNotPassQtyFromPass()
        } else if (this.detailData.inspectionResult === '合格') {
          this.$set(this.detailData, 'notPassQty', 0)
          this.syncPassNotPassQtyFromNotPass()
        }
      },

      // 校验用户是否收藏
      favoriteIsOk () {
        let userFavorite = {
          userId: this.$store.state.user.id,
          languageCode: this.$i18n.locale
        }
        userFavoriteList(userFavorite).then(({data}) => {
          for (let i = 0; i < data.list.length; i++) {
            if (this.$route.meta.menuId === data.list[i].menuId) {
              this.favorite = true
            }
          }
        })
      },

      // 收藏 OR 取消收藏
      favoriteFunction () {
        let userFavorite = {
          userId: this.$store.state.user.id,
          functionId: this.$route.meta.menuId,
        }
        if (this.favorite) {
          removeUserFavorite(userFavorite).then(({data}) => {
            this.$message.success(data.msg)
            this.favorite = false
          })
        } else {
          // 收藏
          saveUserFavorite(userFavorite).then(({data}) => {
            this.$message.success(data.msg)
            this.favorite = true
          })
        }
      },

      //导出excel
      async createExportData () {
        this.searchData.limit = -1
        this.searchData.page = 1
        await qcIQCInspectionSearch(this.searchData).then(({data}) => {
          this.exportList = data.page.list
        })
        return this.exportList
      },

      startDownload() {},

      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
      },

      // 动态列开始 获取 用户保存的 格式列
      async getTableUserColumn (tableId, columnId) {
        let queryTableUser = {
          userId: this.$store.state.user.name,
          functionId: this.$route.meta.menuId,
          tableId: tableId,
          status: true,
          languageCode: this.$i18n.locale
        }
        await getTableUserListLanguage(queryTableUser).then(({data}) => {
          if (data.rows.length > 0) {
            //this.columnList1 = []
            switch (columnId) {
              case 1:
                this.columnList1 = data.rows
                break;
              case 2:
                this.detailColumnList = data.rows
                break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            this.getColumnList(tableId, columnId)
          }
        })
      },

      // 获取 tableDefault 列
      async getColumnList (tableId, columnId) {
        let queryTable = {
          functionId: this.$route.meta.menuId,
          tableId: tableId,
          languageCode: this.$i18n.locale
        }
        await getTableDefaultListLanguage(queryTable).then(({data}) => {
          if (!data.rows.length == 0) {
            switch (columnId) {
              case 1:
                this.columnList1 = data.rows
                break;
              case 2:
                this.detailColumnList = data.rows
                break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            // this.showDefault = true.
          }
        })
      },

      /**
       * 明细导入后将返回值回传给父组件
       * @param val
       */
      changeMyString (val) {
        for (let i = 0; i < this.detailList.length; i++) {
          if (val[this.detailList[i].itemNo] !== undefined) {
            this.detailList[i].unqualifiedQuantity = val[this.detailList[i].itemNo]
            if (val[this.detailList[i].itemNo] != null) {
              this.detailList[i].subDetailRecordNum = 1
            }
            if (val[this.detailList[i].itemNo] > 0) {
              this.detailList[i].itemResult = 'N'
            }
          }
        }
      },

      //获取按钮的权限数据
      getButtonAuthData () {
        let searchFlag = this.isAuth(this.menuId + ":search")
        let checkFlag = this.isAuth(this.menuId + ":check")
        let overLoadFlag = this.isAuth(this.menuId + ":overLoad")
        let deleteFlag = this.isAuth(this.menuId + ":delete")
        let detailFlag = this.isAuth(this.menuId + ":detail")
        let fileFlag = this.isAuth(this.menuId + ":file")
        let cancelCheckFlag = this.isAuth(this.menuId + ":cancelCheck")
        //处理页面的权限数据
        this.authSearch = !searchFlag
        this.authCheck = !checkFlag
        this.authOverLoad = !overLoadFlag
        this.authDelete = !deleteFlag
        this.authDetail = !detailFlag
        this.authFile = !fileFlag
        this.authCancelCheck = !cancelCheckFlag
      },
      noUnqualifiedQtyChange(){
        if (this.detailData.unqualifiedQty > this.detailData.rollCount) {
          // 恢复原值
          this.$set(this.detailData, 'unqualifiedQty', parseInt(this.detailData.rollCount))
          this.$message.warning('不合格项目数量不能大于送检数量！')
        }
      },
      noRollCountChange(){
        if (parseInt(this.detailData.rollCount) > parseInt(this.detailData.rollQty)) {
          // 恢复原值
          this.$set(this.detailData, 'rollCount', parseInt(this.detailData.rollQty))
          this.$message.warning('送检数量不能大于到货数量！')
        }
        this.noSamplingQtyChange()
        this.noPassQtyChange()
      },
      noSamplingQtyChange(){     
        const samplingQty = Number(this.detailData.samplingQty)
        const rollCount = Number(this.detailData.rollCount)
        if (!Number.isNaN(samplingQty) && !Number.isNaN(rollCount) && samplingQty > rollCount) {
          // 恢复原值
          this.$set(this.detailData, 'samplingQty', rollCount)
          this.$message.warning('抽检数量不能大于送检数量！')
        }
        this.noPassQtyChange()
      },
      syncPassNotPassQtyFromPass () {
        const samplingQty = Number(this.detailData.samplingQty)
        const passQty = Number(this.detailData.passQty)
        if (Number.isNaN(samplingQty) || Number.isNaN(passQty)) {
          return
        }
        this.$set(this.detailData, 'notPassQty', samplingQty - passQty)
      },
      syncPassNotPassQtyFromNotPass () {
        const samplingQty = Number(this.detailData.samplingQty)
        const notPassQty = Number(this.detailData.notPassQty)
        if (Number.isNaN(samplingQty) || Number.isNaN(notPassQty)) {
          return
        }
        this.$set(this.detailData, 'passQty', samplingQty - notPassQty)
      },
      noPassQtyChange(){
        const passQty = Number(this.detailData.passQty)
        const samplingQty = Number(this.detailData.samplingQty)
        if (Number.isNaN(passQty) || Number.isNaN(samplingQty)) {
          return
        }
        if (passQty > samplingQty) {
          this.$message.warning('合格数量不能大于抽样数量！')
          this.$nextTick(() => {
            this.$set(this.detailData, 'passQty', samplingQty)
            this.syncPassNotPassQtyFromPass()
          })
          return
        }
        this.syncPassNotPassQtyFromPass()
      },
      noNotPassQtyChange () {
        const notPassQty = Number(this.detailData.notPassQty)
        const samplingQty = Number(this.detailData.samplingQty)
        if (Number.isNaN(notPassQty) || Number.isNaN(samplingQty)) {
          return
        }
        if (notPassQty > samplingQty) {
          this.$message.warning('不合格数量不能大于抽样数量！')
          this.$nextTick(() => {
            this.$set(this.detailData, 'notPassQty', samplingQty)
            this.syncPassNotPassQtyFromNotPass()
          })
          return
        }
        this.syncPassNotPassQtyFromNotPass()
      },
      noBatchQualifiedQtyChange(){
        if (this.detailData.noBatchQualifiedQty > this.detailData.rollQty) {
          // 恢复原值
          this.detailData.noBatchQualifiedQty = this.detailData.rollQty - this.detailData.batchQualifiedQty
          this.$message.warning('批次不合格数量不能大于到货数量！')
        }
        // 给合格数量赋值
        let newValue = this.detailData.rollQty - this.detailData.noBatchQualifiedQty
        this.$set(this.detailData, 'batchQualifiedQty', newValue)
      },
    }
  }
</script>

<style scoped>
/deep/ .redElSelect .el-input--suffix .el-input__inner{
  color: red;
  font-weight: bold;
}
/deep/ .greenElSelect .el-input--suffix .el-input__inner{
  color: rgb(103,194,58);
  font-weight: bold;
}
.el-table /deep/ .cell{
  height: auto;
  line-height: 1.5;
}
</style>

