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 |  205 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 136 insertions(+), 69 deletions(-)

diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index 0020801..eac01ab 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -1,22 +1,7 @@
 <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="currentOtherForm" 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="currentOtherForm.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="currentOtherForm.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">%RH</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>
@@ -106,8 +91,9 @@
         </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="鏍峰搧鏁伴噺">{{ insOrder.testQuantity }}</el-descriptions-item>
           <el-descriptions-item label="涓嬪彂鏃堕棿">{{ insOrder.sendTime }}</el-descriptions-item>
           <el-descriptions-item label="绱ф�ョ▼搴�">{{ insOrder.typeName }}</el-descriptions-item>
@@ -117,18 +103,6 @@
         <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-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>
@@ -200,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">
@@ -583,8 +601,6 @@
   submitPlan,
   saveInsContext,
   saveTemplateContext,
-  getOrderDevices,
-  saveOrderDevices,
   selectUserCondition,
   downFile,
   getFileList,
@@ -668,11 +684,9 @@
       excelMethodList: [],
       equipOptions: [],
       orderDeviceOptions: [],
-      selectedDeviceIds: [],
       reviewLoading: false,
       reviewDia: false,
       noReason: "",
-      reviewInsResult: null,
       tableWidth: 1000,
       currentTable: null,
       tableLists: [],
@@ -689,7 +703,7 @@
         inspectionItem: 1,
         inspectionItemSubclass: "20(甯告俯)",
       },
-      // 娓╁害銆佹箍搴︽寜妯℃澘 id 鍒嗙粍锛歿 [templateId]: { temperature, humidity } }
+      // 妫�娴嬫潯浠朵笌妫�楠岀粨璁烘寜妯℃澘 id 鍒嗙粍锛歿 [templateId]: { temperature, humidity, detectionTime, detectionPlace, deviceIds, insResult } }
       otherForm: {},
       equipForm: {
         value0: null,
@@ -843,14 +857,22 @@
     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() {
@@ -926,7 +948,7 @@
               this.tableList = this.tableLists.filter(
                 (m) => m.templateId == val1
               );
-              // 妯℃澘闆嗗悎鍙兘鍙樺寲锛岃ˉ榻愭俯搴︺�佹箍搴︽Ы浣�
+              // 妯℃澘闆嗗悎鍙兘鍙樺寲锛岃ˉ榻愭娴嬫潯浠舵Ы浣�
               this.tableLists.forEach((m) => this.ensureOtherForm(m.templateId));
               // 瀵规ā鏉胯繘琛屽鐞�
               this.handleTableData();
@@ -1094,7 +1116,6 @@
         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)
@@ -1115,12 +1136,16 @@
         this.sampleProduct = res.data.sampleProduct;
         this.currentSample = this.HaveJson(this.sampleProduct[0]);
         let insProduct = this.HaveJson(this.currentSample.insProduct);
-        // 娓╁害銆佹箍搴﹁祴鍊硷細鎸夋ā鏉� id 鍒嗙粍鍥炴樉
+        // 妫�娴嬫潯浠朵笌妫�楠岀粨璁鸿祴鍊硷細鎸夋ā鏉� 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));
@@ -1130,7 +1155,7 @@
         }
         this.getEquipOptions(1);
         if (this.sonLaboratory === "鏂拌仛") {
-          this.loadOverviewDevices();
+          this.loadDeviceOptions();
         }
         // 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
         let list = await this.getCurrentProduct(this.currentSample.id, 0);
@@ -1629,24 +1654,34 @@
         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) {
       const payload = { id: this.insOrder.id };
       if (type === "remark") {
         payload.remark = m;
       } else {
         payload.templateId = this.currentTable;
-        payload[type] = Number(m);
+        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("淇濆瓨鎴愬姛");
@@ -1815,7 +1850,7 @@
         this.tableList = null;
         this.tableList = [this.tableLists[0]];
         this.currentTable = this.tableLists[0].templateId;
-        // 琛ラ綈姣忎釜妯℃澘鐨勬俯搴︺�佹箍搴︽Ы浣�
+        // 琛ラ綈姣忎釜妯℃澘鐨勬娴嬫潯浠舵Ы浣�
         this.tableLists.forEach((m) => this.ensureOtherForm(m.templateId));
         // 澶勭悊椤甸潰鍒楄〃鏁版嵁
         this.handleTableData();
@@ -2214,8 +2249,15 @@
     upInsReview(e) {
       if (e == 1) {
         // 閫氳繃
-        if (this.reviewInsResult !== 0 && this.reviewInsResult !== 1) {
-          this.$message.error("璇烽�夋嫨妫�楠岀粨璁�");
+        // 姣忎釜妯℃澘閮借鏈夌粨璁猴紱鍏ㄩ儴鍚堟牸鎵嶇畻鏁村崟鍚堟牸
+        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;
@@ -2225,7 +2267,7 @@
           laboratory: this.sonLaboratory,
           tell: null,
           userId: this.checkUser,
-          insResult: this.reviewInsResult,
+          insResult: insResults.every((r) => r === 1) ? 1 : 0,
         }).then((res) => {
           if (res.code === 200) {
             this.$message.success("鎿嶄綔鎴愬姛");
@@ -2298,23 +2340,22 @@
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
         return;
       }
-      if (this.isDirectTemplateOrder() && (!this.selectedDeviceIds || this.selectedDeviceIds.length === 0)) {
-        this.$message.error("璇烽�夋嫨璁惧");
-        return;
-      }
-      if (this.insOrder.ifsOrderType !== "02wg") {
-        const labels = { temperature: "娓╁害", humidity: "婀垮害" };
-        const missing = [];
-        this.tableLists.forEach((m) => {
-          const form = this.otherForm[m.templateId] || {};
-          ["temperature", "humidity"].forEach((key) => {
-            if (!form[key]) missing.push(`銆�${m.templateName}銆嶇殑${labels[key]}`);
-          });
-        });
-        if (missing.length > 0) {
-          this.$message.error(`璇峰~鍐�${missing[0]}`);
-          return;
+      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') {
         this.$message.error("璇峰~鍐橧FS搴撳瓨鐗╂枡鎵规灞炴��");
@@ -2540,18 +2581,13 @@
       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]) => {
+    loadDeviceOptions() {
+      search({ status: 0 }).then((devices) => {
         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: 1 }).then((res) => {
@@ -2724,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