From 4a868400b87fa0d1ebfb83a530d786fd7b2f6459 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 07 四月 2021 09:58:17 +0800
Subject: [PATCH] #
---
 src/main/webapp/views/pda/selectMat.html |   51 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/src/main/webapp/views/pda/selectMat.html b/src/main/webapp/views/pda/selectMat.html
index 3c80a1a..58fef5a 100644
--- a/src/main/webapp/views/pda/selectMat.html
+++ b/src/main/webapp/views/pda/selectMat.html
@@ -19,7 +19,16 @@
             height: 100%;
             background-color: #f1f1f1;
             padding: 5px;
+            position: relative;
+            /*overflow: hidden;*/
         }
+
+        /*header {*/
+        /*    position: absolute;*/
+        /*}*/
+        /*main {*/
+        /*    padding-top: 30px;*/
+        /*}*/
 
         /* 澶撮儴鎼滅储鏍� */
         .search-box {
@@ -31,7 +40,7 @@
             border-radius: 20px;
             height: 30px;
             box-shadow: 0 0 3px rgba(0,0,0,.3);
-            width: 75%;
+            width: 73%;
             padding-left: 15px;
             vertical-align: middle;
         }
@@ -92,8 +101,8 @@
 
 <header>
     <div class="search-box">
-        <input type="text" placeholder="璇疯緭鍏ュ晢鍝佺紪鐮�/鍚嶇О">
-        <button>
+        <input id="search-msg" type="text" placeholder="璇疯緭鍏ュ晢鍝佺紪鐮�/鍚嶇О">
+        <button onclick="search()">
             <i class="layui-icon"></i>
         </button>
     </div>
@@ -108,6 +117,36 @@
         showTag();
     })
 
+    // 鎼滅储
+    function search(){
+        var condition = $('#search-msg').val();
+        $.ajax({
+            url: baseUrl + "/mat/search/pda/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                condition: condition
+            },
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    if (res.data != null && res.data.length > 0) {
+                        var tplDom = $("#matTpl");
+                        var tpl = tplDom.html();
+                        var template = Handlebars.compile(tpl);
+                        var html = template(res);
+                        $('#main-contain').html(html);
+                    } else {
+                        $('#main-contain').html('<div style="text-align: center; margin-top: 15px"><span style="font-size: large">鏆傛棤鍟嗗搧</span></div>');
+                    }
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    parent.layer.msg(res.msg, {icon: 2});
+                }
+            }
+        })
+    }
+
     // 褰掔被鐐瑰嚮
     $(document).on('click','.box-tag-item', function () {
         var tagId = $(this).children('input').get(0).value;
@@ -116,7 +155,7 @@
 
     // 鍟嗗搧鐐瑰嚮
     $(document).on('click','.box-mat-item', function () {
-        var tagId = $(this).children('input').get(0).value;
+        parent.findBySelect($(this).children('input').get(0))
     })
 
     // 灞曠ず褰掔被
@@ -131,7 +170,6 @@
             success: function (res) {
                 if (res.code === 200) {
                     if (res.data != null && res.data.length > 0) {
-                        console.log(res.data)
                         var tplDom = $("#tagTpl");
                         var tpl = tplDom.html();
                         var template = Handlebars.compile(tpl);
@@ -165,7 +203,6 @@
             success: function (res) {
                 if (res.code === 200) {
                     if (res.data != null && res.data.length > 0) {
-                        console.log(res.data)
                         var tplDom = $("#matTpl");
                         var tpl = tplDom.html();
                         var template = Handlebars.compile(tpl);
@@ -196,7 +233,7 @@
 <script type="text/template" id="matTpl">
     {{#each data}}
     <div class="box-mat-item">
-        <input name="matId" type="hidden" value="{{this.id}}">
+        <input name="matnr" type="hidden" value="{{this.matnr}}">
         <div class="box-mat-item-label">{{this.maktx}}</div>
     </div>
     {{/each}}
--
Gitblit v1.9.1