From 049fda473cc178917a02f3a174dfd08a84b0cb8d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 17 九月 2026 10:52:28 +0800
Subject: [PATCH] 新疆——新聚lims 1.每个检验项都要有一个选择检测时间的地方,跟温湿度放在一起,还有检测地点,设备也要单独绑定检验项,最后导出模版再总结到一起 2.产品名称改为检测依据、加一个样品名称手输 3.下单时原始记录模板可以从标准库绑定的模板进行删减

---
 src/views/business/inspectionTask/inspection.vue |  352 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 257 insertions(+), 95 deletions(-)

diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index 94318dc..eac01ab 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -1,28 +1,13 @@
 <template>
   <div v-loading="loading" class="inspection" style="background-color: rgb(245, 247, 251);">
     <el-row class="title">
-      <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">
-            <el-input v-model="otherForm.temperature" :disabled="state > 1" placeholder="" size="small"
-              style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'temperature')"></el-input>
-            <span style="margin-left: 4px">鈩�</span>
-          </el-form-item>
-          <el-form-item label="婀垮害:" style="margin-bottom: 0">
-            <el-input v-model="otherForm.humidity" :disabled="state > 1" placeholder="" size="small"
-              style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
-            <span style="margin-left: 4px">%</span>
-          </el-form-item>
-        </el-form>
-      </el-col>
-      <el-col :span="insOrder.ifsOrderType!=='02wg'?16:24" style="text-align: right">
+      <el-col :span="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 && [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 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>
         <!-- 澶嶆牳 -->
@@ -92,7 +77,6 @@
           <el-descriptions-item label="闆朵欢鍙�">{{insOrder.partNo}}</el-descriptions-item>
           <el-descriptions-item label="闆朵欢鍚嶇О">{{insOrder.partDetail}}</el-descriptions-item>
           <el-descriptions-item label="鎵规鍙�">{{ insOrder.lotBatchNo }}</el-descriptions-item>
-          <el-descriptions-item label="鏍峰搧鍨嬪彿" >{{currentSample.model}}</el-descriptions-item>
           <el-descriptions-item label="鎶芥鏁伴噺">{{insOrder.testQuantity}}</el-descriptions-item>
           <el-descriptions-item label="鍘傚瀵嗗害">{{supplierDensity}}</el-descriptions-item>
           <template v-if="insOrder.ifsOrderType && insOrder.ifsOrderType==='02wg'">
@@ -107,10 +91,10 @@
         </template>
         <template v-else>
           <el-descriptions-item label="濮旀墭缂栧彿">{{ insOrder.entrustCode }}</el-descriptions-item>
+          <el-descriptions-item label="妫�娴嬩緷鎹�">{{ insOrder.sample || '-' }}</el-descriptions-item>
+          <el-descriptions-item label="鏍峰搧鍚嶇О">{{ insOrder.sampleView || '-' }}</el-descriptions-item>
           <el-descriptions-item label="鏍峰搧缂栧彿">{{ currentSample.sampleCode }}</el-descriptions-item>
-          <el-descriptions-item label="鏍峰搧鍚嶇О">{{ currentSample.sample }}</el-descriptions-item>
-          <el-descriptions-item label="鏍峰搧鏁伴噺">{{ sampleProduct.length }}</el-descriptions-item>
-          <el-descriptions-item label="鏍峰搧鍨嬪彿">{{ currentSample.model }}</el-descriptions-item>
+          <el-descriptions-item label="鏍峰搧鏁伴噺">{{ insOrder.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>
@@ -190,6 +174,50 @@
             @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰"
             }}</el-button>
         </div>
