From f294efb8c01ad8b0704a92d51c14dbd55d898874 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 23 十月 2025 16:49:46 +0800
Subject: [PATCH] 拆分原材料和外购成品的业务流程(报检、下单、检验)

---
 src/views/business/inspectionTask/inspection.vue |  533 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 350 insertions(+), 183 deletions(-)

diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index e4b841e..40e6f22 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,7 +16,8 @@
           </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" 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"
@@ -74,6 +75,17 @@
             @blur="subOtherForm(insOrder.remark, 'remark')"></el-input>
           <!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> -->
         </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>
     </div>
     <div class="center">
@@ -141,7 +153,7 @@
           <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary"
             @click="getDataAcquisitionDevice">鏁版嵁閲囬泦</el-button>
           <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small"
-            @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰"
+            @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble,disconnect()">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰"
             }}</el-button>
         </div>
       </div>
@@ -288,7 +300,7 @@
                       state == 1
                     "><span :style="`font-family:${n.v.ff} !important;`">{{
                       toFixed(n.v.v, n.v.ct)
-                        }}</span></template>
+                    }}</span></template>
                     <template v-else-if="
                       n.v.ps != undefined &&
                       n.v.ps.value === '鏈�缁堝��' &&
@@ -344,6 +356,7 @@
     </div>
     <el-drawer :size="550" :visible.sync="sampleVisible" title="鏍峰搧鍒囨崲">
       <el-table v-if="sampleVisible" ref="productTable" :current-row-key="currentKey" :data="sampleProduct"
+                :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
         :row-class-name="tableRowClassName" :row-key="(record) => record.index" border class="el-table" height="100%"
         highlight-current-row tooltip-effect="dark" @row-click="handleChangeSample">
         <el-table-column :key="Math.random()" align="center" label="搴忓彿" type="index" width="70px">
@@ -421,67 +434,76 @@
               <td :rowspan="item.child.length">{{ item.faName }}</td>
               <td>{{ item.child[0].name }}</td>
               <td style="text-align: left">
+                <!-- 娣诲姞瀹瑰櫒 div -->
+                <div class="data-collection-items">
                 <el-select v-if="item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                   :multiple-limit="item.child[0].maxNum" clearable filterable multiple placeholder="璇烽�夋嫨"
                   @change="setData(item)">
-                  <el-option v-for="(item, index) in item.child[0].arr" :key="index" :filter-method="filterMethod"
-                    :label="index + 1 + '^' + item.result" :value="index + '^' + item.result">
+                  <el-option v-for="(subItem, subIndex) in item.child[0].arr" :key="index + '-' + subIndex" :filter-method="filterMethod"
+                    :label="subIndex + 1 + '^' + subItem.result" :value="subIndex + '^' + subItem.result">
                     <span>{{
                       "搴忓彿锛�" +
-                      (index + 1) +
+                      (subIndex + 1) +
                       "锛�" +
                       "缁撴灉锛�" +
-                      item.result +
+                      subItem.result +
                       "锛�" +
                       "鍘氬害锛�" +
-                      item.thickness +
+                      subItem.thickness +
                       "锛�" +
                       "鏃堕棿锛�" +
-                      item.mergedDateTime
+                      subItem.mergedDateTime
                     }}</span>
                   </el-option>
                 </el-select>
                 <el-checkbox-group v-if="!item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1"
                   :max="item.child[0].maxNum">
-                  <el-checkbox v-for="(n, j) in item.child[0].arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
+                  <el-checkbox v-for="(n, j) in item.child[0].arr" :key="index + '-' + j + 'aaaaaa'" :label="j + '^' + n"
+                  @change="handleGroupSelect(item.child[0], j, item.child[0].arr.length)" >{{ n }}</el-checkbox>
                 </el-checkbox-group>
