From ba1b15ac2556a322d1cea9bdd108255e0ff32048 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 03 十二月 2024 13:43:44 +0800
Subject: [PATCH] 优化入库出库功能

---
 src/components/view/b1-sample.vue |   53 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/src/components/view/b1-sample.vue b/src/components/view/b1-sample.vue
index 6afb89d..0bc487e 100644
--- a/src/components/view/b1-sample.vue
+++ b/src/components/view/b1-sample.vue
@@ -195,7 +195,7 @@
         <div class="search_thing">
           <div class="search_label">鏍峰搧缂栧彿锛�</div>
           <div class="search_input">
-            <el-input placeholder="璇疯緭鍏ユ牱鍝佺紪鍙�" v-model="searchSampleCode" size="small" autocomplete="off">
+            <el-input placeholder="璇疯緭鍏ユ牱鍝佺紪鍙�" v-model="searchSampleCode" size="small" autocomplete="off" ref="organization" readonly="readonly" @focus="remove('organization')" @blur="setType('organization')">
               <el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button>
             </el-input>
           </div>
@@ -255,7 +255,11 @@
         <el-col class="search_thing" :span="24">
           <div class="search_label"><span class="required-span">* </span>鏍峰搧缂栧彿锛�</div>
           <div class="search_input">
-            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange"></el-input>
+            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange" :disabled="sampleCodeBtnDisabled">
+              <el-tooltip :content="sampleCodeBtnDisabled?'鎵嬪姩杈撳叆':'鎵爜鏋緭鍏�'" placement="top" slot="append">
+                <el-button type="primary" icon="el-icon-edit" @click="sampleCodeBtnDisabled=!sampleCodeBtnDisabled"></el-button>
+              </el-tooltip>
+            </el-input>
           </div>
         </el-col>
       </el-row>
@@ -287,7 +291,11 @@
         <el-col class="search_thing" :span="24">
           <div class="search_label"><span class="required-span">* </span>鏍峰搧缂栧彿锛�</div>
           <div class="search_input">
-            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange"></el-input>
+            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange" clearable :disabled="sampleCodeBtnDisabled">
+              <el-tooltip :content="sampleCodeBtnDisabled?'鎵嬪姩杈撳叆':'鎵爜鏋緭鍏�'" placement="top" slot="append">
+                <el-button type="primary" icon="el-icon-edit" @click="sampleCodeBtnDisabled=!sampleCodeBtnDisabled"></el-button>
+              </el-tooltip>
+            </el-input>
           </div>
         </el-col>
       </el-row>
@@ -366,7 +374,7 @@
         <el-button type="primary" @click="confirmShelves" :loading="upLoadShelves">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <input type="password" id="ScanCodeInfo" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input>
+    <input  id="ScanCodeInfo0" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input>
   </div>
 </template>
 
@@ -382,6 +390,7 @@
           warehouseId: null,
           shelfId: null
         },
+        sampleCodeBtnDisabled:true,
         warehouse: [],
         startTime: null,
         shelf: [],
@@ -408,15 +417,16 @@
         tableLoading:false,
         sampleCode:'',
         currentId:null,
-        searchSampleCode:'',
+        searchSampleCode:null,
         codeInfo:null,
       }
     },
     watch:{
       storageVisible(newVal){
         if(newVal){
+            this.sampleCode = null
             // this.$message.success('鎵爜锛氭墦寮�')
-            let input = document.getElementById('ScanCodeInfo');
+            let input = document.getElementById('ScanCodeInfo0');
             input.focus();
             this.startTime = setInterval(()=>{
                 input.focus()
@@ -424,12 +434,14 @@
         }else{
             // this.$message.warning('鎵爜锛氬叧闂�')
             clearInterval(this.startTime)
+            this.sampleCodeBtnDisabled=true
         }
       },
       exportVisible(newVal){
         if(newVal){
             // this.$message.success('鎵爜锛氭墦寮�')
-            let input = document.getElementById('ScanCodeInfo');
+            this.sampleCode = null
+            let input = document.getElementById('ScanCodeInfo0');
             input.focus();
             this.startTime = setInterval(()=>{
                 input.focus()
@@ -437,8 +449,26 @@
         }else{
             // this.$message.warning('鎵爜锛氬叧闂�')
             clearInterval(this.startTime)
+            this.sampleCodeBtnDisabled=true
         }
       },
+      sampleCodeBtnDisabled(val){
+        if(!val){
+          this.startTime&&clearInterval(this.startTime)
+        }else if(this.exportVisible||this.storageVisible){
+          this.sampleCode = null
+          let input = document.getElementById('ScanCodeInfo');
+          input.focus();
+          this.startTime = setInterval(()=>{
+              input.focus()
+          },1000)
+        }
+      },
+      isEdit(newVal){
+        if(!newVal){
+          this.shelves = {}
+        }
+      }
     },
     mounted() {
       this.selectList()
@@ -447,7 +477,8 @@
       keyup(e){
         var code = ''
         try{
-            code = JSON.parse(this.codeInfo)
+            console.log(2222,this.codeInfo)
+            code = this.codeInfo.substring()
             if(code==null||code==undefined||code==''){
                 this.$message.error('璇ヤ簩缁寸爜鏈夎')
             }else{
@@ -802,6 +833,12 @@
         if(e){
           this.sampleCode = e.replaceAll('"','')
         }
+      },
+      remove(type){
+        this.$refs[type].$el.querySelector('input').removeAttribute('readonly')
+      },
+      setType(type){
+        this.$refs[type].$el.querySelector('input').setAttribute('readonly', 'true')
       }
     }
   }

--
Gitblit v1.9.3