spring
2025-04-23 4e93a3fab91b42560336647ea1051a8f9ad554fd
src/views/business/inspectionTask/inspection.vue
@@ -1,5 +1,5 @@
<template>
  <div v-loading="loading" class="inspection">
  <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-form :inline="true" :model="otherForm" class="form-inline" label-width="50px"
@@ -17,21 +17,18 @@
        </el-form>
      </el-col>
      <el-col :span="16" style="text-align: right">
        <!-- <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"
        <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 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="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>
        <el-button type="primary" size="small" @click="exportTable('myTable')">下载原始记录</el-button>
        <el-button size="small" @click="$emit('goback')">返回</el-button>
        <el-button size="small" @click="goback">返回</el-button>
      </el-col>
    </el-row>
    <div class="search">
@@ -73,12 +70,11 @@
        </el-form-item>
        <el-form-item label="备注:">
          <!--          <span style="color:red">{{ insOrder.remark?insOrder.remark:'-' }}</span>-->
          <el-input v-model="insOrder.remark" :disabled="state !== 1" clearable placeholder="请输入" size="small"
          <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>
      <el-divider></el-divider>
    </div>
    <div class="center">
      <div class="search" style="
@@ -95,9 +91,9 @@
          </el-radio-group>
        </div>
        <div style="display: flex; align-items: center">
          <el-button v-if="state === 1" size="small" type="primary" @click="openAddUnpass">新增不合格复测</el-button>
          <el-button v-if="state === 1" size="small" type="primary" @click="unpassCheck">不合格复测</el-button>
          <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">查看不合格复测</el-button>
          <!-- <el-button v-if="state == 1" size="small" type="primary" @click="openAddUnpass">新增不合格复测</el-button>
          <el-button v-if="state == 1" size="small" type="primary" @click="unpassCheck">不合格复测</el-button>
          <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">查看不合格复测</el-button> -->
          <span v-if="cableTagList.length > 0">&nbsp;&nbsp;电缆配置:</span>
          <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="请选择" size="small"
            @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m)
@@ -142,6 +138,11 @@
                type="success">已检</el-tag>
            </el-option>
          </el-select>
          <!-- 网分仪数采国产/进口 -->
          <NetworkAnalyzerDataAcquisition :itemList="currentSample.insProduct" :param="param"
            :equipOptions="equipOptions"
            v-if="Array.isArray(currentSample.insProduct) && currentSample.insProduct.length > 0 && param"
            ref="NetworkAnalyzerDataAcquisition" />
          <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"
