zouyu
7 天以前 e6e3ff9166c219af461bad39edf0019db7c65315
src/views/business/inspectionTask/inspection.vue
@@ -1,7 +1,7 @@
<template>
  <div v-loading="loading" class="inspection" style="background-color: rgb(245, 247, 251);">
    <el-row class="title">
      <el-col :span="8" style="text-align: left">
      <el-col v-if="insOrder.ifsOrderType!=='02wg'" :span="8" style="text-align: left;">
        <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px"
          style="text-align: right; padding-top: 0; display: inline">
          <el-form-item label="温度:" style="margin-bottom: 0">
@@ -16,14 +16,15 @@
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="16" style="text-align: right">
      <el-col :span="insOrder.ifsOrderType!=='02wg'?16:24" style="text-align: right">
        <el-button v-if="insOrder.ifsOrderType && insOrder.ifsOrderType==='02wg'" size="small" type="primary" @click="showMaterialPropsDialog">IFS物料属性更新</el-button>
        <el-button size="small" type="primary" @click="refreshView">刷新</el-button>
        <el-button v-if="typeSource == 1" size="small" type="primary" @click="openPurchase">进货验证</el-button>
        <el-button v-if="state == 1 && typeSource == 1" size="small" type="primary"
          @click="openUnPassDialog('add')">不合格处理</el-button>
        <el-button size="small" type="primary" @click="sampleVisible = true; uploadSample();">样品切换</el-button>
        <!--        <el-button v-if="state == 1" size="small" type="primary" @click="taskVisible = true">任务切换</el-button>-->
        <el-button v-if="state == 1" size="small" type="primary" @click="viewManHour">提交</el-button>
        <el-button v-if="state == 1" size="small" type="primary" @click="addVerifyDia = true">提交</el-button>
        <!-- 复核 -->
        <el-button v-if="state == 2" size="medium" type="primary" @click="openAddCheck">通过</el-button>
        <el-button v-if="state == 2" size="medium" @click="upInsReview(0)">不通过</el-button>
@@ -32,49 +33,95 @@
      </el-col>
    </el-row>
    <div class="search">
      <el-form :inline="true" :model="searchForm" class="form-inline" label-position="right" label-width="100px">
        <el-form-item label="委托编号:">
          <el-input v-model="insOrder.entrustCode" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品编号:">
          <el-tooltip :content="currentSample.sampleCode" :disabled="!currentSample.sampleCode">
            <el-input v-model="currentSample.sampleCode" clearable disabled placeholder="请输入" size="small"></el-input>
          </el-tooltip>
        </el-form-item>
        <el-form-item label="样品名称:">
          <el-input v-model="currentSample.sample" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品数量:">
          <el-input v-model="sampleProduct.length" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="样品型号:">
          <el-input v-model="currentSample.model" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="下发时间:">
          <el-input v-model="insOrder.sendTime" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="紧急程度:">
          <el-input v-model="insOrder.typeName" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="约定时间:">
          <el-input v-model="insOrder.appointed" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="typeSource === 1" label="抽检数量:">
          <el-input v-model="insOrder.testQuantity" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item v-if="typeSource === 1" label="厂家密度:">
          <el-input v-model="supplierDensity" clearable disabled placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item label="当前样品位数:" label-width="120px">
          <el-tag v-if="currentKey">{{ `NO.${currentKey}` }}</el-tag>
        </el-form-item>
        <el-form-item label="备注:">
          <!--          <span style="color:red">{{ insOrder.remark?insOrder.remark:'-' }}</span>-->