-              </td>
-            </tr>
-            <tr v-for="(m, i) in item.child" v-show="i > 0" :key="i + 'bbbbbbbbbbbbbb'">
-              <td>{{ m.name }}</td>
-              <td style="text-align: left">
+              </div>
+            </td>
+          </tr>
+          <tr v-for="(m, i) in item.child" v-show="i > 0" :key="index + '-' + i + 'bbbbbbbbbbbbbb'">
+            <td>{{ m.name }}</td>
+            <td style="text-align: left">
+              <!-- 娣诲姞瀹瑰櫒 div -->
+              <div class="data-collection-items">
                 <el-select v-if="m.isShowSelect" v-model="m.getDataIndex1" :multiple-limit="m.maxNum" clearable
                   filterable multiple placeholder="璇烽�夋嫨">
-                  <el-option v-for="(item, index1) in m.arr" :key="index1" :label="index + 1 + '^' + item.result"
-                    :value="index1 + '^' + item.result">
+                  <el-option v-for="(subItem, index1) in m.arr" :key="index + '-' + index1 + 'cccccccc'"
+                    :label="index1 + 1 + '^' + subItem.result" :value="index1 + '^' + subItem.result">
                     <span>{{
                       "搴忓彿锛�" +
                       (index1 + 1) +
                       "锛�" +
                       "缁撴灉锛�" +
-                      item.result +
+                      subItem.result +
                       "锛�" +
                       "鍘氬害锛�" +
-                      item.thickness +
+                      subItem.thickness +
                       "锛�" +
                       "鏃堕棿锛�" +
-                      item.mergedDateTime
+                      subItem.mergedDateTime
                     }}</span>
                   </el-option>
                 </el-select>
                 <el-checkbox-group v-if="!m.isShowSelect" v-model="m.getDataIndex1" :max="m.maxNum">
-                  <el-checkbox v-for="(n, j) in m.arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox>
+                  <el-checkbox v-for="(n, j) in m.arr" :key="index + '-' + j + 'dddddddd'" :label="j + '^' + n"
+                  @change="handleGroupSelect(m, j, m.arr.length)" >{{ n }}</el-checkbox>
                 </el-checkbox-group>
-              </td>
-            </tr>
-          </template>
-        </table>
-      </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="dataGetDia = false">鍙� 娑�</el-button>
-        <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">纭� 瀹�</el-button>
-      </span>
-    </el-dialog>
+              </div>
+            </td>
+          </tr>
+        </template>
+      </table>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="dataGetDia = false">鍙� 娑�</el-button>
+      <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">纭� 瀹�</el-button>
+    </span>
+  </el-dialog>
+
     <el-dialog :close-on-click-modal="false" :visible.sync="addCheck" title="鎸囧畾鎶ュ憡瀹℃牳浜哄憳" width="400px"
       @close="closeAddVerifyDia">
       <div class="body" style="display: flex; padding: 10px; align-items: center">
@@ -500,15 +522,57 @@
         <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 size="small" v-model="ifsMaterialPropsForm.drumNo"></el-input>
+        </el-form-item>
+        <el-form-item label="璧峰绫虫爣(Attr2):">
+          <el-input size="small" v-model="ifsMaterialPropsForm.startMeterMark"></el-input>
+        </el-form-item>
+        <el-form-item label="鎴绫虫爣(Attr3):">
+          <el-input size="small" v-model="ifsMaterialPropsForm.endMeterMark"></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-input size="small" v-model="ifsMaterialPropsForm.insulationColor"></el-input>
+        </el-form-item>
+        <el-form-item label="澶栨姢棰滆壊(Attr5):">
+          <el-input size="small" v-model="ifsMaterialPropsForm.outerColor"></el-input>
+        </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>
 
@@ -519,6 +583,8 @@
 import AddUnPass from "../unpass/components/addUnPass.vue";
 import InspectionWord from "./components/InspectionWord.vue";
 import PurchaseVerification from "../unpass/components/PurchaseVerification.vue";
+
+
 import {
   doInsOrder,
   getCableTag,
@@ -538,13 +604,17 @@
   delfile,
   inspectionOrderDetailsTaskSwitching
 } from "@/api/business/inspectionTask.js";
