From 0916bb4ea987c0599b6af6bb8dd251a071770e05 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期四, 23 十月 2025 14:32:15 +0800
Subject: [PATCH] 通用下拉选择框值从视图获取

---
 src/main/webapp/views/pla/locDetlQuery.html |   69 +++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/src/main/webapp/views/pla/locDetlQuery.html b/src/main/webapp/views/pla/locDetlQuery.html
index 86f1d2a..f92a1ae 100644
--- a/src/main/webapp/views/pla/locDetlQuery.html
+++ b/src/main/webapp/views/pla/locDetlQuery.html
@@ -57,9 +57,10 @@
     <!-- 鎼滅储鏍� -->
     <div id="search-box">
         <div class="layui-form layui-card-header">
-            <div class="layui-inline">
+            <div class="layui-inline" style="width: 270px">
                 <div class="layui-input-inline">
-                    <input class="layui-input" type="text" name="batch" placeholder="鎵瑰彿" autocomplete="off">
+                    <div id="mat" name="mat">
+                    </div>
                 </div>
             </div>
             <div class="layui-inline">
@@ -94,6 +95,15 @@
                         <option value="寰呭嚭搴�">寰呭嚭搴�</option>
                         <option value="閮ㄥ垎鍑哄簱">閮ㄥ垎鍑哄簱</option>
                         <option value="鍏ㄩ儴鍑哄簱">鍏ㄩ儴鍑哄簱</option>
+                    </select>
+                </div>
+            </div>
+            <div class="layui-inline">
+                <div class="layui-input-inline">
+                    <select name="stock_freeze">
+                        <option value="">鏄惁鍐荤粨</option>
+                        <option value="0">鏄�</option>
+                        <option value="1">鍚�</option>
                     </select>
                 </div>
             </div>
@@ -228,7 +238,12 @@
 <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
 <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
-
+<script type="text/html" id="stockFreezeTpl">
+    {{# if(d.stockFreeze == 0) { }}
+    <span style="color:#34a8de;">鍐荤粨</span>
+    {{# } else { }}
+    <span style="color:#0c0c0c;">鏈喕缁�</span>
+    {{# } }}</script>
 </body>
 <script>
 
@@ -238,7 +253,7 @@
 
     layui.config({
         base: baseUrl + "/static/layui/lay/modules/"
-    }).use(['table','laydate', 'form', 'admin', 'tableMerge'], function() {
+    }).use(['table','laydate', 'form', 'admin', 'tableMerge', 'xmSelect'], function() {
         var table = layui.table;
         var $ = layui.jquery;
         var layer = layui.layer;
@@ -260,12 +275,12 @@
             url: baseUrl+'/pla/list/auth?step=2',
             page: true,
             totalRow: true, // 寮�鍚悎璁¤
-            height: function(){
-                var otherHeight = $('.function-area').outerHeight() + $('#search-box').outerHeight(); // 鑷畾涔夊叾浠栧尯鍩熺殑楂樺害
-                console.log($(window).height() - otherHeight);
-                return $(window).height() - otherHeight - 100; // 杩斿洖 number 绫诲瀷
-            },
-            //height: 'full',
+            // height: function(){
+            //     var otherHeight = $('.function-area').outerHeight() + $('#search-box').outerHeight(); // 鑷畾涔夊叾浠栧尯鍩熺殑楂樺害
+            //     console.log($(window).height() - otherHeight);
+            //     return $(window).height() - otherHeight - 100; // 杩斿洖 number 绫诲瀷
+            // },
+            height: '500',
             limit: 500,
             limits: [500,1000],
             even: true,
@@ -339,6 +354,36 @@
             }
         });
 
+        // 娓叉煋鐗╂枡閫夋嫨
+        var matXmSelect = xmSelect.render({
+            el: '#mat',
+            style: {
+                width: '270px',
+            },
+            autoRow: true,
+            toolbar: { show: true },
+            filterable: true,
+            remoteSearch: true,
+            remoteMethod: function(val, cb, show){
+                $.ajax({
+                    url: baseUrl+"/pla/batch/all/get/kv",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: {
+                        condition: val
+                    },
+                    method: 'POST',
+                    success: function (res) {
+                        if (res.code === 200){
+                            cb(res.data)
+                        } else {
+                            cb([]);
+                            layer.msg(res.msg, {icon: 2});
+                        }
+                    }
+                });
+            }
+        })
+
         // 鐩戝惉澶村伐鍏锋爮浜嬩欢
         table.on('toolbar(stockOut)', function (obj) {
             var checkStatus = table.checkStatus(obj.config.id);
@@ -371,6 +416,10 @@
         $.each($('#search-box [name]').serializeArray(), function() {
             searchData[this.name] = this.value;
         });
+        if(searchData.select){
+            searchData.batch = searchData.select;
+            searchData.select = null;
+        }
         locDetlTableIns.reload({
             where: searchData,
         });

--
Gitblit v1.9.1