mirror of https://gitee.com/karson/fastadmin.git
Merge remote-tracking branch 'upstream/master'
commit
fbe1b0c12e
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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__');
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ return [
|
|||
'Cancel' => '取消',
|
||||
'Loading' => '加载中',
|
||||
'More' => '更多',
|
||||
'Yes' => '是',
|
||||
'No' => '否',
|
||||
'Normal' => '正常',
|
||||
'Hidden' => '隐藏',
|
||||
'Submit' => '提交',
|
||||
|
|
|
|||
|
|
@ -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来生成',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
{:__('If not necessary, use the command line to build rule')}
|
||||
</div>
|
||||
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
|
||||
<div class="form-group">
|
||||
<label for="content" class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -1,22 +1,28 @@
|
|||
<form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action="">
|
||||
<div class="form-group">
|
||||
<label for="content" class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pid" class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control selectpicker', 'required'=>''])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="action" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="text" class="form-control" id="title" name="row[title]" value="{$row.title}" required="required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="text" class="form-control" id="name" name="row[name]" value="{$row.name}" required="required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="action" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="text" class="form-control" id="title" name="row[title]" value="{$row.title}" required="required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="icon" class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -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: '<a href="javascript:;" class="btn btn-primary btn-xs btn-toggle"><i class="fa fa-chevron-down"></i></a>', formatter: Controller.api.formatter.subnode},
|
||||
|
|
|
|||
Loading…
Reference in New Issue