From fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 九月 2026 09:21:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_新疆_新聚' into dev_新疆_新聚

---
 src/views/business/inspectionTask/inspection.vue | 1496 ++++++++++++++++++++++++-----------------------------------
 1 files changed, 615 insertions(+), 881 deletions(-)

diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index 697a551..68b3a9a 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/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,12 +16,14 @@
           </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 && [0,1].includes(Number(typeSource))" 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="addVerifyDia = true">鎻愪氦</el-button>
         <!-- 澶嶆牳 -->
         <el-button v-if="state == 2" size="medium" type="primary" @click="openAddCheck">閫氳繃</el-button>
@@ -31,49 +33,104 @@
       </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="鎶芥鏁伴噺">{{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="鏍峰搧鏁伴噺">{{ insOrder.testQuantity }}</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-item v-if="isDirectTemplateOrder()" label="璁惧" :span="2">
+          <el-select v-model="selectedDeviceIds" multiple filterable clearable size="small" placeholder="璇烽�夋嫨璁惧"
+            :disabled="state != 1" @change="saveOverviewDevices">
+            <el-option v-for="device in orderDeviceOptions" :key="device.id" :label="device.label" :value="device.id" />
+          </el-select>
+        </el-descriptions-item>
+        <el-descriptions-item label="妫�楠岀粨璁�">
+          <el-radio-group v-model="reviewInsResult" :disabled="state != 2">
+            <el-radio :label="1">鍚堟牸</el-radio>
+            <el-radio :label="0">涓嶅悎鏍�</el-radio>
+          </el-radio-group>
+        </el-descriptions-item>
+      </el-descriptions>
     </div>
     <div class="center">
       <div class="search" style="
@@ -97,7 +154,7 @@
           <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="璇烽�夋嫨" size="small"
             @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m)
               " @focus="getCableTag(currentSample.id)">
-            <el-option v-for="item in cableTagList" :key="item.cableTag" :label="item.cableTag" :value="item.cableTag">
+            <el-option v-for="(item, index) in cableTagList" :key="index" :label="item.cableTag" :value="item.cableTag">
               <span style="float: left">{{ item.cableTag }}</span>
               <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
                 type="danger">鏈</el-tag>
@@ -112,7 +169,7 @@
             size="small" @change="(m) =>
               handleChangeCableTag(currentSample.id, 0, 'repetitionTag', m)
               " @focus="getRepetitionTag(currentSample.id)">
-            <el-option v-for="item in repetitionTagList" :key="item.repetitionTag" :label="item.radius"
+            <el-option v-for="(item, index) in repetitionTagList" :key="index" :label="item.radius"
               :value="item.repetitionTag">
               <span style="float: left">{{ item.radius }}</span>
               <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
@@ -126,7 +183,7 @@
           <span v-if="typeSource == '1'">&nbsp;&nbsp;寰呮楠屾暟閲忥細</span>
           <el-select v-if="typeSource == '1'" v-model="rawMaterialTag" placeholder="璇烽�夋嫨" size="small" @change="(m) => handleChangeCableTag(currentSample.id, 4, 'cableTag', m)
             " @focus="getRawMaterialTag(currentSample.id)">
-            <el-option v-for="item in rawMaterialTagList" :key="item.rawMaterialTag" :label="item.rawMaterialTag"
+            <el-option v-for="(item, index) in rawMaterialTagList" :key="index" :label="item.rawMaterialTag"
               :value="item.rawMaterialTag">
               <span style="float: left">{{ item.rawMaterialTag }}</span>
               <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px"
@@ -172,7 +229,9 @@
                       n.v.ps.value.includes('妫�楠屽��') &&
                       state == 1
                     ">
-                      <el-input v-if="getInspectionValueType(n.i) == 1"
+                      <el-input v-if="getInspectionValueType(n.i) == 1 ||
+                        (getInspectionValueType(n.i) != 2 && getInspectionValueType(n.i) != 4)
+                        "
                         :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v" :disabled="(getInspectionItemType(n.i) == 1 &&
                           !dataAcquisitionEidtAble) ||
                           (n.u != userId && n.u != undefined && n.u != '')
@@ -202,68 +261,13 @@
                             'getDataType'
                           )
                           " />
-                      <!-- <el-select v-else-if="getInspectionValueType(n.i) == 5" v-model="n.v.v" :disabled="state > 1 ||
-                      getInspectionItemType(n.i) == 1 ||
-                      (n.u != userId && n.u != undefined && n.u != '')
-                      " class="table_input" @change="(m) =>
-                        changeInput(
-                          m,
-                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                          n,
-                          'getDataType'
-                        )
-                        " @visible-change="(e) => getDic(e, n.i)">
-                      <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option>
-                    </el-select> -->
                       <span v-else-if="getInspectionValueType(n.i) == 4"
                         :style="`font-family:${n.v.ff} !important;`">/</span>
-                    </template>
-                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '缁撹'">
-                      <el-select v-if="
-                        (getInspectionValueType(n.i) == 2 ||
-                          getInspectionValueType(n.i) == 5) &&
-                        state == 1
-                      " v-model="n.v.v" class="table_input" @change="(m) =>
-                        changeInput(
-                          m,
-                          `${item.templateId}-${n.r}-${n.c}-${n.i}`,
-                          n,
-                          'getDataType',
-                          'changeSelect'
-                        )
-                        ">
-                        <el-option :value="1" label="鍚堟牸"></el-option>
-                        <el-option :value="0" label="涓嶅悎鏍�"></el-option>
-                        <el-option :value="3" label="涓嶅垽瀹�"></el-option>
-                        <el-option :value="2" label="寰呭畾"></el-option>
-                      </el-select>
-                      <template v-if="state > 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                      <template v-if="getInspectionValueType(n.i) != 2 &&
-                        state == 1">
-                        <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span>
-                        <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span>
-                        <span v-else-if="n.v.v === 3"
-                          :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span>
-                        <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span>
-                      </template>
-                    </template>
-                    <template v-else-if="
-                      n.v.ps != undefined &&
-                      n.v.ps.value === '璁惧缂栫爜' &&
-                      state == 1
-                    ">
-                      <span>{{ n.v.v }}</span>
                     </template>
                     <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