<!--      <el-form :inline="true" :model="searchForm" class="form-inline" label-position="right" label-width="100px">-->
<!--        <el-form-item label="委托编号:">-->
<!--          <el-input v-model="insOrder.entrustCode" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="样品编号:">-->
<!--          <el-tooltip :content="currentSample.sampleCode" :disabled="!currentSample.sampleCode">-->
<!--            <el-input v-model="currentSample.sampleCode" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--          </el-tooltip>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="样品名称:">-->
<!--          <el-input v-model="currentSample.sample" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="样品数量:">-->
<!--          <el-input v-model="sampleProduct.length" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="样品型号:">-->
<!--          <el-input v-model="currentSample.model" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="下发时间:">-->
<!--          <el-input v-model="insOrder.sendTime" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="紧急程度:">-->
<!--          <el-input v-model="insOrder.typeName" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="约定时间:">-->
<!--          <el-input v-model="insOrder.appointed" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item v-if="typeSource === 1" label="抽检数量:">-->
<!--          <el-input v-model="insOrder.testQuantity" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item v-if="typeSource === 1" label="厂家密度:">-->
<!--          <el-input v-model="supplierDensity" clearable disabled placeholder="请输入" size="small"></el-input>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="当前样品位数:" label-width="120px">-->
<!--          <el-tag v-if="currentKey">{{ `NO.${currentKey}` }}</el-tag>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="备注:">-->
<!--          &lt;!&ndash;          <span style="color:red">{{ insOrder.remark?insOrder.remark:'-' }}</span>&ndash;&gt;-->
<!--          <el-input v-model="insOrder.remark" :disabled="state != 1" clearable placeholder="请输入" size="small"-->
<!--            @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>-->
<!--          &lt;!&ndash; <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> &ndash;&gt;-->
<!--        </el-form-item>-->
<!--        <template v-if="insOrder.isSplitOrder && insOrder.isSplitOrder===1">-->
<!--          <el-form-item label="外护颜色:">-->
<!--            <el-input v-model="insOrder.outerColor" clearable disabled placeholder="" size="small"></el-input>-->
<!--          </el-form-item>-->
<!--          <el-form-item label="绝缘颜色:">-->
<!--            <el-input v-model="insOrder.insulationColor" clearable disabled placeholder="" size="small"></el-input>-->
<!--          </el-form-item>-->
<!--          <el-form-item label="盘号:">-->
<!--            <el-input v-model="insOrder.drumNo" clearable disabled placeholder="" size="small"></el-input>-->
<!--          </el-form-item>-->
<!--        </template>-->
<!--      </el-form>-->
<!--      -->
      <el-descriptions title="检验单概况" :column="4" border>
        <template v-if="insOrder.ifsOrderType">
          <el-descriptions-item label="零件号">{{insOrder.partNo}}</el-descriptions-item>
          <el-descriptions-item label="零件名称">{{insOrder.partDetail}}</el-descriptions-item>
          <el-descriptions-item label="批次号">{{ insOrder.lotBatchNo }}</el-descriptions-item>
          <el-descriptions-item label="样品型号" >{{currentSample.model}}</el-descriptions-item>
          <el-descriptions-item label="抽检数量">{{insOrder.testQuantity}}</el-descriptions-item>
          <el-descriptions-item label="厂家密度">{{supplierDensity}}</el-descriptions-item>
          <template v-if="insOrder.ifsOrderType && insOrder.ifsOrderType==='02wg'">
            <el-descriptions-item label="载具编号">{{insOrder.drumNo}}</el-descriptions-item>
            <el-descriptions-item label="起始米标(km)">{{insOrder.startMeterMark}}</el-descriptions-item>
            <el-descriptions-item label="截止米标(km)">{{insOrder.endMeterMark}}</el-descriptions-item>
            <el-descriptions-item label="入库长度(km)">{{calcInbondLength(insOrder.startMeterMark,insOrder.endMeterMark)}}</el-descriptions-item>
            <el-descriptions-item label="绝缘颜色">{{insOrder.insulationColor}}</el-descriptions-item>
            <el-descriptions-item label="外护颜色">{{insOrder.outerColor}}</el-descriptions-item>
            <el-descriptions-item label="印字信息">{{insOrder.letteringInfo}}</el-descriptions-item>
          </template>
        </template>
        <template v-else>
          <el-descriptions-item label="委托编号">{{ insOrder.entrustCode }}</el-descriptions-item>
          <el-descriptions-item label="样品编号">{{ currentSample.sampleCode }}</el-descriptions-item>
          <el-descriptions-item label="样品名称">{{ currentSample.sample }}</el-descriptions-item>
          <el-descriptions-item label="样品数量">{{ sampleProduct.length }}</el-descriptions-item>
          <el-descriptions-item label="样品型号">{{ currentSample.model }}</el-descriptions-item>
          <el-descriptions-item label="下发时间">{{ insOrder.sendTime }}</el-descriptions-item>
          <el-descriptions-item label="紧急程度">{{ insOrder.typeName }}</el-descriptions-item>
          <el-descriptions-item label="约定时间">{{ insOrder.appointed }}</el-descriptions-item>
        </template>
        <el-descriptions-item label="当前样品位数"><el-tag v-if="currentKey">{{ `NO.${currentKey}` }}</el-tag></el-descriptions-item>
        <el-descriptions-item label="备注">
          <el-input v-model="insOrder.remark" :disabled="state != 1" clearable placeholder="请输入" size="small"
            @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
          <!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> -->
        </el-form-item>
      </el-form>
                    @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <div class="center">
      <div class="search" style="
@@ -141,7 +188,7 @@
          <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary"
            @click="getDataAcquisitionDevice">数据采集</el-button>
          <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small"
            @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "关闭编辑" : "编辑数采"
            @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble,disconnect()">{{ dataAcquisitionEidtAble ? "关闭编辑" : "编辑数采"
            }}</el-button>
        </div>
      </div>
@@ -288,7 +335,7 @@
                      state == 1
                    "><span :style="`font-family:${n.v.ff} !important;`">{{
                      toFixed(n.v.v, n.v.ct)
                        }}</span></template>
                    }}</span></template>
                    <template v-else-if="
                      n.v.ps != undefined &&
                      n.v.ps.value === '最终值' &&
@@ -344,6 +391,7 @@
    </div>
    <el-drawer :size="550" :visible.sync="sampleVisible" title="样品切换">
      <el-table v-if="sampleVisible" ref="productTable" :current-row-key="currentKey" :data="sampleProduct"
                :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
        :row-class-name="tableRowClassName" :row-key="(record) => record.index" border class="el-table" height="100%"
        highlight-current-row tooltip-effect="dark" @row-click="handleChangeSample">
        <el-table-column :key="Math.random()" align="center" label="序号" type="index" width="70px">
