<template>
  <div class="mod-config">
    <!-- 条件查询 -->
    <el-card :class="['search-card', { 'collapsed': !searchExpanded }]" shadow="hover">
      <div slot="header" class="search-header">
        <div class="header-left">
          <i class="el-icon-search"></i>
          <span class="header-title">Search</span>
        </div>
        <div class="header-right">
          <el-button
            type="text"
            size="small"
            @click="toggleSearchExpand"
            class="collapse-btn">
            <span>{{ searchExpanded ? '收起' : '展开' }}</span>
            <i :class="searchExpanded ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
          </el-button>
        </div>
      </div>

      <el-form
        :inline="true"
        label-position="top"
        :model="searchData"
        class="search-form"
        @keyup.enter.native="getDataList">

        <!-- 所有查询条件 - 可展开/收起 -->
        <template v-if="searchExpanded">
          <!-- 第一行：基础单据信息 -->
          <el-row :gutter="16">
            <el-col :span="5">
              <el-form-item label="BU">
                <el-select v-model="searchData.buNo" placeholder="请选择" clearable>
                  <el-option
                    v-for="i in buList"
                    :key="i.buNo"
                    :label="i.buDesc"
                    :value="i.buNo">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="检验单号">
                <el-input v-model="searchData.inspectionNo" placeholder="请输入检验单号" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="通知单号">
                <el-input v-model="searchData.documentNo" placeholder="请输入通知单号" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="工单号">
                <el-input v-model="searchData.orderNo" placeholder="请输入工单号" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="派工单号">
                <el-input v-model="searchData.seqNo" placeholder="请输入派工单号" clearable></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 第二行：物料信息 -->
          <el-row :gutter="16">
            <el-col :span="5">
              <el-form-item label="物料编码">
                <el-input v-model="searchData.partNo" placeholder="请输入物料编码" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="物料名称">
                <el-input v-model="searchData.partDesc" placeholder="请输入物料名称" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="规格型号">
                <el-input v-model="searchData.spec" placeholder="请输入规格型号" clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="工序">
                <el-select v-model="searchData.operationDesc" clearable filterable placeholder="请选择工序">
                  <el-option v-for="item in operationDescList" :key="item" :label="item" :value="item"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 第三行：检验相关信息 -->
          <el-row :gutter="16">
            <el-col :span="5">
              <el-form-item label="检验结论">
                <el-select v-model="searchData.inspectionResult" clearable placeholder="请选择检验结论">
                  <el-option label="合格" value="合格">
                    <i class="el-icon-success" style="color: #67C23A;"></i> 合格
                  </el-option>
                  <el-option label="不合格" value="不合格">
                    <i class="el-icon-error" style="color: #F56C6C;"></i> 不合格
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="处置措施">
                <el-select v-model="searchData.disposalMeasures" clearable placeholder="请选择处置措施">
                  <el-option
                    v-for="i in disposalMeasuresOptions"
                    :key="i.id"
                    :label="i.disposalMeasures"
                    :value="i.disposalMeasures">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="状态">
                <el-select v-model="searchData.states" multiple collapse-tags placeholder="请选择状态" class="status-select">
                  <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-col>
            <el-col :span="5">
              <el-form-item label="质检员">
                <el-input v-model="searchData.inspectorName" placeholder="请输入质检员姓名" clearable></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <!-- 第四行：日期信息 -->
          <el-row :gutter="16">
            <el-col :span="7">
              <el-form-item label="送检日期">
                <el-date-picker
                  v-model="searchData.startDate2"
                  type="datetime"
                  value-format='yyyy-MM-dd HH:mm:ss'
                  format='yyyy-MM-dd HH:mm:ss'
                  placeholder="开始日期"
                  style="width: 44%">
                </el-date-picker>
                <span style="margin: 0 6px; color: #DCDFE6;">~</span>
                <el-date-picker
                  v-model="searchData.endDate2"
                  type="datetime"
                  value-format='yyyy-MM-dd HH:mm:ss'
                  format='yyyy-MM-dd HH:mm:ss'
                  placeholder="结束日期"
                  style="width: 44%">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="检验时间">
                <el-date-picker
                  v-model="searchData.startDate"
                  type="datetime"
                  value-format='yyyy-MM-dd HH:mm:ss'
                  format='yyyy-MM-dd HH:mm:ss'
                  placeholder="开始日期"
                  style="width: 44%">
                </el-date-picker>
                <span style="margin: 0 6px; color: #DCDFE6;">~</span>
                <el-date-picker
                  v-model="searchData.endDate"
                  type="datetime"
                  value-format='yyyy-MM-dd HH:mm:ss'
                  format='yyyy-MM-dd HH:mm:ss'
                  placeholder="结束日期"
                  style="width: 44%">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
        </template>

        <!-- 操作按钮区域 -->
        <el-row :gutter="16">
          <el-col :span="24">
            <div class="search-actions">
              <div class="action-left">
                <el-button
                  v-if="!authSearch"
                  type="primary"
                  icon="el-icon-search"
                  :loading="searchLoading"
                  @click="getDataList">
                  查询
                </el-button>
                <el-button
                  icon="el-icon-refresh"
                  @click="resetSearch">
                  重置
                </el-button>
              </div>
              <div class="action-right">
                <el-button
                  v-if="!authSave"
                  type="success"
                  icon="el-icon-plus"
                  @click="addModal">
                  新增
                </el-button>
                <el-button
                  v-if="!authCheck"
                  type="success"
                  icon="el-icon-check"
                  @click="submitResult">
                  审核
                </el-button>
                <el-button
                  v-if="!authCancelCheck"
                  type="warning"
                  icon="el-icon-close"
                  @click="cancelApproval">
                  取消审核
                </el-button>
                <el-button
                  v-if="!authDelete"
                  type="danger"
                  icon="el-icon-delete"
                  @click="deleteModal">
                  删除
                </el-button>
                <el-button
                  icon="el-icon-printer"
                  @click="printList">
                  打印
                </el-button>
                <download-excel
                  :fields="exportFields"
                  :fetch="createExportData"
                  :before-generate="startDownload"
                  :before-finish="finishDownload"
                  type="xls"
                  :name="exportName"
                  worksheet="导出信息"
                  class="el-button el-button--medium">
                  <i class="el-icon-download"></i>
                  导出
                </download-excel>
              </div>
            </div>
          </el-col>
        </el-row>
      </el-form>
    </el-card>

    <!-- 检验记录展示列表 -->
    <el-table
      :height="height"
      :data="dataList"
      border
      ref="FAITable"
      highlight-current-row
      @row-click="FAIClickRow"
      @selection-change="selectionFAI"
      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">{{ formatMainListCellValue(scope.row, item) }}</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="180"
        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>
          <el-link style="cursor: pointer" v-if="!authExceptionModify && scope.row.state === '已完成'" @click="abnormalModifyModal(scope.row)">异常修改</el-link>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页-->
    <el-pagination
      style="margin-top: 0px"
      @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="modalFlag" width="495px">
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="BU" prop="bu" :rules="rules.bu">
          <el-select v-model="modalData.bu" placeholder="请选择" @change="buChange" style="width: 221px">
            <el-option
              v-for = "i in userBuList"
              :key = "i.buNo"
              :label = "i.sitename"
              :value = "i.buNo">
              <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-if="this.modalData.specialTaskFlag === 'Y'" disabled v-model="modalData.rollNo" style="width: 221px"></el-input>
          <el-input v-else v-model="modalData.rollNo" @keyup.native.enter="rollNoEnter" clearable style="width: 221px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px">
        <el-form-item v-if="this.modalData.specialTaskFlag !== 'Y' && (this.modalData.rollNo === '' || this.modalData.rollNo == null)" prop="orderNo" :rules="rules.seqNoType">
          <span style="cursor: pointer" slot="label" @click="getBaseList(1052)"><a herf="#">派工单号</a></span>
          <el-input v-model="modalData.seqNo" style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item v-if="this.modalData.specialTaskFlag !== 'Y' && this.modalData.rollNo !== '' && this.modalData.rollNo != null" prop="orderNo" :rules="rules.seqNoType">
          <span slot="label">派工单号</span>
          <el-input v-model="modalData.seqNo" disabled style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item v-if="this.modalData.specialTaskFlag === 'Y'" prop="orderNo" :rules="rules.seqNoType">
          <span slot="label">派工单号</span>
          <el-input v-model="modalData.seqNo" disabled style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item label="工单号" prop="orderNo" :rules="rules.orderNoType">
          <el-input v-model="modalData.orderNo" style="width: 221px" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px">
        <el-form-item label="工序" prop="operationDesc" :rules="rules.operationDescType">
          <el-select v-model="modalData.operationDesc" placeholder="请选择" style="width: 221px">
            <el-option
              v-for = "i in operationList"
              :key = "i.operationNo"
              :label = "i.operationDesc"
              :value = "i.operationDesc">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-if="this.modalData.specialTaskFlag === 'Y'">
          <span style="cursor: pointer" slot="label" @click="getBaseList(505)"><a herf="#">机台</a></span>
          <el-input v-model="modalData.resourceDesc" style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item v-else label="机台" prop="resourceId" :rules="rules.resourceIdType">
          <el-input v-model="modalData.resourceDesc" style="width: 221px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px">
        <el-form-item v-if="this.modalData.specialTaskFlag === 'Y'" :model="modalData">
          <span style="cursor: pointer" slot="label" @click="queryPartList"><a herf="#">物料编码</a></span>
          <el-input v-model="modalData.partNo" style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item v-else label="物料编码" prop="partNo" :rules="rules.partNoType">
          <el-input v-model="modalData.partNo" readonly style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item label="物料名称">
          <el-input v-model="modalData.partDesc" readonly style="width: 221px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px">
        <el-form-item label="物料类别">
          <el-input v-model="modalData.invdefinetype" readonly style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item label="SKU">
          <el-input v-model="modalData.sku" readonly style="width: 221px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px">
        <el-form-item prop="templateId" :rules="rules.templateId">
          <span style="cursor: pointer" v-if="this.controlData.baseData === '控制'" slot="label" @click="queryTemplateList"><a>检验模板</a></span>
          <span v-else slot="label">检验模板</span>
          <el-input v-model="modalData.templateName" disabled style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item label="送检数量:" prop="rollQty" :rules="rules.rollQtyType">
          <el-input v-model="modalData.rollQty" type="number" style="width: 103px"></el-input>
        </el-form-item>
        <el-form-item label="单位" prop="umId" :rules="rules.umIdType">
          <el-select v-model="modalData.umId" placeholder="请选择" style="width: 103px">
            <el-option
              v-for = "i in umList"
              :key = "i.umId"
              :label = "i.umName"
              :value = "i.umId">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px">
        <el-form-item label="老卷号">
          <el-input v-model="modalData.batchRollNo" style="width: 221px"></el-input>
        </el-form-item>
        <el-form-item label="送检总数">
          <el-input v-model="modalData.sjzs" disabled style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item label=" ">
          <input type="checkbox" id="specialTask" name="specialTask" v-model="checked" @click="changeSpecialTask"/> <label for="specialTask">无工单检验</label>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px">
        <el-form-item label="特殊要求">
          <el-input type="textarea" v-model="modalData.specialRequirements" :rows="3" resize='none' show-word-limit style="width: 456px;height: 30px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:40px;margin-top: 55px;text-align:center">
        <el-button type="primary" :loading="saveLoading" @click="saveData">保存</el-button>
        <el-button @click="modalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 检验单详情页 -->
    <el-dialog
      :title="'检验明细清单-' + (detailData.inspectionNo || '')"
      :close-on-click-modal="false"
      v-drag
      :visible.sync="detailInformationFlag"
      @close="closeDetailDialog"
      width="1200px"
      top="2vh"
      custom-class="fqc-inspection-dialog">
      <!-- 单据信息卡片 -->
      <div class="inspection-info-card">
        <div class="info-section">
          <div class="section-title">
            <i class="el-icon-document"></i>
            <span>检验单信息</span>
          </div>
          <!-- 第一行：物料信息 + 人员信息 -->
          <el-row :gutter="12" class="info-row">
            <el-col :span="3">
              <div class="info-item">
                <label>物料编码</label>
                <el-input v-model="detailData.partNo" disabled size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="3">
              <div class="info-item">
                <label>物料类别</label>
                <el-input v-model="detailData.invdefinetype" readonly size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="info-item">
                <label>物料名称</label>
                <el-input v-model="detailData.partDesc" disabled size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="3">
              <div class="info-item">
                <label>规格型号</label>
                <el-input v-model="detailData.spec" disabled size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="2">
              <div class="info-item">
                <label>单位</label>
                <el-input v-model="detailData.umName" disabled size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="3">
              <div class="info-item">
                <label>
                  <span v-if="isDetailReadonly">协同人员</span>
                  <a v-else style="cursor: pointer" @click="getOperatorList">协同人员</a>
                </label>
                <el-input v-model="detailData.operatorName" readonly size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>
                  <span v-if="isDetailReadonly">责任人</span>
                  <a v-else style="cursor: pointer" @click="getResponsiblePersonList">责任人</a>
                </label>
                <el-input v-model="detailData.responsiblePersonName" readonly size="small"></el-input>
              </div>
            </el-col>
          </el-row>
          <!-- 第二行：数量信息 -->
          <el-row :gutter="12" class="info-row" style="margin-top: 12px">
            <el-col :span="4">
              <div class="info-item">
                <label>送检数量</label>
                <el-input-number :controls="false" :step="0" v-model="detailData.rollQty" size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>抽样数量</label>
                <el-input-number :controls="false" :step="0" v-model="detailData.samplingQty" size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>合格数量</label>
                <el-input-number :controls="false" :step="0" min="0" v-if="isDetailReadonly" v-model="detailData.passQty" disabled size="small" style="width: 100%"></el-input-number>
                <el-input-number :controls="false" :step="0" min="0" v-else v-model="detailData.passQty" size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>不合格数量</label>
                <el-input-number :controls="false" :step="0" min="0" v-model="detailData.notPassQty" disabled size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>不合格项目数量</label>
                <el-input-number :controls="false" :step="0" v-if="isDetailReadonly" v-model="detailData.unqualifiedQty" disabled size="small" style="width: 100%"></el-input-number>
                <el-input-number :controls="false" :step="0" v-else v-model="detailData.unqualifiedQty" size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
            <el-col :span="4">
              <div class="info-item">
                <label>批次合格数</label>
                <el-input-number :controls="false" :step="0" min="0" v-model="detailData.batchQualifiedQty" disabled size="small" style="width: 100%"></el-input-number>
              </div>
            </el-col>
          </el-row>
        </div>

        <div class="info-section" style="margin-top: 10px">
          <div class="section-title">
            <i class="el-icon-finished"></i>
            <span>检验结论</span>
          </div>
          <el-row :gutter="12" class="info-row">
            <el-col :span="3">
              <div class="info-item">
                <label>检验结论</label>
                <el-select v-if="isInspectionResultReadonly" v-model="detailData.inspectionResult" disabled size="small" placeholder="请选择" style="width: 100%">
                  <el-option label="合格" value="合格"></el-option>
                  <el-option label="不合格" value="不合格"></el-option>
                </el-select>
                <el-select v-else v-model="detailData.inspectionResult" size="small" placeholder="请选择" style="width: 100%">
                  <el-option label="合格" value="合格"></el-option>
                  <el-option label="不合格" value="不合格"></el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="7">
              <div class="info-item">
                <label>质检备注</label>
                <el-input v-if="isDetailReadonly" v-model="detailData.inspectionRemark" disabled size="small"></el-input>
                <el-input v-else v-model="detailData.inspectionRemark" size="small"></el-input>
              </div>
            </el-col>
            <el-col :span="3" v-show="detailData.inspectionResult === '不合格'">
              <div class="info-item">
                <label>处置措施</label>
                <el-select v-if="isDetailReadonly" clearable v-model="detailData.disposalMeasures" disabled size="small" style="width: 100%">
                  <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" size="small" style="width: 100%">
                  <el-option
                    v-for = "i in disposalMeasuresOptions"
                    :key = "i.id"
                    :label = "i.disposalMeasures"
                    :value = "i.disposalMeasures">
                  </el-option>
                </el-select>
              </div>
            </el-col>
            <el-col :span="7" v-show="detailData.inspectionResult === '不合格'">
              <div class="info-item">
                <label>处置说明</label>
                <el-input v-if="isDetailReadonly" v-model="detailData.disposalRemark" disabled size="small"></el-input>
                <el-input v-else v-model="detailData.disposalRemark" size="small"></el-input>
              </div>
            </el-col>
          </el-row>
        </div>

        <!-- 操作按钮区域 -->
        <div class="action-buttons">
          <div class="left-actions">
            <el-button v-if="!isDetailReadonly" type="primary" size="small" :loading="loadFlag" @click="dataAcquisition" icon="el-icon-download">
              数据采集
            </el-button>
            <el-button type="info" size="small" @click="getFileContentData(detailData)" icon="el-icon-folder-opened">
              文件清单
            </el-button>
            <el-button type="warning" size="small" @click="subDetailUpload" icon="el-icon-upload2">
              子明细导入
            </el-button>
          </div>
          <div class="right-actions">
            <el-button type="success" size="small" @click="openItemOperationDialog" icon="el-icon-setting">
              项目导入
            </el-button>
            <el-button type="primary" size="small" @click="openTemplateImportDialog" icon="el-icon-download">
              模板导入
            </el-button>
          </div>
        </div>
      </div>
      <!-- 检验项目列表 -->
      <div class="inspection-table-wrapper">
        <div class="table-header">
          <span class="table-title">
            <i class="el-icon-tickets"></i>
            检验内容
          </span>
        </div>
        <el-table
          :height="435"
          :data="detailList"
          border
          stripe
          style="width: 100%;"
          highlight-current-row
          class="inspection-table">
          <el-table-column
            prop=""
            header-align="center"
            align="center"
            width="110"
            label="操作">
            <template slot-scope="scope">
              <el-button icon="el-icon-picture" :type="scope.row.detailImageNum > 0 ? 'success' : 'primary'" size="mini" @click="uploadImageModal(scope.row)" title="上传图片"></el-button>
              <el-button icon="el-icon-edit-outline" type="primary" size="mini" :loading="loadFlag" @click="dataAcquisitionByItem(scope.row)" title="数据采集"></el-button>
