Merge remote-tracking branch 'upstream/master'
正在显示
7 个修改的文件
包含
37 行增加
和
7 行删除
@@ -155,7 +155,7 @@ CREATE TABLE `fa_auth_rule` ( | @@ -155,7 +155,7 @@ CREATE TABLE `fa_auth_rule` ( | ||
155 | `ismenu` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单', | 155 | `ismenu` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单', |
156 | `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', | 156 | `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', |
157 | `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', | 157 | `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', |
158 | - `weigh` int(10) NOT NULL COMMENT '权重', | 158 | + `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重', |
159 | `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', | 159 | `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', |
160 | PRIMARY KEY (`id`), | 160 | PRIMARY KEY (`id`), |
161 | UNIQUE KEY `name` (`name`) USING BTREE, | 161 | UNIQUE KEY `name` (`name`) USING BTREE, |
@@ -29,6 +29,8 @@ class Rule extends Backend | @@ -29,6 +29,8 @@ class Rule extends Backend | ||
29 | $ruledata = [0 => __('None')]; | 29 | $ruledata = [0 => __('None')]; |
30 | foreach ($this->rulelist as $k => $v) | 30 | foreach ($this->rulelist as $k => $v) |
31 | { | 31 | { |
32 | + if (!$v['ismenu']) | ||
33 | + continue; | ||
32 | $ruledata[$v['id']] = $v['title']; | 34 | $ruledata[$v['id']] = $v['title']; |
33 | } | 35 | } |
34 | $this->view->assign('ruledata', $ruledata); | 36 | $this->view->assign('ruledata', $ruledata); |
@@ -62,6 +64,11 @@ class Rule extends Backend | @@ -62,6 +64,11 @@ class Rule extends Backend | ||
62 | $params = $this->request->post("row/a"); | 64 | $params = $this->request->post("row/a"); |
63 | if ($params) | 65 | if ($params) |
64 | { | 66 | { |
67 | + if (!$params['ismenu'] && !$params['pid']) | ||
68 | + { | ||
69 | + $this->msg = __('The non-menu rule must have parent'); | ||
70 | + return; | ||
71 | + } | ||
65 | $this->model->create($params); | 72 | $this->model->create($params); |
66 | AdminLog::record(__('Add'), $this->model->getLastInsID()); | 73 | AdminLog::record(__('Add'), $this->model->getLastInsID()); |
67 | Cache::rm('__menu__'); | 74 | Cache::rm('__menu__'); |
@@ -87,6 +94,11 @@ class Rule extends Backend | @@ -87,6 +94,11 @@ class Rule extends Backend | ||
87 | $params = $this->request->post("row/a"); | 94 | $params = $this->request->post("row/a"); |
88 | if ($params) | 95 | if ($params) |
89 | { | 96 | { |
97 | + if (!$params['ismenu'] && !$params['pid']) | ||
98 | + { | ||
99 | + $this->msg = __('The non-menu rule must have parent'); | ||
100 | + return; | ||
101 | + } | ||
90 | $row->save($params); | 102 | $row->save($params); |
91 | AdminLog::record(__('Edit'), $ids); | 103 | AdminLog::record(__('Edit'), $ids); |
92 | Cache::rm('__menu__'); | 104 | Cache::rm('__menu__'); |
@@ -30,6 +30,8 @@ return [ | @@ -30,6 +30,8 @@ return [ | ||
30 | 'Cancel' => '取消', | 30 | 'Cancel' => '取消', |
31 | 'Loading' => '加载中', | 31 | 'Loading' => '加载中', |
32 | 'More' => '更多', | 32 | 'More' => '更多', |
33 | + 'Yes' => '是', | ||
34 | + 'No' => '否', | ||
33 | 'Normal' => '正常', | 35 | 'Normal' => '正常', |
34 | 'Hidden' => '隐藏', | 36 | 'Hidden' => '隐藏', |
35 | 'Submit' => '提交', | 37 | 'Submit' => '提交', |
@@ -2,9 +2,12 @@ | @@ -2,9 +2,12 @@ | ||
2 | 2 | ||
3 | return [ | 3 | return [ |
4 | 'Toggle all' => '显示全部', | 4 | 'Toggle all' => '显示全部', |
5 | - 'Condition' => '条件', | 5 | + 'Condition' => '规则条件', |
6 | 'Remark' => '备注', | 6 | 'Remark' => '备注', |
7 | 'Icon' => '图标', | 7 | 'Icon' => '图标', |
8 | 'Alert' => '警告', | 8 | 'Alert' => '警告', |
9 | - 'If not necessary, use the command line to build rule' => '非必要情况下请使用命令行来生成', | 9 | + 'Name' => '规则URL', |
10 | + 'Ismenu' => '菜单', | ||
11 | + 'The non-menu rule must have parent' => '非菜单规则节点必须有父级', | ||
12 | + 'If not necessary, use the command line to build rule' => '非必要情况下请直接使用命令行php think menu来生成', | ||
10 | ]; | 13 | ]; |
@@ -4,6 +4,12 @@ | @@ -4,6 +4,12 @@ | ||
4 | </div> | 4 | </div> |
5 | <form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action=""> | 5 | <form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action=""> |
6 | <div class="form-group"> | 6 | <div class="form-group"> |
7 | + <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label> | ||
8 | + <div class="col-xs-12 col-sm-8"> | ||
9 | + {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])} | ||
10 | + </div> | ||
11 | + </div> | ||
12 | + <div class="form-group"> | ||
7 | <label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label> | 13 | <label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label> |
8 | <div class="col-xs-12 col-sm-8"> | 14 | <div class="col-xs-12 col-sm-8"> |
9 | {:build_select('row[pid]', $ruledata, null, ['class'=>'form-control selectpicker', 'required'=>''])} | 15 | {:build_select('row[pid]', $ruledata, null, ['class'=>'form-control selectpicker', 'required'=>''])} |
1 | <form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action=""> | 1 | <form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action=""> |
2 | <div class="form-group"> | 2 | <div class="form-group"> |
3 | - <label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label> | 3 | + <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label> |
4 | <div class="col-xs-12 col-sm-8"> | 4 | <div class="col-xs-12 col-sm-8"> |
5 | - {:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control selectpicker', 'required'=>''])} | 5 | + {:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])} |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | <div class="form-group"> | 8 | <div class="form-group"> |
9 | - <label for="action" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | 9 | + <label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label> |
10 | <div class="col-xs-12 col-sm-8"> | 10 | <div class="col-xs-12 col-sm-8"> |
11 | - <input type="text" class="form-control" id="title" name="row[title]" value="{$row.title}" required="required" /> | 11 | + {:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control selectpicker', 'required'=>''])} |
12 | </div> | 12 | </div> |
13 | </div> | 13 | </div> |
14 | <div class="form-group"> | 14 | <div class="form-group"> |
@@ -18,6 +18,12 @@ | @@ -18,6 +18,12 @@ | ||
18 | </div> | 18 | </div> |
19 | </div> | 19 | </div> |
20 | <div class="form-group"> | 20 | <div class="form-group"> |
21 | + <label for="action" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
22 | + <div class="col-xs-12 col-sm-8"> | ||
23 | + <input type="text" class="form-control" id="title" name="row[title]" value="{$row.title}" required="required" /> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + <div class="form-group"> | ||
21 | <label for="icon" class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label> | 27 | <label for="icon" class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label> |
22 | <div class="col-xs-12 col-sm-8"> | 28 | <div class="col-xs-12 col-sm-8"> |
23 | <div class="input-group input-groupp-md"> | 29 | <div class="input-group input-groupp-md"> |
@@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function | @@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function | ||
30 | {field: 'title', title: __('Title'), align: 'left'}, | 30 | {field: 'title', title: __('Title'), align: 'left'}, |
31 | {field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon}, | 31 | {field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon}, |
32 | {field: 'name', title: __('Name'), align: 'left'}, | 32 | {field: 'name', title: __('Name'), align: 'left'}, |
33 | + {field: 'ismenu', title: __('Ismenu'), align: 'left'}, | ||
33 | {field: 'weigh', title: __('Weigh')}, | 34 | {field: 'weigh', title: __('Weigh')}, |
34 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, | 35 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, |
35 | {field: 'id', title: '<a href="javascript:;" class="btn btn-primary btn-xs btn-toggle"><i class="fa fa-chevron-down"></i></a>', formatter: Controller.api.formatter.subnode}, | 36 | {field: 'id', title: '<a href="javascript:;" class="btn btn-primary btn-xs btn-toggle"><i class="fa fa-chevron-down"></i></a>', formatter: Controller.api.formatter.subnode}, |
-
请 注册 或 登录 后发表评论