+      </div>
+      <!-- 褰撳墠妫�楠屾ā鏉跨殑妫�娴嬫潯浠朵笌妫�楠岀粨璁� -->
+      <div class="template-panel">
+        <el-form v-if="showTemplateConditions" :inline="true" :model="currentOtherForm" class="form-inline"
+          size="small" label-width="84px">
+          <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="娓╁害:">
+            <el-input v-model="currentOtherForm.temperature" :disabled="state > 1" placeholder="" size="small"
+              style="width: 90px" @change="(m) => subOtherForm(m, 'temperature')"></el-input>
+            <span class="template-panel__unit">鈩�</span>
+          </el-form-item>
+          <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="婀垮害:">
+            <el-input v-model="currentOtherForm.humidity" :disabled="state > 1" placeholder="" size="small"
+              style="width: 90px" @change="(m) => subOtherForm(m, 'humidity')"></el-input>
+            <span class="template-panel__unit">%RH</span>
+          </el-form-item>
+          <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="妫�娴嬫椂闂�:">
+            <el-date-picker v-model="currentOtherForm.detectionTime" :disabled="state > 1" type="date"
+              value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨鏃ユ湡" size="small" style="width: 160px"
+              @change="(m) => subOtherForm(m, 'detectionTime')"></el-date-picker>
+          </el-form-item>
+          <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="妫�娴嬪湴鐐�:">
+            <el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable placeholder="璇疯緭鍏ユ娴嬪湴鐐�"
+              size="small" style="width: 200px" @change="(m) => subOtherForm(m, 'detectionPlace')"></el-input>
+          </el-form-item>
+          <el-form-item v-if="isDirectTemplateOrder()" label="璁惧:">
+            <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
+              size="small" placeholder="璇烽�夋嫨璁惧" style="width: 360px"
+              @change="(m) => subOtherForm(m, 'deviceIds')">
+              <el-option v-for="device in orderDeviceOptions" :key="device.id" :label="device.label" :value="device.id" />
+            </el-select>
+          </el-form-item>
+        </el-form>
+        <!-- 澶嶆牳鏃舵墠鑳介�� -->
+        <el-form :inline="true" :model="currentOtherForm"
+          :class="['form-inline', { 'template-panel__conclusion--divided': showTemplateConditions }]"
+          size="small" label-width="84px">
+          <el-form-item label="妫�楠岀粨璁�:">
+            <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
+              @change="(m) => subOtherForm(m, 'insResult')">
+              <el-radio :label="1">鍚堟牸</el-radio>
+              <el-radio :label="0">涓嶅悎鏍�</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-form>
       </div>
       <!-- 甯歌妫�楠屽師濮嬭褰� -->
       <div id="nav" v-loading="tableLoading" class="center-box">
@@ -291,12 +319,12 @@
                         align-items: center;
                         width: 100%;
                       ">
-                        <i class="el-icon-caret-left table_caret" style="width: 16px" @click="caretSample(-1)"></i>
+                        <!-- <i class="el-icon-caret-left table_caret" style="width: 16px" @click="caretSample(-1)"></i> -->
                         <div
                           :style="`font-family:${n.v.ff} !important;overflow: hidden;white-space: nowrap;width: calc(100% - 32px);`">
                           {{ currentSample.sampleCode }}
                         </div>
-                        <i class="el-icon-caret-right table_caret" style="width: 16px" @click="caretSample(1)"></i>
+                        <!-- <i class="el-icon-caret-right table_caret" style="width: 16px" @click="caretSample(1)"></i> -->
                       </div>
                     </template>
                     <template v-else-if="
@@ -326,6 +354,7 @@
       <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
         :height="'calc(100vh - 290px)'" @pagination="pagination" style="height: 100%; margin-top: 16px"></lims-table>
     </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
@@ -346,7 +375,9 @@
             <span>{{ scope.row.isLeave == 0 ? "鍚�" : "鏄�" }}</span>
           </template>
         </el-table-column>
+    -->
         <!-- 妫�楠屽崟浼氭湁涓�涓槸鍚︽湁閰嶅鏍峰搧瀛楁鎺у埗鏄剧ず -->
+    <!--
         <el-table-column v-if="insOrder.mating > 0" label="閰嶅鏍峰搧鍨嬪彿" min-width="130px" prop="joinModel"
           show-overflow-tooltip></el-table-column>
         <el-table-column v-if="insOrder.mating > 0" label="閰嶅鏍峰搧鍚嶇О" min-width="130px" prop="joinName"
@@ -355,6 +386,7 @@
           show-overflow-tooltip></el-table-column>
       </el-table>
     </el-drawer>
