diff --git a/application/admin/model/AuthRule.php b/application/admin/model/AuthRule.php index bebb1df8..154da5d8 100644 --- a/application/admin/model/AuthRule.php +++ b/application/admin/model/AuthRule.php @@ -36,6 +36,19 @@ class AuthRule extends Base return $this->where('id',$value)->value('title'); } - + + // 获取二级菜单 + public function getMymenuAttr($value) + { + return $this + ->where('pid',$this->getAttr('id')) + ->where('status&ismenu',1) + ->field('title,url') + ->order(['paixu']) + ->select(); + } + + + } diff --git a/application/common/validate/School.php b/application/common/validate/School.php new file mode 100644 index 00000000..1527ed2d --- /dev/null +++ b/application/common/validate/School.php @@ -0,0 +1,24 @@ + ['规则1','规则2'...] + * + * @var array + */ + protected $rule = []; + + /** + * 定义错误信息 + * 格式:'字段名.规则名' => '错误信息' + * + * @var array + */ + protected $message = []; +} diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index 039acbf1..238b8938 100644 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -77,92 +77,29 @@ {load href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /}
diff --git a/application/system/controller/School.php b/application/system/controller/School.php new file mode 100644 index 00000000..ad46618c --- /dev/null +++ b/application/system/controller/School.php @@ -0,0 +1,85 @@ + 'require|chs|length:2,8', + 'paixu|排序' => 'number|max:999', + ]; /** * 定义错误信息 diff --git a/application/system/view/category/create.html b/application/system/view/category/create.html index ca710219..e3d2492c 100644 --- a/application/system/view/category/create.html +++ b/application/system/view/category/create.html @@ -58,12 +58,7 @@ title:{ required:true, zh:true, - rangelength:[2,6] - }, - name:{ - required:true, - ustr:true, - rangelength:[1,80] + rangelength:[2,8] }, paixu:{ digits:true, diff --git a/application/system/view/category/edit.html b/application/system/view/category/edit.html index 99dd7007..c4419132 100644 --- a/application/system/view/category/edit.html +++ b/application/system/view/category/edit.html @@ -60,11 +60,6 @@ zh:true, rangelength:[2,6] }, - name:{ - required:true, - ustr:true, - rangelength:[1,80] - }, paixu:{ digits:true, max:999 diff --git a/database/migrations/20181025041505_category.php b/database/migrations/20181025041505_category.php index 545a04b4..5cb91d73 100644 --- a/database/migrations/20181025041505_category.php +++ b/database/migrations/20181025041505_category.php @@ -36,7 +36,7 @@ class Category extends Migrator ->addColumn('title','string',['limit'=>15,'null'=>false,'comment'=>'类型标题']) ->addColumn('pid','integer',['limit'=>4,'default'=>'0','null'=>false,'comment'=>'父级ID']) ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('paixu','integer',['limit'=>4,'default'=>'99','null'=>false,'comment'=>'排序']) + ->addColumn('paixu','integer',['limit'=>4,'default'=>'999','null'=>false,'comment'=>'排序']) ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) ->addIndex(array('title'), array('unique' => true)) diff --git a/database/migrations/20181026002455_school.php b/database/migrations/20181026002455_school.php new file mode 100644 index 00000000..d5ec20a5 --- /dev/null +++ b/database/migrations/20181026002455_school.php @@ -0,0 +1,33 @@ +1,'title'=>'系统管理','name' =>'system','paixu' =>5,'ismenu'=>true,'font' =>'ui-iconfont-system'], - ['id'=>2,'title' =>'管理员管理','name'=>'admin','paixu' =>4,'ismenu' =>true,'font'=>'.Hui-iconfont-root'], + ['id'=>1,'title'=>'系统管理','name' =>'system','paixu' =>5,'ismenu'=>true,'font' =>'Hui-iconfont-system'], + ['id'=>2,'title' =>'管理员管理','name'=>'admin','paixu' =>4,'ismenu' =>true,'font'=>'Hui-iconfont-root'], // 二级菜单 // 系统设置 - ['id'=>11,'title'=>'系统设置','name'=>'system/SystemBase/index','paixu'=>1,'ismenu' =>true,'pid' =>1,'url'=>'/sysbase',], + ['id'=>11,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>true,'pid' =>1,'url'=>'/category',], + ['id'=>12,'title'=>'单位管理','name'=>'system/School/index','paixu'=>2,'ismenu' =>true,'pid' =>1,'url'=>'/school',], + ['id'=>13,'title'=>'系统设置','name'=>'system/SystemBase/index','paixu'=>3,'ismenu' =>true,'pid' =>1,'url'=>'/sysbase',], // 管理员管理 ['id'=>21,'title'=>'管理员列表','name'=>'admin/Index/index','paixu'=>1,'ismenu' =>true,'pid' =>2,'url'=>'/admin',], ['id'=>22,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>true,'pid' =>2,'url'=>'/authrule',], ['id'=>23,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>true,'pid' =>2,'url'=>'/authgroup',], + + // 系统设置 + // 类别管理权限 + ['title'=>'添加','name'=>'system/Category/create','paixu' =>1,'pid'=>11], + ['title'=>'删除','name'=>'system/Category/delete','paixu'=>2,'pid'=>11], + ['title'=>'编辑','name'=>'system/Category/edit','paixu'=>3,'pid'=>11,], + ['title'=>'查看','name'=>'system/Category/read','paixu'=>4,'pid'=>11,], + ['title'=>'状态','name'=>'system/Category/status','paixu'=>5,'pid'=>11], + // 类别管理权限 + ['title'=>'添加','name'=>'system/School/create','paixu' =>1,'pid'=>12], + ['title'=>'删除','name'=>'system/School/delete','paixu'=>2,'pid'=>12], + ['title'=>'编辑','name'=>'system/School/edit','paixu'=>3,'pid'=>12,], + ['title'=>'查看','name'=>'system/School/read','paixu'=>4,'pid'=>12,], + ['title'=>'状态','name'=>'system/School/status','paixu'=>5,'pid'=>12], + + + //管理员管理 // 管理员列表权限 ['title'=>'添加','name'=>'admin/Index/create','paixu' =>1,'pid'=>21], ['title'=>'删除','name'=>'admin/Index/delete','paixu'=>2,'pid'=>21], diff --git a/database/seeds/School.php b/database/seeds/School.php new file mode 100644 index 00000000..6c096a67 --- /dev/null +++ b/database/seeds/School.php @@ -0,0 +1,19 @@ +