@@ -421,67 +469,76 @@
              <td :rowspan="item.child.length">{{ item.faName }}</td>
              <td>{{ item.child[0].name }}</td>
              <td style="text-align: left">
                <!-- 添加容器 div -->
                <div class="data-collection-items">
                <el-select v-if="item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                  :multiple-limit="item.child[0].maxNum" clearable filterable multiple placeholder="请选择"
                  @change="setData(item)">
                  <el-option v-for="(item, index) in item.child[0].arr" :key="index" :filter-method="filterMethod"
                    :label="index + 1 + '^' + item.result" :value="index + '^' + item.result">
                  <el-option v-for="(subItem, subIndex) in item.child[0].arr" :key="index + '-' + subIndex" :filter-method="filterMethod"
                    :label="subIndex + 1 + '^' + subItem.result" :value="subIndex + '^' + subItem.result">
                    <span>{{
                      "序号:" +
                      (index + 1) +
                      (subIndex + 1) +
                      "," +
                      "结果:" +
                      item.result +
                      subItem.result +
                      "," +
                      "厚度:" +
                      item.thickness +
                      subItem.thickness +
                      "," +
                      "时间:" +
                      item.mergedDateTime
                      subItem.mergedDateTime
                    }}</span>
                  </el-option>
                </el-select>
                <el-checkbox-group v-if="!item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                  :max="item.child[0].maxNum">
                  <el-checkbox v-for="(n, j) in item.child[0].arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
                  <el-checkbox v-for="(n, j) in item.child[0].arr" :key="index + '-' + j + 'aaaaaa'" :label="j + '^' + n"
                  @change="handleGroupSelect(item.child[0], j, item.child[0].arr.length)" >{{ n }}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
            <tr v-for="(m, i) in item.child" v-show="i > 0" :key="i + 'bbbbbbbbbbbbbb'">
              <td>{{ m.name }}</td>
              <td style="text-align: left">
              </div>
            </td>
          </tr>
          <tr v-for="(m, i) in item.child" v-show="i > 0" :key="index + '-' + i + 'bbbbbbbbbbbbbb'">
            <td>{{ m.name }}</td>
            <td style="text-align: left">
              <!-- 添加容器 div -->
              <div class="data-collection-items">
                <el-select v-if="m.isShowSelect" v-model="m.getDataIndex1" :multiple-limit="m.maxNum" clearable
                  filterable multiple placeholder="请选择">
                  <el-option v-for="(item, index1) in m.arr" :key="index1" :label="index + 1 + '^' + item.result"
                    :value="index1 + '^' + item.result">
                  <el-option v-for="(subItem, index1) in m.arr" :key="index + '-' + index1 + 'cccccccc'"
                    :label="index1 + 1 + '^' + subItem.result" :value="index1 + '^' + subItem.result">
                    <span>{{
                      "序号:" +
                      (index1 + 1) +
                      "," +
                      "结果:" +
                      item.result +
                      subItem.result +
                      "," +
                      "厚度:" +
                      item.thickness +
                      subItem.thickness +
                      "," +
                      "时间:" +
                      item.mergedDateTime
                      subItem.mergedDateTime
                    }}</span>
                  </el-option>
                </el-select>
                <el-checkbox-group v-if="!m.isShowSelect" v-model="m.getDataIndex1" :max="m.maxNum">
                  <el-checkbox v-for="(n, j) in m.arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
                  <el-checkbox v-for="(n, j) in m.arr" :key="index + '-' + j + 'dddddddd'" :label="j + '^' + n"
                  @change="handleGroupSelect(m, j, m.arr.length)" >{{ n }}</el-checkbox>
                </el-checkbox-group>
              </td>
            </tr>
          </template>
        </table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dataGetDia = false">取 消</el-button>
        <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">确 定</el-button>
      </span>
    </el-dialog>
              </div>
            </td>
          </tr>
        </template>
      </table>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dataGetDia = false">取 消</el-button>
      <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">确 定</el-button>
    </span>
  </el-dialog>
    <el-dialog :close-on-click-modal="false" :visible.sync="addCheck" title="指定报告审核人员" width="400px"
      @close="closeAddVerifyDia">
      <div class="body" style="display: flex; padding: 10px; align-items: center">
@@ -500,17 +557,65 @@
        <el-button :loading="reviewLoading" type="primary" @click="upInsReview(1)">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 添加不合格复测弹框-->
    <add-un-pass v-if="addUnPassDialog" ref="addUnPassDialog" :addUnPassDialog="addUnPassDialog"
      @resetAddUnPass="resetAddUnPass"></add-un-pass>
    <!-- 不合格处理弹框-->
    <UnPassDialog v-if="unPassDialog" ref="unPassDialog" :orderId="orderId" :unPassDialog="unPassDialog"
      @resetForm="resetForm"></UnPassDialog>
    <!-- 不合格复测弹框-->
    <InspectionWord v-if="unPassCheck" :inspectorList="inspectorList" :orderId="orderId"
                    :cableTag="temCableTag" :repetitionTag="repetitionTag"
      :rawMaterialTag="rawMaterialTag" :sonLaboratory="sonLaboratory" :state="state" :typeSource="typeSource"
      :unPassCheck="unPassCheck" @closeUnPassCheckDialog="closeUnPassCheckDialog" @refreshView="refreshView" />
    <!-- 进货验证弹框-->
    <purchase-verification v-if="purchaseDialog" ref="purchaseDialog" :orderId="orderId"
      :purchaseDialog="purchaseDialog" @resetPurchaseDialog="resetPurchaseDialog"></purchase-verification>
    <!--查看工时弹框-->
    <viewManHourDia ref="viewManHourDia" @submit="openAddVerifyDia"></viewManHourDia>