+    -->
     <el-drawer :size="500" :visible.sync="taskVisible" title="浠诲姟鍒囨崲">
       <lims-table :tableData="tableData0" :column="column0" :page="page0" :tableLoading="tableLoading0"
         :height="'calc(100vh - 90px)'" :currentChange="handleChangeTask"></lims-table>
@@ -382,17 +414,6 @@
           <el-select v-model="verifyUser" clearable filterable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
             <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
             </el-option>
-          </el-select>
-        </div>
-      </div>
-      <div class="body" style="display: flex; padding: 10px; align-items: center">
-        <div class="search_label" style="width: 150px">
-          <span class="required-span">*</span>鎶ュ憡绫诲瀷
-        </div>
-        <div class="search_input" style="width: 100%">
-          <el-select v-model="reportType" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
-            <el-option label="妫�娴嬫姤鍛�" :value="0"></el-option>
-            <el-option label="妫�楠屾姤鍛�" :value="1"></el-option>
           </el-select>
         </div>
       </div>
@@ -579,6 +600,7 @@
   checkSubmitPlan,
   submitPlan,
   saveInsContext,
+  saveTemplateContext,
   selectUserCondition,
   downFile,
   getFileList,
@@ -661,6 +683,7 @@
       comparisonList: [],
       excelMethodList: [],
       equipOptions: [],
+      orderDeviceOptions: [],
       reviewLoading: false,
       reviewDia: false,
       noReason: "",
@@ -670,7 +693,6 @@
       widthList: [],
       addVerifyDia: false,
       verifyUser: null,
-      reportType: null,
       personList: [],
       enumList: [],
       tableLoading: false,
@@ -681,10 +703,8 @@
         inspectionItem: 1,
         inspectionItemSubclass: "20(甯告俯)",
       },
-      otherForm: {
-        humidity: null,
-        temperature: null,
-      },
+      // 妫�娴嬫潯浠朵笌妫�楠岀粨璁烘寜妯℃澘 id 鍒嗙粍锛歿 [templateId]: { temperature, humidity, detectionTime, detectionPlace, deviceIds, insResult } }
+      otherForm: {},
       equipForm: {
         value0: null,
         code0: null,
@@ -696,6 +716,8 @@
       worker0: null,
       // 妫�楠屽�兼寜瑙﹀彂椤哄簭涓茶淇濆瓨锛岄伩鍏嶅悓涓�妫�楠岄」鐨勬棫璇锋眰瑕嗙洊鏂拌姹傘��
       saveQueue: null,
+      calculationRevision: 0,
+      completedCalculationRevision: 0,
       wareLength: [],
       dataAcquisitionInfo: {},
       dataAcquisitionInfoNew: {},
@@ -827,7 +849,6 @@
       },
       tableLoading0: false,
       // 浠诲姟鍒囨崲鍒楄〃--缁撴潫
-      isSplit: 0, // 鏄惁鏄媶鍗曡繃鏉ョ殑
     };
   },
   // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
@@ -836,10 +857,27 @@
     action() {
       return this.javaApi + "/insOrderPlan/uploadFile";
     },
+    // 褰撳墠妯℃澘瀵瑰簲鐨勬娴嬫潯浠朵笌妫�楠岀粨璁�
+    currentOtherForm() {
+      return (
+        this.otherForm[this.currentTable] || {
+          temperature: null,
+          humidity: null,
+          detectionTime: null,
+          detectionPlace: null,
+          deviceIds: [],
+          insResult: null,
+        }
+      );
+    },
+    // 02wg 鍗曟病鏈夋俯婀垮害锛涙柊鑱氱洿鎺ョ粦瀹氭ā鏉跨殑鍗曞彧鏈夎澶�
+    showTemplateConditions() {
+      return this.insOrder.ifsOrderType !== "02wg" || this.isDirectTemplateOrder();
+    },
   },
   created() {
     this.saveQueue = Promise.resolve();
-    let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } =
+    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
       this.$route.query;
     this.sonLaboratory = sonLaboratory;
     this.orderId = orderId;
