|  |  | 
 |  |  |                             <div class="layui-col-md10"> | 
 |  |  |                                 <div class="layui-form-item"> | 
 |  |  |                                     <div class="layui-inline"> | 
 |  |  |                                         <label class="layui-form-label">名称:</label> | 
 |  |  |                                         <div class="layui-input-inline"> | 
 |  |  |                                             <input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input"> | 
 |  |  |                                         </div> | 
 |  |  | 
 |  |  |                             </div> | 
 |  |  |                         </div> | 
 |  |  |                     </form> | 
 |  |  |                     <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table> | 
 |  |  |                     <table lay-filter="categoryTable" lay-data="{id: 'categoryTable'}"></table> | 
 |  |  |                     <style type="text/css"> | 
 |  |  |                         .layui-table-cell{ | 
 |  |  |                             text-align:center; | 
 |  |  |                             height: auto; | 
 |  |  |                             white-space: normal; | 
 |  |  |                         } | 
 |  |  |                         .layui-table img{ | 
 |  |  |                             max-width:100px | 
 |  |  |                         } | 
 |  |  |                     </style> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  | <!-- 表格操作栏 start --> | 
 |  |  | <script type="text/html" id="user-option"> | 
 |  |  |     <span shiro:lacksPermission="user:view,user:update,user:delete"> | 
 |  |  |         <span class="layui-badge-dot febs-bg-orange"></span> 无权限 | 
 |  |  |     </span> | 
 |  |  |     <a lay-event="edit" shiro:hasPermission="user:update"><i | 
 |  |  |             class="layui-icon febs-edit-area febs-blue"></i></a> | 
 |  |  | <script type="text/html" id="tableCategoryBar-option"> | 
 |  |  |     <div class="layui-btn-container"> | 
 |  |  |         <button class="layui-btn layui-btn-normal layui-btn-xs" type="button" shiro:hasPermission="categoryBar:update" lay-event="see">编辑</button> | 
 |  |  |         <button class="layui-btn layui-btn-normal layui-btn-xs" type="button" shiro:hasPermission="categoryBar:delete" lay-event="delCategary">删除</button> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  | <!-- 表格操作栏 end --> | 
 |  |  | <script data-th-inline="none" type="text/javascript"> | 
 |  |  | 
 |  |  |             $searchForm = $view.find('form'), | 
 |  |  |             sortObject = {field: 'phone', type: null}, | 
 |  |  |             tableIns; | 
 |  |  |  | 
 |  |  |         //结合表格操作栏是否有内容,来控制数据列是否显示 | 
 |  |  |         let tableCategoryBarOption = $.trim($("#tableCategoryBar-option").html())==="" ? true : false; | 
 |  |  |         form.render(); | 
 |  |  |  | 
 |  |  |         // 表格初始化 | 
 |  |  |         initTable(); | 
 |  |  |  | 
 |  |  |         // 初始化表格操作栏各个按钮功能 | 
 |  |  |         table.on('tool(userTable)', function (obj) { | 
 |  |  |         table.on('tool(categoryTable)', function (obj) { | 
 |  |  |             var data = obj.data, | 
 |  |  |                 layEvent = obj.event; | 
 |  |  |  | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'delCategary') { | 
 |  |  |                 febs.modal.confirm('删除', '确认删除?', function () { | 
 |  |  |                     delCategary(data.id); | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'seeImges') { | 
 |  |  |                 var t = $view.find('#seeImges'+data.id+''); | 
 |  |  |                 //页面层 | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 1, | 
 |  |  |                     title: "图片", | 
 |  |  |                     skin: 'layui-layer-rim', //加上边框 | 
 |  |  |                     area: ['80%', '80%'], //宽高 | 
 |  |  |                     shadeClose: true, //开启遮罩关闭 | 
 |  |  |                     end: function (index, layero) { | 
 |  |  |                         return false; | 
 |  |  |                     }, | 
 |  |  |                     content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         function delCategary(id) { | 
 |  |  |             febs.get(ctx + 'admin/goodsCategory/delCategary/' + id, null, function () { | 
 |  |  |                 febs.alert.success('操作成功'); | 
 |  |  |                 $query.click(); | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 查询按钮 | 
 |  |  |         $query.on('click', function () { | 
 |  |  | 
 |  |  |         function initTable() { | 
 |  |  |             tableIns = febs.table.init({ | 
 |  |  |                 elem: $view.find('table'), | 
 |  |  |                 id: 'userTable', | 
 |  |  |                 id: 'categoryTable', | 
 |  |  |                 url: ctx + 'admin/goodsCategory/categoryList', | 
 |  |  |                 cols: [[ | 
 |  |  |                     {field: 'name', title: '名称', minWidth: 150,align:'left'}, | 
 |  |  |                     {field: 'parentName', title: '父级名称', minWidth: 150,align:'left'}, | 
 |  |  |                     {title: '操作', | 
 |  |  |                     {field: 'image', title: '图片', | 
 |  |  |                         templet: function (d) { | 
 |  |  |                             return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="see" shiro:hasPermission="user:update">编辑</button>' | 
 |  |  |                         },minWidth: 300,align:'center'} | 
 |  |  |                             return '<a lay-event="seeImges"><img id="seeImges'+d.id+'" src="'+d.image+'" alt=""></a>'; | 
 |  |  |                         }, minWidth: 100,align:'center'}, | 
 |  |  |                     {title: '操作', minWidth: 200 ,toolbar: '#tableCategoryBar-option',hide:tableCategoryBarOption} | 
 |  |  |                 ]] | 
 |  |  |             }); | 
 |  |  |         } |