+                      <el-select v-model="n.v.v" :disabled="state > 1" class="table_input" filterable multiple clearable
                         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"
@@ -274,20 +278,11 @@
                     </template>
                     <template v-else-if="
                       n.v.ps != undefined &&
-                      n.v.ps.value === '瑕佹眰鍊�' &&
-                      state == 1
-                    ">
-                      <span :style="`font-family:${n.v.ff} !important;`">{{
-                        getTell(n.i)
-                      }}</span>
-                    </template>
-                    <template v-else-if="
-                      n.v.ps != undefined &&
                       n.v.ps.value === '璁$畻鍊�' &&
                       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 === '鏈�缁堝��' &&
@@ -343,6 +338,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">
@@ -499,25 +495,76 @@
         <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>
 
 <script>
 import excelFunction from "@/utils/excelFountion";
 import limsTable from "@/components/Table/lims-table.vue";
-import UnPassDialog from "../unpass/components/addUnPass.vue";
+import UnPassDialog from "../unpass/components/unPassDialog.vue";
 import AddUnPass from "../unpass/components/addUnPass.vue";
 import InspectionWord from "./components/InspectionWord.vue";
 import PurchaseVerification from "../unpass/components/PurchaseVerification.vue";
+import {getOneByIfsId,saveOrUpdateProps} from "@/api/business/ifsPartProps.js";
 import {
   doInsOrder,
   getCableTag,
@@ -531,19 +578,25 @@
   checkSubmitPlan,
   submitPlan,
   saveInsContext,
+  saveTemplateContext,
+  getOrderDevices,
+  saveOrderDevices,
   selectUserCondition,
   downFile,
   getFileList,
   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 {getDicts} from "@/api/system/dict/data";
 export default {
-  name: 'inspection',
+  name: 'Inspection',
   components: {
+    viewManHourDia,
     PurchaseVerification,
     AddUnPass,
     limsTable,
@@ -552,6 +605,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,
@@ -595,9 +663,12 @@
       comparisonList: [],
       excelMethodList: [],
       equipOptions: [],
+      orderDeviceOptions: [],
+      selectedDeviceIds: [],
       reviewLoading: false,
       reviewDia: false,
       noReason: "",
+      reviewInsResult: null,
       tableWidth: 1000,
       currentTable: null,
       tableLists: [],
@@ -627,6 +698,10 @@
       result: null,
       worker: null,
       worker0: null,
+      // 妫�楠屽�兼寜瑙﹀彂椤哄簭涓茶淇濆瓨锛岄伩鍏嶅悓涓�妫�楠岄」鐨勬棫璇锋眰瑕嗙洊鏂拌姹傘��
+      saveQueue: null,
+      calculationRevision: 0,
+      completedCalculationRevision: 0,
       wareLength: [],
       dataAcquisitionInfo: {},
       dataAcquisitionInfoNew: {},
@@ -724,7 +799,6 @@
         size: 10,
         current: 0,
       },
-      tableLoading: false,
       // 鏂囦欢鍒楄〃鐩稿叧--缁撴潫
       // 浠诲姟鍒囨崲鍒楄〃--寮�濮�
       tableData0: [],
@@ -769,6 +843,7 @@
     },
   },
   created() {
+    this.saveQueue = Promise.resolve();
     let { sonLaboratory, orderId, state, inspectorList, typeSource } =
       this.$route.query;
     this.sonLaboratory = sonLaboratory;
@@ -783,7 +858,15 @@
     this.getInsStateDicts();
     this.getComparisonList();
     this.getAuthorizedPerson();
-    // this.getPower();
+    this.startWorker();
+    // this.getList0() // 浠诲姟鍒囨崲
+    this.scrollInit();
+  },
+  activated() {
+    this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」
+    this.getInsStateDicts();
+    this.getComparisonList();
+    this.getAuthorizedPerson();
     this.startWorker();
     // this.getList0() // 浠诲姟鍒囨崲
     this.scrollInit();
@@ -794,8 +877,9 @@
       this.refreshView()
     },
     // 鐩戝惉褰撳墠妯℃澘鍙樺寲
-    currentTable(val1, val0) {
+    async currentTable(val1, val0) {
       if (val0 != null && val1 != val0) {
+        await this.waitForPendingSaves();
         if (this.changeType && this.changeType > 0) {
           // 濡傛灉鏄厜绾ゃ�佸厜绾ゅ甫锛屽垯涓嶆墽琛屼笅闈㈡搷浣�
           return;
@@ -804,17 +888,7 @@
           if (m.templateId == val1) {
             let list = await this.getCurrentProduct(this.currentSample.id, 0);
             this.currentSample.insProduct = this.HaveJson(list); //璧嬪�煎綋鍓嶆牱鍝佺殑妫�楠岄」
-            this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟
-            this.currentSample.insProduct.forEach((a, j) => {
-              this.param[a.id] = {
-                insValue: [],
-                comValue: [],
-                resValue: null,
-                equipValue: [],
-                equipName: [],
-                insResult: null,
-              };
-            });
+            this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟,鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍団�濆瓨
             // 鍘婚噸妯℃澘锛岃繑鍥炴湁鍑犱釜妯℃澘
             const mySet1 = new Set();
             this.tableLists = this.currentSample.insProduct.filter((m) => {
@@ -859,6 +933,87 @@
     this.stopWorker();
   },
   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!=='')){
+        let minus = this.$Big(endMeterMark).minus(this.$Big(startMeterMark));
+        inboundLength = Math.abs(minus)
+      }
+      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;
+          this.refreshView()
+        }
+      })
+    },
+    //鎵撳紑IFS鐗╂枡灞炴�у脊妗�
+    showMaterialPropsDialog(){
+      this.getPartProps(this.insOrder.ifsInventoryId)
+      this.getOuterColorDicts()
+      this.getInsulationColorDicts()
+      this.getLetteringInfoDicts()
+      this.$nextTick(()=>{
+        this.ifsMaterialPropsVisible = true;
+      })
+    },
     // 鏂囦欢绠$悊--寮�濮�
     getList() {
       this.tableLoading = true;
@@ -886,15 +1041,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(() => { });
     },
     // 鏂囦欢绠$悊--缁撴潫
 
