From e1749547c76a5d8bae94e47d38d4d75b481610c1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 09 九月 2021 10:51:15 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/ioWorks/stockIn.js |  153 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 128 insertions(+), 25 deletions(-)

diff --git a/src/main/webapp/static/js/ioWorks/stockIn.js b/src/main/webapp/static/js/ioWorks/stockIn.js
index 674e01b..eed7ff0 100644
--- a/src/main/webapp/static/js/ioWorks/stockIn.js
+++ b/src/main/webapp/static/js/ioWorks/stockIn.js
@@ -10,12 +10,17 @@
     return cols;
 }
 
-layui.use(['table','laydate', 'form'], function() {
+layui.config({
+    base: baseUrl + "/static/layui/lay/modules/"
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'treeTable'], function() {
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
+    var admin = layui.admin;
+    var xmSelect = layui.xmSelect;
+    var treeTable = layui.treeTable;
 
     tableIns = table.render({
         elem: '#chooseData',
@@ -42,7 +47,7 @@
         var checkStatus = table.checkStatus(obj.config.id);
         var data = checkStatus.data;
         switch(obj.event) {
-            case 'comb':
+            case 'confirm':
                 // 鍒ゆ柇鏄惁瀛樺湪鐗╂枡
                 if (matCodeData.length === 0) {
                     layer.msg("璇峰厛娣诲姞鐗╂枡");
@@ -59,29 +64,32 @@
                         return;
                     }
                 }
-                $.ajax({
-                    url: baseUrl+"/full/store/put/start",
-                    headers: {'token': localStorage.getItem('token')},
-                    data: JSON.stringify({
-                        devpNo: Number($('#putSiteSelect').val()),
-                        list: matCodeData
-                    }),
-                    contentType:'application/json;charset=UTF-8',
-                    method: 'POST',
-                    async: false,
-                    success: function (res) {
-                        if (res.code === 200){
-                            layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data);
-                            matCodeData = [];
-                            tableIns.reload({data: matCodeData,done:function (res) { limit();}});
-                        } else if (res.code === 403){
-                            top.location.href = baseUrl+"/";
-                        }else {
-                            layer.msg(res.msg)
-                        }
-                    }
-                })
-                break;
+
+                showNodeSelect();
+
+                // $.ajax({
+                //     url: baseUrl+"/full/store/put/start",
+                //     headers: {'token': localStorage.getItem('token')},
+                //     data: JSON.stringify({
+                //         devpNo: Number($('#putSiteSelect').val()),
+                //         list: matCodeData
+                //     }),
+                //     contentType:'application/json;charset=UTF-8',
+                //     method: 'POST',
+                //     async: false,
+                //     success: function (res) {
+                //         if (res.code === 200){
+                //             layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data);
+                //             matCodeData = [];
+                //             tableIns.reload({data: matCodeData,done:function (res) { limit();}});
+                //         } else if (res.code === 403){
+                //             top.location.href = baseUrl+"/";
+                //         }else {
+                //             layer.msg(res.msg)
+                //         }
+                //     }
+                // })
+                // break;
         }
     });
 
@@ -131,6 +139,101 @@
             }});
     }
 
+    /* 鏄剧ず琛ㄥ崟寮圭獥 */
+    function showNodeSelect() {
+        admin.open({
+            type: 1,
+            area: '400px',
+            title: '閫夋嫨鍏ュ簱璐т綅',
+            content: $('#nodeSelect').html(),
+            success: function (layero, dIndex) {
+                // 琛ㄥ崟鎻愪氦浜嬩欢
+                form.on('submit(pakin)', function (data) {
+                    data.field.nodeSel = insXmSel.getValue('valueStr');
+                    var loadIndex = layer.load(2);
+                    $.ajax({
+                        url: baseUrl+"/work/stock/pakin",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify({
+                            nodeId: data.field.nodeSel,
+                            mats: matCodeData
+                        }),
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            layer.close(loadIndex);
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                matCodeData = [];
+                                tableIns.reload({data: matCodeData});
+                                limit();
+                                layer.msg(res.msg, {icon: 1});
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            } else {
+                                layer.msg(res.msg, {icon: 2});
+                            }
+                        }
+                    })
+                    return false;
+                });
+                // 娓叉煋涓嬫媺鏍�
+                var insXmSel = xmSelect.render({
+                    el: '#nodeSel',
+                    height: '250px',
+                    data: insTb.options.data,
+                    initValue: [],
+                    model: {label: {type: 'text'}},
+                    prop: {
+                        name: 'name',
+                        value: 'id'
+                    },
+                    radio: true,
+                    clickClose: true,
+                    tree: {
+                        show: true,
+                        indent: 15,
+                        strict: false,
+                        expandedKeys: true
+                    }
+                });
+                // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯
+                $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                layui.form.render('select');
+            }
+        });
+    }
+
+    var insTb = treeTable.render({
+        elem: '#node',
+        url: baseUrl+'/node/tree/auth',
+        headers: {token: localStorage.getItem('token')},
+        height: 'full-200',
+        tree: {
+            iconIndex: 2,           // 鎶樺彔鍥炬爣鏄剧ず鍦ㄧ鍑犲垪
+            isPidData: true,        // 鏄惁鏄痠d銆乸id褰㈠紡鏁版嵁
+            idName: 'id',           // id瀛楁鍚嶇О
+            pidName: 'parentId'     // pid瀛楁鍚嶇О
+        },
+        cols: [[
+            {type: 'checkbox'}
+            ,{type: 'numbers'}
+            ,{field: 'name', align: 'left',title: '鍚嶇О', minWidth: 150}
+            ,{field: 'type$', align: 'center',title: '绫诲瀷'}
+            ,{field: 'leading', align: 'center',title: '璐熻矗浜�'}
+            ,{field: 'sort', align: 'center',title: '鎺掑簭', hide: true}
+            ,{field: 'status$', align: 'center',title: '鐘舵��'}
+            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+            ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳', hide: true}
+            ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
+        ]],
+        done: function (data) {
+            $('.ew-tree-table-box').css('height', '100%');
+            insTb.expandAll();
+        }
+    });
+
 });
 
 // 鎻愬彇鐗╂枡

--
Gitblit v1.9.1