فهرست منبع

Merge branch 'dev' of http://47.103.65.67:3000/yeguodong/thmz into dev

‘chenzhilei’ 2 هفته پیش
والد
کامیت
4e8166e462
1فایلهای تغییر یافته به همراه19 افزوده شده و 24 حذف شده
  1. 19 24
      src/main/resources/static/js/mz/west_pharmacy_send.js

+ 19 - 24
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -1455,7 +1455,8 @@ function prescriptionDetail(realNo, orderNo, receiptNo, times, patientId, confir
                 let lastInputValue = '';
                 
                 $element.off('input.scan').on('input.scan', function(e) {
-                    let inputValue = e.target.textContent || e.target.innerText;
+                    // 使用innerHTML获取包含<br>的完整内容
+                    let inputValue = e.target.innerHTML;
                     
                     console.log('扫码输入事件触发,输入值:', inputValue);
                     console.log('输入值长度:', inputValue ? inputValue.length : 0);
@@ -1469,32 +1470,26 @@ function prescriptionDetail(realNo, orderNo, receiptNo, times, patientId, confir
                     // 设置防抖定时器,0.5秒后触发验证
                     inputTimer = setTimeout(function() {
                         if (inputValue && inputValue.trim().length > 0) {
-                            // 获取最后一个完整的追溯码(根据国家药监局规定,追溯码长度为20位)
-                            let currentInput = inputValue.trim();
-                            let lastCode = '';
+                            // 直接按<br>分割,获取所有追溯码
+                            let codes = inputValue.split('<br>').filter(code => code.trim().length > 0);
+                            console.log('分割后的追溯码列表:', codes);
                             
-                            // 如果输入长度超过20位,取最后20位作为追溯码
-                            if (currentInput.length >= 20) {
-                                lastCode = currentInput.slice(-20);
+                            // 检查最后一个追溯码是否为20位
+                            if (codes.length > 0) {
+                                let lastCode = codes[codes.length - 1];
+                                console.log('最后一个追溯码:', lastCode);
+                                console.log('最后一个追溯码长度:', lastCode.length);
+                                
+                                if (lastCode.length === 20) {
+                                    console.log('防抖触发,准备验证追溯码:', lastCode);
+                                    // 验证最后一个完整的追溯码
+                                    validateAndAddTracCodg(lastCode, row, $element);
+                                } else {
+                                    console.log('最后一个追溯码长度不正确,不进行验证:', lastCode.length);
+                                }
                             } else {
-                                // 如果输入长度不足20位,不进行验证
-                                console.log('输入长度不足20位,不进行验证:', currentInput.length);
-                                return;
+                                console.log('没有找到有效的追溯码');
                             }
-                            
-                            // 验证追溯码长度是否为20位
-                            if (lastCode.length !== 20) {
-                                console.log('追溯码长度不正确,不进行验证:', lastCode.length);
-                                return;
-                            }
-                            
-                            console.log('防抖触发,准备验证追溯码:', lastCode);
-                            console.log('完整输入值:', currentInput);
-                            console.log('提取的追溯码:', lastCode);
-                            console.log('追溯码长度:', lastCode.length);
-                            
-                            // 验证最后一个完整的追溯码
-                            validateAndAddTracCodg(lastCode, row, $element);
                         }
                     }, 500);
                 });