@@ -921,13 +1073,19 @@
       this.checkUser = "";
     },
     // 鍒锋柊椤甸潰
-    refreshView() {
+    async refreshView() {
+      await this.waitForPendingSaves();
       this.loading = true;
       doInsOrder({
         id: this.id,
         laboratory: this.sonLaboratory,
       }).then(async (res) => {
         this.insOrder = res.data.insOrder;
+        this.reviewInsResult = this.insOrder.insResult;
+        if(res.data.insOrder.ifsOrderType==='02wg'){
+          //鏌ヨ闆朵欢灞炴��
+          this.getPartProps(res.data.insOrder.ifsInventoryId)
+        }
         this.supplierDensity = res.data.supplierDensity;
         this.getList()
         this.urgentList.forEach((m) => {
@@ -956,22 +1114,15 @@
           this.rawMaterialTag = "1";
         }
         this.getEquipOptions(1);
+        if (this.sonLaboratory === "鏂拌仛") {
+          this.loadOverviewDevices();
+        }
         // 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
         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;
@@ -1027,8 +1178,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);
@@ -1122,7 +1274,6 @@
       this.dataAcquisitionInfo = {};
       this.getData = [];
       for (let i in this.objectOrder(data)) {
-        console.log("i---", i);
         let obj = {};
         if (i.includes("@")) {
           obj = {
@@ -1465,12 +1616,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("淇濆瓨鎴愬姛");
       });
     },
@@ -1489,34 +1638,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({
@@ -1549,6 +1670,7 @@
     },
     // 鍒囨崲鏍峰搧
     async handleChangeSample(row, column, event) {
+      await this.waitForPendingSaves();
       // 鍒濆鍖栨暟鎹�
       this.param = {};
       this.sampleVisible = false;
@@ -1560,16 +1682,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 澶勭悊椤甸潰鍒楄〃鏁版嵁
       this.getTableLists();
       this.currentKey = row.index;
@@ -1605,16 +1717,6 @@
         let list = await this.getCurrentProduct(m, type, cableTag);
         if (list && list.length > 0) {
           this.param = {};
-          list.forEach((a) => {
-            this.param[a.id] = {
-              insValue: [],
-              comValue: [],
-              resValue: null,
-              equipValue: [],
-              equipName: [],
-              insResult: null,
-            };
-          });
           this.getTableLists0(list);
           this.worker.postMessage(
             JSON.stringify({
@@ -1655,20 +1757,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;
     },
@@ -1772,209 +1860,18 @@
           count++;
         });
       });
-      // 鏈寰幆涓昏鏄帶鍒跺悎骞�,浠ュ強鎺у埗妫�楠岄」淇℃伅鏄惁灞曠ず鍑烘潵,浠ヤ究鍚庣画妫�楠�
+      // 鎸夊悗绔笅鍙戠殑鈥滄ā鏉縄D + 妯℃澘琛屽彿鈥濈洿鎺ョ粦瀹氭楠岄」锛屼笉鍋氬悕绉版瘮瀵癸紝涓嶉殣钘忎换浣曡
       this.tableList.forEach((a) => {
-        let dels = new Set(); //闇�瑕佸垹闄ょ殑琛�
-        let ids = []; //鎵�鏈夋楠岄」鐨刬d
-        let set3 = new Set();
-        a.template.forEach((b) => {
-          let size1 = set3.size;
-          let size2 = set3.add(b.r).size;
-          if (size1 < size2) {
-            let str = "";
-            let str2 = "";
-            let unit2 = "";
-            let count4 = 0;
-            let isThree = 0;
-            a.template.forEach((c) => {
-              // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉�
-              if (b.r === c.r) {
-                if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」鍒嗙被" &&
-                  count4 === 0
-                ) {
-                  // 涓夌骇鍒嗙被
-                  isThree = 1;
-                } else if (
-                  c.v.ps != undefined &&
-                  c.v.ps.value === "妫�楠岄」" &&
-                  count4 === 0
-                ) {
-                  // 浜岀骇鍒嗙被
-                  isThree = 0;
-                }
-                if (isThree == 0) {
-                  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, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } 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, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                } else if (isThree == 1) {
-                  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, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } 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, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  } else if (
-                    c.v.ps != undefined &&
-                    c.v.ps.value === "妫�楠屽瓙椤�"
-                  ) {
-                    if (count4 === 2) {
-                      if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
-                      }
-                      str += c.v.v;
-                      count4 += 1;
-                    }
-                  }
-                }
-                if (str === "鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  if (c.v.ps != undefined && c.v.ps.value === "鍗曚綅") {
-                    if (c.v.v) {
-                      c.v.v = c.v.v.replace(/\s*/g, "");
-                    }
-                    str2 = str + c.v.v;
-                    unit2 = c.v.v;
-                  }
-                }
-              }
-            });
-            if (str != "") {
-              let count2 = 0;
-              for (let i in this.currentSample.insProduct) {
-                let inspectionItemClass =
-                  this.currentSample.insProduct[i].inspectionItemClass ==
-                    null ||
-                    this.currentSample.insProduct[i].inspectionItemClass ==
-                    undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemClass;
-                inspectionItemClass = inspectionItemClass.replace(/\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, "");
-                let inspectionItemSubclass =
-                  this.currentSample.insProduct[i].inspectionItemSubclass ==
-                    null ||
-                    this.currentSample.insProduct[i].inspectionItemSubclass ==
-                    undefined
-                    ? ""
-                    : this.currentSample.insProduct[i].inspectionItemSubclass;
-                inspectionItemSubclass = inspectionItemSubclass.replace(
-                  /\s*/g,
-                  ""
-                );
-                if (inspectionItemSubclass === "骞叉�佹媺浼稿己搴�(绾靛悜)") {
-                  // 妫�楠屽瓙椤逛负'骞叉�佹媺浼稿己搴�(绾靛悜)'鏃讹紝妯$増閲屾槸涓や釜璁$畻鍊煎搴旂浉鍚岀殑妫�楠屽�煎苟涓旇绠楁柟寮忎笉鍚岋紝瑕佹牴鎹浉鍚岀殑'鍗曚綅'鍋氱壒娈婄殑娓叉煋
-                  const unit = this.currentSample.insProduct[i].unit;
-                  if (
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass +
-                      unit ===
-                      str2) ||
-                    (this.currentSample.insProduct[i].templateId ===
-                      a.templateId &&
-                      !unit2.includes("/") &&
-                      inspectionItemClass +
-                      inspectionItem +
-                      inspectionItemSubclass ===
-                      str)
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                } else {
-                  // 濡傛灉鐩哥瓑,閭d箞璇存槑鎵惧埌浜�,骞朵笖鎶奿d瀛樿捣鏉�,鍚庣画妫�楠岄」涔熶細鍦ㄩ〉闈腑鏄剧ず鍑烘潵
-                  if (
-                    this.currentSample.insProduct[i].templateId ===
-                    a.templateId &&
-                    inspectionItemClass +
-                    inspectionItem +
-                    inspectionItemSubclass ===
-                    str
-                  ) {
-                    ids.push({
-                      r: b.r,
-                      id: this.currentSample.insProduct[i].id,
-                      product: this.currentSample.insProduct[i],
-                    });
-                    break;
-                  }
-                }
-                count2++;
-              }
-              if (count2 == this.currentSample.insProduct.length) {
-                dels.add(b.r);
-              }
+        const directProducts = this.currentSample.insProduct.filter(
+          (product) => product.templateId === a.templateId &&
+            product.templateRowIndex !== null && product.templateRowIndex !== undefined
+        );
+        directProducts.forEach((product) => {
+          a.template.forEach((cell) => {
+            if (cell.r === product.templateRowIndex) {
+              cell.i = product.id;
             }
-          }
-        });
-        // 鎿嶄綔鍒犻櫎
-        dels.forEach((del) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === del) {
-              a.template.splice(b, 1);
-              b -= 1;
-            }
-          }
-        });
-        // 鎿嶄綔璧嬪��--涓昏璧嬪�煎崟浣�,璇曢獙鏂规硶绛変俊鎭�
-        ids.forEach((id) => {
-          for (let b = 0; b < a.template.length; b++) {
-            if (a.template[b].r === id.r) {
-              a.template[b].i = id.id;
-              if (
-                a.template[b].v.ps != undefined &&
-                a.template[b].v.ps.value === "鍗曚綅"
-              ) {
-                a.template[b].v.v = id.product.unit;
-              }
-              if (
-                a.template[b].v.ps != undefined &&
-                (a.template[b].v.ps.value === "璇曢獙鏂规硶" ||
-                  a.template[b].v.ps.value === "妫�娴嬫柟娉�")
-              ) {
-                a.template[b].v.v = id.product.methodS;
-              }
-            }
-          }
+          });
         });
         let set2 = new Set();
         // 鍚堝苟鐨勬暟鎹鐞�,cs  rs  浠h〃鍚堝苟鐨勬暟閲�
@@ -1997,20 +1894,11 @@
           }
         });
       });