<!--    IFS物料属性编辑弹框-->
    <el-dialog
      title="更新IFS库存物料批次属性"
      :visible.sync="ifsMaterialPropsVisible"
      width="20%">
      <el-form style="width:100%" :model="ifsMaterialPropsForm">
        <el-form-item label="载具编号(Attr1):">
          <el-input placeholder="载具编号" size="small" v-model="ifsMaterialPropsForm.drumNo"></el-input>
        </el-form-item>
        <el-form-item label="起始米标(Attr2):">
          <el-input @blur="validateQuality()" placeholder="起始米标" size="small" v-model="ifsMaterialPropsForm.startMeterMark">
            <span slot="suffix">km</span>
          </el-input>
        </el-form-item>
        <el-form-item label="截止米标(Attr3):">
          <el-input @blur="validateQuality()" placeholder="截止米标" size="small" v-model="ifsMaterialPropsForm.endMeterMark">
            <span slot="suffix">km</span>
          </el-input>
        </el-form-item>
<!--        <el-form-item label="入库长度">-->
<!--          <el-input v-model="ifsMaterialPropsForm.inboundLength"></el-input>-->
<!--        </el-form-item>-->
        <el-form-item label="外护颜色(Attr4):">
          <el-select size="small" v-model="ifsMaterialPropsForm.outerColor">
            <el-option v-for="(item,index) in outerColorList" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="绝缘颜色(Attr5):">
          <el-select size="small" v-model="ifsMaterialPropsForm.insulationColor">
            <el-option v-for="(item,index) in insulationColorList" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="印字信息(Attr8):">
          <el-select size="small" v-model="ifsMaterialPropsForm.letteringInfo" placeholder="请选择">
            <el-option v-for="(item,index) in letteringInfoList" :label="item.dictLabel" :value="item.dictValue" :key="index"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
    <el-button @click="closePartPropDialog()">取 消</el-button>
    <el-button type="primary" @click="saveOrUpdatePartProp()">确 定</el-button>
  </span>
    </el-dialog>
  </div>
</template>
@@ -540,11 +645,14 @@
  delfile,
  inspectionOrderDetailsTaskSwitching
} from "@/api/business/inspectionTask.js";
import InspectionWorker from '../../../InspectionWorker.worker';
import DataWorker from '../../../DataWorker.worker';
import InspectionWorker from '@/workers/InspectionWorker.worker.js';
import DataWorker from '@/workers/DataWorker.worker.js';
import html2canvas from "html2canvas";
import { mapGetters } from "vuex";
import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue";
import {connect,disconnect,weightList} from "@/utils/connect";
import {getOneByIfsId,saveOrUpdateProps} from "@/api/business/ifsPartProps.js";
import {getDicts} from "@/api/system/dict/data";
export default {
  name: 'Inspection',
  components: {
@@ -557,6 +665,21 @@
  },
  data() {
    return {
      outerColorList:[],
      insulationColorList:[],
      letteringInfoList: [],
      ifsMaterialPropsForm:{
        id:null,
        ifsInventoryId: null,
        drumNo: '', // 载具编号
        startMeterMark: '', // 起始米标
        endMeterMark: '', // 截止米标
        insulationColor: '', // 绝缘颜色
        outerColor: '', // 外护颜色
        inboundLength: '', // 入库长度
        letteringInfo: '', // 印字信息
      },
      ifsMaterialPropsVisible:false,
      sonLaboratory: null,
      orderId: null,
      state: null,
@@ -581,6 +704,8 @@
        sampleName: null,
        state: null,
      },
      isSerialConnected: false, // 新增状态变量,串口连接状态
      serialPort: null, // 存储串口对象
      id: null,
      changeType: null,
      insOrder: {},
@@ -729,7 +854,6 @@
        size: 10,
        current: 0,
      },
      tableLoading: false,
      // 文件列表相关--结束
      // 任务切换列表--开始
      tableData0: [],
@@ -764,6 +888,7 @@
      },
      tableLoading0: false,
      // 任务切换列表--结束
      isSplit: 0, // 是否是拆单过来的
    };
  },
  // 用于上传文件的信息
@@ -774,7 +899,7 @@
    },
  },
  created() {
    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
    let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } =
      this.$route.query;
    this.sonLaboratory = sonLaboratory;
    this.orderId = orderId;
