var prefix = ctx + "system/menu" window.onload = function() { loading(); }; function loading() { var columns = [ { title : '菜单名称', field : 'menuName', width : '20%', formatter : function(row, index) { if(row.icon == null || row == "") { return row.menuName; } else { return ' ' + row.menuName + ''; } } }, { field : 'orderNum', title : '排序', width : '10%', }, { field : 'url', title : '请求地址', width : '15%', }, { title : '类型', field : 'menuType', width : '10%', formatter : function(item, index) { if (item.menuType == 'M') { return '目录'; } if (item.menuType == 'C') { return '菜单'; } if (item.menuType == 'F') { return '按钮'; } } }, { field: 'visible', title: '可见', width : '10%', formatter: function(row, index) { if (row.visible == 0) { return '显示'; } else if (row.visible == 1) { return '隐藏'; } } }, { field : 'perms', title : '权限标识', width : '15%', }, { title : '操作', width : '20%', formatter : function(row, index) { var actions = []; actions.push('编辑 '); actions.push('新增 '); actions.push('删除'); return actions.join(''); } }]; var url = prefix + "/list"; $.initTreeTable('menuId', 'parentId', columns, url, false); } /*菜单管理-新增*/ function add(menuId) { var url = prefix + '/add/' + menuId; layer_showAuto("新增菜单", url); } /*菜单管理-修改*/ function edit(menuId) { var url = prefix + '/edit/' + menuId; layer_showAuto("修改菜单", url); } /*菜单管理-删除*/ function remove(menuId) { layer.confirm("确定要删除菜单吗?",{icon: 3, title:'提示'},function(index){ $.ajax({ type : 'get', url: prefix + "/remove/" + menuId, success : function(r) { if (r.code == 0) { layer.msg(r.msg, { icon: 1, time: 1000 }); loading(); } else { layer.alert(r.msg, { icon: 2, title: "系统提示" }); } } }); }); }