-      // 鏈寰幆涓昏鏄鍚庣浼犲弬杩涜鍒濆鍖�,鏍峰紡閫昏緫淇敼
+      // 鏈寰幆涓昏鍋氭牱寮忛�昏緫澶勭悊,鍙紪杈戝崟鍏冩牸鍒濆鍖�
       this.tableList.forEach((a) => {
         let arrs = [];
         let set = new Set();
         let count1 = 0;
-        let conclusionList = []; //缁撹鍒楄〃
-        let finalList = []; //鏈�缁堝�煎垪琛�
-        // 缁撹涓庢渶缁堝�煎湪杩欓噷涓�涓�瀵瑰簲,浠ヤ笅涓や釜鍒楄〃闀垮害鑲畾鏄竴鏍风殑,濡傛灉鏈変笉涓�鏍�,閭d箞澶氬崐鏄ā鏉块厤缃緱闂
-        conclusionList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "缁撹"
-        ); //缁撹鍒楄〃
-        finalList = a.template.filter(
-          (n) => n.v.ps != undefined && n.v.ps.value === "鏈�缁堝��"
-        ); //鏈�缁堝�煎垪琛�
         a.template.forEach((b) => {
           if (
             b.v.ps != undefined &&
@@ -2021,61 +1909,18 @@
             count1++;
             b.v.v = count1;
           }
-          if (b.v.ps != undefined && b.v.ps.value === "瑕佹眰鍊�") {
-            // 瀵硅姹傚�艰繘琛岃祴鍊�
-            b.v.v = this.getAsk(b.i);
-          }
-          // 瀵归〉闈㈢殑鍜岀粰鍚庣浼犲弬鐨勬楠屽��,璁$畻鍊�,璁惧缂栫爜,璁惧鍚嶇О,鏈�缁堝��,缁撹杩涜鍒濆鍖�
+          // 鍒濆鍖栧彲濉啓/鍙绠楀崟鍏冩牸,鍚庣画鎸夊潗鏍囧洖鏄�
           if (
             b.v.ps != undefined &&
             typeof b.v.ps.value === "string" &&
-            b.v.ps.value.includes("妫�楠屽��")
+            (b.v.ps.value.includes("妫�楠屽��") ||
+              b.v.ps.value === "璁$畻鍊�" ||
+              b.v.ps.value === "鏈�缁堝��" ||
+              b.v.ps.value === "璁惧鍚嶇О")
           ) {
             this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.u = "";
-            b.i && this.param[b.i] && this.param[b.i].insValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁$畻鍊�") {
-            this.$set(b.v, "v", "");
-            // b.v.v = ''
-            b.i && this.param[b.i] && this.param[b.i].comValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧缂栫爜") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            b.i && this.param[b.i] && this.param[b.i].equipValue.push(b);
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "璁惧鍚嶇О") {
-            this.$set(b.v, "v", "");
-            // 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 === "鏈�缁堝��") {
-            // b.v.v = ''
-            this.$set(b.v, "v", "");
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].resValue
-            ) {
-              this.param[b.i].resValue = b;
-            }
-          }
-          if (b.v.ps != undefined && b.v.ps.value === "缁撹") {
-            if (
-              b.i !== undefined &&
-              this.param[b.i] &&
-              !this.param[b.i].insResult
-            ) {
-              this.param[b.i].insResult = b;
-              conclusionList.forEach((n, i) => {
-                if (n.r == b.r && n.c == b.c) {
-                  b.v.f = `(${this.comparisonList.find((j) => j.value == finalList[i].c)
-                    .label
-                    }${finalList[i].r + 1})`;
-                }
-              });
+            if (b.v.ps.value.includes("妫�楠屽��")) {
+              b.u = "";
             }
           }
           set.add(b.r);
@@ -2103,110 +1948,56 @@
             a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i];
         }
       });