@@ -782,13 +907,13 @@
    this.state = state;
    this.inspectorList = inspectorList;
    this.typeSource = typeSource;
    this.isSplit = isSplit;
  },
  mounted() {
    this.getTypeDicts(); // 获取紧急程度下拉框选项
    this.getInsStateDicts();
    this.getComparisonList();
    this.getAuthorizedPerson();
    // this.getPower();
    this.startWorker();
    // this.getList0() // 任务切换
    this.scrollInit();
@@ -798,7 +923,6 @@
    this.getInsStateDicts();
    this.getComparisonList();
    this.getAuthorizedPerson();
    // this.getPower();
    this.startWorker();
    // this.getList0() // 任务切换
    this.scrollInit();
@@ -862,6 +986,7 @@
          }
        });
      }
      console.log("处理后的模板-",this.tableList)
    },
    // 特殊检验项--监听设备信息改变
    equipForm: {
@@ -872,8 +997,98 @@
  beforeDestroy() {
    // 在组件销毁前确保停止 Worker,避免内存泄漏
    this.stopWorker();
    disconnect();
    // 调用前先判断方法是否存在,避免报错
    if (this.closeSerialPort) {
      this.closeSerialPort();// 组件销毁前关闭串口
    }
  },
  methods: {
    validateQuality(){
      let inboundLength = Number(this.calcInbondLength(this.ifsMaterialPropsForm.startMeterMark,this.ifsMaterialPropsForm.endMeterMark));
      let testQuantity = Number(this.insOrder.testQuantity);
      if(inboundLength!=null && testQuantity!==inboundLength){
        this.$message.warning(`入库长度(${inboundLength}km)与检验数量(${testQuantity}km)不符,请确认!`);
      }
    },
    calcInbondLength(startMeterMark,endMeterMark){
      let inboundLength = null;
      if((startMeterMark!=null && startMeterMark!=='') && (endMeterMark!=null&&endMeterMark!=='')){
        inboundLength = Math.abs(endMeterMark - startMeterMark)
      }
      return inboundLength;
    },
    getLetteringInfoDicts(){
      getDicts("lettering_info_type").then(res=>{
        if(res.code==200){
          this.letteringInfoList = res.data
        }
      })
    },
    getInsulationColorDicts(){
      getDicts("insulation_color_type").then(res=>{
        if(res.code==200){
          this.insulationColorList = res.data
        }
      })
    },
    getOuterColorDicts(){
      getDicts("outer_color_type").then(res=>{
        if(res.code==200){
          this.outerColorList = res.data
        }
      })
    },
    closePartPropDialog(){
      this.ifsMaterialPropsForm = {
        id:null,
        ifsInventoryId: null,
        drumNo: '', // 载具编号
        startMeterMark: '', // 起始米标
        endMeterMark: '', // 截止米标
        insulationColor: '', // 绝缘颜色
        outerColor: '', // 外护颜色
        inboundLength: '', // 入库长度
        letteringInfo: '', // 印字信息
      }
      this.ifsMaterialPropsVisible = false;
    },
    getPartProps(ifsId){
      getOneByIfsId(ifsId).then((res)=>{
        if(res.code==200 && res.data){
          this.ifsMaterialPropsForm = res.data;
        }
      })
    },
    saveOrUpdatePartProp(){
      this.ifsMaterialPropsForm.ifsInventoryId = this.insOrder.ifsInventoryId
      saveOrUpdateProps({
        ...this.ifsMaterialPropsForm,
        partNo: this.insOrder.partNo,
        lotBatchNo: this.insOrder.lotBatchNo,
      }).then((res)=>{
        if(res.code==200){
          this.$message.success("保存成功");
          this.ifsMaterialPropsVisible = false;
        }
      })
    },
    //打开IFS物料属性弹框
    showMaterialPropsDialog(){
      this.getPartProps(this.insOrder.ifsInventoryId)
      this.getOuterColorDicts()
      this.getInsulationColorDicts()
      this.getLetteringInfoDicts()
      this.$nextTick(()=>{
        this.ifsMaterialPropsVisible = true;
      })
    },
    disconnect() {
      return disconnect
    },
    sss() {
      console.log(this.$store.state.weightList) //
    },
    // 文件管理--开始
    getList() {
      this.tableLoading = true;
@@ -909,6 +1124,22 @@
      }).catch(() => { });
    },
    // 文件管理--结束
    // 处理整组勾选逻辑的方法
    handleGroupSelect(childItem, clickedIndex, groupSize = 5) {
      if(groupSize == 6){
        groupSize = 6;
      }else{
        groupSize = 5;
      }
      // 计算所在组的起始索引
      const groupStartIndex = Math.floor(clickedIndex / groupSize) * groupSize;
      // 清空当前已选
      childItem.getDataIndex1 = [];
      // 遍历当前组的 groupSize 个元素,添加到选中列表
      for (let i = groupStartIndex; i < groupStartIndex + groupSize && i < childItem.arr.length; i++) {
        childItem.getDataIndex1.push(i + '^' + childItem.arr[i]);
      }
    },
    // 任务切换--开始
    getList0() {
@@ -940,6 +1171,10 @@
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.insOrder = res.data.insOrder;
        if(res.data.insOrder.ifsOrderType){
          //查询零件属性
          this.getPartProps(res.data.insOrder.ifsInventoryId)
        }
        this.supplierDensity = res.data.supplierDensity;
        this.getList()
        this.urgentList.forEach((m) => {
@@ -1039,8 +1274,9 @@
        id: this.currentSample.id,
        type: this.type,
        laboratory: this.sonLaboratory,
        cableTag: "",
        cableTag: this.temCableTag,
        rawMaterialTag: this.rawMaterialTag,
        repetitionTag: this.repetitionTag,
      };
      this.$nextTick(() => {
        this.$refs.addUnPassDialog.getInsOrder(info);
@@ -1089,31 +1325,59 @@
      this.$refs.purchaseDialog.$refs["purchaseForm"].resetFields();
      this.purchaseDialog = false;
    },
    // 数据采集
    getDataAcquisitionDevice() {
      let itemIds = [];
      this.currentSample.insProduct.forEach((item) => {
        if (item.inspectionItemType === "1") {
          itemIds.push(item.id);
  getDataAcquisitionDevice() {
      (async () => {
        try {
          // 检查页面中检测项是否包含密度
          const hasDensityItem = this.currentSample.insProduct.some(item => {
            // 假设密度相关的检测项名称包含 "密度" 关键字,可按需修改
            return item.inspectionItem && item.inspectionItem.includes('密度');
          });
          if (hasDensityItem) {
            // 检查是否支持 Web Serial API
            if ('serial' in navigator) {
              // 请求可用串口
              const ports = await navigator.serial.getPorts();
              if (ports.length > 0) {
                await connect();
              } else {
                console.log('没有可用的串口');
              }
            } else {
              console.log('当前浏览器不支持 Web Serial API');
            }
          }
        } catch (error) {
          console.error('检测串口时出错:', error);
        }
      });
      const params = {
        entrustCode: this.insOrder.entrustCode,
        sampleCode: this.currentSample.sampleCode,
        id: this.currentSample.id,
        itemIds: itemIds,
      };
      this.dataAcquisitionLoading = true;
      dataCollection(params).then((res) => {
        this.dataAcquisitionLoading = false;
        if (res.code != 200) {
          return;
        }
        this.dataAcquisitionInfoNew = this.HaveJson(res.data);
        // 对数采回来的值进行处理
        this.handleDataAcquisition(res.data);
      }).catch(err => {
        this.dataAcquisitionLoading = false;
      })().then(() => {
        let itemIds = [];
        this.currentSample.insProduct.forEach((item) => {
          if (item.inspectionItemType === "1") {
            itemIds.push(item.id);
          }
        });
        const params = {
          entrustCode: this.insOrder.entrustCode,
          sampleCode: this.currentSample.sampleCode,
          id: this.currentSample.id,
          itemIds: itemIds,
        };
        this.dataAcquisitionLoading = true;
        dataCollection(params).then((res) => {
          this.dataAcquisitionLoading = false;
          if (res.code != 200) {
            return;
          }
          this.dataAcquisitionInfoNew = this.HaveJson(res.data);
          // 对数采回来的值进行处理
          this.handleDataAcquisition(res.data);
        }).catch(err => {
          this.dataAcquisitionLoading = false;
        });
      });
    },
    objectOrder(obj) {
@@ -1125,6 +1389,7 @@
      return newObj;
    },
    handleDataAcquisition(data, noDialog) {
      console.log("dadad--",data)
      // 是否可以编辑数采数据
      if (this.dataAcquisitionEidtAble) {
        this.getDataType = 1;
@@ -1134,7 +1399,6 @@
      this.dataAcquisitionInfo = {};
      this.getData = [];
      for (let i in this.objectOrder(data)) {
        console.log("i---", i);
        let obj = {};
        if (i.includes("@")) {
          obj = {
@@ -1149,7 +1413,9 @@
          };
        }
        // 循环数采数据
        console.log(data[i],i)
        for (let j in data[i]) {
          console.log("jjjjj--",j)
          // 拼接字符串  检验项分类+检验项+检验子项
          let str0 = "";
          if (i.includes("@")) {
@@ -1243,7 +1509,7 @@
              } else {
                str0 = i + "," + j;
              }
            }
            };
            let list = this.tableList[0].arr;
            let maxNum = 0;
            list.forEach((item, index) => {
@@ -1276,6 +1542,7 @@
                  }
                  let num = 0;
                  list[index].forEach((n) => {
                    // console.log(n.v.ps.value);
                    if (
                      n.v.ps &&
                      n.v.ps.value &&
@@ -1352,6 +1619,7 @@
          this.getDataIndexLoading = false;
          this.dataGetDia = false;
          this.getDataTypeId = "";
          console.log("dadada---",this.dataAcquisitionInfo)
          this.worker0.postMessage(
            JSON.stringify({
              dataAcquisitionInfo: this.dataAcquisitionInfo,
@@ -1365,6 +1633,7 @@
      // 监听 Worker 返回的结果
      this.worker0.onmessage = (event) => {
        let result = JSON.parse(event.data);
        console.log("Worker 返回的结果:", result);
        if (result.method == "changeInput") {
          // 采集后的数据,需要进行计算的线程进行计算
          let { list, n } = result.value;
@@ -1477,7 +1746,6 @@
    },
    // 保存湿度、温度数据
    subOtherForm(m, type) {
      console.log("m---", m);
      write({
        [type]: type === "remark" ? m : Number(m),
        id: this.insOrder.id,
@@ -1500,34 +1768,6 @@
        a.download = "table.png";
        a.click();
      });
    },
    // 权限获取
    getPower() {
      let power = JSON.parse(sessionStorage.getItem("power"));
      let fileDel = false;
      let fileAdd = false;
      let collected = false;
      let temDataAcquisition = false;
      for (var i = 0; i < power.length; i++) {
        if (power[i].menuMethod == "uploadFile") {
          fileAdd = true;
        }
        if (power[i].menuMethod == "delfile") {
          fileDel = true;
        }
        if (power[i].menuMethod == "isItAllowedToModifyTheCollectedValues") {
          collected = true;
        }
        if (power[i].menuMethod == "temDataAcquisition") {
          temDataAcquisition = true;
        }
      }
      if (!fileDel) {
        // this.componentData0.do.splice(1, 1);
      }
      this.fileAdd = fileAdd;
      this.collected = collected;
      this.temDataAcquisition = temDataAcquisition;
    },
    uploadSample() {
      doInsOrder({
@@ -1666,20 +1906,6 @@
        this.comparisonList = this.dictToValue(response.data);
      });
    },
    // 获取检验值为下拉时的下拉列表
    // selectEnumByCategoryOfSelect(val) {
    //   this.enumList = [];
    //   if (val === undefined || val === null) {
    //     return;
    //   }
    //   this.$axios
    //     .post(this.$api.enums.selectEnumByCategory, {
    //       category: val,
    //     })
    //     .then((res) => {
    //       this.enumList = res.data;
    //     });
    // },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
@@ -1819,7 +2045,7 @@
                  if (c.v.ps != undefined && c.v.ps.value === "检验项") {
                    if (count4 === 0) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
@@ -1830,7 +2056,7 @@
                  ) {
                    if (count4 === 1) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
@@ -1840,7 +2066,7 @@
                  if (c.v.ps != undefined && c.v.ps.value === "检验项分类") {
                    if (count4 === 0) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
@@ -1848,7 +2074,7 @@
                  } else if (c.v.ps != undefined && c.v.ps.value === "检验项") {
                    if (count4 === 1) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
@@ -1859,7 +2085,7 @@
                  ) {
                    if (count4 === 2) {
                      if (c.v.v) {
                        c.v.v = c.v.v.replace(/\s*/g, "");
                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                      }
                      str += c.v.v;
                      count4 += 1;
@@ -1869,7 +2095,7 @@
                if (str === "机械性能干态拉伸强度(纵向)") {
                  if (c.v.ps != undefined && c.v.ps.value === "单位") {
                    if (c.v.v) {
                      c.v.v = c.v.v.replace(/\s*/g, "");
                      c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                    }
                    str2 = str + c.v.v;
                    unit2 = c.v.v;
@@ -1887,13 +2113,13 @@
                    undefined
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItemClass;
                inspectionItemClass = inspectionItemClass.replace(/\s*/g, "");
                inspectionItemClass = inspectionItemClass.replace(/[\n\r\s]*/g, "");
                let inspectionItem =
                  this.currentSample.insProduct[i].inspectionItem == null ||
                    this.currentSample.insProduct[i].inspectionItem == undefined
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItem;
                inspectionItem = inspectionItem.replace(/\s*/g, "");
                inspectionItem = inspectionItem.replace(/[\n\r\s]*/g, "");
                let inspectionItemSubclass =
                  this.currentSample.insProduct[i].inspectionItemSubclass ==
                    null ||
@@ -1902,7 +2128,7 @@
                    ? ""
                    : this.currentSample.insProduct[i].inspectionItemSubclass;
                inspectionItemSubclass = inspectionItemSubclass.replace(
                  /\s*/g,
                  /[\n\r\s]*/g,
                  ""
                );
                if (inspectionItemSubclass === "干态拉伸强度(纵向)") {
@@ -1933,6 +2159,10 @@
                  }
                } else {
                  // 如果相等,那么说明找到了,并且把id存起来,后续检验项也会在页面中显示出来
                  let aa = inspectionItemClass +
                    inspectionItem +
                    inspectionItemSubclass;
                  console.log(aa,str,aa===str)
                  if (
                    this.currentSample.insProduct[i].templateId ===
                    a.templateId &&
@@ -2589,20 +2819,44 @@
    viewManHour() {
      this.$refs.viewManHourDia.showDialog(this.id, 99);
    },
    openAddVerifyDia () {
    openAddVerifyDia() {
      this.addVerifyDia = true;
    },
    confirmSubmit(registerInsResults){
      submitPlan({
        orderId: this.orderId,
        laboratory: this.sonLaboratory,
        verifyUser: this.verifyUser,
        entrustCode: this.insOrder.entrustCode,
        registerInsResults: registerInsResults
      }).then((res) => {
        if (res.code === 200) {
          this.$message.success("操作成功");
          this.goback();
          this.submitLoading = false;
          this.addVerifyDia = false;
        }
      })
        .catch((error) => {
          console.error(error);
          this.submitLoading = false;
        });
    },
    submit() {
      if (this.verifyUser === null || this.verifyUser === "") {
        this.$message.error("请指定复核人员");
        return;
      }
      if (!this.otherForm.humidity) {
      if (!this.otherForm.humidity && this.insOrder.ifsOrderType!=='02wg') {
        this.$message.error("请输入湿度");
        return;
      }
      if (!this.otherForm.temperature) {
      if (!this.otherForm.temperature && this.insOrder.ifsOrderType!=='02wg') {
        this.$message.error("请输入温度");
        return;
      }
      if (!this.insOrder.lotPartId && this.insOrder.ifsOrderType==='02wg') {
        this.$message.error("请填写IFS库存物料批次属性");
        return;
      }
      this.submitLoading = true;
@@ -2610,39 +2864,39 @@
        orderId: this.orderId,
        laboratory: this.sonLaboratory,
      }).then((res) => {
        console.log(res)
        if (res.code === 200) {
          if (!res.data || res.data.length == 0) {
          if (!res.data || res.data.errorMsg.length == 0) {
            this.submitLoading = true;
            submitPlan({
              orderId: this.orderId,
              laboratory: this.sonLaboratory,
              verifyUser: this.verifyUser,
              entrustCode: this.insOrder.entrustCode,
            }).then((res) => {
              if (res.code === 200) {
                this.$message.success("操作成功");
                this.goback();
                this.submitLoading = false;
                this.addVerifyDia = false;
              }
            })
              .catch((error) => {
                console.error(error);
                this.submitLoading = false;
            //检验类型为原材料
            if(this.typeSource==1 && res.data.unInsOrderCount==0 && this.isSplit==1){
              const htmlStr = "是否登记IFS采购检验结果并移库?该操作会登记<span style='color:#ff4949'>同一零件同一订单的所有拆分批次</span>,请谨慎选择。"
              this.$confirm(htmlStr, '提示', {
                confirmButtonText: '是',
                cancelButtonText: '否',
                type: 'warning',
                dangerouslyUseHTMLString: true
              }).then(() => {
                this.confirmSubmit(true)
              }).catch(() => {
                this.confirmSubmit(false)
              });
            }else{
              this.confirmSubmit(true)
            }
          } else {
            let newData = [];
            const h = this.$createElement;
            for (let i in res.data) {
              const lastChar = res.data[i].slice(-1);
            for (let i in res.data.errorMsg) {
              const lastChar = res.data.errorMsg[i].slice(-1);
              if (lastChar == "-") {
                res.data[i] = res.data[i].slice(0, -1);
                res.data.errorMsg[i] = res.data.errorMsg[i].slice(0, -1);
              }
              newData.push(
                h(
                  "p",
                  { style: "font-size: 14px;color: red;" },
                  Number(i) + 1 + "、" + res.data[i]
                  Number(i) + 1 + "、" + res.data.errorMsg[i]
                )
              );
            }
@@ -2665,22 +2919,7 @@
            })
              .then(() => {
                this.submitLoading = true;
                submitPlan({
                  orderId: this.orderId,
                  laboratory: this.sonLaboratory,
                  verifyUser: this.verifyUser,
                }).then((res) => {
                  if (res.code === 200) {
                    this.$message.success("操作成功");
                    this.addVerifyDia = false;
                    this.goback();
                  }
                  this.submitLoading = false;
                })
                  .catch((error) => {
                    console.error(error);
                    this.submitLoading = false;
                  });
                this.confirmSubmit(false)
              })
              .catch(() => { });
          }
@@ -2702,12 +2941,23 @@
          } else {
            param = this.param;
          }
          let isNoTestValue = ''
          for (let key in param) {
            if (param[key]) {
              if (param[key].insValue?.length === 0) {
                isNoTestValue = 1
              } else {
                isNoTestValue = ''
              }
            }
          }
          saveInsContext({
            param: JSON.stringify(param),
            currentTable: this.currentTable,
            sampleId: this.currentSample.id,
            orderId: this.orderId,
            sonLaboratory: this.sonLaboratory
            sonLaboratory: this.sonLaboratory,
            isNoTestValue: isNoTestValue
          }).then((res) => {
            this.$message.success("已保存");
          });
@@ -2776,7 +3026,7 @@
      }
    },
    getAuthorizedPerson() {
      selectUserCondition({ type: 0 }).then((res) => {
      selectUserCondition({ type: 1 }).then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
@@ -2879,7 +3129,7 @@
    },
    handleDown(row) {
      downFile({ id: row.id }).then((res) => {
        this.$download.downloadFileFromUrl(res.data.fileUrl, row.fileName)
        this.$download.saveAs(res.data.fileUrl, row.fileName)
      })
        .catch((error) => { });
    },
@@ -2906,6 +3156,9 @@
    goback() {
      this.$router.go(-1)
    }
  },
  destroyed() {
    disconnect()
  },
};
</script>
@@ -2946,6 +3199,7 @@
  background-color: #fff;
  border-radius: 3px;
  margin-bottom: 10px;
  padding: 10px;
}
.search .form-inline {
@@ -3041,7 +3295,7 @@
}
.content-h-2 {
  justify-content: end;
  justify-content: flex-end;
}
.content-v-0 {
@@ -3179,4 +3433,16 @@
  max-width: 1000px;
  /* 设置最大宽度 */
}
.data-collection-items {
  display: flex;
  flex-wrap: wrap;
}
.data-collection-items .el-select,
.data-collection-items .el-checkbox {
  flex-basis: 20% ;
  box-sizing: border-box;
  padding: 5px 2%;
}
</style>