-import InspectionWorker from '../../../InspectionWorker.worker';
-import DataWorker from '../../../DataWorker.worker';
+import InspectionWorker from '@/workers/InspectionWorker.worker.js';
+import DataWorker from '@/workers/DataWorker.worker.js';
 import html2canvas from "html2canvas";
 import { mapGetters } from "vuex";
+import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue";
+import {connect,disconnect,weightList} from "@/utils/connect";
+import {getOneByIfsId,saveOrUpdateProps} from "@/api/business/ifsPartProps.js";
 export default {
   name: 'Inspection',
   components: {
+    viewManHourDia,
     PurchaseVerification,
     AddUnPass,
     limsTable,
@@ -553,6 +623,19 @@
   },
   data() {
     return {
+      letteringInfoList: [],
+      ifsMaterialPropsForm:{
+        id:null,
+        ifsOrderId: null,
+        drumNo: '', // 杞藉叿缂栧彿
+        startMeterMark: '', // 璧峰绫虫爣
+        endMeterMark: '', // 鎴绫虫爣
+        insulationColor: '', // 缁濈紭棰滆壊
+        outerColor: '', // 澶栨姢棰滆壊
+        inboundLength: '', // 鍏ュ簱闀垮害
+        letteringInfo: '', // 鍗板瓧淇℃伅
+      },
+      ifsMaterialPropsVisible:false,
       sonLaboratory: null,
       orderId: null,
       state: null,
@@ -577,6 +660,8 @@
         sampleName: null,
         state: null,
       },
+      isSerialConnected: false, // 鏂板鐘舵�佸彉閲忥紝涓插彛杩炴帴鐘舵��
+      serialPort: null, // 瀛樺偍涓插彛瀵硅薄
       id: null,
       changeType: null,
       insOrder: {},
@@ -725,7 +810,6 @@
         size: 10,
         current: 0,
       },
-      tableLoading: false,
       // 鏂囦欢鍒楄〃鐩稿叧--缁撴潫
       // 浠诲姟鍒囨崲鍒楄〃--寮�濮�
       tableData0: [],
@@ -760,6 +844,7 @@
       },
       tableLoading0: false,
       // 浠诲姟鍒囨崲鍒楄〃--缁撴潫
+      isSplit: 0, // 鏄惁鏄媶鍗曡繃鏉ョ殑
     };
   },
   // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
@@ -770,7 +855,7 @@
     },
   },
   created() {
-    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
+    let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } =
       this.$route.query;
     this.sonLaboratory = sonLaboratory;
     this.orderId = orderId;
@@ -778,13 +863,13 @@
     this.state = state;
     this.inspectorList = inspectorList;
     this.typeSource = typeSource;
+    this.isSplit = isSplit;
   },
   mounted() {
     this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」
     this.getInsStateDicts();
     this.getComparisonList();
     this.getAuthorizedPerson();
-    // this.getPower();
     this.startWorker();
     // this.getList0() // 浠诲姟鍒囨崲
     this.scrollInit();
@@ -794,7 +879,6 @@
     this.getInsStateDicts();
     this.getComparisonList();
     this.getAuthorizedPerson();
-    // this.getPower();
     this.startWorker();
     // this.getList0() // 浠诲姟鍒囨崲
     this.scrollInit();
@@ -858,6 +942,7 @@
           }
         });
       }
