From a84137b0b1660bf4033f6831c19dac09c02ccc30 Mon Sep 17 00:00:00 2001
From: zhaoxiaohao <279049017@qq.com>
Date: Tue, 23 Mar 2021 16:18:25 +0800
Subject: [PATCH] 自定义权限的树状图添加滚动条

---
 kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html
index e16d00b..c7f62fb 100644
--- a/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html
+++ b/kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/system/role.html
@@ -16,7 +16,7 @@
                 <option value="">-请选择-</option>
                 <option value="name">角色名称</option>
             </select>&emsp;
-            <input id="role-edit-value" class="layui-input search-input" type="text" placeholder="输入关键字" />&emsp;
+            <input id="role-edit-value" class="layui-input search-input" type="text" placeholder="按关键字" />&emsp;
             <button id="role-btn-search" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
             <button id="role-btn-add" class="layui-btn icon-btn permissions" permissions="saveOrUpdate"><i class="layui-icon">&#xe654;</i>添加</button>
         </div>
@@ -88,7 +88,7 @@
                 </select>
             </div>
         </div>
-        <div class="layui-form-item" id="tree">
+        <div class="layui-form-item layui_layout_body" id="tree">
             <!-- <label class="layui-form-label">数据权限</label> -->
             <!-- <div id="orgParentId-tree" class="demo-tree demo-tree-box"></div> -->
             <ul id="treeMenu-role" class="ztree" style="padding: 25px 0px 20px 60px;"></ul>
@@ -138,8 +138,6 @@
             page: true,
             cellMinWidth: 80,
             cols: [[
-                { type: 'numbers' },
-                { field: 'id', sort: true, title: 'ID', width: 80 },
                 { field: 'name', sort: true, title: '角色名' },
                 { field: 'code', sort: true, title: 'Code' },
                 { field: 'tenantId', sort: true, title: '应用标识' },
@@ -175,7 +173,7 @@
                 })
                 form.render();
             } else {
-                layer.msg(data.msg, { icon: 2, time: 500 });
+                layer.msg(data.msg, { icon: 2, time: 2000 });
             }
         }, 'GET');
 
@@ -191,13 +189,12 @@
             layer.load(2);
             admin.req('api-user/roles/saveOrUpdate?tenantId=' + tenantId, JSON.stringify(data.field), function (data) {
                 layer.closeAll('loading');
-                // console.log(data);
                 if (data.code === 0) {
-                    layer.msg(data.msg, { icon: 1, time: 500 });
+                    layer.msg(data.msg, { icon: 1, time: 2000 });
                     table.reload('role-table');
                     layer.closeAll('page');
                 } else {
-                    layer.msg(data.msg, { icon: 2, time: 500 });
+                    layer.msg(data.msg, { icon: 2, time: 2000 });
                 }
             }, $('#role-form').attr('method'));
             return false;
@@ -208,7 +205,6 @@
             var treeObj = $.fn.zTree.getZTreeObj('treeMenu-role');
             var nodes = treeObj.getCheckedNodes(true);
             $.each(nodes,function(i,item){
-                // console.log(item)
                 if(!item.children){
                     array.push(item.id);
                 }
@@ -220,13 +216,12 @@
             layer.load(2);
             admin.req('api-user/sysroleorganization', JSON.stringify(data.field), function (data) {
                 layer.closeAll('loading');
-                console.log(data);
                 if (data.code === 0) {
-                    layer.msg(data.msg, { icon: 1, time: 500 });
+                    layer.msg(data.msg, { icon: 1, time: 2000 });
                     table.reload('role-table');
                     layer.closeAll('page');
                 } else {
-                    layer.msg(data.msg, { icon: 2, time: 500 });
+                    layer.msg(data.msg, { icon: 2, time: 2000 });
                 }
             }, $('#role-form').attr('method'));
             layer.closeAll('page');
@@ -256,9 +251,9 @@
             }, function (data) {
                 layer.closeAll('loading');
                 if (data.code == 0) {
-                    layer.msg(data.msg, { icon: 1, time: 500 });
+                    layer.msg(data.msg, { icon: 1, time: 2000 });
                 } else {
-                    layer.msg(data.msg, { icon: 2, time: 500 });
+                    layer.msg(data.msg, { icon: 2, time: 2000 });
                     $(obj.elem).prop('checked', !obj.elem.checked);
                     form.render('checkbox');
                 }
@@ -297,7 +292,7 @@
                     layer.closeAll('loading');
 
                 } else {
-                    layer.msg(data.msg, { icon: 2, time: 500 });
+                    layer.msg(data.msg, { icon: 2, time: 2000 });
                 }
             }, 'get');
         }
@@ -344,7 +339,6 @@
         };
         //数据权限的点击事件
         form.on('select(role_organization)', function (data) {
-            console.log(data.value)
             if (data.value == 2) {
                 $("#tree").show();
             }else{
@@ -364,7 +358,6 @@
                     $('#role-form').attr('method', 'POST');
                     if (data) {
                         getData();
-                        console.log(data.type)
                         if(data.type!=2){
                             $("#tree").hide();
                         }
@@ -384,10 +377,10 @@
                 admin.req('api-user/roles/' + obj.data.id + '?tenantId=' + tenantId, {}, function (data) {
                     layer.closeAll('loading');
                     if (data.code === 0) {
-                        layer.msg(data.msg, { icon: 1, time: 500 });
+                        layer.msg(data.msg, { icon: 1, time: 2000 });
                         obj.del();
                     } else {
-                        layer.msg(data.msg, { icon: 2, time: 500 });
+                        layer.msg(data.msg, { icon: 2, time: 2000 });
                     }
                 }, 'DELETE');
             });
@@ -439,10 +432,10 @@
                     admin.req('api-user/menus/granted?tenantId=' + tenantId, JSON.stringify(data), function (data) {
                         layer.closeAll('loading');
                         if (0 == data.code) {
-                            layer.msg(data.msg, { icon: 1, time: 500 });
+                            layer.msg(data.msg, { icon: 1, time: 2000 });
                             layer.close(index);
                         } else {
-                            layer.msg(data.msg, { icon: 2, time: 500 });
+                            layer.msg(data.msg, { icon: 2, time: 2000 });
                         }
                     }, 'POST');
                 }
@@ -455,4 +448,10 @@
         });
     });
 
-</script>
\ No newline at end of file
+</script>
+<style>
+    .layui_layout_body {
+        overflow-y: auto;
+        height: 200px;
+    }
+ </style>
\ No newline at end of file

--
Gitblit v1.8.0