-      // 鏈寰幆涓昏鏄椤甸潰鍙婂悗绔紶鍙傝繘琛屽垵濮嬪寲璧嬪��
-      this.currentSample.insProduct.forEach(async (a) => {
-        try {
-          // 璁$畻鍊艰祴鍊�
-          let comValue = JSON.parse(a.insProductResult.comValue);
-          for (var i = 0; i < comValue.length; i++) {
-            if (
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              )
-            ) {
-              this.param[a.id].comValue.find(
-                (m) => m.c == comValue[i].c && m.r == comValue[i].r
-              ).v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue.find(
-                  (m) => m.c == comValue[i].c && m.r == comValue[i].r
-                ).v.ct
-              );
-            } else if (!comValue[i].c || !comValue[i].r) {
-              this.param[a.id].comValue[i].v.v = this.toFixed(
-                comValue[i].v,
-                this.param[a.id].comValue[i].v.ct
-              );
-            }
-          }
-        } catch (e) { }
-        try {
-          // 妫�楠屽�艰祴鍊�
-          let insValue = JSON.parse(a.insProductResult.insValue);
-          for (let i = 0; i < insValue.length; i++) {
-            if (
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              )
-            ) {
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).v.v = this.toFixed(
-                insValue[i].v,
-                this.param[a.id].insValue.find(
-                  (m) => m.c == insValue[i].c && m.r == insValue[i].r
-                ).v.ct
-              );
-              this.param[a.id].insValue.find(
-                (m) => m.c == insValue[i].c && m.r == insValue[i].r
-              ).u = insValue[i].u;
-              // this.param[a.id].insValue[i].v.v = insValue[i].v
-              // this.param[a.id].insValue[i].u = insValue[i].u
-            }
-          }
-        } catch (e) { }
-        try {
-          // 璁惧缂栧彿璧嬪��
-          let equipValue = JSON.parse(a.insProductResult.equipValue);
-          for (let i = 0; i < equipValue.length; i++) {
-            // 鏅�氳澶囪祴鍊�
-            this.param[a.id].equipValue[i].v.v = equipValue[i].v;
-          }
-        } catch (e) { }
-        try {
-          // 璁惧鍚嶇О璧嬪��
-          let equipName = JSON.parse(a.insProductResult.equipName);
-          for (let i = 0; i < equipName.length; i++) {
-            equipName[i].v !== "" &&
-              equipName[i].v.map((val) => {
-                const index = this.equipOptions.findIndex(
-                  (item) => item.value === val
-                );
-                if (index > -1) {
-                  // 鏍规嵁璁惧缂栫爜杞崲涓虹浉搴旂殑璁惧鍚嶇О
-                  val = this.equipOptions[index].deviceName;
-                }
-              });
-          }
-          for (let i = 0; i < equipName.length; i++) {
-            // 鏅�氳澶囧悕绉拌祴鍊�
-            this.param[a.id].equipName[i].v.v = equipName[i].v;
-          }
-        } catch (e) {
-          console.log("璁惧鍚嶇О璧嬪��----", e);
-        }
-        try {
-          // 鏈�缁堝�艰祴鍊�
-          this.param[a.id].resValue.v.v = this.toFixed(
-            a.lastValue,
-            this.param[a.id].resValue.v.ct
-          );
-          // 缁撹璧嬪��
-          this.param[a.id].insResult.v.v = a.insResult;
-        } catch (e) { }
-      });
+      // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+      this.initParamByCoordinate();
       // 瀵筫xcel鍑芥暟杩涜澶勭悊
       this.handleExcelMethod();
     },
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濆洖鏄惧凡淇濆瓨鐨勫��
+    initParamByCoordinate() {
+      this.param = {};
+      this.tableList.forEach((a) => {
+        this.param[a.templateId] = {};
+        const product = this.currentSample.insProduct.find(
+          (m) => m.templateId === a.templateId
+        );
+        let saved =
+          (product && (product.recordValues || product.insProductResult)) || {};
+        if (typeof saved === "string") {
+          try {
+            saved = JSON.parse(saved);
+          } catch (e) {
+            saved = {};
+          }
+        }
+        a.template.forEach((cell) => {
+          const key = `${cell.r}-${cell.c}`;
+          const item = saved[key];
+          if (item === undefined || item === null) {
+            return;
+          }
+          const value = typeof item === "object" ? item.v : item;
+          if (value === undefined || value === null) {
+            return;
+          }
+          cell.v.v = value;
+          if (typeof item === "object" && item.u) {
+            cell.u = item.u;
+          }
+          this.param[a.templateId][key] = {
+            v: value,
+            u: typeof item === "object" ? item.u : cell.u,
+          };
+        });
+      });
+    },
     // 妫�楠屽�艰緭鍏ュ悗瑙﹀彂鐨勫嚱鏁�
