'可用', 2 => '不可用', ); $fast = array ( 1 => '是', 2 => '否', ); $type = array ( 1 => '开启', 2 => '不开启', ); # 图标 $icon = array ( 1 => '默认', ); $menu = function() { $array = array(-1 => array('name' => '父级菜单')); $menu = Dever::load('manage/menu-get'); if($menu) { $array += $menu; } return $array; }; $group = function() { $array = array(); $menu = Dever::db('manage/menu_group')->state(); if($menu) { $array += $menu; } return $array; }; if (layadmin()) { $link = 'https://www.layui.com/doc/element/icon.html'; } else { $link = 'http://dwz.cn/1j8SP0'; } return array ( # 表名 'name' => 'menu', # 显示给用户看的名称 'lang' => '管理菜单设置', 'order' => 2, //'check' => 'key', 'end' => array ( 'update' => 'manage/menu.updateKey', ), # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => '菜单ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'order' => 'desc', ), 'name' => array ( 'type' => 'varchar-50', 'name' => '菜单名称', 'default' => '', 'desc' => '请输入菜单名称', 'match' => 'is_string', 'update' => 'text', 'search' => 'order,fulltext', 'list' => true, ), 'group_id' => array ( 'type' => 'int-11', 'name' => '选择分组', 'default' => 1, 'desc' => '请选择选择分组', 'match' => 'is_numeric', 'update' => 'select', 'search' => 'select', 'list' => true, 'option' => $group, 'edit' => true, ), 'menu_id' => array ( 'type' => 'int-11', 'name' => '上级菜单', 'default' => -1, 'desc' => '请选择上级菜单', 'match' => 'is_numeric', //'update' => 'select', //'search' => 'order,select', 'value' => Dever::input('option_menu_id', -1), 'list' => '{menu_id} > 0 ? Dever::load("manage/menu-one#name", {menu_id}) : "父级菜单"', 'option' => $menu, //'edit' => true, ), 'menu' => array ( 'type' => 'varchar-800', 'name' => '上级菜单', 'default' => Dever::input('option_menu', -1), 'desc' => '请选择上级菜单', 'match' => 'is_string', 'update' => 'linkage', 'linkage' => 'id=' . Dever::input('where_id'), 'option' => Dever::url('menu.getCate', 'manage'), ), 'key' => array ( 'type' => 'varchar-100', 'name' => '菜单标识-选填,可以为空,用来标识菜单的唯一性', 'default' => '', 'desc' => '请输入菜单标识', 'match' => 'option', 'update' => 'text', 'search' => 'fulltext', //'list' => true, //'modal' => 'test', ), 'link' => array ( 'type' => 'varchar-150', 'name' => '链接(或路径)-选填,可以为空', 'default' => '', 'desc' => '请输入链接', 'match' => 'option', 'update' => 'text', //'search' => 'fulltext', //'list' => true, ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', 'update' => 'text', 'search' => 'order', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'type' => array ( 'type' => 'tinyint-1', 'name' => '开启子菜单', 'default' => '2', 'desc' => '请选择开启子菜单', 'match' => 'is_numeric', 'option' => $type, //'update' => 'radio', //'list' => true, ), 'icon' => array ( 'type' => 'varchar-100', 'name' => '图标代码-请点此查看图标代码', 'default' => 'glyphicon glyphicon-folder-close', 'desc' => '请输入图标代码', 'match' => 'is_string', //'option' => $icon, 'update' => 'text', ), 'fast' => array ( 'type' => 'tinyint-1', 'name' => '是否快捷菜单', 'default' => '2', 'desc' => '请选择快捷菜单', 'match' => 'is_numeric', 'option' => $fast, 'update' => 'radio', 'list' => true, 'edit' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), 'manage' => array ( # 列表页的类型 'list_type' => 'tree', 'list_button' => array ( 'update' => '编辑', 'add' => array('新增子菜单', '"{menu}" == -1 ? "menu&option_menu={id}" : "menu&option_menu={menu},{id}"'), 'delete' => '删除', ), 'button' => array ( '更新菜单' => 'manage/menu.update', '菜单分组' => array('location', 'manage/project/database/list&project=manage&table=menu_group'), //'全部清空' => 'manage/menu.delete', ), # 每页显示条数,第一个为默认值 'num' => array(30,50,100), ), # request 请求接口定义 'request' => array ( 'getAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'menu_id' => 'yes', 'id' => array('yes', '!='), 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'asc'), 'col' => 'id as value, name', ), # info 取一条正常的数据 'info' => array ( 'where' => array ( 'id' => 'is_numeric', 'state' => 1, ), 'type' => 'one', ), 'key' => array ( 'where' => array ( 'key' => 'yes', ), 'type' => 'one', ), 'keyId' => array ( 'where' => array ( 'key' => 'yes', 'id' => array('yes', '!='), ), 'type' => 'one', ), # 取所有菜单 'all' => array ( 'type' => 'all', 'order' => array('reorder` desc,`id', 'desc'), 'col' => '*|id', ), # main 取所有子菜单 'child' => array ( 'where' => array ( 'state' => 1, 'menu_id' => array(1, '>='), ), 'type' => 'all', 'order' => array('reorder` desc,`id', 'desc'), 'col' => '*|menu_id|key|', ), # main 取所有一级菜单 'main' => array ( 'where' => array ( 'state' => 1, 'menu_id' => -1, ), 'option' => array ( 'key' => array('yes', 'in'), ), 'type' => 'all', 'order' => array('reorder` desc,`id', 'desc'), 'col' => '*|key', ), # main 取所有一级菜单 'get' => array ( 'where' => array ( 'state' => 1, 'menu_id' => -1, ), 'type' => 'all', 'order' => array('reorder` desc,`id', 'desc'), 'col' => '*|id', ), # in测试in 'in' => array ( 'where' => array ( 'id' => array('yes', 'in'), ), 'type' => 'all', //'order' => array('id' => 'desc'), ), ), );