diff --git a/application/admin/command/Install/fastadmin.sql b/application/admin/command/Install/fastadmin.sql index 75a63a1d..ebb4d065 100644 --- a/application/admin/command/Install/fastadmin.sql +++ b/application/admin/command/Install/fastadmin.sql @@ -155,7 +155,7 @@ CREATE TABLE `fa_auth_rule` ( `ismenu` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单', `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', - `weigh` int(10) NOT NULL COMMENT '权重', + `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) USING BTREE, diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index b006bef7..ed559005 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -29,6 +29,8 @@ class Rule extends Backend $ruledata = [0 => __('None')]; foreach ($this->rulelist as $k => $v) { + if (!$v['ismenu']) + continue; $ruledata[$v['id']] = $v['title']; } $this->view->assign('ruledata', $ruledata); @@ -62,6 +64,11 @@ class Rule extends Backend $params = $this->request->post("row/a"); if ($params) { + if (!$params['ismenu'] && !$params['pid']) + { + $this->msg = __('The non-menu rule must have parent'); + return; + } $this->model->create($params); AdminLog::record(__('Add'), $this->model->getLastInsID()); Cache::rm('__menu__'); @@ -87,6 +94,11 @@ class Rule extends Backend $params = $this->request->post("row/a"); if ($params) { + if (!$params['ismenu'] && !$params['pid']) + { + $this->msg = __('The non-menu rule must have parent'); + return; + } $row->save($params); AdminLog::record(__('Edit'), $ids); Cache::rm('__menu__'); diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 1fdbb046..4e3c034e 100644 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -30,6 +30,8 @@ return [ 'Cancel' => '取消', 'Loading' => '加载中', 'More' => '更多', + 'Yes' => '是', + 'No' => '否', 'Normal' => '正常', 'Hidden' => '隐藏', 'Submit' => '提交', diff --git a/application/admin/lang/zh-cn/auth/rule.php b/application/admin/lang/zh-cn/auth/rule.php index d173e4d5..b1b7694c 100644 --- a/application/admin/lang/zh-cn/auth/rule.php +++ b/application/admin/lang/zh-cn/auth/rule.php @@ -2,9 +2,12 @@ return [ 'Toggle all' => '显示全部', - 'Condition' => '条件', + 'Condition' => '规则条件', 'Remark' => '备注', 'Icon' => '图标', 'Alert' => '警告', - 'If not necessary, use the command line to build rule' => '非必要情况下请使用命令行来生成', + 'Name' => '规则URL', + 'Ismenu' => '菜单', + 'The non-menu rule must have parent' => '非菜单规则节点必须有父级', + 'If not necessary, use the command line to build rule' => '非必要情况下请直接使用命令行php think menu来生成', ]; diff --git a/application/admin/view/auth/rule/add.html b/application/admin/view/auth/rule/add.html index 469289ae..960291d8 100644 --- a/application/admin/view/auth/rule/add.html +++ b/application/admin/view/auth/rule/add.html @@ -3,6 +3,12 @@ {:__('If not necessary, use the command line to build rule')}
+
+ +
+ {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])} +
+
diff --git a/application/admin/view/auth/rule/edit.html b/application/admin/view/auth/rule/edit.html index 61bee4e5..42138ff2 100644 --- a/application/admin/view/auth/rule/edit.html +++ b/application/admin/view/auth/rule/edit.html @@ -1,22 +1,28 @@ +
+ +
+ {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])} +
+
{:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control selectpicker', 'required'=>''])}
-
- -
- -
-
+
+ +
+ +
+
diff --git a/public/assets/js/backend/auth/rule.js b/public/assets/js/backend/auth/rule.js index a103402c..9755cfcb 100755 --- a/public/assets/js/backend/auth/rule.js +++ b/public/assets/js/backend/auth/rule.js @@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function {field: 'title', title: __('Title'), align: 'left'}, {field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon}, {field: 'name', title: __('Name'), align: 'left'}, + {field: 'ismenu', title: __('Ismenu'), align: 'left'}, {field: 'weigh', title: __('Weigh')}, {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, {field: 'id', title: '', formatter: Controller.api.formatter.subnode},