From 5d2f451118fe4a2b4076972e3269ce93882e5cb9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 四月 2025 15:22:34 +0800
Subject: [PATCH] 检验任务-新增不合格复测修改

---
 src/views/business/inspectionTask/components/InspectionWord.vue |   32 +++++++++------
 src/views/business/unpass/components/addUnPass.vue              |   39 +++++++++++++++----
 src/api/business/rawMaterialOrder.js                            |    4 +-
 src/views/business/inspectionTask/inspection.vue                |    4 +
 4 files changed, 55 insertions(+), 24 deletions(-)

diff --git a/src/api/business/rawMaterialOrder.js b/src/api/business/rawMaterialOrder.js
index f307ca8..a5e5d85 100644
--- a/src/api/business/rawMaterialOrder.js
+++ b/src/api/business/rawMaterialOrder.js
@@ -291,7 +291,7 @@
 export function saveUnqualifiedContext(query) {
   return request({
     url: '/insOrderPlan/saveUnqualifiedContext',
-    method: 'delete',
-    params: query
+    method: 'post',
+    data: query
   })
 }
diff --git a/src/views/business/inspectionTask/components/InspectionWord.vue b/src/views/business/inspectionTask/components/InspectionWord.vue
index 7991e24..755730e 100644
--- a/src/views/business/inspectionTask/components/InspectionWord.vue
+++ b/src/views/business/inspectionTask/components/InspectionWord.vue
@@ -17,8 +17,8 @@
             </el-radio-group>
           </div>
           <div style="display: flex;align-items: center;">
-            <span v-if="typeSource == '1'">&nbsp;&nbsp;澶嶆祴娆℃暟锛�</span>
-            <el-select v-if="typeSource == '1'" v-model="retestTag" placeholder="璇烽�夋嫨" size="small"
+            <span>&nbsp;&nbsp;澶嶆祴娆℃暟锛�</span>
+            <el-select v-model="retestTag" placeholder="璇烽�夋嫨" size="small"
               @change="m => handleChangeCableTag(currentSample.id, 4, 'cableTag', m)">
               <el-option v-for="item in unPassNumList" :key="item.retestTag" :label="item.retestTag"
                 :value="item.retestTag">
@@ -253,8 +253,10 @@
   verifyPlan
 } from "@/api/business/inspectionTask";
 import { getUserNow, saveUnqualifiedContext } from "@/api/business/rawMaterialOrder";
+import InspectionWorker from '@/workers/InspectionWorker.worker';
+import DataWorker from '@/workers/DataWorker.worker';
 export default {
-  props: ['sonLaboratory', 'orderId', 'state', 'inspectorList', 'typeSource', 'unPassCheck', 'rawMaterialTag'],
+  props: ['sonLaboratory', 'orderId', 'state', 'inspectorList', 'typeSource', 'unPassCheck', 'rawMaterialTag','cableTag', 'repetitionTag'],
   components: {
     AddUnPass,
     UnPassDialog
@@ -427,7 +429,7 @@
       getDataTypeId: '',
       getDataType: null,
       unPassDialog: false, // 涓嶅悎鏍煎鐞嗗脊妗�
-      retestTag: '', // 澶嶆祴娆℃暟
+      retestTag: '1', // 澶嶆祴娆℃暟
       addCheck: false, // 鎸囧畾瀹℃牳浜哄憳寮规
       checkUser: '',
       type: '',
@@ -514,7 +516,7 @@
             }
           }
         })
-        await this.determineWhetherToCollectData()//鏄惁闇�瑕佹暟閲�
+        // await this.determineWhetherToCollectData()//鏄惁闇�瑕佹暟閲�
         if (this.currentSample.index == undefined) this.currentSample['index'] = 1
         let bushing = this.currentSample.bushing
         this.getTableLists();//澶勭悊妯℃澘鍒楄〃淇℃伅
@@ -817,12 +819,12 @@
         this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝�
       }
       // 鍒涘缓 Worker 瀹炰緥
-      this.worker = new Worker('/static/js/worker.js');
+      this.worker = new InspectionWorker();
       if (this.worker0) {
         this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝�
       }
       // 鍒涘缓 Worker 瀹炰緥
-      this.worker0 = new Worker('/static/js/worker0.js');
+      this.worker0 = new DataWorker();
     },
     // 鍋滄澶氱嚎绋�
     stopWorker() {
@@ -846,8 +848,11 @@
         laboratory: this.sonLaboratory,
         retestTag: this.retestTag,
         rawMaterialTag: this.rawMaterialTag,
+        repetitionTag: this.repetitionTag,
+        cableTag: this.cableTag,
       }
-      let res = getInsProductUnqualifiedRetest(params)
+      let res = await getInsProductUnqualifiedRetest(params)
+      console.log('res---', res)
       if (res.code === 200 && res.data.length > 0) {
         this.tableLoading = false;
         this.scrollInit()
@@ -1281,7 +1286,8 @@
           }
         })
         // 浠ヤ笅鏄牱寮忓鐞嗛�昏緫