-    changeInput(m, code, n, getDataType, changeSelect) {
+    changeInput(m, code, n, getDataType) {
       // 涓烘暟閲囧畾涔変竴涓�昏緫鍙傛暟
       if (getDataType == "getDataType") {
         this.getDataType = 2;
       }
-      let currentInsItemId = null; //褰撳墠妫�楠岄」id
       if (n) {
-        currentInsItemId = JSON.parse(JSON.stringify(n.i));
         // 瀹氫箟涓�涓嚱鏁版潵楠岃瘉鍒嗘暟鏄惁鏈夋晥
         if (typeof n.v.v == "string") {
           function isValidFraction(fraction) {
@@ -2220,6 +2011,7 @@
         }
       }
       try {
+        const revision = ++this.calculationRevision;
         // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
         this.worker.postMessage(
           JSON.stringify({
@@ -2234,164 +2026,51 @@
             getDataTypeId: this.getDataTypeId,
             modelType: this.sampleProduct[0].model,
             currentInsItem: n,
+            revision: revision,
           })
         );
+        // 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
+        // 杩欐牱鍗充娇鐢ㄦ埛杈撳叆鍚庣珛鍗冲埛鏂般�佸垏鎹㈡垨杩斿洖锛屾渶鍚庣紪杈戠殑鍗曞厓鏍间篃涓嶄細涓㈠け銆�
+        if (n) {
+          this.saveInsContext();
+        }
       } catch (error) {
         console.log(444, error);
       }
 
       // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
       this.worker.onmessage = (event) => {
-        this.result = JSON.parse(event.data);
-        switch (this.result.method) {
+        const workerResult = JSON.parse(event.data);
+        if (workerResult.revision != null && workerResult.revision < this.calculationRevision) {
+          return;
+        }
+        this.result = workerResult;
+        switch (workerResult.method) {
           case "saveInsContext":
             this.$nextTick(() => {
-              // this.$delete(this.tableList[0],'arr')
+              const resultValue = workerResult.value;
               this.$set(
                 this.tableList[0],
                 "arr",
-                this.result.value.tableList[0].arr
+                resultValue.tableList[0].arr
               );
-              this.param = this.result.value.param;
-              if (this.result.value.currentInsItemId) {
-                currentInsItemId = this.result.value.currentInsItemId;
-              }
-              // 鐗规畩澶勭悊涓�涓嬬粨璁�,浼氭湁杩欑鐗规畩鎯呭喌
-              for (var i in this.param) {
-                if (
-                  this.param[i].insResult &&
-                  this.param[i].insResult.v &&
-                  this.param[i].insResult.v.v
-                ) {
-                  if (this.param[i].insResult.v.v == "鍚堟牸") {
-                    this.$set(this.param[i].insResult.v, "v", 1);
-                  } else if (this.param[i].insResult.v.v == "涓嶅悎鏍�") {
-                    this.$set(this.param[i].insResult.v, "v", 0);
-                  }
-                }
-              }
-              this.saveInsContext(currentInsItemId);
+              this.param = resultValue.param;
+              this.saveInsContext();
+              this.completedCalculationRevision = Math.max(
+                this.completedCalculationRevision,
+                workerResult.revision || 0
+              );
             });
             break;
           case "tableList":
             this.$nextTick(() => {
               // 鏇存柊鏁版嵁
               this.$delete(this.tableList[0], "arr");
-              this.$set(this.tableList[0], "arr", this.result.value[0].arr);
-              // this.param = this.result.value.param
-              if (this.result.value.currentInsItem) {
-                currentInsItemId = this.result.value.currentInsItem.i;
-              }
+              this.$set(this.tableList[0], "arr", workerResult.value[0].arr);
             });
-            break;
-          case "getCurrentInsProduct":
-            // 鏇存柊椤甸潰鏁版嵁
-            this.getCurrentInsProduct(this.result.value);
             break;
         }
       };
-      // 淇濆瓨鏁版嵁
-      setTimeout(() => {
-        if (changeSelect) {
-          this.saveInsContext(currentInsItemId);
-        }
-      }, 200);
-    },
-    // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁   param => this.tableList[0].insProductResult
-    getCurrentInsProduct(pId) {
-      if (!this.tableList[0].insProductResult) {
-        this.tableList[0].insProductResult = {};
-      }
-      for (let m in this.param[pId]) {
-        let value = this.param[pId][m];
-        switch (m) {
-          case "comValue":
-            // 璧嬪�艰绠楀��
-            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(555, error);
-              }
-            }
-            break;
-          // 璧嬪�兼楠屽��
-          case "insValue":
-            if (value && value.length > 0) {
-              this.tableList[0].insProductResult[m] = [];
-              value.forEach((a, i) => {
-                let obj = {
-                  v: a.v.v,
-                  u: a.u,
-                };
-                this.tableList[0].insProductResult[m].push(obj);
-              });
-              try {
-                this.tableList[0].insProductResult[m] = JSON.stringify(
-                  this.tableList[0].insProductResult[m]
-                );
-              } catch (error) {
-                console.log(666, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囩紪鍙�
-          case "equipValue":
-            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(777, error);
-              }
-            }
-            break;
-          // 璧嬪�艰澶囧悕绉�
-          case "equipName":
-            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);
-              }
-            }
-            break;
-          // 璧嬪�兼渶缁堝��
-          case "resValue":
-            this.tableList[0].lastValue = value ? value.v.v : "";
-            break;
-          // 璧嬪�肩粨璁�
-          case "insResult":
-            this.tableList[0].insResult = value ? value.v.v : "";
-            break;
-        }
-      }
     },
     // 瀵笶XCEL鍑芥暟杩涜澶勭悊
     handleExcelMethod() {
@@ -2435,14 +2114,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鎻忚堪
-    getTell(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].tell;
-        }
-      }
-    },
     // 鍔ㄦ�佽幏鍙栧崟鍏冩牸瀹藉害
     handleWidth(n) {
       let sum = 0;
@@ -2483,14 +2154,6 @@
         }
       }
     },
-    // 鑾峰彇瑕佹眰鍊�
-    getAsk(id) {
-      for (var a in this.currentSample.insProduct) {
-        if (this.currentSample.insProduct[a].id == id) {
-          return this.currentSample.insProduct[a].ask;
-        }
-      }
-    },
     // 鑾峰彇鎵�鏈夎澶�
     getEquipOptions(e, id) {
       if (e) {
@@ -2509,17 +2172,6 @@
           });
       }
     },
-    // getDic(e, id) {
-    //   if (e) {
-    //     for (var a in this.currentSample.insProduct) {
-    //       if (this.currentSample.insProduct[a].id == id) {
-    //         let str = this.currentSample.insProduct[a].dic;
-    //         this.selectEnumByCategoryOfSelect(str);
-    //         return str;
-    //       }
-    //     }
-    //   }
-    // },
     openAddCheck() {
       this.addCheck = true;
     },
