From 25c8177bdc13bebc1097571d8fdea6323438a98b Mon Sep 17 00:00:00 2001 From: Karson Date: Sat, 6 May 2017 16:10:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E7=94=9F=E6=88=90menu=E6=97=B6=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E7=94=9F=E6=88=90=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Install/fastadmin.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From a5355f4d5db157882c00df105a32022529452510 Mon Sep 17 00:00:00 2001 From: Karson Date: Sun, 7 May 2017 09:53:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=BE=91=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20=E4=BF=AE=E5=A4=8D=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E8=AF=AD=E8=A8=80=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Rule.php | 12 ++++++++++++ application/admin/lang/zh-cn.php | 2 ++ application/admin/lang/zh-cn/auth/rule.php | 7 +++++-- application/admin/view/auth/rule/add.html | 6 ++++++ application/admin/view/auth/rule/edit.html | 18 ++++++++++++------ public/assets/js/backend/auth/rule.js | 1 + 6 files changed, 38 insertions(+), 8 deletions(-) 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 3bfe0da0..1e9153b3 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},