-        set = Array.sort(set)
+        // set = Array.sort(set)
+        set = [...set]
         set.forEach(b => {
           let arr = []
           a.template.forEach(c => {
@@ -1477,10 +1483,10 @@
       }, 200)
     },
     // 鏄惁闇�瑕佹暟閲�
-    async determineWhetherToCollectData() {
-      let res = determineWhetherToCollectData({ managementNumber: '' })
-      this.isGet = res.data
-    },
+    // async determineWhetherToCollectData() {
+    //   let res = determineWhetherToCollectData({ managementNumber: '' })
+    //   this.isGet = res.data
+    // },
     // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁   param => this.tableList[0].insProductResult
     getCurrentInsProduct(pId) {
       if (!this.tableList[0].insProductResult) {
diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index b8e35ca..cfaa862 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -509,6 +509,7 @@
       @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" />
     <!-- 杩涜揣楠岃瘉寮规-->
@@ -1042,8 +1043,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);
diff --git a/src/views/business/unpass/components/addUnPass.vue b/src/views/business/unpass/components/addUnPass.vue
index 59c1e8e..f706a98 100644
--- a/src/views/business/unpass/components/addUnPass.vue
+++ b/src/views/business/unpass/components/addUnPass.vue
@@ -7,8 +7,15 @@
                   v-loading="tableLoading" @selection-change="selectProduct" style="margin-bottom: 10px;"
                   :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border @select-all="handleAll">
           <el-table-column type="selection" width="65"></el-table-column>
-          <el-table-column prop="inspectionItemClass" label="妫�楠岄」鍒嗙被" min-width="140"
-            show-overflow-tooltip></el-table-column>
+          <el-table-column prop="isBinding" label="绫诲瀷" min-width="140" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <el-select v-model="scope.row.isBinding" clearable size="small">
+                <el-option :value="1" label="缁戝畾鍊�"></el-option>
+                <el-option :value="0" label="涓嶅悎鏍煎��"></el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column prop="inspectionItemClass" label="妫�楠岄」鍒嗙被" min-width="140" show-overflow-tooltip></el-table-column>
           <el-table-column prop="inspectionItem" label="妫�楠岄」" min-width="140" show-overflow-tooltip></el-table-column>
           <el-table-column prop="inspectionItemSubclass" label="妫�楠岄」瀛愰」" min-width="140"
             show-overflow-tooltip></el-table-column>
@@ -16,8 +23,10 @@
           <el-table-column prop="ask" label="瑕佹眰鍊�" min-width="220px"></el-table-column>
           <el-table-column prop="lastValue" label="妫�楠岀粨鏋�" min-width="140" show-overflow-tooltip></el-table-column>
           <el-table-column prop="insResult" label="缁撴灉鍒ゅ畾" min-width="140" show-overflow-tooltip>
-            <template>
-              <el-tag type="danger">涓嶅悎鏍�</el-tag>
+            <template slot-scope="scope">
+              <el-tag type="success" v-if="scope.row.insResult === 1">鍚堟牸</el-tag>
+              <el-tag type="danger" v-if="scope.row.insResult === 0">涓嶅悎鏍�</el-tag>
+              <el-tag type="info" v-if="scope.row.insResult === 3">涓嶅垽瀹�</el-tag>
             </template>
           </el-table-column>
         </el-table>
@@ -32,6 +41,7 @@
 
 <script>
 import {addUnqualifiedRetest, getInsProductUnqualified} from '@/api/business/unpass.js'
+import {getInsProduct} from "@/api/business/inspectionTask";
 export default {
   name: "addUnPass",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -61,7 +71,7 @@
     getInsOrder(info) {
       this.tableLoading = true
       try {
-        getInsProductUnqualified({ id: info.id, type: info.type, laboratory: info.laboratory, rawMaterialTag: info.rawMaterialTag }).then(res => {
+        getInsProduct({ id: info.id, type: info.type, laboratory: info.laboratory, rawMaterialTag: info.rawMaterialTag,repetitionTag: info.repetitionTag,cableTag: info.cableTag }).then(res => {
           if (res.code === 200) {
             this.productList = res.data
           }
@@ -77,6 +87,15 @@
         this.$message.warning('璇烽�夋嫨闇�瑕佸娴嬬殑妫�楠岄」')
         return
       }
+      // 妫�鏌ユ槸鍚︽墍鏈夐�変腑鐨勮閮介�夋嫨浜� isBinding
+      const hasUnselectedBinding = this.productListSelected.some(
+        (row) => row.isBinding === null || row.isBinding === undefined
+      );
+
+      if (hasUnselectedBinding) {
+        this.$message.error("璇风‘淇濋�変腑鐨勬暟鎹兘閫夋嫨浜嗙被鍨嬶紒");
+        return;
+      }
       this.$confirm('纭鎻愪氦涓嶅悎鏍煎娴�?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
@@ -88,16 +107,20 @@
       });
     },
     handlePass() {
+      const ids = this.productListSelected.map(item => ({
+        id: item.id,
+        isBinding: item.isBinding
+      }));
       this.handlePassLoading = true
       try {
-        addUnqualifiedRetest({
-          ids: this.productIds
-        }).then(res => {
+        addUnqualifiedRetest(ids).then(res => {
           if (res.code === 200) {
             this.$message.success('鎻愪氦鎴愬姛')
             this.$emit('resetAddUnPass')
           }
           this.handlePassLoading = false
+        }).catch(e => {
+          this.handlePassLoading = false
         })
       } catch (e) {
         this.handlePassLoading = false

--
Gitblit v1.9.3