@@ -2527,6 +2179,10 @@
     upInsReview(e) {
       if (e == 1) {
         // 閫氳繃
+        if (this.reviewInsResult !== 0 && this.reviewInsResult !== 1) {
+          this.$message.error("璇烽�夋嫨妫�楠岀粨璁�");
+          return;
+        }
         this.reviewLoading = true;
         verifyPlan({
           orderId: this.orderId,
@@ -2534,6 +2190,7 @@
           laboratory: this.sonLaboratory,
           tell: null,
           userId: this.checkUser,
+          insResult: this.reviewInsResult,
         }).then((res) => {
           if (res.code === 200) {
             this.$message.success("鎿嶄綔鎴愬姛");
@@ -2574,57 +2231,77 @@
         this.$message.error("鏈緭鍏ヤ笉閫氳繃鍘熷洜");
       }
     },
-    submit() {
+    // 鏌ョ湅宸ユ椂
+    viewManHour() {
+      this.$refs.viewManHourDia.showDialog(this.id, 99);
+    },
+    openAddVerifyDia() {
+      this.addVerifyDia = true;
+    },
+    confirmSubmit(){
+      submitPlan({
+        orderId: this.orderId,
+        laboratory: this.sonLaboratory,
+        verifyUser: this.verifyUser,
+        entrustCode: this.insOrder.entrustCode,
+        registerInsResults: false,
+      }).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;
+        });
+    },
+    async submit() {
       if (this.verifyUser === null || this.verifyUser === "") {
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
         return;
       }
-      if (!this.otherForm.humidity) {
+      if (this.isDirectTemplateOrder() && (!this.selectedDeviceIds || this.selectedDeviceIds.length === 0)) {
+        this.$message.error("璇烽�夋嫨璁惧");
+        return;
+      }
+      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("璇峰~鍐橧FS搴撳瓨鐗╂枡鎵规灞炴��");
+        return;
+      }
+      await this.waitForPendingSaves();
       this.submitLoading = true;
       checkSubmitPlan({
         orderId: this.orderId,
         laboratory: this.sonLaboratory,
       }).then((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;
-              });
+            this.confirmSubmit();
           } 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]
                 )
               );
             }
@@ -2647,22 +2324,23 @@
             })
               .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()
+                // 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;
+                //   });
               })
               .catch(() => { });
           }
@@ -2674,95 +2352,168 @@
         });
       return;
     },
