From a7d816c40f5035c3ae4ddffc32ed80d3c55e3f4f Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 08 三月 2024 17:11:52 +0800
Subject: [PATCH] 原材料检验:检测值失焦保存

---
 src/views/quality/rawMaterial/rawMaterial-form.vue |   51 ++++++++++++++-----------
 src/views/plan/customerorder/index.vue             |   32 +++++++++-------
 2 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/src/views/plan/customerorder/index.vue b/src/views/plan/customerorder/index.vue
index d87d035..4ba8c0f 100644
--- a/src/views/plan/customerorder/index.vue
+++ b/src/views/plan/customerorder/index.vue
@@ -1036,20 +1036,24 @@
         permitArr: [],
       })
     }
-    this.table.toolbar.push({
-        text: '涓嬭浇宸ヨ壓鏂囦欢',
-        disabled: false,
-        type: 'primary',
-        fun: this.downloadWord,
-        permitArr: ['03plan','04planed'],
-    })
-    this.table.toolbar.push({
-        text: '涓嬭浇鎺掍骇鍗�',
-        disabled: false,
-        type: 'primary',
-        permitArr: [],
-        fun: this.downloadProductionScheduling,
-    })
+    if(this.permissions.plan_download_process_file){
+        this.table.toolbar.push({
+            text: '涓嬭浇宸ヨ壓鏂囦欢',
+            disabled: false,
+            type: 'primary',
+            fun: this.downloadWord,
+            permitArr: ['03plan','04planed'],
+        })
+    }
+    if(this.permissions.plan_download_product_file){
+        this.table.toolbar.push({
+            text: '涓嬭浇鎺掍骇鍗�',
+            disabled: false,
+            type: 'primary',
+            permitArr: [],
+            fun: this.downloadProductionScheduling,
+        })
+    }
     this.table.toolbar.push({
       text: '鍏宠仈璁㈠崟',
       disabled: false,
diff --git a/src/views/quality/rawMaterial/rawMaterial-form.vue b/src/views/quality/rawMaterial/rawMaterial-form.vue
index 768325d..31e5075 100644
--- a/src/views/quality/rawMaterial/rawMaterial-form.vue
+++ b/src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -178,13 +178,14 @@
                         <template slot-scope="scope">
                           <div v-if="!scope.row.children">
                             <!-- :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" -->
-                            <!-- @blur.stop="changeState(scope.row)" -->
+                                <!-- @input="$nextTick(()=>{checkTestValues(scope.row)})" -->
+                                <!-- @blur.capture.native="changeState(scope.row)" -->
                             <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="璇峰厛閫夋嫨璁惧锛�" placement="top-start">
                                 <el-autocomplete clearable
                                 cache="false"
                                 ref="testValueInput"
-                                @input="$nextTick(()=>{checkTestValues(scope.row)})"
-                                @blur="$nextTick(()=>{changeState(scope.row)})"
+                                @blur="checkTestValues(scope.row,'blur',$event)"
+                                @select="checkTestValues(scope.row,'select',$event)"
                                 v-model="scope.row.testValueList[index]"
                                 :fetch-suggestions="querySearch"
                                 placeholder="璇疯緭鍏ユ垨閫夋嫨妫�娴嬪��" >
@@ -216,7 +217,7 @@
                       <el-table-column prop="note" label="妫�楠屾弿杩�" width="160" >
                         <template slot-scope="scope">
                           <div v-if="!scope.row.children">
-                            <el-input @blur="changeState(scope.row)" :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input>
+                            <el-input @blur="checkTestValues(scope.row,'blur',$event)" :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input>
                           </div>
                         </template>
                       </el-table-column>
@@ -406,12 +407,10 @@
   import rawMaterialPartDialog from '@/views/common/rawMaterial-part'
   import { getStore } from '@/util/store'
   import qrCodeApp from '@/views/common/qrCodeApp'
-  import testValueSelect from './testValue-select'
   export default {
   components:{
     rawMaterialPartDialog,
     qrCodeApp,
-    testValueSelect
   },
     computed:{},
     data(){
@@ -477,7 +476,7 @@
             }],
             dataRule: {
               code:[{ required: true, message: '璇锋壂鎻忛�夋嫨闆朵欢', trigger: 'blur' }],
-              createTime: [{ required: true, message: '璇烽�夋嫨鎶ユ鏃ユ湡', trigger: 'change' }]
+              createTime: [{ required: true, message: '璇烽�夋嫨鎶ユ鏃ユ湡', trigger: 'blur' }]
             },
             deviceList: [],
         }
@@ -883,31 +882,37 @@
         console.log(e,e.target.tabIndex);
         console.log(e.target.value);
       },
-      checkTestValues(row){
-        if(row){
+      checkTestValues(row,currentOption,event){
+          if(row){
               let isTrue = true
-              for(var i=0;i<row.testValueList.length;i++){
-                  let val = row.testValueList[i]
-                  if(val != '' && val != null){
-                      if(!['鏄�','鍚�'].includes(val)){
-                          let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
-                          if(!reg.test(val)){
-                            row.testValueList[i] = null
-                            this.$message.error("璇疯緭鍏�6浣嶆暟瀛楁垨閫夋嫨鏄惁")
-                            isTrue = false
-                        }
-                    }
+              if(currentOption==='blur'){
+                  let targetVal = event.target.value
+                  if( (targetVal && ['鏄�','鍚�'].includes(targetVal)) || !targetVal){
+                    isTrue = false
+                  }else{
+                      for(var i=0;i<row.testValueList.length;i++){
+                          let val = row.testValueList[i]
+                          if(val != '' && val != null){
+                              if(!['鏄�','鍚�'].includes(val)){
+                                  let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
+                                  if(!reg.test(val)){
+                                    row.testValueList[i] = ''
+                                    event.target.value = ''
+                                    this.$message.error("璇疯緭鍏�6浣嶆暟瀛楁垨閫夋嫨鏄惁")
+                                    isTrue = false
+                                }
+                            }
+                          }
+                      }
                   }
               }
               if(!isTrue){
                   return
               }
-
+              this.changeState(row)
           }
       },
       changeState(row) {
-          console.log("鏇存柊--銆�",row.testValueList[0]);
-          return
           this.$nextTick(()=>{
             if (row.rpId != null && row.rpId != '') {
                 let val = row.testValueList.join(",")

--
Gitblit v1.9.3