@@ -847,7 +885,6 @@
     this.state = state;
     this.inspectorList = inspectorList;
     this.typeSource = typeSource;
-    this.isSplit = isSplit;
   },
   mounted() {
     this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」
@@ -911,6 +948,8 @@
               this.tableList = this.tableLists.filter(
                 (m) => m.templateId == val1
               );
+              // 妯℃澘闆嗗悎鍙兘鍙樺寲锛岃ˉ榻愭娴嬫潯浠舵Ы浣�
+              this.tableLists.forEach((m) => this.ensureOtherForm(m.templateId));
               // 瀵规ā鏉胯繘琛屽鐞�
               this.handleTableData();
             }
@@ -1097,18 +1136,27 @@
         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,
-        };
+        // 妫�娴嬫潯浠朵笌妫�楠岀粨璁鸿祴鍊硷細鎸夋ā鏉� id 鍒嗙粍鍥炴樉
+        this.otherForm = {};
+        (this.insOrder.templateConditions || []).forEach((item) => {
+          this.$set(this.otherForm, item.templateId, {
+            temperature: item.temperature != null ? item.temperature : null,
+            humidity: item.humidity != null ? item.humidity : null,
+            detectionTime: item.detectionTime != null ? item.detectionTime : null,
+            detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
+            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
+            insResult: item.insResult != null ? item.insResult : null,
+          });
+        });
+        this.tableLists.forEach((m) => this.ensureOtherForm(m.templateId));
         if (this.typeSource == "1") {
           this.getRawMaterialTag(this.currentSample.id); // 鍘熸潗鏂欑殑妫�楠屼换鍔℃煡璇㈡壒鏁�
           this.rawMaterialTag = "1";
         }
         this.getEquipOptions(1);
+        if (this.sonLaboratory === "鏂拌仛") {
+          this.loadDeviceOptions();
+        }
         // 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
         let list = await this.getCurrentProduct(this.currentSample.id, 0);
         this.currentSample.insProduct = this.HaveJson(list);
@@ -1606,12 +1654,36 @@
         this.worker0 = null;
       }
     },
-    // 淇濆瓨婀垮害銆佹俯搴︽暟鎹�
+    // 淇濊瘉妯℃澘鐨勬娴嬫潯浠朵笌妫�楠岀粨璁烘Ы浣嶅瓨鍦�
+    ensureOtherForm(templateId) {
+      if (templateId == null) return;
+      if (!this.otherForm[templateId]) {
+        this.$set(this.otherForm, templateId, {
+          temperature: null,
+          humidity: null,
+          detectionTime: null,
+          detectionPlace: null,
+          deviceIds: [],
+          insResult: null,
+        });
+      }
+    },
+    // 淇濆瓨褰撳墠妯℃澘鐨勬娴嬫潯浠朵笌妫�楠岀粨璁猴紱澶囨敞鏄崟鎹骇锛屼笉甯︽ā鏉�
     subOtherForm(m, type) {
-      write({
-        [type]: type === "remark" ? m : Number(m),
-        id: this.insOrder.id,
-      }).then((res) => {
+      const payload = { id: this.insOrder.id };
+      if (type === "remark") {
+        payload.remark = m;
+      } else {
+        payload.templateId = this.currentTable;
+        if (type === "deviceIds") {
+          payload.deviceIds = Array.isArray(m) ? [...m] : [];
+        } else if (type === "detectionTime" || type === "detectionPlace") {
+          payload[type] = m === "" || m == null ? null : m;
+        } else {
+          payload[type] = Number(m);
+        }
+      }
+      write(payload).then((res) => {
         this.$message.success("淇濆瓨鎴愬姛");
       });
     },
@@ -1778,6 +1850,8 @@
         this.tableList = null;
         this.tableList = [this.tableLists[0]];
         this.currentTable = this.tableLists[0].templateId;
+        // 琛ラ綈姣忎釜妯℃澘鐨勬娴嬫潯浠舵Ы浣�
+        this.tableLists.forEach((m) => this.ensureOtherForm(m.templateId));
         // 澶勭悊椤甸潰鍒楄〃鏁版嵁
         this.handleTableData();
       }
@@ -2003,6 +2077,7 @@
         }
       }
       try {
+        const revision = ++this.calculationRevision;
         // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
         this.worker.postMessage(
           JSON.stringify({
@@ -2017,6 +2092,7 @@
             getDataTypeId: this.getDataTypeId,
             modelType: this.sampleProduct[0].model,
             currentInsItem: n,
+            revision: revision,
           })
         );
         // 鍏堜繚瀛樹富绾跨▼涓凡缁忚緭鍏ョ殑鍘熷鍊笺�俉orker 瀹屾垚璁$畻鍚庝細鍐嶆鍏ラ槦淇濆瓨璁$畻缁撴灉銆�
@@ -2031,6 +2107,9 @@
       // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
       this.worker.onmessage = (event) => {
         const workerResult = JSON.parse(event.data);
+        if (workerResult.revision != null && workerResult.revision < this.calculationRevision) {
+          return;
+        }
         this.result = workerResult;
         switch (workerResult.method) {
           case "saveInsContext":
@@ -2043,6 +2122,10 @@
               );
               this.param = resultValue.param;
               this.saveInsContext();
+              this.completedCalculationRevision = Math.max(
+                this.completedCalculationRevision,
+                workerResult.revision || 0
+              );
             });
             break;
           case "tableList":