-    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
-    saveInsContext(currentInsItemId) {
-      try {
-        if (this.param) {
-          let param = null;
-          if (currentInsItemId) {
-            param = { [currentInsItemId]: this.param[currentInsItemId] };
-          } else {
-            param = this.param;
+    // 鎸夆�滄ā鏉縤d + 鍗曞厓鏍煎潗鏍�(r-c)鈥濅粠褰撳墠妯℃澘蹇収鍑哄緟淇濆瓨鍙傛暟
+    buildParam() {
+      const param = {};
+      this.tableList.forEach((a) => {
+        param[a.templateId] = {};
+        // Worker 鍥炰紶鍚� arr 鏄〉闈笂鐨勬渶鏂板璞★紝template 浠嶅彲鑳戒繚鐣欒绠楀墠鐨勬棫鍊笺��
+        const cells = a.arr && a.arr.length
+          ? a.arr.reduce((all, row) => all.concat(row), [])
+          : a.template;
+        const resultHeader = cells.find((cell) =>
+          cell.v && String(cell.v.v || "").trim() === "妫�楠岀粨鏋�"
+        );
+        const exportRows = new Set(cells.filter((cell) =>
+          cell.v && cell.v.ps && cell.v.ps.value === "瀵煎嚭鍊�"
+        ).map((cell) => cell.r));
+        cells.forEach((cell) => {
+          const isEditable =
+            cell.v.ps != undefined &&
+            typeof cell.v.ps.value === "string" &&
+            (cell.v.ps.value.includes("妫�楠屽��") ||
+              cell.v.ps.value === "璁$畻鍊�" ||
+              cell.v.ps.value === "鏈�缁堝��" ||
+              cell.v.ps.value === "璁惧鍚嶇О");
+          const isExportResult = resultHeader && exportRows.has(cell.r) && cell.c === resultHeader.c;
+          if (!isEditable && !isExportResult) {
+            return;
           }
-          saveInsContext({
-            param: JSON.stringify(param),
-            currentTable: this.currentTable,
-            sampleId: this.currentSample.id,
-            orderId: this.orderId,
-            sonLaboratory: this.sonLaboratory
-          }).then((res) => {
-            if (res.code == 201) {
-              this.$message.error("淇濆瓨澶辫触");
-              return;
-            }
-            this.$message.success("宸蹭繚瀛�");
-          });
-          // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
-          this.worker.postMessage(
-            JSON.stringify({
-              modelType: this.sampleProduct[0].model,
-              type: "saveData",
-              tableList: this.tableList,
-              param: this.param,
-              currentTable: this.currentTable,
-            })
-          );
+          if (
+            isEditable &&
+            cell.v.ps.value.includes("妫�楠屽��") &&
+            (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+          ) {
+            return;
+          }
+          param[a.templateId][`${cell.r}-${cell.c}`] = {
+            v: cell.v.v,
+            u: cell.u,
+          };
+        });
+      });
+      return param;
+    },
+    // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹�
+    saveInsContext() {
+      try {
+        if (!this.param) {
+          return;
         }
+        const param = this.buildParam();
+        this.param = param;
+        let isNoTestValue = "";
+        this.tableList.forEach((a) => {
+          a.template.forEach((cell) => {
+            if (
+              cell.v.ps != undefined &&
+              typeof cell.v.ps.value === "string" &&
+              cell.v.ps.value.includes("妫�楠屽��") &&
+              (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
+            ) {
+              isNoTestValue = 1;
+            }
+          });
+        });
+        const payload = {
+          param: JSON.stringify(param),
+          currentTable: this.currentTable,
+          sampleId: this.currentSample.id,
+          orderId: this.orderId,
+          sonLaboratory: this.sonLaboratory,
+          isNoTestValue: isNoTestValue
+        };
+        const previousSave = this.saveQueue || Promise.resolve();
+        this.saveQueue = previousSave
+          .catch(() => undefined)
+          .then(() => this.isDirectTemplateOrder()
+            ? saveTemplateContext({
+                orderId: this.orderId,
+                sampleId: this.currentSample.id,
+                templateId: this.currentTable,
+                values: param[this.currentTable] || {},
+              })
+            : saveInsContext(payload))
+          .then(() => {
+            this.$message.success("宸蹭繚瀛�");
+          })
+          .catch((error) => {
+            console.error("妫�楠屾暟鎹繚瀛樺け璐�", error);
+            this.$message.error("妫�楠屾暟鎹繚瀛樺け璐ワ紝璇烽噸璇�");
+          });
+        // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+        this.worker.postMessage(
+          JSON.stringify({
+            modelType: this.sampleProduct[0].model,
+            type: "saveData",
+            tableList: this.tableList,
+            param: this.param,
+            currentTable: this.currentTable,
+          })
+        );
       } catch (error) {
         console.log(999, error);
       }
     },
-    // 璁惧鏀瑰彉
-    changeEquip(val, n, v) {
-      try {
-        // this.$set(n.v,'v',val)
-        this.tableList[0].arr.forEach((item, index) => {
-          item.forEach((m, i) => {
-            if (this.param[m.i]) {
-              this.param[m.i].state = 1;
+    async waitForPendingSaves() {
+      const targetRevision = this.calculationRevision;
+      if (this.completedCalculationRevision < targetRevision) {
+        await new Promise((resolve) => {
+          const startedAt = Date.now();
+          const waitWorker = () => {
+            if (this.completedCalculationRevision >= targetRevision || Date.now() - startedAt > 5000) {
+              resolve();
+              return;
             }
-            // if(m.i==n.i&&m.v.ps&&m.v.ps.value=='璁惧鍚嶇О'&&v){
-            //   this.$set(m.v,'v',v)
-            // }
-          });
+            setTimeout(waitWorker, 20);
+          };
+          waitWorker();
         });
-        for (let i in this.param) {
-          if (this.param[i].state != 1) {
-            delete this.param[i];
-          }
-        }
-        // this.equipOptions涓鸿澶囧悕绉颁笅鎷夋閫夐」鏁版嵁
-        for (let i1 in this.param[n.i].equipName) {
-          if (
-            this.param[n.i].equipName[i1].i === n.i &&
-            this.param[n.i].equipName[i1].r === n.r
-          ) {
-            this.$delete(this.param[n.i].equipValue[i1].v, "v");
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipValue[i1].v, "v", val.join("锛�"));
-            this.$delete(this.param[n.i].equipName[i1].v, "v");
-            // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜
-            this.$set(this.param[n.i].equipName[i1].v, "v", val);
-            this.tableList[0].arr.forEach((item, index) => {
-              item.forEach((m) => {
-                if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧缂栫爜") {
-                  this.$set(m.v, "v", val.join("锛�"));
-                }
-                if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧鍚嶇О") {
-                  this.$set(m.v, "v", val);
-                }
-              });
-            });
-          }
-        }
-        // 淇濆瓨鏁版嵁
-        this.saveInsContext(n.i);
-      } catch (e) {
-        console.log("changeEquip----", e);
+      }
+      if (this.saveQueue) {
+        await this.saveQueue;
       }
     },
+    // 璁惧鏀瑰彉
+    changeEquip(val, n) {
+      const selectedDevices = Array.isArray(val) ? [...val] : [];
+      const deviceCodes = selectedDevices.join("锛�");
+      this.$set(n.v, "v", selectedDevices);
+      this.tableList.forEach((table) => {
+        (table.arr || []).forEach((row) => {
+          row.forEach((cell) => {
+            if (cell.i == n.i && cell.v.ps) {
+              if (cell.v.ps.value === "璁惧鍚嶇О") {
+                this.$set(cell.v, "v", [...selectedDevices]);
+              } else if (cell.v.ps.value === "璁惧缂栫爜") {
+                this.$set(cell.v, "v", deviceCodes);
+              }
+            }
+          });
+        });
+      });
+      // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
+      this.saveInsContext();
+    },
+    isDirectTemplateOrder() {
+      return this.sonLaboratory === "鏂拌仛" && this.currentSample &&
+        (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
+    },
+    loadOverviewDevices() {
+      Promise.all([search({ status: 0 }), getOrderDevices({ orderId: this.orderId })]).then(([devices, selected]) => {
+        this.orderDeviceOptions = (devices.data || []).map((device) => ({
+          id: device.id,
+          label: `${device.deviceName}--${device.managementNumber}`,
+        }));
+        this.selectedDeviceIds = selected.data || [];
+      });
+    },
+    saveOverviewDevices() {
+      return saveOrderDevices({ orderId: this.orderId, deviceIds: this.selectedDeviceIds })
+        .then(() => this.$message.success("璁惧宸蹭繚瀛�"));
+    },
     getAuthorizedPerson() {
-      selectUserCondition({ type: 0 }).then((res) => {
+      selectUserCondition({ type: 1 }).then((res) => {
         let data = [];
         res.data.forEach((a) => {
           data.push({
@@ -2819,16 +2570,6 @@
       // 鍒濆鍖栧悗绔紶鍙�
       this.param = {};
       this.changeType = 0;
-      this.currentSample.insProduct.forEach((a, j) => {
-        this.param[a.id] = {
-          insValue: [],
-          comValue: [],
-          resValue: null,
-          equipValue: [],
-          equipName: [],
-          insResult: null,
-        };
-      });
       // 椤甸潰鏁版嵁澶勭悊
       this.getTableLists();
       // 鏇存柊鍒板绾跨▼
@@ -2846,7 +2587,7 @@
       this.upLoading = false;
       if (response.code == 200) {
         this.$message.success("涓婁紶鎴愬姛");
-        this.$refs.fileList.selectList();
+        this.getList();
       }
     },
     beforeUpload(file) {
@@ -2865,16 +2606,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) => { });
     },
@@ -2898,8 +2630,9 @@
         return v;
       }
     },
-    goback() {
-      this.$tab.closeOpenPage({ path: "/business/inspectionTask" });
+    async goback() {
+      await this.waitForPendingSaves();
+      this.$router.go(-1)
     }
   },
 };
@@ -2941,6 +2674,7 @@
   background-color: #fff;
   border-radius: 3px;
   margin-bottom: 10px;
+  padding: 10px;
 }
 
 .search .form-inline {
@@ -3036,7 +2770,7 @@
 }
 
 .content-h-2 {
-  justify-content: end;
+  justify-content: flex-end;
 }
 
 .content-v-0 {

--
Gitblit v1.9.3