<!--              <el-button style="margin-left: 2px" icon="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">
            <!-- 标准值、上限值、下限值可编辑 -->
            <template v-if="item.columnProp === 'defaultValue' || item.columnProp === 'minValue' || item.columnProp === 'maxValue'">
              <el-input v-model="scope.row[item.columnProp]" style="height: 11px; width: 98%"></el-input>
            </template>
            <template v-else>
              <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>
          </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="isDetailReadonly" 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="isDetailReadonly" 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="75"
          label="项目检验结论">
          <template slot-scope="scope">
            <el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="isItemResultReadonly" v-model="scope.row.itemResult" disabled style="height: 11px" >
              <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" 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>

      <!-- 底部操作按钮 -->
      <div class="dialog-footer">
        <el-button v-if="detailData.state === '待检验' && !exceptionModifyMode" type="primary" :loading="transferLoadFlag" @click="Transfer('1')">应用</el-button>
        <el-button v-if="detailData.state === '待检验' || detailData.state === '待审核' || exceptionModifyMode" type="primary" :loading="transferLoadFlag" @click="Transfer('2')">保存</el-button>
        <el-button @click="detailInformationFlag=false">关闭</el-button>
      </div>
    </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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="isSubDetailReadonly(templateTableData[row.xh-1])" 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="!isDetailReadonly" type="primary" @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="templateModelFlag" width="520px">
      <div class="rq">
        <el-form :inline="true" label-position="top" :model="templateData">
          <el-form-item :label="'模板编码'">
            <el-input v-model="templateData.templateId" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="'模板名称'">
            <el-input v-model="templateData.templateName" clearable style="width: 120px"></el-input>
          </el-form-item>
          <el-form-item :label="' '">
            <el-button type="primary" @click="queryTemplateList">查询</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :height="300"
          :data="templateList"
          @row-dblclick="getRowData"
          border
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in templateDetailList" :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="templateModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 物料 -->
    <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="partModelFlag" width="520px">
      <div class="rq">
        <el-form :inline="true" label-position="top" :model="partData">
          <el-form-item :label="'物料编码'">
            <el-input v-model="partData.partNo" clearable style="width: 115px"></el-input>
          </el-form-item>
          <el-form-item :label="'物料名称'">
            <el-input v-model="partData.partDesc" clearable style="width: 115px"></el-input>
          </el-form-item>
          <el-form-item :label="'SKU'">
            <el-input v-model="partData.sku" clearable style="width: 79px"></el-input>
          </el-form-item>
          <el-form-item :label="'PN'">
            <el-input v-model="partData.cinvSourceCode" clearable style="width: 79px"></el-input>
          </el-form-item>
          <el-form-item :label="' '">
            <el-button type="primary" @click="queryPartList">查询</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :height="300"
          :data="partList"
          @row-dblclick="getRowData2"
          border
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in partDetailList" :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="partModelFlag=false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 文件清单 -->
    <el-dialog :close-on-click-modal="false" v-drag :visible.sync="fileFlag" width="900px">
      <span slot="title" class="file-dialog-title">
        <span>文件清单</span>
        <a class="file-dialog-link" href="#" @click.prevent="openFileExternalLink">外部链接</a>
      </span>
      <el-tabs v-model="fileActiveTab" type="border-card">
        <el-tab-pane label="QC检验文件" name="qcFile">
          <el-form :inline="true" label-position="top" style="margin-bottom: 10px;">
            <el-form-item v-if="detailInformationFlag">
              <el-button type="primary" size="small" @click="addUploadFileModal">上传文件</el-button>
            </el-form-item>
          </el-form>
          <iqc-file-table :columns="fileColumnList" :data-list="fileContentList" :query-loading="fileLoading" @refreshFileList="getFileContentData(currentFileRow)"></iqc-file-table>
        </el-tab-pane>
        <el-tab-pane label="SOP文件" name="sopFile">
          <el-table :data="sopFileList" border v-loading="sopFileLoading" height="350" style="width: 100%;">
            <el-table-column prop="sopName" header-align="center" align="left" label="文件名称" min-width="200" show-overflow-tooltip></el-table-column>
            <el-table-column prop="fileType" header-align="center" align="center" label="文件类型" width="100"></el-table-column>
            <el-table-column prop="version" header-align="center" align="center" label="版本号" width="80"></el-table-column>
            <el-table-column prop="createdBy" header-align="center" align="center" label="上传人" width="100"></el-table-column>
            <el-table-column prop="creationDate" header-align="center" align="center" label="上传时间" width="150"></el-table-column>
            <el-table-column fixed="right" header-align="center" align="center" width="80" label="操作">
              <template slot-scope="scope">
                <el-link type="primary" @click="previewSopFile(scope.row)">预览</el-link>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>
      <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="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="seqDetailFlag" width="952px" height="273px">
      <el-form :inline="true" label-position="top" :model="seqDetailData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="工单号">
          <el-input v-model="seqDetailData.orderNo" clearable style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="派工单号">
          <el-input v-model="seqDetailData.seqNo" clearable style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="SKU">
          <el-input v-model="seqDetailData.sku" clearable style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="状态">
          <el-select v-model="seqDetailData.status" style="width: 100px" placeholder="请选择">
            <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="seqDetailData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="物料编码">
          <el-input v-model="seqDetailData.partNo" clearable style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="物料名称">
          <el-input v-model="seqDetailData.partDesc" clearable style="width: 315px"></el-input>
        </el-form-item>
        <el-form-item label="工序">
          <el-input v-model="seqDetailData.operationDesc" clearable style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="searchSeqInfo" style="margin-top: 24px">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="400"
        :data="seqInfoList"
        @row-dblclick="getRowData1"
        border
        style="width: 100%;">
        <el-table-column
          v-for="(item,index) in seqDetailColumnList" :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">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="seqDetailFlag = 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'" :label="'所属角色'">
            <el-select v-model="operatorData.roleId" placeholder="请选择" style="width: 120px">
              <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">
      <div class="rq">
        <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>
      </div>
      <el-footer style="height:35px;margin-top: 15px;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模态框 -->
    <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>

    <!-- 项目操作对话框 -->
    <el-dialog
      title="检验项目操作"
      @close="refreshInspectionDetailList"
      :close-on-click-modal="false"
      v-drag
      :visible.sync="itemOperationDialogFlag"
      width="1200px"
      custom-class="item-operation-dialog">
      <div class="search-container">
        <el-form :inline="true" size="small">
          <el-form-item label="项目编码">
            <el-input v-model="itemOperationQuery.itemNo" placeholder="请输入项目编码" clearable prefix-icon="el-icon-search" style="width: 160px"></el-input>
          </el-form-item>
          <el-form-item label="项目名称">
            <el-input v-model="itemOperationQuery.itemDesc" placeholder="请输入项目名称" clearable prefix-icon="el-icon-search" style="width: 200px"></el-input>
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="searchFQCItems">查询</el-button>
          <el-button icon="el-icon-refresh" size="small" @click="resetItemQuery">重置</el-button>
        </el-form>
      </div>
      <div class="item-operation-content">
        <div class="item-panel available-panel">
          <div class="panel-header">
            <i class="el-icon-menu"></i>
            <span class="panel-title">可选项目列表</span>
            <span class="item-count">{{ availableItemList.length }}</span>
          </div>
          <el-table ref="availableItemTable" :data="availableItemList" @row-click="availableItemClickRow" @selection-change="availableItemSelectionChange" highlight-current-row class="operation-table" height="400" border>
            <el-table-column type="selection" width="45" align="center"></el-table-column>
            <el-table-column prop="itemNo" label="项目编码" min-width="120"></el-table-column>
            <el-table-column prop="itemDesc" label="项目名称" min-width="180" show-overflow-tooltip></el-table-column>
          </el-table>
        </div>
        <div class="operation-buttons">
          <el-tooltip content="添加选中项目" placement="left">
            <el-button type="primary" icon="el-icon-d-arrow-right" circle @click="addInspectionItems" :disabled="!availableItemSelections || availableItemSelections.length === 0"></el-button>
          </el-tooltip>
          <el-tooltip content="移除选中项目" placement="right">
            <el-button type="danger" icon="el-icon-d-arrow-left" circle @click="deleteInspectionItems" :disabled="!selectedItemSelections || selectedItemSelections.length === 0"></el-button>
          </el-tooltip>
        </div>
        <div class="item-panel selected-panel">
          <div class="panel-header">
            <i class="el-icon-tickets"></i>
            <span class="panel-title">已有项目列表</span>
            <span class="item-count">{{ selectedItemList.length }}</span>
          </div>
          <el-table ref="selectedItemTable" :data="selectedItemList" @row-click="selectedItemClickRow" @selection-change="selectedItemSelectionChange" highlight-current-row class="operation-table" height="400" border>
            <el-table-column type="selection" width="45" align="center"></el-table-column>
            <el-table-column prop="itemNo" label="项目编码" min-width="120"></el-table-column>
            <el-table-column prop="itemDesc" label="项目名称" min-width="180" show-overflow-tooltip></el-table-column>
          </el-table>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="itemOperationDialogFlag = false" size="small" style="width: 80px;">关闭</el-button>
      </div>
    </el-dialog>

    <!-- 模板导入对话框 -->
    <el-dialog
      title="模板导入"
      :close-on-click-modal="false"
      v-drag
      :visible.sync="templateImportDialogFlag"
      width="900px"
      custom-class="template-import-dialog">
      <div class="search-container">
        <el-form :inline="true" size="small">
          <el-form-item label="模板编码">
            <el-input v-model="templateQuery.templateId" placeholder="请输入模板编码" clearable prefix-icon="el-icon-search" style="width: 160px"></el-input>
          </el-form-item>
          <el-form-item label="模板名称">
            <el-input v-model="templateQuery.templateDesc" placeholder="请输入模板名称" clearable prefix-icon="el-icon-search" style="width: 200px"></el-input>
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="searchFQCTemplates">查询</el-button>
          <el-button icon="el-icon-refresh" size="small" @click="resetTemplateQuery">重置</el-button>
        </el-form>
      </div>
      <div class="template-list-container">
        <div class="panel-header">
          <i class="el-icon-s-grid"></i>
          <span class="panel-title">FQC检验模板</span>
          <span class="item-count">({{ templateList.length }})</span>
        </div>
        <el-table ref="templateTable" :data="templateList" @row-click="templateClickRow" @selection-change="templateSelectionChange" highlight-current-row class="template-table" height="450" :header-cell-style="{background: '#f5f7fa', color: '#606266', fontWeight: '500'}">
          <el-table-column type="selection" width="50" align="center"></el-table-column>
          <el-table-column prop="templateId" label="模板编码" align="center" width="120"></el-table-column>
          <el-table-column prop="templateName" label="模板名称" align="left" min-width="200" show-overflow-tooltip></el-table-column>
          <el-table-column prop="itemCount" label="项目数量" align="center" width="100"></el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" icon="el-icon-download" @click="confirmImportTemplate" :disabled="!templateSelections || templateSelections.length === 0" :loading="importLoading" size="small">导入选中模板</el-button>
        <el-button @click="templateImportDialogFlag = false" size="small" style="width: 80px;">关闭</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import {
    qcFQCInspectionSearch, // 查询FAI的检验记录
    fqcDetailSearch, // 查询FAI的检验明细
    fqcRecordDelete, // 删除检验记录
    saveFQCDetailedRecord, // 新增明细信息
    saveFQCSubmitResult, // 审核
    saveFQCSubDetailed, // 新增子明细信息
    selectFQCSubDetailedRecord, // 子明细记录信息查询
    checkFQCIsSubmit, // 检查是否已提交
    getResourceList, // 查询机台列表
    getOperationList, // 查询工序列表
    getPartList, // 查询物料列表
    saveFQCInspection, // 新增FQC检验
    queryController, // 检查动控
    queryTemplateList, // 获取检验模板列表
    getPartInformation, // 获取物料信息
    getSpecialOperationList, // 获取特殊工序列表
    inspectionTypeSearch, // 搜索所有检验类型
    disposalMeasuresSearch, // 获取处置措施列表
    getRollNo, // 模糊查询标签号
    rollNoEnter, // 标签号回车事件
    queryPartList, // 查询物料集合
    umSearch, // 查询单位列表
    getSiteAndBuByUserName,
    getSiteAndBuByUserName2,
    searchSeqInfo, // 查询派工单号
    actionFQCInspection, // 开始检验
    dataAcquisition, // 数据采集
    getResponsibleOperatorList, // 获取责任人列表
    getFQCItemObjectList, // 查询项目设备
    dataAcquisitionByItem, // 根据项目数据采集
    cancelApproval2, // 取消审核
    getUserRoleList, // 获取用户角色列表
    getOperatorList,
    // FQC检验项目操作和模板导入
    getFQCItemList,
    addFQCItemDetails,
    deleteFQCItemDetails,
    getFQCTemplateList,
    importFQCTemplateItems
  } 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 { searchQcSopFileList, downloadSopFile, getAllOperationDescList } from '@/api/qc/qc.js'
  import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  import {qcPrint} from '@/api/qc/qcPrint.js'
  import excel from "@/utils/excel-util.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";
  /*上传文件的組件*/
  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)
      },
      isDetailReadonly () {
        return this.detailData.submitFlag === 'Y' && !this.exceptionModifyMode
      },
      isInspectionResultReadonly () {
        return this.isDetailReadonly || this.exceptionModifyMode
      },
      isItemResultReadonly () {
        return this.isDetailReadonly || this.exceptionModifyMode
      },
      // 导出字段映射
      exportFields () {
        let fields = {}
        // 添加固定的状态列
        fields['状态'] = 'state'
        // 添加动态列
        this.columnList1.forEach(item => {
          fields[item.columnLabel] = item.columnProp
        })
        return fields
      }
    },
    watch: {
      detailData: {
        deep: true,
        handler: function (newV, oldV) {
          this.detailData.notPassQty = this.detailData.samplingQty - this.detailData.passQty
          if (this.detailData.inspectionResult === '不合格') {
            if (this.detailData.disposalMeasures === '让步接收' || this.detailData.disposalMeasures === '') {
              this.detailData.batchQualifiedQty = this.detailData.rollQty
            } else if (this.detailData.disposalMeasures === '挑选使用') {
              this.detailData.batchQualifiedQty = this.detailData.rollQty - this.detailData.notPassQty
            } else {
              this.detailData.batchQualifiedQty = 0
            }
          } else {
            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 {
        searchExpanded: false,
        loadFlag: false,
        transferLoadFlag: false,
        inspectionNo: '',
        fileFlag: false,
        fileContentList: [],
        fileActiveTab: 'qcFile',
        sopFileList: [],
        sopFileLoading: false,
        currentFileRow: null,
        operationDescList: [], // 工序下拉列表
        // 是否收藏
        favorite: false,
        // 导出 start
        exportData: [],
        exportName: "FAI检验录入" + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["FAI检验录入"],
        exportFooter: [],
        exportList: [],
        // 导出 end
        checkCompletedData: {
          inspectionNo: ''
        },
        submitData: {
          site: '',
          inspectionNo: '',
          submit_flag: '',
          inspectionResult: '',
          submitList: [],
          updateBy: this.$store.state.user.name,
          type: 'fqc'
        },
        tagNo: '',
        searchData: {
          site: '',
          userName: this.$store.state.user.name,
          inspectionNo: '',
          state: '',
          inspectionResult: '',
          orderNo: '',
          operationDesc: '',
          buNo: '',
          startDate: '',
          endDate: '',
          partNo: '',
          startDate2: '',
          endDate2: '',
          partDesc: '',
          cinvSourceCode: '',
          sku: '',
          disposalMeasures: '',
          page: 1,
          limit: 10,
          seqNo: '',
          states: ['未开始','待检验'],
          documentNo: ''
        },
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0,
        pageIndex2: 1,
        pageSize2: 20,
        totalPage2: 0,
        height: 200,
        dataList: [],
        dataListSelections: [],
        modalData: {
          flag: '',
          site: '',
          bu: '',
          inspectionNo: '',
          partNo: '',
          partDesc: '',
          inspectionTypeNo: '107',
          inspectionTypeName: '',
          inspectorNo: '',
          inspectorName: '',
          submit_flag: '',
          seqNo: '',
          batchRollNo: '',
          invdefinetype: '',
          sku: '',
          qtyrequired: '',
          lotsize:'',
          operationDesc:'',
          specialRequirements: '',
          templateId: '',
          templateName: '',
          specialTaskFlag: '',
          workCenterNo: '',
          rollNo: '',
          umId: '',
          umName: '',
          sjzs: ''
        },
        // 展示列集
        columnList1: [
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table1BuDesc',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1InspectionNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1BatchRollNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'batchRollNo',
            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: 301015,
            serialNumber: '301015Table1RollNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'rollNo',
            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: 301015,
            serialNumber: '301015Table1InspectionResult',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1DisposalMeasures',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'disposalMeasures',
            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: 301015,
            serialNumber: '301015Table1TaskDate',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'taskDate',
            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: 301015,
            serialNumber: '301015Table1InspectionCycle',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1DocumentNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'documentNo',
            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: 301015,
            serialNumber: '301015Table1OrderNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'orderNo',
            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: 301015,
            serialNumber: '301015Table1SeqNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'seqNo',
            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: 301015,
            serialNumber: '301015Table1OperationDesc',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'operationDesc',
            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: 301015,
            serialNumber: '301015Table1ResourceDesc',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'resourceDesc',
            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: 301015,
            serialNumber: '301015Table1PartNo',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1PartDesc',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1Spec',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'spec',
            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: 301015,
            serialNumber: '301015Table1Invdefinetype',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1RollQty',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1SamplingQty',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1UmName',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'umName',
            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: 301015,
            serialNumber: '301015Table1InspectionRemark',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1DisposalRemark',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1ActionDate',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1InspectorDate',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1SubmitDate',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1InspectorName',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            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: 301015,
            serialNumber: '301015Table1SpecialRequirements',
            tableId: "301015Table1",
            tableName: "FQC检验记录表",
            columnProp: 'specialRequirements',
            headerAlign: "center",
            align: "left",
            columnLabel: '特殊要求',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 200,
          },
        ],
        //项目清单
        detailData: {
          site: '',
          buNo: '',
          inspectionNo:'',
          partNo:'',
          partDesc:'',
          rollQty:'',
          samplingQty: '',
          unqualifiedQty: 0,
          unqualifiedQuantity:'',
          disposalMeasures:'',
          disposalRemark: '',
          inspectionResult: '',
          inspectorNo: '',
          inspectorName: '',
          inspectionRemark: '',
          submitFlag: '',
          cinvSourceCode: '',
          sku: '',
          invdefinetype: '',
          umId: '',
          umName: '',
          operator: '',
          operatorName: '',
          responsiblePerson: '',
          responsiblePersonName: '',
          state: '',
          passQty: '',
          notPassQty: '',
          batchQualifiedQty: '',
          spec: ''
        },
        detailInformationFlag: false,
        detailList: [],
        saveInformationData: {
          site: '',
          buNo: '',
          inspectionNo:'',
          disposalMeasures: '',
          disposalRemark: '',
          inspectorNo: '',
          inspectionRemark: '',
          samplingQty: '',
          rollQty: '',
          itemList:[],
          unqualifiedQty: '',
          partNo: '',
          partDesc: '',
          operator: '',
          operatorName: '',
          responsiblePerson: '',
          responsiblePersonName: '',
          subDetailList: [],
          type: '',
          passQty: '',
          notPassQty: '',
          batchQualifiedQty: ''
        },
        detailColumnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table2ItemNo',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2ItemDesc',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2SamplingLevelDesc',
            tableId: "301015Table2",
            tableName: "检验单明细表",
            columnProp: 'samplingLevelDesc',
            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: 301015,
            serialNumber: '301015Table2SamplingProgrammeDesc',
            tableId: "301015Table2",
            tableName: "检验单明细表",
            columnProp: 'samplingProgrammeDesc',
            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: 301015,
            serialNumber: '301015Table2MethodName',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2MethodRemark',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2ObjectDesc',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2Aql',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2Ac',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2Re',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2DefaultValue',
            tableId: "301015Table2",
            tableName: "检验单明细表",
            columnProp: 'defaultValue',
            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: 301015,
            serialNumber: '301015Table2MaxValue',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2MinValue',
            tableId: "301015Table2",
            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: 301015,
            serialNumber: '301015Table2ValueType',
            tableId: "301015Table2",
            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
          },
        ],
        // 派工单号
        seqInfoList: [],
        seqDetailFlag: false,
        seqDetailData: {
          orderNo: '',
          seqNo: '',
          sku: '',
          partNo: '',
          partDesc: '',
          operationDesc: '',
          qtyrequired: '',
          lotsize: '',
          status: '下达'
        },
        seqDetailColumnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3OrderNo',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'orderNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '工单号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3SeqNo',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'seqNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '派工单号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3Sku',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'sku',
            headerAlign: "center",
            align: "center",
            columnLabel: 'SKU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3PartNo',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'partNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '物料编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3PartDesc',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'partDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '物料名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3Lotsize',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'lotsize',
            headerAlign: "center",
            align: "center",
            columnLabel: '工单数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3Qtyrequired',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'qtyrequired',
            headerAlign: "center",
            align: "center",
            columnLabel: '派工数量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 301015,
            serialNumber: '301015Table3OperationDesc',
            tableId: "301015Table3",
            tableName: "任务新增-派工单",
            fixed: '',
            columnWidth: 80,
            columnProp: 'operationDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '工序',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
          }
        ],
        // 子明细数据对象
        tableData: [],
        checkedDetail: [],
        subDetailFlag: false,
        subDetailData: {
          site: '',
          buNo: '',
          inspectionNo: '',
          itemNo: '',
          itemDesc: '',
          defaultValue: '',
          maxValue: '',
          minValue: '',
          valueTypeDb: '',
          subDetailValues:[],
          page: 1,
          limit: 10,
        },
        options: [],
        FAISelections: [],
        modalFlag: false,
        rules: {
          orderNoType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          operationDescType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          resourceIdType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          rollQtyType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          seqNoType: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          partNoType: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          umIdType: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          templateId: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          bu:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ]
        },
        resourceList: [],
        operationList: [],
        partList: [],
        batchHandleAddModalFlag: false,
        batchAddData: {
          samplingLocation: '',
          samplingLocationB: '',
          samplingNumber: ''
        },
        controlData: {},
        templateData: {
          site: '',
          bu: '',
          templateId: '',
          templateName: '',
          inspectionTypeNo: '',
          inspectionTypeName: ''
        },
        templateModelFlag: false,
        templateDetailList: [
          {
            columnProp: 'templateId',
            headerAlign: "center",
            align: "center",
            columnLabel: '模板编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'templateName',
            headerAlign: "center",
            align: "center",
            columnLabel: '模板名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'inspectionTypeName',
            headerAlign: "center",
            align: "center",
            columnLabel: '检验类型',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
        ],
        checked: false,
        typeOptions: [],
        disposalMeasuresOptions: [],
        timeout: null,
        partData: {
          site: '',
          bu: '',
          partNo: '',
          partDesc: '',
          sku: '',
          cinvSourceCode: ''
        },
        partDetailList: [
          {
            columnProp: 'partNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '物料编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'partDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '物料名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'sku',
            headerAlign: "center",
            align: "center",
            columnLabel: 'SKU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
          {
            columnProp: 'cinvSourceCode',
            headerAlign: "center",
            align: "center",
            columnLabel: 'PN',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
          },
        ],
        partModelFlag: false,
        umList: [],
        userBuList: [],
        buList: [],
        authSearch: false,
        authSave: false,
        authCheck: false,
        authCancelCheck: false,
        authDelete: false,
        authDetail: false,
        authFile: false,
        authExceptionModify: false,
        exceptionModifyMode: false,
        exceptionModifyInspectionResult: '',
        exceptionModifyItemResultMap: {},
        menuId: this.$route.meta.menuId,
        roleList: [],
        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,
            columnWidth: 120,
          },
          {
            columnProp: 'itemDesc',
            headerAlign: "center",
            align: "left",
            columnLabel: '项目名称',
            columnHidden: false,
            columnImage: false,
            status: true,
            columnWidth: 200,
          },
        ],
        actionData: {
          site: '',
          buNo: '',
          inspectionNo: ''
        },
        fileLoading: false,
        subDetailLoading: false,
        saveLoading: false,
        searchLoading: false,
        // FQC项目操作相关
        itemOperationDialogFlag: false,
        itemOperationQuery: {
          itemNo: '',
          itemDesc: '',
        },
        availableItemList: [],
        selectedItemList: [],
        availableItemSelections: [],
        selectedItemSelections: [],
        // FQC模板导入相关
        templateImportDialogFlag: false,
        templateQuery: {
          templateId: '',
          templateDesc: '',
        },
        templateList: [],
        templateSelections: [],
        importLoading: false
      }
    },

    mounted () {
      this.calculateTableHeight();
      window.addEventListener('resize', this.calculateTableHeight);
    },
    beforeDestroy() {
      window.removeEventListener('resize', this.calculateTableHeight);
    },

    created () {
      // 按钮控制
      this.getButtonAuthData()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName2()
      // 收藏
      this.favoriteIsOk()
      // 检验类型
      this.inspectionTypeSearch()
      // 处置措施
      this.disposalMeasuresSearch()
      // 单位
      this.umSearch()
      // 查看 质量任务生成规则控制 动控是否开启
      this.queryController()
      // 动态列
      this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
      this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
      this.getTableUserColumn(this.$route.meta.menuId+'table3',3)
      if (!this.authSearch) {
        // 获取数据列表
        this.getDataList()
      }
      // 获取用户角色
      this.getUserRoleList()
      // 加载工序下拉列表
      this.loadOperationDescList()
    },

    methods: {
      // 加载工序下拉列表
      loadOperationDescList() {
        const params = {
          userName: this.$store.state.user.name
        }
        getAllOperationDescList(params).then(({data}) => {
          if (data && data.code === 0) {
            this.operationDescList = data.rows || []
          }
        })
      },
      // 切换搜索框展开/收起
      toggleSearchExpand() {
        this.searchExpanded = !this.searchExpanded;
        this.calculateTableHeight();
      },
      // 计算表格高度
      calculateTableHeight() {
        this.$nextTick(() => {
          const windowHeight = window.innerHeight;
          const headerHeight = this.searchExpanded ? 412 : 186;
          this.height = windowHeight - headerHeight - 65;
        });
      },

      formatMainListCellValue (row, column) {
        if (!row || !column) {
          return ''
        }
        const value = row[column.columnProp]
        if ((column.columnProp === 'taskDate' || column.columnProp === 'task_date') && value) {
          const formattedValue = this.dayjs(value).format('YYYY-MM-DD HH:mm:ss')
          return formattedValue === 'Invalid Date' ? value : formattedValue
        }
        return value
      },

      // 重置搜索条件
      resetSearch() {
        this.searchData = {
          site: '',
          userName: this.$store.state.user.name,
          inspectionNo: '',
          inspectionTypeNo: '',
          isQualified: '',
          buNo: '',
          startDate: '',
          endDate: '',
          startDate2: '',
          endDate2: '',
          partNo:'',
          partDesc:'',
          cinvSourceCode:'',
          sku:'',
          state: '',
          inspectionResult: '',
          disposalMeasures: '',
          page: 1,
          limit: 10,
          states: ['未开始','待检验'],
          orderNo: '',
          seqNo: '',
          operationDesc: '',
          documentNo: ''
        }
      },

      // 获取用户的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.FAISelections.length === 0) {
          this.$message.warning('请勾选要打印的检验单！')
          return
        }
        const inspectionNos = this.$refs.qrCode.init(this.FAISelections.map(item => item.inspectionNo))
        for (let i = 0; i < inspectionNos.length; i++) {
          this.FAISelections[i].qrCode = inspectionNos[i]
        }
        qcPrint(this.FAISelections)
      },

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

      // 根据项目数据采集
      dataAcquisitionByItem (row) {
        this.loadFlag = true
        let tempDate = {
          site: row.site,
          buNo: row.buNo,
          inspectionNo: row.inspectionNo,
          templateId: row.templateId,
          itemNo: row.itemNo,
          flag: 'fqc'
        }
        dataAcquisitionByItem(tempDate).then(({data}) => {
          if (data.code === 0) {
            this.changeMyString(data.rows)
            this.$message.success('数据采集成功')
          } else {
            this.$message.error(data.msg)
          }
          this.loadFlag = false
        })
      },

      // 获取用户角色
      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
        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 = ''
        }
        // 先清空缓存选中
        this.$nextTick(() => this.$refs.operatorTable.clearSelection())
        // 拿到选中的人员编号
        let tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';')
        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))
              }
            })
            this.operatorModelFlag = true
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 获取责任人员列表
      getResponsiblePersonList () {
        this.operatorData.flag = '2'
        this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo

        // 先清空缓存选中
        this.$nextTick(() => this.$refs.operatorTable.clearSelection())
        // 拿到选中的人员编号
        let tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';')
        getResponsibleOperatorList(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))
              }
            })
            this.operatorModelFlag = true
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 查询机修人员列表
      getOperatorList2 () {
        if (this.operatorData.flag === '1') {
          // 拿到选中的人员编号
          let tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';')
          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))
                }
              })
            } else {
              this.operatorList = []
            }
          })
        } else {
          // 拿到选中的人员编号
          let tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';')
          getResponsibleOperatorList(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))
                }
              })
            } else {
              this.operatorList = []
            }
          })
        }
      },

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

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

      // 确认多选协同人员
      confirmOperator () {
        if (this.dataListSelections2.length === 0) {
          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 {
          for (let i = 0; i < this.dataListSelections2.length; i++) {
            if (!this.detailData.responsiblePerson.split(';').includes(this.dataListSelections2[i].adminID)) {
              this.detailData.responsiblePersonName = this.detailData.responsiblePersonName + ";" + this.dataListSelections2[i].adminName
              this.detailData.responsiblePerson = this.detailData.responsiblePerson + ";" + this.dataListSelections2[i].adminID
            }
          }
          if (this.detailData.responsiblePerson.charAt(0) === ';') {
            this.detailData.responsiblePerson = this.detailData.responsiblePerson.substring(1)
            this.detailData.responsiblePersonName = this.detailData.responsiblePersonName.substring(1)
          }
        }
        this.operatorData = {
          flag: '',
          site: '',
          bu: '',
          adminID: '',
          adminName: '',
          roleName: '',
          roleId: '',
          userName: this.$store.state.user.name
        }
        this.operatorModelFlag = false
      },

      // bu内容改变事件
      buChange () {
        if (this.modalData.specialTaskFlag !== 'Y') { // 正常检验
          this.modalData.templateId = ''
          this.modalData.templateName = ''
        } else { // 无工单检验
          this.modalData.partNo = ''
          this.modalData.partDesc = ''
          this.modalData.invdefinetype = ''
          this.modalData.sku = ''
          this.modalData.cinvSourceCode = ''
          this.modalData.templateId = ''
          this.modalData.templateName = ''
        }
      },

      // 获取用户的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: 'FQC',
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          inspectionNo: this.detailData.inspectionNo
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.subDetailUpload.init(currentData)
        })
      },

      // 查询单位
      umSearch () {
        let tempData = {
          site: this.$store.state.user.site,
          active: 'Y'
        }
        umSearch(tempData).then(({data}) => {
          if (data.code === 0) {
            this.umList = data.rows
          }
        })
      },

      // 标签号回车事件
      rollNoEnter () {
        const regex = /\(08\)(.*)/
        const result = this.modalData.rollNo.match(regex)
        let tempData = {
          site: '',
          bu: this.modalData.bu,
          rollNo: result == null ? this.modalData.rollNo : result[1]
        }
        rollNoEnter(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.operationList = data.rows
            this.modalData.seqNo = data.rows[0].seqNo
            this.modalData.orderNo = data.rows[0].orderNo
            this.modalData.operationDesc = data.rows[0].operationDesc
            this.modalData.workCenterNo = data.rows[0].workCenterNo
            this.modalData.resourceId = data.rows[0].resourceId
            this.modalData.resourceDesc = data.rows[0].resourceDesc
            this.modalData.partNo = data.rows[0].partNo
            this.modalData.partDesc = data.rows[0].partDesc
            this.modalData.invdefinetype = data.rows[0].invdefinetype
            this.modalData.sku = data.rows[0].sku
            this.modalData.cinvSourceCode = data.rows[0].cinvSourceCode
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      querySearchAsync (queryString, cb) {
        clearTimeout(this.timeout)
        let results = []
        if (queryString === '') {
          cb(results)
        } else {
          // 掉接口需要的参数
          let find = {
            rollNo: queryString, //上面输入框绑定的数据
            site: this.$store.state.user.site,
          }
          // 这里去调后端的接口.根据自己接口的情况进行赋值
          getRollNo(find).then(({data}) => {
            if (data.code === 0) {
              let result = data.rows
              // 循环放到一个远程搜索需要的数组
              for (let i = 0; i < result.length; i++) {
                const element = result[i]
                results.push({
                  value: element.rollNo,
                  seqNo: element.seqNo,
                  orderNo: element.orderNo
                })
              }
              cb(results)
            } else {
              results = []
              cb(results)
            }
          })
        }
      },

      // 点击出现搜索后点击的每一项
      handleSelect (item) {
        this.modalData.rollNo = item.value
        this.modalData.seqNo = item.seqNo
        this.modalData.orderNo = item.orderNo
        this.getOperationList()
        //this.getPartList()
      },

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

      // 查询检验类型
      inspectionTypeSearch () {
        let tempData = {
          site: this.$store.state.user.site
        }
        inspectionTypeSearch(tempData).then(({data}) => {
          if (data.code === 0) {
            this.typeOptions = data.rows
            this.typeOptions.forEach(val => {
              if (val.inspectionTypeName.includes('FQC')) {
                this.templateData.inspectionTypeNo = val.inspectionTypeNo
                this.templateData.inspectionTypeName = val.inspectionTypeName
              }
            })
          }
        })
      },

      // 获取基础数据列表S
      getBaseList (val,type) {
        this.tagNo = val
        this.$nextTick(() => {
          let strVal = ''
          if (val === 1052) {
            this.searchSeqInfo()
            this.seqDetailFlag = true
          }
          if (val === 505) {
            strVal = this.modalData.resourceDesc
            this.$refs.baseList.init(val, strVal)
          }
        })
      },

      /* 列表方法的回调 */
      getBaseData (val) {
        if (this.tagNo === 1052) {
          this.modalData.seqNo = val.seqno
          this.modalData.orderNo = val.orderno
          this.modalData.operationDesc = ''
          this.modalData.resourceId = ''
          this.getOperationList()
        }
        if (this.tagNo === 505) {
          this.modalData.resourceId = val.resource_id
          this.modalData.resourceDesc = val.resource_desc
        }
      },

      // 获取机台列表
      getResourceList () {
        // 判断是否为特殊任务，特殊任务的机台不随工序改变
        if (this.modalData.specialTaskFlag === 'Y') {
          return
        } else {
          getResourceList(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.modalData.workCenterNo = data.rows[0].workCenterNo
              this.modalData.resourceId = data.rows[0].resourceId
              this.modalData.resourceDesc = data.rows[0].resourceDesc
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      },

      // 获取工序列表
      getOperationList () {
        getOperationList(this.modalData).then(({data}) => {
          if (data && data.code === 0) {
            this.operationList = data.rows
            this.modalData.operationDesc = data.rows[0].operationDesc
            this.modalData.workCenterNo = data.rows[0].workCenterNo
            this.modalData.resourceId = data.rows[0].resourceId
            this.modalData.resourceDesc = data.rows[0].resourceDesc
            this.modalData.partNo = data.rows[0].partNo
            this.modalData.partDesc = data.rows[0].partDesc
            this.modalData.invdefinetype = data.rows[0].invdefinetype
            this.modalData.sku = data.rows[0].sku
            this.modalData.cinvSourceCode = data.rows[0].cinvSourceCode
            this.modalData.operationDesc = data.rows[0].operationDesc
            this.modalData.qtyrequired = data.rows[0].qtyrequired
            this.modalData.lotsize = data.rows[0].lotsize
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 获取物料列表
      getPartList () {
        getPartList(this.modalData).then(({data}) => {
          if (data && data.code === 0) {
            this.partList = data.rows
            this.modalData.partNo = this.partList[0].partNo
            this.modalData.partDesc = this.partList[0].partDesc
            this.modalData.invdefinetype = this.partList[0].invdefinetype
            this.modalData.sku = this.partList[0].sku
            this.modalData.cinvSourceCode = this.partList[0].cinvSourceCode
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 是否新增特殊任务
      changeSpecialTask () {
        // 先重置数据
        this.modalData = {
          flag: '1',
          site: '',
          bu: this.userBuList[0].buNo,
          inspectionNo: '',
          partNo: '',
          partDesc: '',
          inspectionTypeNo: '',
          inspectionTypeName: '',
          inspectorNo: '',
          inspectorName: '',
          submit_flag: '',
          orderNo: '',
          operationDesc: '',
          operationNo: '',
          resourceId: '',
          resourceDesc: '',
          rollQty: '',
          seqNo: '',
          batchRollNo: '',
          invdefinetype: '',
          sku: '',
          cinvSourceCode: '',
          specialRequirements: '',
          templateId: '',
          templateName: '',
          specialTaskFlag: '',
          workCenterNo: '',
          rollNo: '',
          umId: this.umList[0].umId,
          umName: this.umList[0].umName
        }
        // 获取选中框
        let obj = document.getElementsByName('specialTask')
        // 判断是否打勾
        if (obj[0].checked) {
          let tempData = {
            site: '',
            bu: this.modalData.bu
          }
          this.modalData.specialTaskFlag = 'Y'
          // 获取特殊工序列表
          getSpecialOperationList(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.operationList = data.rows
            } else {
              this.$message.error(data.msg)
            }
          })
          // 派工单和工单号赋值
          this.modalData.seqNo = '000#1TSGD'
          this.modalData.orderNo = '000#1'
        } else {
          this.operationList = []
          this.modalData.specialTaskFlag = ''
        }
      },

      // 新增FAI巡检记录
      saveData () {
        if (this.modalData.bu === '' || this.modalData.bu == null) {
          this.$message.warning('请选择BU！')
          return
        }
        if (this.modalData.seqNo === '' || this.modalData.seqNo == null) {
          this.$message.warning('请选择派工单！')
          return
        }
        if (this.modalData.orderNo === '' || this.modalData.orderNo == null) {
          this.$message.warning('请选择工单！')
          return
        }
        if (this.modalData.specialTaskFlag !== 'Y' && (this.modalData.partNo === '' || this.modalData.partNo == null)) {
          this.$message.warning('请选择物料！')
          return
        }
        if (this.modalData.operationDesc === '' || this.modalData.operationDesc == null) {
          this.$message.warning('请选择工序！')
          return
        }
        if (this.modalData.specialTaskFlag !== 'Y' && (this.modalData.resourceId === '' || this.modalData.resourceId == null)) {
          this.$message.warning('请选择机台！')
          return
        }
        if (this.modalData.rollQty === '' || this.modalData.rollQty == null) {
          this.$message.warning('请填写送检数量！')
          return
        }
        if (this.modalData.umId === '' || this.modalData.umId == null) {
          this.$message.warning('请选择单位！')
          return
        }
        if (this.controlData.baseData === '控制' && (this.modalData.templateId == null || this.modalData.templateId === '')) {
          this.$message.warning('请选择检验模板！')
          return
        }
        this.saveLoading = true
        if (this.modalData.flag === '1') {
          saveFQCInspection(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.operationList = []
              this.resourceList = []
              this.partList = []
              this.modalFlag = false
              this.$message.success('操作成功')
            } else {
              this.$message.error(data.msg)
            }
            this.saveLoading = false
          }).catch(()=>{
            this.saveLoading = false
          })
        }
      },

      // 检查动控是否开启
      queryController () {
        let tempData = {
          controlNo: '10004',
          site: this.$store.state.user.site,
        }
        queryController(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.controlData = data.rows
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 新增
      addModal () {
        this.modalData = {
          flag: '1',
          site: '',
          bu: this.userBuList[0].buNo,
          inspectionNo: '',
          partNo: '',
          partDesc: '',
          inspectionTypeNo: '107',
          inspectionTypeName: '',
          inspectorNo: '',
          inspectorName: '',
          submit_flag: '',
          orderNo: '',
          operationDesc: '',
          operationNo: '',
          resourceId: '',
          resourceDesc: '',
          rollQty: '',
          seqNo: '',
          batchRollNo: '',
          invdefinetype: '',
          sku: '',
          cinvSourceCode: '',
          specialRequirements: '',
          templateId: '',
          templateName: '',
          specialTaskFlag: '',
          workCenterNo: '',
          rollNo: '',
          umId: this.umList[0].umId,
          umName: this.umList[0].umName,
          sjzs: '',
        }
        this.operationList = []
        this.resourceList = []
        this.partList = []
        this.modalFlag = true
        this.checked = false
      },

      // 获取检验模板列表
      queryTemplateList () {
        this.templateData.bu = this.modalData.bu
        // 查询所有检验模板
        queryTemplateList(this.templateData).then(({data}) => {
          if (data && data.code === 0) {
            this.templateList = data.rows
            this.templateModelFlag = true
          }else {
            this.$message.error(data.msg)
          }
        })
      },

      // 获取物料列表
      queryPartList () {
        this.partData.bu = this.modalData.bu
        // 查询所有物料
        if (this.partData.partNo === '' && this.partData.partDesc === '' && this.partData.sku === '' && this.partData.cinvSourceCode === '') {
          this.partList = []
          this.partModelFlag = true
        } else {
          queryPartList(this.partData).then(({data}) => {
            if (data && data.code === 0) {
              this.partList = data.rows
              this.partModelFlag = true
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      },

      // 选中检验模板
      getRowData (row) {
        this.modalData.templateId = row.templateId
        this.modalData.templateName = row.templateName
        this.templateModelFlag = false
      },

      // 选中派工单号
      getRowData1 (row) {
        this.modalData.sku = row.sku
        this.modalData.cinvSourceCode = row.cinvSourceCode
        this.modalData.orderNo = row.orderNo
        this.modalData.seqNo = row.seqNo
        this.modalData.lotsize = row.lotsize
        this.modalData.operationDesc = row.operationDesc
        this.modalData.qtyrequired = row.qtyrequired
        this.modalData.rollQty = row.qtyrequired
        this.modalData.sjzs = row.sjzs
        this.getOperationList()
        this.seqDetailFlag = false
      },

      // 选中物料
      getRowData2 (row) {
        this.modalData.partNo = row.partNo
        this.modalData.partDesc = row.partDesc
        this.modalData.sku = row.sku
        this.modalData.cinvSourceCode = row.cinvSourceCode
        this.modalData.invdefinetype = row.invdefinetype
        this.partData = {
          site: '',
          bu: '',
          partNo: '',
          partDesc: '',
          sku: '',
          cinvSourceCode: ''
        }
        this.partModelFlag = false
      },

      selectFlag () {
        return true
      },

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

      // 复选
      selectionFAI (val) {
        this.FAISelections = val
      },

      // 刷新派设备文档的列表
      getFileContentData (row) {
        this.currentFileRow = row
        this.fileActiveTab = 'qcFile'
        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.getSopFileList(row)
        this.fileFlag = true
      },

      // 打开文件清单外部链接（按物料编码）
      openFileExternalLink () {
        const partNo = (this.currentFileRow && this.currentFileRow.partNo) || this.detailData.partNo
        if (!partNo) {
          this.$message.error('物料号不能为空')
          return false
        }
        const baseUrl = window.SITE_CONFIG['materialSopUrl'] || 'http://pdm.bt.in/#/public/materialSop'
        const targetUrl = `${baseUrl}/${partNo}`
        window.open(targetUrl, '_blank')
      },

      // 获取SOP文件列表（FQC传所有条件：site, partNo, operationDesc, workcenterNo, orderNo）
      getSopFileList(row) {
        this.sopFileLoading = true
        this.sopFileList = []
        searchQcSopFileList({
          site: row.site,
          partNo: row.partNo || '',
          operationDesc: row.operationDesc || '',
          workcenterNo: row.workCenterNo || '',
          orderNo: row.orderNo || ''
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.sopFileList = data.rows || []
          } else {
            this.sopFileList = []
          }
          this.sopFileLoading = false
        }).catch(() => {
          this.sopFileList = []
          this.sopFileLoading = false
        })
      },

      previewSopFile(row) {
        if (!row.sopUrl) {
          this.$message.warning('该文件暂无预览路径')
          return
        }
        const fileName = row.sopName || row.sopUrl
        downloadSopFile(row.sopUrl).then(({ data }) => {
          this.$filePreview.previewFile(data, fileName).then(result => {
            if (result.message) {
              this.$message.success(result.message)
            }
          }).catch(error => {
            this.$message.error('文件预览失败：' + (error.message || '未知错误'))
          })
        }).catch(() => {
          this.$message.error('文件下载失败，请稍后重试')
        })
      },

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

      // 上传项目图片
      uploadImageModal (row) {
        // 打开上传图片前先应用当前数据，防止上传完成刷新表单后导致未保存的数据丢失
        if (this.detailData.state === '待检验') {
          this.Transfer('1')
        }
        let currentData = {
          site: this.detailData.site,
          buNo: this.detailData.buNo,
          createBy: this.$store.state.user.name,
          inspectionNo: this.detailData.inspectionNo,
          itemNo: row.itemNo,
          folder: 'FQCItemImageFile'
        }
        //打开组件 去做新增业务
        this.$nextTick(() => {
          this.$refs.comQcItemImageUploadFile.init(currentData)
        })
      },

      // 获取主信息数据列表
      getDataList () {
        this.searchLoading = true
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        qcFQCInspectionSearch(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()
      },

      // 导出excel - 获取所有数据
      async createExportData () {
        this.searchData.limit = -1
        this.searchData.page = 1
        const { data } = await qcFQCInspectionSearch(this.searchData)
        return data.page.list || []
      },

      startDownload () {
        this._exportLoading = this.$loading({
          lock: true,
          text: '正在导出数据，请稍候...',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        })
      },

      finishDownload () {
        if (this._exportLoading) {
          this._exportLoading.close()
          this._exportLoading = null
        }
      },

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

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

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

      // 删除检验记录
      deleteModal () {
        if (this.FAISelections.length === 0) {
          this.$alert('请勾选要删除的检验单！', '提示', {
            confirmButtonText: '确定'
          })
          return false
        }
        this.$confirm(`是否删除该 `+ this.FAISelections.length +` 条检验记录?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: '',
            submitList: this.FAISelections
          }
          fqcRecordDelete(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.FAISelections = []
              this.$message.success('操作成功')
            } else {
              this.$message.error(data.msg)
            }
          })
        })
      },

      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.preserveExceptionLockedFields()
        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.rollQty = this.detailData.rollQty
        this.saveInformationData.samplingQty = this.detailData.samplingQty
        this.saveInformationData.unqualifiedQty = this.detailData.unqualifiedQty
        this.saveInformationData.partNo = this.detailData.partNo
        this.saveInformationData.partDesc = this.detailData.partDesc
        this.saveInformationData.operator = this.detailData.operator
        this.saveInformationData.responsiblePerson = this.detailData.responsiblePerson
        this.saveInformationData.itemList = JSON.parse(JSON.stringify(this.detailList))
        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.saveInformationData.type = this.exceptionModifyMode ? '3' : type
        this.transferLoadFlag = true
        saveFQCDetailedRecord(this.saveInformationData).then(({data}) => {
          if (data && data.code === 0) {
            this.getDataList()
            // 应用时(type=1)不关闭对话框，只刷新数据
            if (type === '1') {
              this.getInspectionFormData()
            } else {
              this.detailInformationFlag = false
            }
            this.$message.success('操作成功')
          } else {
            this.$message.error(data.msg)
          }
          this.transferLoadFlag = false
        }).catch(()=>{
          this.transferLoadFlag = false
        })
      },

      abnormalModifyModal (row) {
        this.detailModal(row, true)
      },

      closeDetailDialog () {
        this.exceptionModifyMode = false
        this.exceptionModifyInspectionResult = ''
        this.exceptionModifyItemResultMap = {}
      },

      preserveExceptionLockedFields () {
        if (!this.exceptionModifyMode) {
          return
        }
        this.detailData.inspectionResult = this.exceptionModifyInspectionResult
        this.detailList.forEach(item => {
          const originItemResult = this.exceptionModifyItemResultMap[item.itemNo]
          if (originItemResult !== undefined) {
            item.itemResult = originItemResult
          }
        })
      },

      isSubDetailReadonly (row) {
        if (!row) {
          return true
        }
        return row.isSubmit === 'Y' && !this.exceptionModifyMode
      },

      // 开始检验
      actionModal (row) {
        this.actionData = {
          site: row.site,
          buNo: row.buNo,
          inspectionNo: row.inspectionNo
        }
        getFQCItemObjectList(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.$message.error(data.msg)
          }
        })
      },

      // 开始检验
      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
          }
          actionFQCInspection(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.$message.success('操作成功')
              this.ItemObjectModelFlag = false
            } else {
              this.$message.error(data.msg)
            }
          })
        })
      },

      // 明细记录信息查询
      detailModal (row, exceptionModifyMode = false) {
        this.exceptionModifyMode = exceptionModifyMode
        this.exceptionModifyInspectionResult = ''
        this.exceptionModifyItemResultMap = {}
        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.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.inspectorName = row.inspectorName
        this.detailData.inspectionRemark = row.inspectionRemark
        this.detailData.cinvSourceCode = row.cinvSourceCode
        this.detailData.sku = row.sku
        this.detailData.invdefinetype = row.invdefinetype
        this.detailData.umId = row.umId
        this.detailData.umName = row.umName
        this.detailData.operator = row.operator
        this.detailData.operatorName = row.operatorName
        this.detailData.responsiblePerson = row.responsiblePerson
        this.detailData.responsiblePersonName = row.responsiblePersonName
        this.detailData.state = row.state
        this.detailData.spec = row.spec
        if (this.exceptionModifyMode) {
          this.exceptionModifyInspectionResult = row.inspectionResult
        }
        if (row.state === '待检验') {
          this.detailData.passQty = row.samplingQty
        } else {
          this.detailData.passQty = row.passQty
          this.detailData.notPassQty = row.notPassQty
        }
        this.detailData.batchQualifiedQty = row.batchQualifiedQty
        this.getInspectionFormData()
        this.detailInformationFlag = true
      },

      // 检验单明细
      getInspectionFormData () {
        fqcDetailSearch(this.detailData).then(({data}) => {
          if (data && data.code === 0) {
            this.detailList = data.rows
            if (this.exceptionModifyMode) {
              let itemResultMap = {}
              this.detailList.forEach(item => {
                itemResultMap[item.itemNo] = item.itemResult
              })
              this.exceptionModifyItemResultMap = itemResultMap
            }
          } else {
            this.detailList = []
            this.exceptionModifyItemResultMap = {}
          }
        })
      },

      // 子明细记录信息查询
      subDetailModal (row) {
        this.subDetailLoading = true
        this.subDetailData = row
        this.pageIndex2 = 1
        selectFQCSubDetailedRecord(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 () {
        selectFQCSubDetailedRecord(this.subDetailData).then(({data}) => {
          if (data.code === 0) {
            this.tableData = data.rows
          }
        })
      },

      // 审核按钮
      submitResult () {
        let tempData1 = '' // 记录不是待审核状态的单号
        let tempData2 = '' // 记录处置措施未填写的单号
        if (this.FAISelections.length === 0) {
          this.$alert('请勾选要审核的检验单！', '提示', {
            confirmButtonText: '确定'
          })
          return false
        }
        for (let i = 0; i < this.FAISelections.length; i++) {
          if (this.FAISelections[i].state !== '待审核'){
            tempData1 = tempData1 + this.FAISelections[i].inspectionNo + '、'
          }
          if (this.FAISelections[i].inspectionResult === '不合格' && (this.FAISelections[i].disposalMeasures ==='' || this.FAISelections[i].disposalMeasures == null)) {
            tempData2 = tempData2 + this.FAISelections[i].inspectionNo + '、'
          }
        }
        if (tempData1 !== ''){
          tempData1 = tempData1.substring(0, tempData1.length - 1)
          this.$alert('检验单号 ' + tempData1 + ' 不是待审核状态！', '提示', {
            confirmButtonText: '确定'
          })
          return false
        }
        if (tempData2 !== ''){
          tempData2 = tempData2.substring(0, tempData2.length - 1)
          this.$alert('检验单号 ' + tempData2 + ' 的处置措施未选择！', '提示', {
            confirmButtonText: '确定'
          })
          return false
        }
        this.$confirm(`已确认单据信息无误，确定审核该 ` + this.FAISelections.length + ` 条记录`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.submitData.submitList = this.FAISelections
          saveFQCSubmitResult(this.submitData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.FAISelections = []
              this.$message.success('操作成功')
            } else {
              this.$message.error(data.msg)
            }
          })
        })
      },

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

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

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

      //点击新增更多
      handleAddBtn (td) {
        if (this.exceptionModifyMode) {
          let obj = {
            subDetailValue: '',
            samplingLocation: '',
            samplingLocationB: '',
            subDetailValueB: '',
            subDetailValueC: '',
            subDetailValueD: '',
            subDetailValueE: '',
          }
          this.tableData.push(obj)
          return
        }
        checkFQCIsSubmit(td).then(({data}) => {
          if (data.flag !== 1) {
            let obj = {
              subDetailValue: '',
              samplingLocation: '',
              samplingLocationB: '',
              subDetailValueB: '',
              subDetailValueC: '',
              subDetailValueD: '',
              subDetailValueE: '',
            }
            this.tableData.push(obj)
          } else {
            this.$message.error('记录已提交')
          }
        })
      },

      // 批量新增操作
      batchHandleAdd (td) {
        if (this.exceptionModifyMode) {
          this.batchHandleAddModalFlag = true
          return
        }
        checkFQCIsSubmit(td).then(({data}) => {
          if (data.flag !== 1) {
            this.batchHandleAddModalFlag = true
          } else {
            this.$message.error('记录已提交')
          }
        })
      },

      // 批量新增行
      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 (this.exceptionModifyMode) {
          return
        }
        if (row.maxValue == null && row.minValue == null&&row.defaultValue==null) {
          this.$message.success("tuichu")
          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) {
        if (this.exceptionModifyMode) {
          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
                }
              },
            })
          }
          return
        }
        checkFQCIsSubmit(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
        saveFQCSubDetailed(this.subDetailData).then(({data}) => {
          if (data && data.code === 0) {
            if (data.count > 0) {
              if (!this.exceptionModifyMode) {
                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
              if (!this.exceptionModifyMode) {
                this.subDetailData.itemResult = 'Y'
              }
            }
            this.subDetailFlag = false
            this.tableData = []
            this.$message.success('操作成功')
          } else {
            this.$message.error(data.msg)
          }
        })
      },

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

      // 校验用户是否收藏
      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
          })
        }
      },

      ensureSubmitDateColumn (columns) {
        const columnList = Array.isArray(columns) ? [...columns] : []
        const hasSubmitDateColumn = columnList.some(item => item.columnProp === 'submitDate' || item.columnProp === 'submit_date')
        if (hasSubmitDateColumn) {
          return columnList
        }
        const submitDateColumn = {
          userId: this.$store.state.user.name,
          functionId: 301015,
          serialNumber: '301015Table1SubmitDate',
          tableId: "301015Table1",
          tableName: "FQC检验记录表",
          columnProp: 'submitDate',
          headerAlign: "center",
          align: "center",
          columnLabel: '审核时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 170,
        }
        const inspectorDateIndex = columnList.findIndex(item => item.columnProp === 'inspectorDate')
        if (inspectorDateIndex >= 0) {
          columnList.splice(inspectorDateIndex + 1, 0, submitDateColumn)
        } else {
          columnList.push(submitDateColumn)
        }
        return columnList
      },

      // 动态列开始 获取 用户保存的 格式列
      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 = this.ensureSubmitDateColumn(data.rows)
                break;
              case 2:
                this.detailColumnList = data.rows
                break;
              case 3:
                this.seqDetailColumnList = 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 = this.ensureSubmitDateColumn(data.rows)
                break;
              case 2:
                this.detailColumnList = data.rows
                break;
              case 3:
                this.seqDetailColumnList = data.rows
                break;
            }
          }
        })
      },

      // 明细导入后将返回值回传给父组件
      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 (!this.exceptionModifyMode && val[this.detailList[i].itemNo] > 0) {
              this.detailList[i].itemResult = 'N'
            }
          }
        }
      },

      searchSeqInfo () {
        let tempData = {
          // 取modalData.bu中index为0的字符作为site  例：2_01-Label 取2
          bu: this.modalData.bu,
          seqNo: this.seqDetailData.seqNo,
          orderNo: this.seqDetailData.orderNo,
          sku: this.seqDetailData.sku,
          partDesc: this.seqDetailData.partDesc,
          partNo: this.seqDetailData.partNo,
          operationDesc: this.seqDetailData.operationDesc,
          status: this.seqDetailData.status
        }
        if (!this.seqDetailData.seqNo && !this.seqDetailData.orderNo && !this.seqDetailData.sku && !this.seqDetailData.partNo && !this.seqDetailData.partDesc && !this.seqDetailData.operationDesc){
          this.seqInfoList = []
        } else {
          searchSeqInfo(tempData).then(({data}) => {
            if (data && data.code === 0) {
              this.seqInfoList = data.rows
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      },
      closeDialog () {
        this.seqDetailData = {
          seqNo : '',
          orderNo: '',
          sku: '',
          partNo: '',
          partDesc:'',
          operationDesc: '',
          status: '下达'
        }
        this.seqInfoList = []
      },

      //获取按钮的权限数据
      getButtonAuthData () {
        let searchFlag = this.isAuth(this.menuId + ":search")
        let checkFlag = this.isAuth(this.menuId + ":check")
        let saveFlag = this.isAuth(this.menuId + ":save")
        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")
        let exceptionModifyFlag = this.isAuth(this.menuId + ":exceptionModify")
        //处理页面的权限数据
        this.authSearch = !searchFlag
        this.authCheck = !checkFlag
        this.authSave = !saveFlag
        this.authDelete = !deleteFlag
        this.authDetail = !detailFlag
        this.authFile = !fileFlag
        this.authCancelCheck = !cancelCheckFlag
        this.authExceptionModify = !exceptionModifyFlag
      },

      // ======================== FQC检验项目操作相关方法 ========================
      openItemOperationDialog() {
        this.itemOperationQuery = { itemNo: '', itemDesc: '' }
        this.searchFQCItems()
        this.itemOperationDialogFlag = true
      },
      async searchFQCItems() {
        try {
          const params = {
            site: this.detailData.site,
            buNo: this.detailData.buNo,
            inspectionNo: this.detailData.inspectionNo,
            itemNo: this.itemOperationQuery.itemNo || '',
            itemDesc: this.itemOperationQuery.itemDesc || ''
          }
          const { data } = await getFQCItemList(params)
          if (data && data.code === 0) {
            this.availableItemList = data.row1 || []
            this.selectedItemList = data.row2 || []
          }
        } catch (error) {
          this.$message.error('查询检验项目失败')
        }
      },
      availableItemClickRow(row) {
        this.$refs.availableItemTable.toggleRowSelection(row)
      },
      availableItemSelectionChange(selection) {
        this.availableItemSelections = selection
      },
      selectedItemClickRow(row) {
        this.$refs.selectedItemTable.toggleRowSelection(row)
      },
      selectedItemSelectionChange(selection) {
        this.selectedItemSelections = selection
      },
      async addInspectionItems() {
        if (!this.availableItemSelections || this.availableItemSelections.length === 0) {
          this.$message.warning('请选择要添加的项目')
          return
        }
        this.$confirm('确认添加选中的检验项目吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          try {
            const params = {
              site: this.detailData.site,
              buNo: this.detailData.buNo,
              inspectionNo: this.detailData.inspectionNo,
              itemList: this.availableItemSelections.map(item => ({ itemNo: item.itemNo }))
            }
            const { data } = await addFQCItemDetails(params)
            if (data && data.code === 0) {
              this.$message.success('添加成功')
              this.searchFQCItems()
            } else {
              this.$message.error(data.msg || '添加失败')
            }
          } catch (error) {
            this.$message.error('添加失败，请检查')
          }
        }).catch(() => {
          this.$message.info('已取消添加')
        })
      },
      async deleteInspectionItems() {
        if (!this.selectedItemSelections || this.selectedItemSelections.length === 0) {
          this.$message.warning('请选择要移除的项目')
          return
        }
        this.$confirm('确认移除选中的检验项目吗？（将同时删除该项目的子明细数据）', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          try {
            const params = {
              site: this.detailData.site,
              buNo: this.detailData.buNo,
              inspectionNo: this.detailData.inspectionNo,
              itemList: this.selectedItemSelections.map(item => ({ itemNo: item.itemNo }))
            }
            const { data } = await deleteFQCItemDetails(params)
            if (data && data.code === 0) {
              this.$message.success('移除成功')
              this.searchFQCItems()
            } else {
              this.$message.error(data.msg || '移除失败')
            }
          } catch (error) {
            this.$message.error('移除失败，请检查')
          }
        }).catch(() => {
          this.$message.info('已取消移除')
        })
      },
      refreshInspectionDetailList() {
        if (this.detailInformationFlag) {
          this.getInspectionFormData()
        }
      },

      // ======================== FQC模板导入相关方法 ========================
      openTemplateImportDialog() {
        this.templateQuery = { templateId: '', templateDesc: '' }
        this.searchFQCTemplates()
        this.templateImportDialogFlag = true
      },
      async searchFQCTemplates() {
        try {
          const params = {
            site: this.detailData.site,
            buNo: this.detailData.buNo,
            templateId: this.templateQuery.templateId || '',
            templateDesc: this.templateQuery.templateDesc || ''
          }
          const { data } = await getFQCTemplateList(params)
          if (data && data.code === 0) {
            this.templateList = data.rows || []
          }
        } catch (error) {
          this.$message.error('查询模板失败')
        }
      },
      templateClickRow(row) {
        this.$refs.templateTable.toggleRowSelection(row)
      },
      templateSelectionChange(selection) {
        this.templateSelections = selection
      },
      confirmImportTemplate() {
        if (!this.templateSelections || this.templateSelections.length === 0) {
          this.$message.warning('请选择要导入的模板')
          return
        }
        this.$confirm(`确认导入选中的 ${this.templateSelections.length} 个模板吗？`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          this.importLoading = true
          try {
            const params = {
              site: this.detailData.site,
              buNo: this.detailData.buNo,
              inspectionNo: this.detailData.inspectionNo,
              templateList: this.templateSelections.map(item => ({ templateId: item.templateId }))
            }
            const { data } = await importFQCTemplateItems(params)
            if (data && data.code === 0) {
              this.$message.success(`导入成功，共导入 ${data.importCount || 0} 个检验项目`)
              this.templateImportDialogFlag = false
              this.templateSelections = []
              this.getInspectionFormData()
            } else {
              this.$message.error(data.msg || '导入失败')
            }
          } catch (error) {
            this.$message.error('导入失败，请检查')
          } finally {
            this.importLoading = false
          }
        }).catch(() => {
          this.$message.info('已取消导入')
        })
      },
      resetItemQuery() {
        this.itemOperationQuery = { itemNo: '', itemDesc: '' }
        this.searchFQCItems()
      },
      resetTemplateQuery() {
        this.templateQuery = { templateId: '', templateDesc: '' }
        this.searchFQCTemplates()
      },
    }
  }
</script>

<style scoped>
.file-dialog-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.file-dialog-link {
  color: #17b3a3;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
}

.file-dialog-link:visited,
.file-dialog-link:active,
.file-dialog-link:hover {
  color: #17b3a3;
}

/* 搜索卡片样式 */
.search-card {
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.search-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.search-card /deep/ .el-card__header {
  padding: 5px 20px;
  background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  border-bottom: none;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  color: #fff;
}

.header-left i {
  font-size: 16px;
  margin-right: 8px;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-right {
  color: #fff;
}

.collapse-btn {
  color: #fff;
  font-weight: 500;
  transition: all 0.3s ease;
}

.collapse-btn:hover {
  color: #f0f0f0;
  transform: translateY(-1px);
}

.collapse-btn i {
  transition: transform 0.3s ease;
}

/* 搜索表单样式 */
.search-form {
  padding: 6px 0;
  min-height: 0;
}

/* 卡片主体样式 */
.search-card /deep/ .el-card__body {
  padding: 10px;
  transition: all 0.3s ease;
}

/* 收起时的样式 */
.search-card.collapsed /deep/ .el-card__body {
  padding: 10px 20px;
}

.search-form /deep/ .el-form-item {
  margin-bottom: 12px;
}

.search-form /deep/ .el-form-item__label {
  font-weight: 500;
  color: #606266;
  padding-bottom: 4px;
}

.search-form /deep/ .el-input__inner,
.search-form /deep/ .el-textarea__inner {
  border-radius: 6px;
  border: 1px solid #DCDFE6;
  transition: all 0.3s ease;
}

.search-form /deep/ .el-input__inner:focus,
.search-form /deep/ .el-textarea__inner:focus {
  border-color: #9ac3d0;
  box-shadow: 0 0 0 2px rgba(154, 195, 208, 0.1);
}

.search-form /deep/ .el-select {
  width: 100%;
}

.search-form /deep/ .el-date-editor.el-input {
  width: 100%;
}

/* 状态下拉框优化 */
.search-form /deep/ .status-select {
  width: 180px;
}

.search-form /deep/ .status-select .el-select__tags {
  max-width: calc(100% - 30px);
}

.search-form /deep/ .status-select .el-tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 操作按钮区域 */
.search-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 2px 0;
}

/* 展开时显示上边框 */
.search-card:not(.collapsed) .search-actions {
  border-top: 1px solid #f0f0f0;
  margin-top: 6px;
}

/* 收起时不显示上边框和上边距 */
.search-card.collapsed .search-actions {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.action-left,
.action-right {
  display: flex;
  gap: 8px;
}

.search-actions .el-button {
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.search-actions .el-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-actions .el-button--primary {
  background: #60aeff;
  border-color: #60aeff;
}

.search-actions .el-button--primary:hover {
  background: #7dbdff;
  border-color: #7dbdff;
}

.search-actions .el-button--success {
  background: #67C23A;
  border-color: #67C23A;
}

.search-actions .el-button--success:hover {
  background: #85ce61;
  border-color: #85ce61;
}

.search-actions .el-button--danger {
  background: #F56C6C;
  border-color: #F56C6C;
}

.search-actions .el-button--danger:hover {
  background: #f78989;
  border-color: #f78989;
}

.search-actions .el-button--warning {
  background: #E6A23C;
  border-color: #E6A23C;
}

.search-actions .el-button--warning:hover {
  background: #ebb563;
  border-color: #ebb563;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .search-actions {
    flex-direction: column;
    gap: 10px;
  }

  .action-left,
  .action-right {
    width: 100%;
    justify-content: center;
  }
}

/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;
}

/* ==================== FQC检验项目操作对话框样式 ==================== */
/deep/ .item-operation-dialog {
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
/deep/ .item-operation-dialog .el-dialog__header {
  background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  padding: 20px 24px;
  border-radius: 8px 8px 0 0;
}
/deep/ .item-operation-dialog .el-dialog__title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
/deep/ .item-operation-dialog .el-dialog__headerbtn .el-dialog__close {
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
}
/deep/ .item-operation-dialog .el-dialog__headerbtn:hover .el-dialog__close {
  color: #f0f0f0;
}
/deep/ .item-operation-dialog .el-dialog__body {
  padding: 24px;
  background: #f8f9fa;
}
.search-container {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.search-container .el-form-item {
  margin-bottom: 0;
}
.search-container .el-form-item__label {
  font-weight: 500;
  color: #606266;
}
.item-operation-content {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.item-panel {
  flex: 1;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.3s ease;
}
.item-panel:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.available-panel {
  flex: 1.5;
}
.selected-panel {
  flex: 1;
}
.panel-header {
  padding: 8px 16px;
  background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  border-bottom: 2px solid #9ac3d0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header i {
  font-size: 18px;
  color: #ffffff;
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5px;
}
.item-count {
  margin-left: auto;
  font-size: 12px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}
.operation-table {
  border: none !important;
}
.operation-table /deep/ .el-table__body tr:hover > td {
  background-color: #f0f7ff !important;
}
.operation-table /deep/ .el-table__row.current-row > td {
  background-color: #e6f2ff !important;
}
.operation-table /deep/ td {
  border-bottom: 1px solid #f0f0f0;
}
.operation-table /deep/ .el-table__body {
  font-size: 13px;
}
.operation-buttons {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 0 8px;
}
.operation-buttons .el-button {
  width: 48px;
  height: 48px;
  font-size: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.operation-buttons .el-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.operation-buttons .el-button.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.operation-buttons .el-button--primary {
  background: linear-gradient(135deg, #409EFF 0%, #66b1ff 100%);
  border: none;
}
.operation-buttons .el-button--danger {
  background: linear-gradient(135deg, #F56C6C 0%, #f78989 100%);
  border: none;
}
@media (max-width: 1200px) {
  .item-operation-content {
    flex-direction: column;
  }
  .operation-buttons {
    flex-direction: row;
    gap: 12px;
  }
  .operation-buttons .el-button {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
}
/deep/ .template-import-dialog {
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
/deep/ .template-import-dialog .el-dialog__header {
  background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
  padding: 20px 24px;
  border-radius: 8px 8px 0 0;
}
/deep/ .template-import-dialog .el-dialog__title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
/deep/ .template-import-dialog .el-dialog__headerbtn .el-dialog__close {
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
}
/deep/ .template-import-dialog .el-dialog__headerbtn:hover .el-dialog__close {
  color: #f0f0f0;
}
/deep/ .template-import-dialog .el-dialog__body {
  padding: 24px;
  background: #f8f9fa;
}
.template-list-container {
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.3s ease;
}
.template-list-container:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.template-table {
  border: none !important;
}
.template-table /deep/ .el-table__body tr:hover > td {
  background-color: #f0f7ff !important;
}
.template-table /deep/ .el-table__row.current-row > td {
  background-color: #e6f2ff !important;
}
.template-table /deep/ td {
  border-bottom: 1px solid #f0f0f0;
}
.template-table /deep/ .el-table__body {
  font-size: 13px;
}
.operation-btn {
  position: relative;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.operation-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}
.operation-btn:active {
  transform: translateY(0);
}
.operation-btn i {
  margin-right: 4px;
  font-size: 13px;
}
.operation-btn span {
  position: relative;
  z-index: 1;
}
.item-operation-btn {
  background: linear-gradient(135deg, #97a9f7 0%, #ac97df 100%);
  color: #ffffff;
}
.item-operation-btn:hover {
  background: linear-gradient(135deg, #97a9f7 0%, #ac97df 100%);
  color: #ffffff;
}
.template-import-btn {
  background: linear-gradient(135deg, #97a9f7 0%, #ac97df 100%);
  color: #ffffff;
  margin-left: 10px;
}
.template-import-btn:hover {
  background: linear-gradient(135deg, #97a9f7 0%, #ac97df 100%);
  color: #ffffff;
}

/* ==================== 检验单对话框样式 ==================== */
.fqc-inspection-dialog /deep/ .el-dialog__header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px 24px;
  border-radius: 8px 8px 0 0;
}

.fqc-inspection-dialog /deep/ .el-dialog__title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.fqc-inspection-dialog /deep/ .el-dialog__headerbtn .el-dialog__close {
  color: #ffffff;
  font-size: 20px;
}

.fqc-inspection-dialog /deep/ .el-dialog__body {
  padding: 0;
  background: #f5f7fa;
}

/* 单据信息卡片 */
.inspection-info-card {
  background: #ffffff;
  padding: 0px 0px;
}

.info-section {
  margin-bottom: 0;
  background: #f9fafb;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid #e8eaed;
  transition: all 0.3s ease;
}

.info-section:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border-color: #d0d4d9;
}

.info-section:last-child {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8eaed;
  font-size: 14px;
  font-weight: 600;
  color: #303133;
}

.section-title i {
  font-size: 18px;
  margin-right: 8px;
  color: #667eea;
}

.info-row {
  margin-bottom: 0 !important;
}

.info-item {
  margin-bottom: 0;
}

.info-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #606266;
}

.info-item label a {
  color: #409eff;
  text-decoration: none;
  transition: color 0.3s;
}

.info-item label a:hover {
  color: #66b1ff;
  text-decoration: underline;
}

.info-item /deep/ .el-input--small .el-input__inner,
.info-item /deep/ .el-input-number--small .el-input__inner {
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  transition: all 0.3s;
}

.info-item /deep/ .el-input--small .el-input__inner:focus,
.info-item /deep/ .el-input-number--small .el-input__inner:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.info-item /deep/ .el-select {
  width: 100%;
}

/* 操作按钮区域 */
.action-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e8eaed;
  margin-top: 10px;
}

.left-actions,
.right-actions {
  display: flex;
  gap: 10px;
}

.action-buttons .el-button {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.action-buttons .el-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 检验项目列表 */
.inspection-table-wrapper {
  background: #ffffff;
  padding: 0px 0px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 10px;
  border-bottom: 2px solid #e8eaed;
}

.table-title {
  font-size: 15px;
  font-weight: 600;
  color: #303133;
  display: flex;
  align-items: center;
}

.table-title i {
  font-size: 18px;
  margin-right: 8px;
  color: #667eea;
}

.inspection-table {
  border-radius: 8px;
  overflow: hidden;
}

.inspection-table /deep/ .el-table__header-wrapper th {
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eaed 100%);
  color: #303133;
  font-weight: 600;
  font-size: 13px;
  padding: 12px 0;
}

.inspection-table /deep/ .el-table__body-wrapper .el-table__row {
  transition: all 0.3s ease;
}

.inspection-table /deep/ .el-table__body-wrapper .el-table__row:hover {
  background: #f5f7fa;
}

.inspection-table /deep/ .el-table__body-wrapper .el-table__row.el-table__row--striped {
  background: #fafbfc;
}

.inspection-table /deep/ .el-table__body-wrapper .el-table__row.el-table__row--striped:hover {
  background: #f0f2f5;
}

.inspection-table /deep/ .el-button--mini {
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
}

/* 底部操作按钮 */
.dialog-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e8eaed;
}

.dialog-footer .el-button {
  min-width: 100px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.dialog-footer .el-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dialog-footer .el-button--success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  border: none;
}

.dialog-footer .el-button--success:hover {
  background: linear-gradient(135deg, #15b39d 0%, #4af58e 100%);
}
</style>