@@ -151,28 +152,26 @@
      </div>
      <!-- 常规检验原始记录 -->
      <div id="nav" v-loading="tableLoading" class="center-box">
        <template v-if="
          tableLists.find((m) => m.templateId == currentTable)">
        <template v-if="tableLists.find((m) => m.templateId == currentTable)">
          <table v-for="(item, index) in tableList" :key="index + currentTable + currentSample.id" border="1"
            cellpadding="10" class="tables" id="myTable">
            <tbody>
              <tr style="white-space: nowrap">
                委托编号:{{
                  insOrder.entrustCode
                }}
              <tr>
                <th :colspan="50" style="text-align: left !important;">
                  委托编号:{{
                    insOrder.entrustCode
                  }}
                </th>
              </tr>
              <tr v-for="(m, i) in item.arr" :key="i">
                <td v-for="(n, j) in m" v-if="n.v.mc == undefined || Object.keys(n.v.mc).length === 4"
                  :id="item.templateId + '-' + n.i + '-' + n.r + '-' + n.c" :key="j"
                  :colspan="n.v.mc && n.v.mc.cs ? n.v.mc.cs : 1" :rowspan="n.v.mc && n.v.mc.rs ? n.v.mc.rs : 1" :style="`background:${n.v.bg ? n.v.bg : ''};color:${n.v.fc
                    };font-size:${n.v.fs}px;width:${handleWidth(
                      n
                    )}px !important;height:${item.style.rowlen[n.r]}px;font-wight:${n.v.bl ? 'bold' : ''
                    };font-size:${n.v.fs}px;height:${item.style.rowlen[n.r]}px;font-wight:${n.v.bl ? 'bold' : ''
                    };`">
                  <div :class="`content-h-${n.v.ht} content-v-${n.v.vt}`" :style="`width:${handleWidth(n)}px !important;min-height:${item.style.rowlen[n.r]
                    }px;`" class="content">
                    <template v-if="
                      n.v.ps != undefined &&
                    <template v-if="n.v.ps != undefined &&
                      typeof n.v.ps.value === 'string' &&
                      n.v.ps.value.includes('检验值') &&
                      state == 1
@@ -227,7 +226,7 @@
                      <el-select v-if="
                        (getInspectionValueType(n.i) == 2 ||
                          getInspectionValueType(n.i) == 5) &&
                        state == 1
                        state == 1 && (n.u != userId && n.u != undefined && n.u != '')
                      " v-model="n.v.v" class="table_input" @change="(m) =>
                        changeInput(
                          m,
@@ -258,8 +257,7 @@
                        <span v-else :style="`font-family:${n.v.ff} !important;`">待定</span>
                      </template>
                    </template>
                    <template v-else-if="
                      n.v.ps != undefined &&
                    <template v-else-if="n.v.ps != undefined &&
                      n.v.ps.value === '设备编码' &&
                      state == 1
                    ">
@@ -268,8 +266,9 @@
                    <template v-else-if="
                      n.v.ps != undefined && n.v.ps.value === '设备名称'
                    ">
                      <el-select v-model="n.v.v" :disabled="state > 1" class="table_input" filterable multiple
                        placeholder="设备" remote @change="(val) => changeEquip(val, n)"
                      <el-select v-model="n.v.v"
                        :disabled="state > 1 || (n.u != userId && n.u != undefined && n.u != '')" class="table_input"
                        filterable multiple placeholder="设备" remote @change="(val) => changeEquip(val, n)"
                        @visible-change="(e) => getEquipOptions(e, n.i)">
                        <el-option v-for="item in equipOptions" :key="item.value" :label="item.label"
                          :value="item.value">
@@ -277,8 +276,7 @@
                        </el-option>
                      </el-select>
                    </template>
                    <template v-else-if="
                      n.v.ps != undefined &&
                    <template v-else-if="n.v.ps != undefined &&
                      n.v.ps.value === '要求值' &&
                      state == 1
                    ">
@@ -302,8 +300,7 @@
                        toFixed(n.v.v, n.v.ct)
                      }}</span>
                    </template>
                    <template v-else-if="
                      n.v.ps != undefined && n.v.ps.value === '样品编号'
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '样品编号'
                    ">
                      <div :title="currentSample.sampleCode" style="
                        display: flex;
@@ -319,15 +316,27 @@
                        <i class="el-icon-caret-right table_caret" style="width: 16px" @click="caretSample(1)"></i>
                      </div>
                    </template>
                    <template v-else-if="
                      n.v.ps != undefined && n.v.ps.value === '样品型号'
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '样品型号'
                    ">
                      <div v-if="
                        currentSample.model !== undefined &&
                      <div v-if="currentSample.model !== undefined &&
                        currentSample.model !== null
                      " :style="`font-family:${n.v.ff} !important;`">
                        {{ currentSample.model }}
                      </div>
                    </template>
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '起始时间'
                    ">
                      <span v-if="state > 1 || (n.u != userId && n.u != undefined && n.u != '')">{{ n.v.v }}</span>
                      <el-date-picker v-else v-model="n.v.v" type="datetime" placeholder="" format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss" @change="(val) => changeTestTime(val, n, 'testStartTime')">
                      </el-date-picker>
                    </template>
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '终止时间'
                    ">
                      <span v-if="state > 1 || (n.u != userId && n.u != undefined && n.u != '')">{{ n.v.v }}</span>
                      <el-date-picker v-else v-model="n.v.v" type="datetime" placeholder="" format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss" @change="(val) => changeTestTime(val, n, 'testEndTime')">
                      </el-date-picker>
                    </template>
                    <span v-else :style="`font-family:${n.v.ff} !important;`" v-html="getValue(n.v)"></span>
                  </div>
@@ -339,7 +348,7 @@
      </div>
      <el-upload v-if="state == 1" ref="upload" :action="action" :before-upload="beforeUpload" :data="{
        orderId: id,
      }" :headers="headers" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
      }" :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
        accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar"
        style="width: 80px !important;margin-top: 10px;">
        <el-button v-if="state == 1" size="small" type="primary">附件上传</el-button></el-upload>
@@ -348,8 +357,9 @@
    </div>
    <el-drawer :size="550" :visible.sync="sampleVisible" title="样品切换">
      <el-table v-if="sampleVisible" ref="productTable" :current-row-key="currentKey" :data="sampleProduct"
        :row-class-name="tableRowClassName" :row-key="(record) => record.index" border class="el-table" height="100%"
        highlight-current-row tooltip-effect="dark" @row-click="handleChangeSample">
        :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">
        </el-table-column>
        <el-table-column label="样品编号" min-width="100px" prop="sampleCode" show-overflow-tooltip></el-table-column>
@@ -360,7 +370,6 @@
              size="medium" style="margin-right: 5px">{{ item.label }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="检验人" min-width="80px" prop="checkName" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="是否留样" prop="isLeave" show-overflow-tooltip width="95px">
          <template slot-scope="scope">
            <span>{{ scope.row.isLeave == 0 ? "否" : "是" }}</span>
@@ -505,44 +514,28 @@
        <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"
      :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> -->
    <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"
      :rawMaterialTag="rawMaterialTag" :sonLaboratory="sonLaboratory" :state="state" :typeSource="typeSource"
      :unPassCheck="unPassCheck" @closeUnPassCheckDialog="closeUnPassCheckDialog" @refreshView="refreshView" />
    <purchase-verification v-if="purchaseDialog" ref="purchaseDialog" :orderId="orderId" :workShopId="workShopId"
      :purchaseDialog="purchaseDialog" @resetPurchaseDialog="resetPurchaseDialog"></purchase-verification>
    <!--查看工时弹框-->
    <viewManHourDia ref="viewManHourDia" @submit="openAddVerifyDia"></viewManHourDia>
  </div>
</template>
<script>
import excelFunction from "@/utils/excelFountion";
import limsTable from "@/components/Table/lims-table.vue";
// import UnPassDialog from "../b1-unpass-manage/unPassDialog.vue";
// import AddUnPass from "../b1-unpass-manage/addUnPass.vue";
// import InspectionWord from "./InspectionWord.vue";
// import PurchaseVerification from "../b1-unpass-manage/PurchaseVerification.vue";
import UnPassDialog from "../unpass/components/unPassDialog.vue";
import AddUnPass from "../unpass/components/addUnPass.vue";
import InspectionWord from "./components/InspectionWord.vue";
import NetworkAnalyzerDataAcquisition from "./components/NetworkAnalyzerDataAcquisition.vue";
import PurchaseVerification from "../unpass/components/PurchaseVerification.vue";
import {
  doInsOrder,
  getCableTag,
@@ -562,22 +555,26 @@
  delfile,
  inspectionOrderDetailsTaskSwitching
} from "@/api/business/inspectionTask.js";
import InspectionWorker from '../../../InspectionWorker.worker';
import DataWorker from '../../../DataWorker.worker';
import InspectionWorker from '../../../workers/InspectionWorker.worker';
import DataWorker from '../../../workers/DataWorker.worker';
import html2canvas from "html2canvas";
import { mapGetters } from "vuex";
import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue";
export default {
  // props: ["sonLaboratory", "orderId", "state", "inspectorList", "typeSource"],
  name: 'Inspection',
  components: {
    // PurchaseVerification,
    // AddUnPass,
    viewManHourDia,
    PurchaseVerification,
    AddUnPass,
    limsTable,
    // UnPassDialog,
    // InspectionWord,
    UnPassDialog,
    InspectionWord,
    NetworkAnalyzerDataAcquisition,
  },
  data() {
    return {
      sonLaboratory: null,
      workShopId: null,
      orderId: null,
      state: null,
      inspectorList: null,
@@ -789,18 +786,14 @@
  // 用于上传文件的信息
  computed: {
    ...mapGetters(["userId"]),
    headers() {
      return {
        token: sessionStorage.getItem("token"),
      };
    },
    action() {
      return this.javaApi + "/insOrderPlan/uploadFile";
    },
  },
  created() {
    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
    let { sonLaboratory, orderId, state, inspectorList, typeSource, workShopId } =
      this.$route.query;
    this.workShopId = workShopId
    this.sonLaboratory = sonLaboratory;
    this.orderId = orderId;
    this.id = this.orderId;
@@ -813,73 +806,23 @@
    this.getInsStateDicts();
    this.getComparisonList();
    this.getAuthorizedPerson();
    // this.getPower();
    this.startWorker();
    this.getList0()
    // this.getList0() // 任务切换
    this.scrollInit();
  },
  activated() {
    this.getTypeDicts(); // 获取紧急程度下拉框选项
    this.getInsStateDicts();
    this.getComparisonList();
    this.getAuthorizedPerson();
    this.startWorker();
    // this.getList0() // 任务切换
    this.scrollInit();
  },
  watch: {
    // 监听任务id,获取任务信息
    id(val) {
      this.loading = true;
      doInsOrder({
        id: val,
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.insOrder = res.data.insOrder;
        this.supplierDensity = res.data.supplierDensity;
        this.getList()
        this.urgentList.forEach((m) => {
          if (m.value == this.insOrder.type) {
            this.insOrder.typeName = m.label;
          }
        });
        this.loading = false;
        if (!res.data.sampleProduct || res.data.sampleProduct.length == 0) {
          this.$emit("goback");
          return this.$message.error("该任务没有样品信息");
        }
        // 赋值当前样品列表
        this.sampleProduct = res.data.sampleProduct;
        this.currentSample = this.HaveJson(this.sampleProduct[0]);
        let insProduct = this.HaveJson(this.currentSample.insProduct);
        // 温度、湿度赋值
        this.otherForm = {
          temperature: this.insOrder.temperature
            ? this.insOrder.temperature
            : null,
          humidity: this.insOrder.humidity ? this.insOrder.humidity : null,
        };
        if (this.typeSource == "1") {
          this.getRawMaterialTag(this.currentSample.id); // 原材料的检验任务查询批数
          this.rawMaterialTag = "1";
        }
        this.getEquipOptions(1);
        // 获取当前样品的检验项
        let list = await this.getCurrentProduct(this.currentSample.id, 0);
        this.currentSample.insProduct = this.HaveJson(list);
        // 初始化传递到后端的参数
        this.param = {};
        this.changeType = 0;
        this.currentSample.insProduct.forEach((a) => {
          this.param[a.id] = {
            insValue: [],
            comValue: [],
            resValue: null,
            equipValue: [],
            equipName: [],
            insResult: null,
          };
        });
        if (this.currentSample.index == undefined)
          this.currentSample["index"] = 1;
        let bushing = this.currentSample.bushing;
        this.getTableLists(); //处理模板列表信息
        this.currentKey = 1;
        this.getCableTag(this.currentSample.id); // 查询是否有要多次检验的电缆配置
        this.getRepetitionTag(this.currentSample.id); // 查询是否有要重复检验项
      });
      this.refreshView()
    },
    // 监听当前模板变化
    currentTable(val1, val0) {
@@ -901,6 +844,8 @@
                equipValue: [],
                equipName: [],
                insResult: null,
                testEndTime: [],
                testStartTime: [],
              };
            });
            // 去重模板,返回有几个模板
@@ -974,15 +919,12 @@
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          delfile({ id: row.id }).then((res) => {
            if (res.code == 201) return;
            this.$message.success("删除成功");
            this.refresh();
          });
        })
        .catch(() => { });
      }).then(() => {
        delfile({ id: row.id }).then((res) => {
          this.$message.success("删除成功");
          this.getList();
        });
      }).catch(() => { });
    },
    // 文件管理--结束
@@ -1009,9 +951,69 @@
      this.checkUser = "";
    },
    // 刷新页面
    // refreshView() {
    //   this.$emit("refreshView");
    // },
    refreshView() {
      this.loading = true;
      doInsOrder({
        id: this.id,
        laboratory: this.sonLaboratory,
      }).then(async (res) => {
        this.insOrder = res.data.insOrder;
        this.supplierDensity = res.data.supplierDensity;
        this.getList()
        this.urgentList.forEach((m) => {
          if (m.value == this.insOrder.type) {
            this.insOrder.typeName = m.label;
          }
        });
        this.loading = false;
        if (!res.data.sampleProduct || res.data.sampleProduct.length == 0) {
          this.goback();
          return this.$message.error("该任务没有样品信息");
        }
        // 赋值当前样品列表
        this.sampleProduct = res.data.sampleProduct;
        this.currentSample = this.HaveJson(this.sampleProduct[0]);
        // let insProduct = this.HaveJson(this.currentSample.insProduct);
        // 温度、湿度赋值
        this.otherForm = {
          temperature: this.insOrder.temperature
            ? this.insOrder.temperature
            : null,
          humidity: this.insOrder.humidity ? this.insOrder.humidity : null,
        };
        if (this.typeSource == "1") {
          this.getRawMaterialTag(this.currentSample.id); // 原材料的检验任务查询批数
          this.rawMaterialTag = "1";
        }
        this.getEquipOptions(1);
        // 获取当前样品的检验项
        let list = await this.getCurrentProduct(this.currentSample.id, 0);
        this.currentSample.insProduct = this.HaveJson(list);
        // 初始化传递到后端的参数
        this.param = {};
        this.changeType = 0;
        this.currentSample.insProduct.forEach((a) => {
          this.param[a.id] = {
            insValue: [],
            comValue: [],
            resValue: null,
            equipValue: [],
            equipName: [],
            insResult: null,
            testEndTime: [],
            testStartTime: [],
          };
        });
        if (this.currentSample.index == undefined)
          this.currentSample["index"] = 1;
        let bushing = this.currentSample.bushing;
        this.getTableLists(); //处理模板列表信息
        this.currentKey = 1;
        this.getCableTag(this.currentSample.id); // 查询是否有要多次检验的电缆配置
        this.getRepetitionTag(this.currentSample.id); // 查询是否有要重复检验项
      });
    },
    closeUnPassCheckDialog() {
      this.unPassCheck = false;
    },
@@ -1090,7 +1092,7 @@
    },
    // 打开进货验证弹框
    openPurchase() {
      const operationType = this.state === 1 ? "add" : "view";
      const operationType = this.state == 1 ? "add" : "view";
      this.purchaseDialog = true;
      const item = {
        id: this.currentSample.id,
@@ -1130,6 +1132,8 @@
        this.dataAcquisitionInfoNew = this.HaveJson(res.data);
        // 对数采回来的值进行处理
        this.handleDataAcquisition(res.data);
      }).catch(err => {
        this.dataAcquisitionLoading = false;
      });
    },
    objectOrder(obj) {
@@ -1150,7 +1154,6 @@
      this.dataAcquisitionInfo = {};
      this.getData = [];
      for (let i in this.objectOrder(data)) {
        console.log("i---", i);
        let obj = {};
        if (i.includes("@")) {
          obj = {
@@ -1469,6 +1472,7 @@
    },
    // 多线程
    startWorker() {
      console.log(`Worker 线程开始运行...`, this.worker, this.worker0)
      if (this.worker) {
        this.stopWorker(); // 确保之前的 Worker 已停止
      }
@@ -1493,12 +1497,10 @@
    },
    // 保存湿度、温度数据
    subOtherForm(m, type) {
      console.log("m---", m);
      write({
        [type]: type === "remark" ? m : Number(m),
        id: this.insOrder.id,
      }).then((res) => {
        if (res.code == 201) return;
        this.$message.success("保存成功");
      });
    },
@@ -1517,34 +1519,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({
@@ -1571,7 +1545,7 @@
        repetitionTag: this.repetitionTag
      });
      this.tableLoading = false;
      if (res.data.length > 0) {
      if (res.data) {
        return res.data;
      }
    },
@@ -1596,6 +1570,8 @@
          equipValue: [],
          equipName: [],
          insResult: null,
          testEndTime: [],
          testStartTime: [],
        };
      });
      // 处理页面列表数据
@@ -1641,6 +1617,8 @@
              equipValue: [],
              equipName: [],
              insResult: null,
              testEndTime: [],
              testStartTime: [],
            };
          });
          this.getTableLists0(list);
@@ -2001,6 +1979,12 @@
              ) {
                a.template[b].v.v = id.product.methodS;
              }
              if (
                a.template[b].v.ps != undefined &&
                a.template[b].v.ps.value === "试验条件"
              ) {
                a.template[b].v.v = id.product.radius;
              }
            }
          }
        });
@@ -2040,6 +2024,7 @@
          (n) => n.v.ps != undefined && n.v.ps.value === "最终值"
        ); //最终值列表
        a.template.forEach((b) => {
          // console.log(444444, b)
          if (
            b.v.ps != undefined &&
            b.v.ps.value === "序号" &&
@@ -2062,6 +2047,10 @@
            this.$set(b.v, "v", "");
            // b.v.v = ''
            b.u = "";
            let obj = this.currentSample.insProduct.find(m => m.id == b.i)
            if (obj) {
              this.$set(b, "u", obj.checkUserId);
            }
            b.i && this.param[b.i] && this.param[b.i].insValue.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "计算值") {
@@ -2076,8 +2065,31 @@
          }
          if (b.v.ps != undefined && b.v.ps.value === "设备名称") {
            this.$set(b.v, "v", "");
            b.u = "";
            let obj = this.currentSample.insProduct.find(m => m.id == b.i)
            if (obj) {
              this.$set(b, "u", obj.checkUserId);
            }
            // b.v.v = ''
            b.i && this.param[b.i] && this.param[b.i].equipName.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "起始时间") {
            this.$set(b.v, "v", '');
            let obj = this.currentSample.insProduct.find(m => m.id == b.i)
            if (obj) {
              this.$set(b, "u", obj.checkUserId);
            }
            // this.param[b.i].testStartTime = []
            b.i && this.param[b.i] && this.param[b.i].testStartTime.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "终止时间") {
            this.$set(b.v, "v", "");
            let obj = this.currentSample.insProduct.find(m => m.id == b.i)
            if (obj) {
              this.$set(b, "u", obj.checkUserId);
            }
            // this.param[b.i].testEndTime = []
            b.i && this.param[b.i] && this.param[b.i].testEndTime.push(b);
          }
          if (b.v.ps != undefined && b.v.ps.value === "最终值") {
            // b.v.v = ''
@@ -2091,6 +2103,11 @@
            }
          }
          if (b.v.ps != undefined && b.v.ps.value === "结论") {
            b.u = "";
            let obj = this.currentSample.insProduct.find(m => m.id == b.i)
            if (obj) {
              this.$set(b, "u", obj.checkUserId);
            }
            if (
              b.i !== undefined &&
              this.param[b.i] &&
@@ -2214,6 +2231,24 @@
          console.log("设备名称赋值----", e);
        }
        try {
          // 起始时间赋值
          let testStartTime = a.insProductResult.testStartTime ? JSON.parse(a.insProductResult.testStartTime) : []
          for (let i = 0; i < testStartTime.length; i++) {
            // 普通设备名称赋值
            this.param[a.id].testStartTime[i].v.v = testStartTime[i].v;
          }
        } catch (e) {
        }
        try {
          // 终止时间赋值
          let testEndTime = a.insProductResult.testEndTime ? JSON.parse(a.insProductResult.testEndTime) : []
          for (let i = 0; i < testEndTime.length; i++) {
            // 普通设备名称赋值
            this.param[a.id].testEndTime[i].v.v = testEndTime[i].v;
          }
        } catch (e) { }
        try {
          // 最终值赋值
          this.param[a.id].resValue.v.v = this.toFixed(
            a.lastValue,
@@ -2225,6 +2260,10 @@
      });
      // 对excel函数进行处理
      this.handleExcelMethod();
      this.$nextTick(() => {
        // 是否展示网分仪按钮
        this.$refs.NetworkAnalyzerDataAcquisition.init()
      })
    },
    // 检验值输入后触发的函数
    changeInput(m, code, n, getDataType, changeSelect) {
@@ -2238,6 +2277,9 @@
        // 定义一个函数来验证分数是否有效
        if (typeof n.v.v == "string") {
          function isValidFraction(fraction) {
            if (typeof fraction == 'number') {
              return true
            }
            const [numerator, denominator] = fraction.split("/"); // 分子和分母
            return !(!denominator || !numerator);
          }
@@ -2410,6 +2452,46 @@
              }
            }
            break;
          // 赋值起始时间
          case "testEndTime":
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(888, error);
              }
            }
            // this.tableList[0].insProductResult[m] = value ? value.v.v : "";
            break;
          // 赋值终止时间
          case "testStartTime":
            if (value && value.length > 0) {
              this.tableList[0].insProductResult[m] = [];
              value.forEach((a, i) => {
                let obj = {
                  v: a.v.v,
                };
                this.tableList[0].insProductResult[m].push(obj);
              });
              try {
                this.tableList[0].insProductResult[m] = JSON.stringify(
                  this.tableList[0].insProductResult[m]
                );
              } catch (error) {
                console.log(888, error);
              }
            }
            // this.tableList[0].insProductResult[m] = value ? value.v.v : "";
            break;
          // 赋值最终值
          case "resValue":
            this.tableList[0].lastValue = value ? value.v.v : "";
@@ -2565,7 +2647,7 @@
        }).then((res) => {
          if (res.code === 200) {
            this.$message.success("操作成功");
            this.$emit("goback");
            this.goback();
            this.addCheck = false;
          }
          this.reviewLoading = false;
@@ -2590,7 +2672,7 @@
        }).then((res) => {
          if (res.code === 200) {
            this.$message.success("操作成功");
            this.$emit("goback");
            this.goback();
          }
          this.reviewLoading = false;
        })
@@ -2601,6 +2683,13 @@
      } else {
        this.$message.error("未输入不通过原因");
      }
    },
    // 查看工时
    viewManHour() {
      this.$refs.viewManHourDia.showDialog(this.id, 99);
    },
    openAddVerifyDia() {
      this.addVerifyDia = true;
    },
    submit() {
      if (this.verifyUser === null || this.verifyUser === "") {
@@ -2631,7 +2720,7 @@
            }).then((res) => {
              if (res.code === 200) {
                this.$message.success("操作成功");
                this.$emit("goback");
                this.goback();
                this.submitLoading = false;
                this.addVerifyDia = false;
              }
@@ -2683,7 +2772,7 @@
                  if (res.code === 200) {
                    this.$message.success("操作成功");
                    this.addVerifyDia = false;
                    this.$emit("goback");
                    this.goback();
                  }
                  this.submitLoading = false;
                })
@@ -2719,10 +2808,6 @@
            orderId: this.orderId,
            sonLaboratory: this.sonLaboratory
          }).then((res) => {
            if (res.code == 201) {
              this.$message.error("保存失败");
              return;
            }
            this.$message.success("已保存");
          });
          // 向 Worker 发送消息,开始处理逻辑
@@ -2785,12 +2870,19 @@
        }
        // 保存数据
        this.saveInsContext(n.i);
        // 是否展示网分仪按钮
        this.$refs.NetworkAnalyzerDataAcquisition.init()
      } catch (e) {
        console.log("changeEquip----", e);
      }
    },
    // 起始时间/终止时间保存
    changeTestTime(val, n, type) {
      this.$set(this.param[n.i][type][0].v, 'v', val)
      this.saveInsContext(n.i);
    },
    getAuthorizedPerson() {
      selectUserCondition({ type: 0 }).then((res) => {
      selectUserCondition({ type: 1 }).then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
@@ -2855,6 +2947,8 @@
          equipValue: [],
          equipName: [],
          insResult: null,
          testEndTime: [],
          testStartTime: [],
        };
      });
      // 页面数据处理
@@ -2874,7 +2968,7 @@
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success("上传成功");
        this.$refs.fileList.selectList();
        this.getList();
      }
    },
    beforeUpload(file) {
@@ -2893,16 +2987,7 @@
    },
    handleDown(row) {
      downFile({ id: row.id }).then((res) => {
        if (res.code === 200) {
          let url = "";
          if (res.data.type == 1) {
            url = this.javaApi + "/img/" + res.data.fileUrl;
            this.$download.saveAs(url, row.fileName)
          } else {
            url = this.javaApi + "/word/" + res.data.fileUrl;
            this.$download.saveAs(url, row.fileName)
          }
        }
        this.$download.saveAs(res.data.fileUrl, row.fileName)
      })
        .catch((error) => { });
    },
@@ -2926,14 +3011,13 @@
        return v;
      }
    },
    goback() {
      this.$router.go(-1)
    }
  },
};
</script>
<style scoped>
>>>.el-divider {
  margin: 0 !important;
}
.custom-table .el-table__header-wrapper th {
  background-color: #87ceeb;
  /* 只对带有my-custom-table类的表格生效 */
@@ -2969,6 +3053,7 @@
  width: 100%;
  background-color: #fff;
  border-radius: 3px;
  margin-bottom: 10px;
}
.search .form-inline {
@@ -3064,7 +3149,7 @@
}
.content-h-2 {
  justify-content: end;
  justify-content: flex-end;
}
.content-v-0 {
@@ -3135,10 +3220,10 @@
  align-items: center;
}
</style>
<style>
.inspection .el-form-item__label {
<style scoped>
/* .inspection .el-form-item__label {
  color: #000;
}
} */
.inspection .el-drawer__header::before {
  content: "";