From 8ec50944210dcbb93334ffb462c8f62a565f5748 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 10 七月 2020 11:19:07 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pdaCe/index.html |   89 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 73 insertions(+), 16 deletions(-)

diff --git a/src/main/webapp/views/pdaCe/index.html b/src/main/webapp/views/pdaCe/index.html
index 296d1b8..ede925d 100644
--- a/src/main/webapp/views/pdaCe/index.html
+++ b/src/main/webapp/views/pdaCe/index.html
@@ -117,6 +117,7 @@
 <div>
     <span>鐗╂枡</span>
     <input type="text" id="matNo" onkeyup="find(this)" autocomplete="off">
+    <button onclick="find()">鏌ヨ</button>
 </div>
 
 <div class="mat-msg" id="mat-msg-id">
@@ -134,12 +135,16 @@
 
 <div id="btn-con">
     <button style="margin-right: 20px" onclick="reset()">閲嶇疆</button>
-    <button onclick="comb()">缁勬墭</button>
+    <button id="comb" onclick="comb()">缁勬墭</button>
     <span id="tips"></span>
 </div>
 
 <!-- 璇︽儏 -->
 <div class="form-box" id="mat-detail">
+    <div class="form-item form-count">
+        <span style="margin-right: 10px">鏁伴噺</span>
+        <button onclick="reduce()">-</button><input id="count" type="number" style="text-align: center"><button onclick="add()">+</button>
+    </div>
     <div class="form-item">
         <span>鍚嶇О</span>
         <input id="matName" type="text" disabled="disabled" style="background-color: #ececec;color: #000">
@@ -147,10 +152,6 @@
     <div class="form-item">
         <span>鍗曚綅</span>
         <input id="str1" type="text" disabled="disabled" style="background-color: #ececec;color: #000; text-align: center;">
-    </div>
-    <div class="form-item form-count">
-        <span style="margin-right: 10px">鏁伴噺</span>
-        <button onclick="reduce()">-</button><input id="count" type="number" style="text-align: center"><button onclick="add()">+</button>
     </div>
     <div class="form-item form-btn-con">
         <button id="confirm" onclick="confirm()">鎻愬彇</button>
@@ -161,6 +162,7 @@
 
 </body>
 <script>
+
     var matMsgTableBlankRows = 0;   // 绌虹櫧琛屾暟
     var matData = []; // 琛ㄦ牸鏁版嵁
     var code = document.getElementById("code")
@@ -171,14 +173,17 @@
     var ttbody = document.getElementById("ttbody");
     var btnCon = document.getElementById("btn-con");
     var tipDom = document.getElementById("tips");
+    var combBtn = document.getElementById("comb");
 
     var matDetail = document.getElementById("mat-detail");
     var matName = document.getElementById("matName");
     var str1 = document.getElementById("str1");
     var count = document.getElementById("count");
+    var confirmBtn = document.getElementById("confirm");
 
     matDetail.style.display = 'none';
     var initMatCount = 1;
+    // window.onload = function(){code.focus();}
 
     // 鏌ヨ鐗╂祦
     function find(el) {
@@ -187,7 +192,7 @@
             type: 'post',
             headers: [{token: getCookie('token')}],
             data: {
-                id: el.value
+                id: matNo.value
             },
         }, function (res) {
             if (res.code === 200) {
@@ -199,7 +204,10 @@
                     // 濉厖鏁版嵁
                     matName.value = res.data.matName;
                     str1.value = res.data.str1;
+
+                    count.focus();
                     count.value = initMatCount;
+                    // confirmBtn.focus();
                 } else {
                     matMsg.style.display = 'block';
                     btnCon.style.display = 'block';
@@ -225,18 +233,17 @@
             tips("璇锋彁鍙栫墿鏂�", true);
             return;
         }
-        console.log(JSON.stringify({
-            barcode: barcode,
-            combMats: matData
-        }))
         httpRequest({
-            httpUrl: baseUrl+"/mobile/comb/form",
+            httpUrl: baseUrl+"/mobile/comb/auth",
             type: 'post',
-            headers: [{token: getCookie('token')}],
-            data: {
+            headers: [
+                {token: getCookie('token')}
+                ,{'Content-type':'application/json;charset=UTF-8',}
+                ],
+            data: JSON.stringify({
                 barcode: barcode,
                 combMats: matData
-            },
+            }) ,
         }, function (res) {
             if (res.code === 200) {
                 reset();
@@ -411,7 +418,6 @@
             requestData += name + '='+ paramData[name] + '&';
         }
         requestData = requestData === '' ? '' : requestData.substring(0,requestData.length - 1);
-
         /*璇锋眰鎺ユ敹*/
         xmlhttp.onreadystatechange = function() {
             if(xmlhttp.readyState === 4 && xmlhttp.status === 200) {
@@ -442,8 +448,59 @@
             if (defaultContentType) {
                 xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
             }
-            xmlhttp.send(requestData);
+            xmlhttp.send(defaultContentType?requestData:paramData);
         }
     }
+
+    document.onkeyup = function (e) {
+        if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯
+            e = window.event;
+        var key = e.charCode || e.keyCode;
+        if (key === 112) {
+            code.focus();
+        } else if (key === 113) {
+            matNo.focus();
+        } else if (key === 114) {
+            combBtn.focus();
+        } else if (key === 13) {
+            confirmBtn.focus();
+        }
+
+        // if (code1 === 13) {
+        //     if (window.getComputedStyle(matDetail).display === 'block') {
+        //         confirm()
+        //     } else if (window.getComputedStyle(btnCon).display === 'block') {
+        //         comb()
+        //     }
+        // }
+    }
+
+    document.onkeydown = function (e) {
+        if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯
+            e = window.event;
+        var key = e.charCode || e.keyCode;
+        if (key === 114) {
+            comb()
+        }
+
+        // if (code1 === 13) {
+        //     if (window.getComputedStyle(matDetail).display === 'block') {
+        //         confirm()
+        //     } else if (window.getComputedStyle(btnCon).display === 'block') {
+        //         comb()
+        //     }
+        // }
+    }
+
+    // todo
+    // setTimeout(function () {
+    //     code.value = "888"
+    //     addTableData({
+    //         matNo: "1902980-11/14",
+    //         matName: "閾濆甫|1100-O|0.33*475|",
+    //         str1: "浠�",
+    //         count: 1
+    //     })
+    // }, 200)
 </script>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1