From 577a4d707c1e888d7b28a6d2a53dd851d48b6cb8 Mon Sep 17 00:00:00 2001
From: mrzhssss <pro6@qq.com>
Date: 星期二, 15 三月 2022 09:39:40 +0800
Subject: [PATCH] Changes

---
 src/main/webapp/static/js/receiveDetl/receiveDetl.js |  100 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 99 insertions(+), 1 deletions(-)

diff --git a/src/main/webapp/static/js/receiveDetl/receiveDetl.js b/src/main/webapp/static/js/receiveDetl/receiveDetl.js
index 23a1ebc..39bc7ec 100644
--- a/src/main/webapp/static/js/receiveDetl/receiveDetl.js
+++ b/src/main/webapp/static/js/receiveDetl/receiveDetl.js
@@ -1,7 +1,7 @@
 var pageCurr;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table','laydate', 'form', 'admin'], function(){
+}).use(['table','laydate', 'form', 'admin', 'treeTable', 'xmSelect'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
@@ -70,6 +70,100 @@
             limit();
         }
     });
+
+    var insTb = layui.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();
+        }
+    });
+    /* 鏄剧ず琛ㄥ崟寮圭獥 */
+    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 = layui.xmSelect.render({
+                    el: '#nodeSels',
+                    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');
+            }
+        });
+    }
 
     // 鐩戝惉鎺掑簭浜嬩欢
     table.on('sort(receiveDetl)', function (obj) {
@@ -157,6 +251,9 @@
             case "add":
                 // showEditModel(data);
                 startIn(data);
+                break;
+            case "chooseLoc":
+                showNodeSelect();
                 break;
         }
     });
@@ -296,3 +393,4 @@
         page: {curr: pageCurr}
      });
 }
+

--
Gitblit v1.9.1