@@ -2115,14 +2198,18 @@
     // 瀵硅緭鍏ュ�艰繘琛屾牸寮忔牎楠�
     handleInput(n) {
       try {
-        n.v.v = n.v.v.replace(/[^\d.^e>锛炩墺鈮�<锛滄柇瑁傝剢鍖朶-/+]/g, "");
-        n.v.v = n.v.v.replace(/\.{2,}/g, "."); //鍙繚鐣欑涓�涓�. 娓呴櫎澶氫綑鐨�
-        n.v.v = n.v.v
+        const v = n.v.v;
+        // 鑳藉姏鑼冨洿宸插簾寮�,妫�楠屽�肩被鍨嬩笉鍐嶄綔涓哄垽鏂緷鎹�傛暣涓插彧鐢辩畻寮忓瓧绗︾粍鎴愭椂鎵嶈鑼冨寲鏍煎紡,
+        // 鍑虹幇涓枃绛夊叾瀹冨瓧绗﹀嵆鎸夋枃鏈鐞嗗師鏍蜂繚鐣�,鍚﹀垯鏂囧瓧浼氳閫愬瓧鍒犳帀
+        if (typeof v !== "string" || /[^\d.^e>锛炩墺鈮�<锛滄柇瑁傝剢鍖朶-/+]/.test(v)) {
+          return;
+        }
+        n.v.v = v
+          .replace(/\.{2,}/g, ".") //鍙繚鐣欑涓�涓�. 娓呴櫎澶氫綑鐨�
           .replace(".", "$#$")
           .replace(/\./g, "")
-          .replace("$#$", ".");
-        n.v.v = n.v.v.replace(/\/{2,}/g, "/"); //鍙繚鐣欑涓�涓�/娓呴櫎澶氫綑鐨�
-        n.v.v = n.v.v
+          .replace("$#$", ".")
+          .replace(/\/{2,}/g, "/") //鍙繚鐣欑涓�涓�/娓呴櫎澶氫綑鐨�
           .replace("/", "$#$")
           .replace(/\//g, "")
           .replace("$#$", "/");
@@ -2162,6 +2249,17 @@
     upInsReview(e) {
       if (e == 1) {
         // 閫氳繃
+        // 姣忎釜妯℃澘閮借鏈夌粨璁猴紱鍏ㄩ儴鍚堟牸鎵嶇畻鏁村崟鍚堟牸
+        const insResults = this.tableLists.map(
+          (m) => (this.otherForm[m.templateId] || {}).insResult
+        );
+        const missingIndex = insResults.findIndex((r) => r !== 0 && r !== 1);
+        if (missingIndex > -1) {
+          this.$message.error(
+            `璇烽�夋嫨銆�${this.tableLists[missingIndex].templateName}銆嶇殑妫�楠岀粨璁篳
+          );
+          return;
+        }
         this.reviewLoading = true;
         verifyPlan({
           orderId: this.orderId,
@@ -2169,6 +2267,7 @@
           laboratory: this.sonLaboratory,
           tell: null,
           userId: this.checkUser,
+          insResult: insResults.every((r) => r === 1) ? 1 : 0,
         }).then((res) => {
           if (res.code === 200) {
             this.$message.success("鎿嶄綔鎴愬姛");
@@ -2214,17 +2313,15 @@
       this.$refs.viewManHourDia.showDialog(this.id, 99);
     },
     openAddVerifyDia() {
-      this.reportType = null;
       this.addVerifyDia = true;
     },
-    confirmSubmit(registerInsResults){
+    confirmSubmit(){
       submitPlan({
         orderId: this.orderId,
         laboratory: this.sonLaboratory,
         verifyUser: this.verifyUser,
         entrustCode: this.insOrder.entrustCode,
-        registerInsResults: this.reportType === 1 && registerInsResults,
-        reportType: this.reportType
+        registerInsResults: false,
       }).then((res) => {
         if (res.code === 200) {
           this.$message.success("鎿嶄綔鎴愬姛");
@@ -2243,16 +2340,21 @@
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
         return;
       }
-      if (this.reportType === null || this.reportType === "") {
-        this.$message.error("璇烽�夋嫨鎶ュ憡绫诲瀷");
-        return;
-      }
-      if (!this.otherForm.humidity && this.insOrder.ifsOrderType!=='02wg') {
-        this.$message.error("璇疯緭鍏ユ箍搴�");
-        return;
-      }
-      if (!this.otherForm.temperature && this.insOrder.ifsOrderType!=='02wg') {
-        this.$message.error("璇疯緭鍏ユ俯搴�");
+      const missing = [];
+      this.tableLists.forEach((m) => {
+        const form = this.otherForm[m.templateId] || {};
+        if (this.insOrder.ifsOrderType !== "02wg") {
+          if (!form.temperature) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑娓╁害`);
+          if (!form.humidity) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑婀垮害`);
+          if (!form.detectionTime) missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑妫�娴嬫椂闂碻);
+          if (!form.detectionPlace) missing.push(`璇峰~鍐欍��${m.templateName}銆嶇殑妫�娴嬪湴鐐筦);
+        }
+        if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) {
+          missing.push(`璇烽�夋嫨銆�${m.templateName}銆嶇殑璁惧`);
+        }
+      });
+      if (missing.length > 0) {
+        this.$message.error(missing[0]);
         return;
       }
       if (!this.insOrder.lotPartId && this.insOrder.ifsOrderType==='02wg') {
@@ -2264,27 +2366,11 @@
       checkSubmitPlan({
         orderId: this.orderId,
         laboratory: this.sonLaboratory,
-        reportType: this.reportType,
       }).then((res) => {
         if (res.code === 200) {
           if (!res.data || res.data.errorMsg.length == 0) {
             this.submitLoading = true;
-            //妫�楠岀被鍨嬩负鍘熸潗鏂�
-            if(this.reportType === 1 && this.typeSource==1 && res.data.unInsOrderCount==0 && this.isSplit==1){
-              const htmlStr = "鏄惁鐧昏IFS閲囪喘妫�楠岀粨鏋滃苟绉诲簱锛熻鎿嶄綔浼氱櫥璁�<span style='color:#ff4949'>鍚屼竴闆朵欢鍚屼竴璁㈠崟鐨勬墍鏈夋媶鍒嗘壒娆�</span>锛岃璋ㄦ厧閫夋嫨銆�"
-              this.$confirm(htmlStr, '鎻愮ず', {
-                confirmButtonText: '鏄�',
-                cancelButtonText: '鍚�',
-                type: 'warning',
-                dangerouslyUseHTMLString: true
-              }).then(() => {
-                this.confirmSubmit(true)
-              }).catch(() => {
-                this.confirmSubmit(false)
-              });
-            }else{
-              this.confirmSubmit(true)
-            }
+            this.confirmSubmit();
           } else {
             let newData = [];
             const h = this.$createElement;
@@ -2320,7 +2406,7 @@
             })
               .then(() => {
                 this.submitLoading = true;
-                this.confirmSubmit(false)
+                this.confirmSubmit()
                 // submitPlan({
                 //   orderId: this.orderId,
                 //   laboratory: this.sonLaboratory,
@@ -2353,7 +2439,17 @@
       const param = {};
       this.tableList.forEach((a) => {
         param[a.templateId] = {};
-        a.template.forEach((cell) => {
+        // 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" &&
@@ -2361,10 +2457,12 @@
               cell.v.ps.value === "璁$畻鍊�" ||
               cell.v.ps.value === "鏈�缁堝��" ||
               cell.v.ps.value === "璁惧鍚嶇О");
-          if (!isEditable) {
+          const isExportResult = resultHeader && exportRows.has(cell.r) && cell.c === resultHeader.c;
+          if (!isEditable && !isExportResult) {
             return;
           }
           if (
+            isEditable &&
             cell.v.ps.value.includes("妫�楠屽��") &&
             (cell.v.v === "" || cell.v.v === null || cell.v.v === undefined)
           ) {
@@ -2410,7 +2508,14 @@
         const previousSave = this.saveQueue || Promise.resolve();
         this.saveQueue = previousSave
           .catch(() => undefined)
-          .then(() => saveInsContext(payload))
+          .then(() => this.isDirectTemplateOrder()
+            ? saveTemplateContext({
+                orderId: this.orderId,
+                sampleId: this.currentSample.id,
+                templateId: this.currentTable,
+                values: param[this.currentTable] || {},
+              })
+            : saveInsContext(payload))
           .then(() => {
             this.$message.success("宸蹭繚瀛�");
           })
@@ -2433,6 +2538,20 @@
       }
     },
     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;
+            }
+            setTimeout(waitWorker, 20);
+          };
+          waitWorker();
+        });
+      }
       if (this.saveQueue) {
         await this.saveQueue;
       }
@@ -2457,6 +2576,18 @@
       });
       // 閫夋嫨銆佺Щ闄ゃ�佹竻绌哄潎鐢� change 浜嬩欢瑙﹀彂锛岀珛鍗充繚瀛樸��
       this.saveInsContext();
+    },
+    isDirectTemplateOrder() {
+      return this.sonLaboratory === "鏂拌仛" && this.currentSample &&
+        (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null);
+    },
+    loadDeviceOptions() {
+      search({ status: 0 }).then((devices) => {
+        this.orderDeviceOptions = (devices.data || []).map((device) => ({
+          id: device.id,
+          label: `${device.deviceName}--${device.managementNumber}`,
+        }));
+      });
     },
     getAuthorizedPerson() {
       selectUserCondition({ type: 1 }).then((res) => {
@@ -2629,6 +2760,37 @@
   text-align: left;
 }
 
+/* 褰撳墠妫�楠屾ā鏉跨殑妫�娴嬫潯浠朵笌妫�楠岀粨璁� */
+.template-panel {
+  background-color: #f8f9fb;
+  border: 1px solid #ebeef5;
+  border-radius: 3px;
+  padding: 16px 16px 4px;
+  margin-bottom: 12px;
+  text-align: left;
+}
+
+/* form-item 鐢� inline-flex 淇濊瘉 label 涓庢帶浠跺悓琛岋紝涓嶄緷璧栬鐩掑搴︽帹绠� */
+.template-panel>>>.el-form-item {
+  display: inline-flex;
+  align-items: center;
+  margin-bottom: 12px;
+}
+
+.template-panel>>>.el-form-item__label {
+  flex: none;
+}
+
+.template-panel__unit {
+  margin-left: 4px;
+  color: #606266;
+}
+
+.template-panel__conclusion--divided {
+  border-top: 1px dashed #e4e7ed;
+  padding-top: 12px;
+}
+
 .center {
   width: 100%;
   /* max-height: 580px; */

--
Gitblit v1.9.3