+      console.log("澶勭悊鍚庣殑妯℃澘-",this.tableList)
     },
     // 鐗规畩妫�楠岄」--鐩戝惉璁惧淇℃伅鏀瑰彉
     equipForm: {
@@ -868,8 +953,59 @@
   beforeDestroy() {
     // 鍦ㄧ粍浠堕攢姣佸墠纭繚鍋滄 Worker锛岄伩鍏嶅唴瀛樻硠婕�
     this.stopWorker();
+    disconnect();
+    // 璋冪敤鍓嶅厛鍒ゆ柇鏂规硶鏄惁瀛樺湪锛岄伩鍏嶆姤閿�
+    if (this.closeSerialPort) {
+      this.closeSerialPort();// 缁勪欢閿�姣佸墠鍏抽棴涓插彛
+    }
   },
   methods: {
+    closePartPropDialog(){
+      this.ifsMaterialPropsForm = {
+        id:null,
+        ifsOrderId: 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(){
+      saveOrUpdateProps({
+        ...this.ifsMaterialPropsForm,
+        partNo: this.insOrder.partNo,
+        lotBatchNo: this.insOrder.lotBatchNo,
+      }).then((res)=>{
+        if(res.code==200){
+          this.$message.success("淇濆瓨鎴愬姛");
+          this.ifsMaterialPropsVisible = false;
+        }
+      })
+    },
+    //鎵撳紑IFS鐗╂枡灞炴�у脊妗�
+    showMaterialPropsDialog(){
+      this.getPartProps(this.insOrder.ifsInventoryId)
+      this.$nextTick(()=>{
+        this.ifsMaterialPropsVisible = true;
+      })
+    },
+    disconnect() {
+      return disconnect
+    },
+    sss() {
+      console.log(this.$store.state.weightList) //
+    },
     // 鏂囦欢绠$悊--寮�濮�
     getList() {
       this.tableLoading = true;
@@ -897,17 +1033,30 @@
         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(() => { });
     },
     // 鏂囦欢绠$悊--缁撴潫
+    // 澶勭悊鏁寸粍鍕鹃�夐�昏緫鐨勬柟娉�
+    handleGroupSelect(childItem, clickedIndex, groupSize = 5) {
+      if(groupSize == 6){
+        groupSize = 6;
+      }else{
+        groupSize = 5;
+      }
+      // 璁$畻鎵�鍦ㄧ粍鐨勮捣濮嬬储寮�
+      const groupStartIndex = Math.floor(clickedIndex / groupSize) * groupSize;
+      // 娓呯┖褰撳墠宸查��
+      childItem.getDataIndex1 = [];
+      // 閬嶅巻褰撳墠缁勭殑 groupSize 涓厓绱狅紝娣诲姞鍒伴�変腑鍒楄〃
+      for (let i = groupStartIndex; i < groupStartIndex + groupSize && i < childItem.arr.length; i++) {
+        childItem.getDataIndex1.push(i + '^' + childItem.arr[i]);
+      }
+    },
 
     // 浠诲姟鍒囨崲--寮�濮�
     getList0() {
@@ -939,6 +1088,8 @@
         laboratory: this.sonLaboratory,
       }).then(async (res) => {
         this.insOrder = res.data.insOrder;
+        //鏌ヨ闆朵欢灞炴��
+        this.getPartProps(res.data.insOrder.ifsInventoryId)
         this.supplierDensity = res.data.supplierDensity;
         this.getList()
         this.urgentList.forEach((m) => {
@@ -1038,8 +1189,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);
@@ -1088,31 +1240,59 @@
       this.$refs.purchaseDialog.$refs["purchaseForm"].resetFields();
       this.purchaseDialog = false;
     },
+
     // 鏁版嵁閲囬泦
-    getDataAcquisitionDevice() {
-      let itemIds = [];
-      this.currentSample.insProduct.forEach((item) => {
-        if (item.inspectionItemType === "1") {
-          itemIds.push(item.id);
+
+  getDataAcquisitionDevice() {
+      (async () => {
+        try {
+          // 妫�鏌ラ〉闈腑妫�娴嬮」鏄惁鍖呭惈瀵嗗害
+          const hasDensityItem = this.currentSample.insProduct.some(item => {
+            // 鍋囪瀵嗗害鐩稿叧鐨勬娴嬮」鍚嶇О鍖呭惈 "瀵嗗害" 鍏抽敭瀛楋紝鍙寜闇�淇敼
+            return item.inspectionItem && item.inspectionItem.includes('瀵嗗害');
+          });
+          if (hasDensityItem) {
+            // 妫�鏌ユ槸鍚︽敮鎸� Web Serial API
+            if ('serial' in navigator) {
+              // 璇锋眰鍙敤涓插彛
+              const ports = await navigator.serial.getPorts();
+              if (ports.length > 0) {
+                await connect();
+              } else {
+                console.log('娌℃湁鍙敤鐨勪覆鍙�');
+              }
+            } else {
+              console.log('褰撳墠娴忚鍣ㄤ笉鏀寔 Web Serial API');
+            }
+          }
+        } catch (error) {
+          console.error('妫�娴嬩覆鍙f椂鍑洪敊:', error);
         }
-      });
-      const params = {
-        entrustCode: this.insOrder.entrustCode,
-        sampleCode: this.currentSample.sampleCode,
-        id: this.currentSample.id,
-        itemIds: itemIds,
-      };
-      this.dataAcquisitionLoading = true;
-      dataCollection(params).then((res) => {
-        this.dataAcquisitionLoading = false;
-        if (res.code != 200) {
-          return;
-        }
-        this.dataAcquisitionInfoNew = this.HaveJson(res.data);
-        // 瀵规暟閲囧洖鏉ョ殑鍊艰繘琛屽鐞�
-        this.handleDataAcquisition(res.data);
-      }).catch(err => {
-        this.dataAcquisitionLoading = false;
+      })().then(() => {
+        let itemIds = [];
+        this.currentSample.insProduct.forEach((item) => {
+          if (item.inspectionItemType === "1") {
+            itemIds.push(item.id);
+          }
+        });
+        const params = {
+          entrustCode: this.insOrder.entrustCode,
+          sampleCode: this.currentSample.sampleCode,
+          id: this.currentSample.id,
+          itemIds: itemIds,
+        };
+        this.dataAcquisitionLoading = true;
+        dataCollection(params).then((res) => {
+          this.dataAcquisitionLoading = false;
+          if (res.code != 200) {
+            return;
+          }
+          this.dataAcquisitionInfoNew = this.HaveJson(res.data);
+          // 瀵规暟閲囧洖鏉ョ殑鍊艰繘琛屽鐞�
+          this.handleDataAcquisition(res.data);
+        }).catch(err => {
+          this.dataAcquisitionLoading = false;
+        });
       });
     },
     objectOrder(obj) {
@@ -1124,6 +1304,7 @@
       return newObj;
     },
     handleDataAcquisition(data, noDialog) {
+      console.log("dadad--",data)
       // 鏄惁鍙互缂栬緫鏁伴噰鏁版嵁
       if (this.dataAcquisitionEidtAble) {
         this.getDataType = 1;
@@ -1133,7 +1314,6 @@
       this.dataAcquisitionInfo = {};
       this.getData = [];
       for (let i in this.objectOrder(data)) {
-        console.log("i---", i);
         let obj = {};
         if (i.includes("@")) {
           obj = {
@@ -1148,7 +1328,9 @@
           };
         }
         // 寰幆鏁伴噰鏁版嵁
+        console.log(data[i],i)
         for (let j in data[i]) {
+          console.log("jjjjj--",j)
           // 鎷兼帴瀛楃涓�  妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤�
           let str0 = "";
           if (i.includes("@")) {
@@ -1242,7 +1424,7 @@
               } else {
                 str0 = i + "," + j;
               }
-            }
+            };
             let list = this.tableList[0].arr;
             let maxNum = 0;
             list.forEach((item, index) => {
@@ -1275,6 +1457,7 @@
                   }
                   let num = 0;
                   list[index].forEach((n) => {
+                    // console.log(n.v.ps.value);
                     if (
                       n.v.ps &&
                       n.v.ps.value &&
@@ -1351,6 +1534,7 @@
           this.getDataIndexLoading = false;
           this.dataGetDia = false;
           this.getDataTypeId = "";
+          console.log("dadada---",this.dataAcquisitionInfo)
           this.worker0.postMessage(
             JSON.stringify({
               dataAcquisitionInfo: this.dataAcquisitionInfo,
@@ -1364,6 +1548,7 @@
       // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
       this.worker0.onmessage = (event) => {
         let result = JSON.parse(event.data);
+        console.log("Worker 杩斿洖鐨勭粨鏋�:", result);
         if (result.method == "changeInput") {
           // 閲囬泦鍚庣殑鏁版嵁锛岄渶瑕佽繘琛岃绠楃殑绾跨▼杩涜璁$畻
           let { list, n } = result.value;
@@ -1476,12 +1661,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("淇濆瓨鎴愬姛");
       });
     },
@@ -1500,34 +1683,6 @@
         a.download = "table.png";
         a.click();
       });
-    },
-    // 鏉冮檺鑾峰彇
-    getPower() {
-      let power = JSON.parse(sessionStorage.getItem("power"));
-      let fileDel = false;
-      let fileAdd = false;
-      let collected = false;
-      let temDataAcquisition = false;
-      for (var i = 0; i < power.length; i++) {
-        if (power[i].menuMethod == "uploadFile") {
-          fileAdd = true;
-        }
-        if (power[i].menuMethod == "delfile") {
-          fileDel = true;
-        }
-        if (power[i].menuMethod == "isItAllowedToModifyTheCollectedValues") {
-          collected = true;
-        }
-        if (power[i].menuMethod == "temDataAcquisition") {
-          temDataAcquisition = true;
-        }
-      }
-      if (!fileDel) {
-        // this.componentData0.do.splice(1, 1);
-      }
-      this.fileAdd = fileAdd;
-      this.collected = collected;
-      this.temDataAcquisition = temDataAcquisition;
     },
     uploadSample() {
       doInsOrder({
@@ -1666,20 +1821,6 @@
         this.comparisonList = this.dictToValue(response.data);
       });
     },
-    // 鑾峰彇妫�楠屽�间负涓嬫媺鏃剁殑涓嬫媺鍒楄〃
-    // selectEnumByCategoryOfSelect(val) {
-    //   this.enumList = [];
-    //   if (val === undefined || val === null) {
-    //     return;
-    //   }
-    //   this.$axios
-    //     .post(this.$api.enums.selectEnumByCategory, {
-    //       category: val,
-    //     })
-    //     .then((res) => {
-    //       this.enumList = res.data;
-    //     });
-    // },
     tableRowClassName({ row, rowIndex }) {
       row.index = rowIndex + 1;
     },
@@ -1819,7 +1960,7 @@
                   if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") {
                     if (count4 === 0) {
                       if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
+                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                       }
                       str += c.v.v;
                       count4 += 1;
@@ -1830,7 +1971,7 @@
                   ) {
                     if (count4 === 1) {
                       if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
+                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                       }
                       str += c.v.v;
                       count4 += 1;
@@ -1840,7 +1981,7 @@
                   if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」鍒嗙被") {
                     if (count4 === 0) {
                       if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
+                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                       }
                       str += c.v.v;
                       count4 += 1;
@@ -1848,7 +1989,8 @@
                   } 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, "");
+                        console.log("杩涘叆1111111")
+                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                       }
                       str += c.v.v;
                       count4 += 1;
@@ -1859,7 +2001,7 @@
                   ) {
                     if (count4 === 2) {
                       if (c.v.v) {
-                        c.v.v = c.v.v.replace(/\s*/g, "");
+                        c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                       }
                       str += c.v.v;
                       count4 += 1;
@@ -1869,7 +2011,7 @@
                 if (str === "鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)") {
                   if (c.v.ps != undefined && c.v.ps.value === "鍗曚綅") {
                     if (c.v.v) {
-                      c.v.v = c.v.v.replace(/\s*/g, "");
+                      c.v.v = c.v.v.replace(/[\n\r\s]*/g, "");
                     }
                     str2 = str + c.v.v;
                     unit2 = c.v.v;
@@ -1887,13 +2029,13 @@
                     undefined
                     ? ""
                     : this.currentSample.insProduct[i].inspectionItemClass;
-                inspectionItemClass = inspectionItemClass.replace(/\s*/g, "");
+                inspectionItemClass = inspectionItemClass.replace(/[\n\r\s]*/g, "");
                 let inspectionItem =
                   this.currentSample.insProduct[i].inspectionItem == null ||
                     this.currentSample.insProduct[i].inspectionItem == undefined
                     ? ""
                     : this.currentSample.insProduct[i].inspectionItem;
-                inspectionItem = inspectionItem.replace(/\s*/g, "");
+                inspectionItem = inspectionItem.replace(/[\n\r\s]*/g, "");
                 let inspectionItemSubclass =
                   this.currentSample.insProduct[i].inspectionItemSubclass ==
                     null ||
@@ -1902,7 +2044,7 @@
                     ? ""
                     : this.currentSample.insProduct[i].inspectionItemSubclass;
                 inspectionItemSubclass = inspectionItemSubclass.replace(
-                  /\s*/g,
+                  /[\n\r\s]*/g,
                   ""
                 );
                 if (inspectionItemSubclass === "骞叉�佹媺浼稿己搴�(绾靛悜)") {
@@ -2585,16 +2727,43 @@
         this.$message.error("鏈緭鍏ヤ笉閫氳繃鍘熷洜");
       }
     },
+    // 鏌ョ湅宸ユ椂
+    viewManHour() {
+      this.$refs.viewManHourDia.showDialog(this.id, 99);
+    },
+    openAddVerifyDia() {
+      this.addVerifyDia = true;
+    },
+    confirmSubmit(registerInsResults){
+      submitPlan({
+        orderId: this.orderId,
+        laboratory: this.sonLaboratory,
+        verifyUser: this.verifyUser,
+        entrustCode: this.insOrder.entrustCode,
+        registerInsResults: registerInsResults
+      }).then((res) => {
+        if (res.code === 200) {
+          this.$message.success("鎿嶄綔鎴愬姛");
+          this.goback();
+          this.submitLoading = false;
+          this.addVerifyDia = false;
+        }
+      })
+        .catch((error) => {
+          console.error(error);
+          this.submitLoading = false;
+        });
+    },
     submit() {
       if (this.verifyUser === null || this.verifyUser === "") {
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
         return;
       }
-      if (!this.otherForm.humidity) {
+      if (!this.otherForm.humidity && this.insOrder.ifsOrderType!=='02wg') {
         this.$message.error("璇疯緭鍏ユ箍搴�");
         return;
       }
-      if (!this.otherForm.temperature) {
+      if (!this.otherForm.temperature && this.insOrder.ifsOrderType!=='02wg') {
         this.$message.error("璇疯緭鍏ユ俯搴�");
         return;
       }
@@ -2603,39 +2772,39 @@
         orderId: this.orderId,
         laboratory: this.sonLaboratory,
       }).then((res) => {
+        console.log(res)
         if (res.code === 200) {
-          if (!res.data || res.data.length == 0) {
+          if (!res.data || res.data.errorMsg.length == 0) {
             this.submitLoading = true;
-            submitPlan({
-              orderId: this.orderId,
-              laboratory: this.sonLaboratory,
-              verifyUser: this.verifyUser,
-              entrustCode: this.insOrder.entrustCode,
-            }).then((res) => {
-              if (res.code === 200) {
-                this.$message.success("鎿嶄綔鎴愬姛");
-                this.goback();
-                this.submitLoading = false;
-                this.addVerifyDia = false;
-              }
-            })
-              .catch((error) => {
-                console.error(error);
-                this.submitLoading = false;
+            //妫�楠岀被鍨嬩负鍘熸潗鏂�
+            if(this.typeSource==1 && res.data.unInsOrderCount==0 && this.isSplit==1){
+              const htmlStr = "鏄惁鐧昏IFS閲囪喘妫�楠岀粨鏋滃苟绉诲簱锛熻鎿嶄綔浼氱櫥璁�<span style='color:#ff4949'>鍚屼竴闆朵欢鍚屼竴璁㈠崟鐨勬墍鏈夋媶鍒嗘壒娆�</span>锛岃璋ㄦ厧閫夋嫨銆�"
+              this.$confirm(htmlStr, '鎻愮ず', {
+                confirmButtonText: '鏄�',
+                cancelButtonText: '鍚�',
+                type: 'warning',
+                dangerouslyUseHTMLString: true
+              }).then(() => {
+                this.confirmSubmit(true)
+              }).catch(() => {
+                this.confirmSubmit(false)
               });
+            }else{
+              this.confirmSubmit(true)
+            }
           } else {
             let newData = [];
             const h = this.$createElement;
-            for (let i in res.data) {
-              const lastChar = res.data[i].slice(-1);
+            for (let i in res.data.errorMsg) {
+              const lastChar = res.data.errorMsg[i].slice(-1);
               if (lastChar == "-") {
-                res.data[i] = res.data[i].slice(0, -1);
+                res.data.errorMsg[i] = res.data.errorMsg[i].slice(0, -1);
               }
               newData.push(
                 h(
                   "p",
                   { style: "font-size: 14px;color: red;" },
-                  Number(i) + 1 + "銆�" + res.data[i]
+                  Number(i) + 1 + "銆�" + res.data.errorMsg[i]
                 )
               );
             }
@@ -2658,22 +2827,7 @@
             })
               .then(() => {
                 this.submitLoading = true;
-                submitPlan({
-                  orderId: this.orderId,
-                  laboratory: this.sonLaboratory,
-                  verifyUser: this.verifyUser,
-                }).then((res) => {
-                  if (res.code === 200) {
-                    this.$message.success("鎿嶄綔鎴愬姛");
-                    this.addVerifyDia = false;
-                    this.goback();
-                  }
-                  this.submitLoading = false;
-                })
-                  .catch((error) => {
-                    console.error(error);
-                    this.submitLoading = false;
-                  });
+                this.confirmSubmit(false)
               })
               .catch(() => { });
           }
@@ -2695,17 +2849,24 @@
           } else {
             param = this.param;
           }
+          let isNoTestValue = ''
+          for (let key in param) {
+            if (param[key]) {
+              if (param[key].insValue?.length === 0) {
+                isNoTestValue = 1
+              } else {
+                isNoTestValue = ''
+              }
+            }
+          }
           saveInsContext({
             param: JSON.stringify(param),
             currentTable: this.currentTable,
             sampleId: this.currentSample.id,
             orderId: this.orderId,
-            sonLaboratory: this.sonLaboratory
+            sonLaboratory: this.sonLaboratory,
+            isNoTestValue: isNoTestValue
           }).then((res) => {
-            if (res.code == 201) {
-              this.$message.error("淇濆瓨澶辫触");
-              return;
-            }
             this.$message.success("宸蹭繚瀛�");
           });
           // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
@@ -2773,7 +2934,7 @@
       }
     },
     getAuthorizedPerson() {
-      selectUserCondition({ type: 0 }).then((res) => {
+      selectUserCondition({ type: 1 }).then((res) => {
         let data = [];
         res.data.forEach((a) => {
           data.push({
@@ -2857,7 +3018,7 @@
       this.upLoading = false;
       if (response.code == 200) {
         this.$message.success("涓婁紶鎴愬姛");
-        this.$refs.fileList.selectList();
+        this.getList();
       }
     },
     beforeUpload(file) {
@@ -2876,16 +3037,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) => { });
     },
@@ -2912,6 +3064,9 @@
     goback() {
       this.$router.go(-1)
     }
+  },
+  destroyed() {
+    disconnect()
   },
 };
 </script>
@@ -3047,7 +3202,7 @@
 }
 
 .content-h-2 {
-  justify-content: end;
+  justify-content: flex-end;
 }
 
 .content-v-0 {
@@ -3185,4 +3340,16 @@
   max-width: 1000px;
   /* 璁剧疆鏈�澶у搴� */
 }
+
+
+.data-collection-items {
+  display: flex;
+  flex-wrap: wrap;
+}
+.data-collection-items .el-select,
+.data-collection-items .el-checkbox {
+  flex-basis: 20% ;
+  box-sizing: border-box;
+  padding: 5px 2%;
+}
 </style>

--
Gitblit v1.9.3