From 07c3f96ba711bb308cedbbd894b0e9e52cfd32d8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 27 六月 2020 16:45:12 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pda/matQuery.html |   59 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/src/main/webapp/views/pda/matQuery.html b/src/main/webapp/views/pda/matQuery.html
index bbad7ed..d683825 100644
--- a/src/main/webapp/views/pda/matQuery.html
+++ b/src/main/webapp/views/pda/matQuery.html
@@ -39,6 +39,7 @@
             text-overflow:ellipsis;
         }
         #confirm {
+            margin-top: 10px;
             padding: 5px 20px;
         }
 
@@ -77,42 +78,70 @@
 <div class="form-box">
     <div class="form-item">
         <span>鐗╂枡缂栫爜</span>
-        <input id="matNo" type="text" placeholder="鎵爜/杈撳叆">
+        <input id="matNo" type="text" placeholder="鎵爜 / 杈撳叆" onkeyup="find(this)" autocomplete="off">
     </div>
     <div class="form-item">
         <span>鐗╂枡鍚嶇О</span>
-        <input type="text" disabled="disabled">
+        <input id="matName" type="text" disabled="disabled">
     </div>
     <div class="form-item">
-        <span>鐗╂枡鎻忚堪</span>
-        <input type="text" disabled="disabled">
+        <span>鐗╂枡瑙勬牸</span>
+        <input id="str2" type="text" disabled="disabled">
     </div>
     <div class="form-item">
         <span>鍗曚綅</span>
-        <input type="text" disabled="disabled">
+        <input id="str1" type="text" disabled="disabled">
     </div>
     <div class="form-item">
         <span style="vertical-align: middle">鏁伴噺</span>
         <div class="number-tool" style="vertical-align: middle">
             <button onclick="add()">+</button><input id="count" type="number" value="1"><button onclick="reduce()">-</button>
         </div>
-
     </div>
-    <button id="confirm">鎻愬彇</button>
+    <button id="confirm" onclick="confirm()">鎻愬彇</button>
 </div>
 
 </body>
 <script>
     var countDom = $('#count');
     var pageCurr;
-    layui.use(['table','laydate', 'form'], function() {
-        var table = layui.table;
-        var $ = layui.jquery;
-        var layer = layui.layer;
-        var layDate = layui.laydate;
-        var form = layui.form;
 
-    });
+    /**
+     * 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡璇︽儏
+     */
+    function find(el){
+        if (isEmpty(el.value)) {
+            return;
+        }
+        $.ajax({
+            url: baseUrl + "/matCode/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                id: el.value
+            },
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    if (res.data != null) {
+                        $('#matName').val(res.data.matName);
+                        $('#str1').val(res.data.str1);
+                        $('#str2').val(res.data.str2);
+                    }
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    alert(res.msg)
+                }
+            }
+        })
+    }
+
+    /**
+     * 鎻愬彇
+     */
+    function confirm(){
+        parent.layer.close(parent.matCodeLayerIdx);
+    }
 
     window.onload = function(){document.getElementById("matNo").focus();}
     $(document).on('click','#confirm', function () {
@@ -128,7 +157,7 @@
         countDom.val(Number(countDom.val()) + 1);
     }
     function reduce() {
-        if (countDom.val() <= 0) {
+        if (countDom.val() <= 1) {
             return;
         }
         countDom.val(countDom.val() - 1);

--
Gitblit v1.9.1