提交api控制器
This commit is contained in:
parent
40abf15a0a
commit
b2966c0070
12
application/admin/lang/zh-cn/auth/api/group.php
Normal file
12
application/admin/lang/zh-cn/auth/api/group.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'The parent group can not be its own child' => '父组别不能是自身的子组别',
|
||||||
|
'The parent group can not found' => '父组别未找到',
|
||||||
|
'Group not found' => '组别未找到',
|
||||||
|
'Can not change the parent to child' => '父组别不能是它的子组别',
|
||||||
|
'Can not change the parent to self' => '父组别不能是它自己',
|
||||||
|
'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组',
|
||||||
|
'The parent group exceeds permission limit' => '父组别超出权限范围',
|
||||||
|
'The parent group can not be its own child or itself' => '父组别不能是它的子组别及本身',
|
||||||
|
];
|
29
application/admin/lang/zh-cn/auth/api/rule.php
Normal file
29
application/admin/lang/zh-cn/auth/api/rule.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Toggle all' => '显示全部',
|
||||||
|
'Condition' => '规则条件',
|
||||||
|
'Remark' => '备注',
|
||||||
|
'Icon' => '图标',
|
||||||
|
'Alert' => '警告',
|
||||||
|
'Name' => '规则',
|
||||||
|
'Controller/Action' => '控制器名/方法名',
|
||||||
|
'Ismenu' => '菜单',
|
||||||
|
'Menutype' => '菜单类型',
|
||||||
|
'Addtabs' => '选项卡(默认)',
|
||||||
|
'Dialog' => '弹窗',
|
||||||
|
'Ajax' => 'Ajax请求',
|
||||||
|
'Blank' => '链接',
|
||||||
|
'Extend' => '扩展属性',
|
||||||
|
'Search icon' => '搜索图标',
|
||||||
|
'Toggle menu visible' => '点击切换菜单显示',
|
||||||
|
'Toggle sub menu' => '点击切换子菜单',
|
||||||
|
'Menu tips' => '父级菜单无需匹配控制器和方法,子级菜单请使用控制器名',
|
||||||
|
'Node tips' => '控制器/方法名,如果有目录请使用 目录名/控制器名/方法名',
|
||||||
|
'Url tips' => '一般情况下留空即可,如果是外部链接或相对链接请输入',
|
||||||
|
'The non-menu rule must have parent' => '非菜单规则节点必须有父级',
|
||||||
|
'Can not change the parent to child' => '父级不能是它的子级',
|
||||||
|
'Can not change the parent to self' => '父级不能是它自己',
|
||||||
|
'Name only supports letters, numbers, underscore and slash' => 'URL规则只能是小写字母、数字、下划线和/组成',
|
||||||
|
'Rule_name' => '权限标识(菜单需要)',
|
||||||
|
];
|
27
application/admin/view/auth/api/adminlog/detail.html
Normal file
27
application/admin/view/auth/api/adminlog/detail.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<style>
|
||||||
|
.table-adminlog tr td {
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<table class="table table-striped table-adminlog">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="100">{:__('Title')}</th>
|
||||||
|
<th>{:__('Content')}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{volist name="row" id="vo" }
|
||||||
|
<tr>
|
||||||
|
<td>{:__($key)}</td>
|
||||||
|
<td>{if $key=='createtime'}{$vo|datetime}{else/}{$vo|htmlentities}{/if}</td>
|
||||||
|
</tr>
|
||||||
|
{/volist}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="hide layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
21
application/admin/view/auth/api/adminlog/index.html
Normal file
21
application/admin/view/auth/api/adminlog/index.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
{:build_toolbar('refresh,delete')}
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-detail="{:$auth->check('auth/api/adminlog/index')}"
|
||||||
|
data-operate-del="{:$auth->check('auth/api/adminlog/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
38
application/admin/view/auth/api/group/add.html
Normal file
38
application/admin/view/auth/api/group/add.html
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
{:token()}
|
||||||
|
<input type="hidden" name="row[rules]" value="" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_select('row[pid]', $groupdata, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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="" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Permission')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><span>{:__('Check all')}</span></label></span>
|
||||||
|
<span class="text-muted"><input type="checkbox" name="" id="expandall" /> <label for="expandall"><span>{:__('Expand all')}</span></label></span>
|
||||||
|
|
||||||
|
<div id="treeview"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group hidden layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
38
application/admin/view/auth/api/group/edit.html
Normal file
38
application/admin/view/auth/api/group/edit.html
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action="">
|
||||||
|
{:token()}
|
||||||
|
<input type="hidden" name="row[rules]" value="" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_select('row[pid]', $groupdata, $row['pid'], ['class'=>'form-control selectpicker', 'data-rule'=>'required', 'data-id'=>$row['id'], 'data-pid'=>$row['pid']])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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|htmlentities}" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Permission')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><span>{:__('Check all')}</span></label></span>
|
||||||
|
<span class="text-muted"><input type="checkbox" name="" id="expandall" /> <label for="expandall"><span>{:__('Expand all')}</span></label></span>
|
||||||
|
|
||||||
|
<div id="treeview"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group hidden layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2 col-xs-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
21
application/admin/view/auth/api/group/index.html
Normal file
21
application/admin/view/auth/api/group/index.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
{:build_toolbar('refresh,add,delete')}
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('auth/api/group/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('auth/api/group/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
96
application/admin/view/auth/api/rule/add.html
Normal file
96
application/admin/view/auth/api/rule/add.html
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
{:token()}
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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 class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_select('row[pid]', $ruledata, null, ['class'=>'form-control', '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]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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="" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="url" name="row[url]" value="" data-rule="" placeholder="{:__('Url tips')}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Rule_name')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="rule_name" name="row[rule_name]" value="" data-rule="" placeholder="输入的权限标识(菜单需要)" />
|
||||||
|
</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">
|
||||||
|
<div class="input-group input-groupp-md">
|
||||||
|
<span class="input-group-addon"><i class="fa fa-circle-o" id="icon-style"></i></span>
|
||||||
|
<input type="text" class="form-control" id="icon" name="row[icon]" value="fa fa-circle-o" />
|
||||||
|
<a href="javascript:;" class="btn-search-icon input-group-addon">{:__('Search icon')}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Condition')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="condition" name="row[condition]"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Menutype')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[menutype]', $menutypeList)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="extend" name="row[extend]"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="remark" name="row[remark]"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="weigh" name="row[weigh]" value="0" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group hidden layer-footer">
|
||||||
|
<div class="col-xs-2"></div>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{include file="auth/api/rule/tpl" /}
|
99
application/admin/view/auth/api/rule/edit.html
Normal file
99
application/admin/view/auth/api/rule/edit.html
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action="">
|
||||||
|
{:token()}
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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 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', '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]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="{$row.name|htmlentities}" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label 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|htmlentities}" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="url" name="row[url]" value="{$row.url|htmlentities}" data-rule="" placeholder="{:__('Url tips')}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Rule_name')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="rule_name" name="row[rule_name]" value="{$row.rule_name|htmlentities}" data-rule="" placeholder="输入的权限标识(菜单需要)" />
|
||||||
|
</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">
|
||||||
|
<div class="input-group input-groupp-md">
|
||||||
|
<span class="input-group-addon"><i class="{$row.icon|htmlentities}" id="icon-style"></i></span>
|
||||||
|
<input type="text" class="form-control" id="icon" name="row[icon]" value="{$row.icon|htmlentities}" />
|
||||||
|
<a href="javascript:;" class="btn-search-icon input-group-addon">{:__('Search icon')}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Condition')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="condition" name="row[condition]">{$row.condition|htmlentities}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Menutype')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[menutype]', $menutypeList, $row['menutype'])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" data-type="menu">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="extend" name="row[extend]">{$row.extend|htmlentities}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea class="form-control" id="remark" name="row[remark]">{$row.remark|__|htmlentities}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="weigh" name="row[weigh]" value="{$row.weigh|htmlentities}" data-rule="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group hidden layer-footer">
|
||||||
|
<div class="col-xs-2"></div>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{include file="auth/api/rule/tpl" /}
|
35
application/admin/view/auth/api/rule/index.html
Normal file
35
application/admin/view/auth/api/rule/index.html
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<style>
|
||||||
|
.bootstrap-table tr td .text-muted {color:#888;}
|
||||||
|
</style>
|
||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false"><i class="fa fa-refresh"></i> </a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('auth/api/rule/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('auth/api/rule/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('auth/api/rule/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
<div class="dropdown btn-group {:$auth->check('auth/api/rule/multi')?'':'hide'}">
|
||||||
|
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||||
|
<ul class="dropdown-menu text-left" role="menu">
|
||||||
|
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
|
||||||
|
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-bordered table-hover"
|
||||||
|
data-operate-edit="{:$auth->check('auth/api/rule/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('auth/api/rule/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
43
application/admin/view/auth/api/rule/tpl.html
Normal file
43
application/admin/view/auth/api/rule/tpl.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<style>
|
||||||
|
#chooseicon {
|
||||||
|
margin:10px;
|
||||||
|
}
|
||||||
|
#chooseicon ul {
|
||||||
|
margin:5px 0 0 0;
|
||||||
|
}
|
||||||
|
#chooseicon ul li{
|
||||||
|
width:41px;height:42px;
|
||||||
|
line-height:42px;
|
||||||
|
border:1px solid #efefef;
|
||||||
|
padding:1px;
|
||||||
|
margin:1px;
|
||||||
|
text-align: center;
|
||||||
|
font-size:18px;
|
||||||
|
}
|
||||||
|
#chooseicon ul li:hover{
|
||||||
|
border:1px solid #2c3e50;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script id="chooseicontpl" type="text/html">
|
||||||
|
<div id="chooseicon">
|
||||||
|
<div>
|
||||||
|
<form onsubmit="return false;">
|
||||||
|
<div class="input-group input-groupp-md">
|
||||||
|
<div class="input-group-addon">{:__('Search icon')}</div>
|
||||||
|
<input class="js-icon-search form-control" type="text" placeholder="">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="list-inline">
|
||||||
|
<% for(var i=0; i<iconlist.length; i++){ %>
|
||||||
|
<li data-font="<%=iconlist[i]%>" data-toggle="tooltip" title="<%=iconlist[i]%>">
|
||||||
|
<i class="fa fa-<%=iconlist[i]%>"></i>
|
||||||
|
</li>
|
||||||
|
<% } %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</script>
|
64
public/assets/js/backend/auth/api/adminlog.js
Normal file
64
public/assets/js/backend/auth/api/adminlog.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||||
|
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: 'auth/api/adminlog/index',
|
||||||
|
add_url: '',
|
||||||
|
edit_url: '',
|
||||||
|
del_url: 'auth/api/adminlog/del',
|
||||||
|
multi_url: 'auth/api/adminlog/multi',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
fixedColumns: true,
|
||||||
|
fixedRightNumber: 1,
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{field: 'state', checkbox: true,},
|
||||||
|
{field: 'id', title: 'ID', operate: false},
|
||||||
|
{field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false},
|
||||||
|
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||||
|
{field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索'},
|
||||||
|
{field: 'url', title: __('Url'), formatter: Table.api.formatter.url},
|
||||||
|
{field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search},
|
||||||
|
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||||
|
{
|
||||||
|
field: 'operate', title: __('Operate'), table: table,
|
||||||
|
events: Table.api.events.operate,
|
||||||
|
buttons: [{
|
||||||
|
name: 'detail',
|
||||||
|
text: __('Detail'),
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
classname: 'btn btn-info btn-xs btn-detail btn-dialog',
|
||||||
|
url: 'auth/api/adminlog/detail'
|
||||||
|
}],
|
||||||
|
formatter: Table.api.formatter.operate
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
|
formatter: {
|
||||||
|
browser: function (value, row, index) {
|
||||||
|
return '<a class="btn btn-xs btn-browser">' + row.useragent.split(" ")[0] + '</a>';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
160
public/assets/js/backend/auth/api/group.js
Normal file
160
public/assets/js/backend/auth/api/group.js
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, undefined) {
|
||||||
|
//读取选中的条目
|
||||||
|
$.jstree.core.prototype.get_all_checked = function (full) {
|
||||||
|
var obj = this.get_selected(), i, j;
|
||||||
|
for (i = 0, j = obj.length; i < j; i++) {
|
||||||
|
obj = obj.concat(this.get_node(obj[i]).parents);
|
||||||
|
}
|
||||||
|
obj = $.grep(obj, function (v, i, a) {
|
||||||
|
return v != '#';
|
||||||
|
});
|
||||||
|
obj = obj.filter(function (itm, i, a) {
|
||||||
|
return i == a.indexOf(itm);
|
||||||
|
});
|
||||||
|
return full ? $.map(obj, $.proxy(function (i) {
|
||||||
|
return this.get_node(i);
|
||||||
|
}, this)) : obj;
|
||||||
|
};
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
"index_url": "auth/api/group/index",
|
||||||
|
"add_url": "auth/api/group/add",
|
||||||
|
"edit_url": "auth/api/group/edit",
|
||||||
|
"del_url": "auth/api/group/del",
|
||||||
|
"multi_url": "auth/api/group/multi",
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
//在表格内容渲染完成后回调的事件
|
||||||
|
table.on('post-body.bs.table', function (e, json) {
|
||||||
|
$("tbody tr[data-index]", this).each(function () {
|
||||||
|
if (Config.admin.group_ids.indexOf(parseInt(parseInt($("td:eq(1)", this).text()))) > -1) {
|
||||||
|
$("input[type=checkbox]", this).prop("disabled", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{field: 'state', checkbox: true,},
|
||||||
|
{field: 'id', title: 'ID'},
|
||||||
|
{field: 'pid', title: __('Parent')},
|
||||||
|
{field: 'name', title: __('Name'), align: 'left', formatter:function (value, row, index) {
|
||||||
|
return value.toString().replace(/(&|&)nbsp;/g, ' ');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||||
|
{
|
||||||
|
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
|
||||||
|
if (Config.admin.group_ids.indexOf(parseInt(row.id)) > -1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return Table.api.formatter.operate.call(this, value, row, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
pagination: false,
|
||||||
|
search: false,
|
||||||
|
commonSearch: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);//当内容渲染完成后
|
||||||
|
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"), null, null, function () {
|
||||||
|
if ($("#treeview").length > 0) {
|
||||||
|
var r = $("#treeview").jstree("get_all_checked");
|
||||||
|
$("input[name='row[rules]']").val(r.join(','));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
//渲染权限节点树
|
||||||
|
//变更级别后需要重建节点树
|
||||||
|
$(document).on("change", "select[name='row[pid]']", function () {
|
||||||
|
var pid = $(this).data("pid");
|
||||||
|
var id = $(this).data("id");
|
||||||
|
if ($(this).val() == id) {
|
||||||
|
$("option[value='" + pid + "']", this).prop("selected", true).change();
|
||||||
|
Backend.api.toastr.error(__('Can not change the parent to self'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: "auth/api/group/roletree",
|
||||||
|
type: 'post',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {id: id, pid: $(this).val()},
|
||||||
|
success: function (ret) {
|
||||||
|
if (ret.hasOwnProperty("code")) {
|
||||||
|
var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : "";
|
||||||
|
if (ret.code === 1) {
|
||||||
|
//销毁已有的节点树
|
||||||
|
$("#treeview").jstree("destroy");
|
||||||
|
Controller.api.rendertree(data);
|
||||||
|
} else {
|
||||||
|
Backend.api.toastr.error(ret.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, error: function (e) {
|
||||||
|
Backend.api.toastr.error(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//全选和展开
|
||||||
|
$(document).on("click", "#checkall", function () {
|
||||||
|
$("#treeview").jstree($(this).prop("checked") ? "check_all" : "uncheck_all");
|
||||||
|
});
|
||||||
|
$(document).on("click", "#expandall", function () {
|
||||||
|
$("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all");
|
||||||
|
});
|
||||||
|
$("select[name='row[pid]']").trigger("change");
|
||||||
|
},
|
||||||
|
rendertree: function (content) {
|
||||||
|
$("#treeview")
|
||||||
|
.on('redraw.jstree', function (e) {
|
||||||
|
$(".layer-footer").attr("domrefresh", Math.random());
|
||||||
|
})
|
||||||
|
.jstree({
|
||||||
|
"themes": {"stripes": true},
|
||||||
|
"checkbox": {
|
||||||
|
"keep_selected_style": false,
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"root": {
|
||||||
|
"icon": "fa fa-folder-open",
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"icon": "fa fa-folder-open",
|
||||||
|
},
|
||||||
|
"file": {
|
||||||
|
"icon": "fa fa-file-o",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins": ["checkbox", "types"],
|
||||||
|
"core": {
|
||||||
|
'check_callback': true,
|
||||||
|
"data": content
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
221
public/assets/js/backend/auth/api/rule.js
Normal file
221
public/assets/js/backend/auth/api/rule.js
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
|
||||||
|
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
"index_url": "auth/api/rule/index",
|
||||||
|
"add_url": "auth/api/rule/add",
|
||||||
|
"edit_url": "auth/api/rule/edit",
|
||||||
|
"del_url": "auth/api/rule/del",
|
||||||
|
"multi_url": "auth/api/rule/multi",
|
||||||
|
"table": "auth_rule"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
sortName: '',
|
||||||
|
escape: false,
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{field: 'state', checkbox: true,},
|
||||||
|
{field: 'id', title: 'ID'},
|
||||||
|
{field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title, clickToSelect: !false},
|
||||||
|
{field: 'icon', title: __('Icon'), formatter: Controller.api.formatter.icon},
|
||||||
|
{field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name},
|
||||||
|
{field: 'weigh', title: __('Weigh')},
|
||||||
|
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||||
|
{
|
||||||
|
field: 'ismenu',
|
||||||
|
title: __('Ismenu'),
|
||||||
|
align: 'center',
|
||||||
|
table: table,
|
||||||
|
formatter: Table.api.formatter.toggle
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'operate',
|
||||||
|
title: __('Operate'),
|
||||||
|
table: table,
|
||||||
|
events: Table.api.events.operate,
|
||||||
|
formatter: Table.api.formatter.operate
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
pagination: false,
|
||||||
|
search: false,
|
||||||
|
commonSearch: false,
|
||||||
|
rowAttributes: function (row, index) {
|
||||||
|
return row.pid == 0 ? {} : {style: "display:none"};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
|
var btnSuccessEvent = function (data, ret) {
|
||||||
|
if ($(this).hasClass("btn-change")) {
|
||||||
|
var index = $(this).data("index");
|
||||||
|
var row = Table.api.getrowbyindex(table, index);
|
||||||
|
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
|
||||||
|
table.bootstrapTable("updateRow", {index: index, row: row});
|
||||||
|
} else if ($(this).hasClass("btn-delone")) {
|
||||||
|
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
|
||||||
|
$(this).closest("tr[data-index]").remove();
|
||||||
|
} else {
|
||||||
|
table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
} else if ($(this).hasClass("btn-dragsort")) {
|
||||||
|
table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
Fast.api.refreshmenu();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//表格内容渲染前
|
||||||
|
table.on('pre-body.bs.table', function (e, data) {
|
||||||
|
var options = table.bootstrapTable("getOptions");
|
||||||
|
options.escape = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
//当内容渲染完成后
|
||||||
|
table.on('post-body.bs.table', function (e, data) {
|
||||||
|
var options = table.bootstrapTable("getOptions");
|
||||||
|
options.escape = false;
|
||||||
|
|
||||||
|
//点击切换/排序/删除操作后刷新左侧菜单
|
||||||
|
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
||||||
|
//显示隐藏子节点
|
||||||
|
$(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () {
|
||||||
|
var status = $(this).data("shown") ? true : false;
|
||||||
|
$("a[data-pid='" + $(this).data("id") + "']").each(function () {
|
||||||
|
$(this).closest("tr").toggle(!status);
|
||||||
|
});
|
||||||
|
if (status) {
|
||||||
|
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
|
||||||
|
}
|
||||||
|
$(this).data("shown", !status);
|
||||||
|
$("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//隐藏子节点
|
||||||
|
$(document).on("collapse", ".btn-node-sub", function () {
|
||||||
|
if ($("i", this).length > 0) {
|
||||||
|
$("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
|
||||||
|
}
|
||||||
|
$("i", this).removeClass("fa-caret-down").addClass("fa-caret-right");
|
||||||
|
$(this).data("shown", false);
|
||||||
|
$(this).closest("tr").toggle(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
//批量删除后的回调
|
||||||
|
$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
|
||||||
|
Fast.api.refreshmenu();
|
||||||
|
});
|
||||||
|
|
||||||
|
//展开隐藏一级
|
||||||
|
$(document.body).on("click", ".btn-toggle", function (e) {
|
||||||
|
$("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
|
||||||
|
var that = this;
|
||||||
|
var show = $("i", that).hasClass("fa-chevron-down");
|
||||||
|
$("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show);
|
||||||
|
$("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
|
||||||
|
$(".btn-node-sub[data-pid=0]").data("shown", show);
|
||||||
|
});
|
||||||
|
|
||||||
|
//展开隐藏全部
|
||||||
|
$(document.body).on("click", ".btn-toggle-all", function (e) {
|
||||||
|
var that = this;
|
||||||
|
var show = $("i", that).hasClass("fa-plus");
|
||||||
|
$("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show);
|
||||||
|
$(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show);
|
||||||
|
$(".btn-node-sub").data("shown", show);
|
||||||
|
$(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
formatter: {
|
||||||
|
title: function (value, row, index) {
|
||||||
|
value = value.toString().replace(/(&|&)nbsp;/g, ' ');
|
||||||
|
var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
|
||||||
|
value = value.indexOf(" ") > -1 ? value.replace(/(.*) /, "$1" + caret) : caret + value;
|
||||||
|
|
||||||
|
value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
||||||
|
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
|
||||||
|
+ (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
|
||||||
|
},
|
||||||
|
name: function (value, row, index) {
|
||||||
|
return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
|
||||||
|
},
|
||||||
|
icon: function (value, row, index) {
|
||||||
|
return '<span class="' + (!row.ismenu || row.status == 'hidden' ? 'text-muted' : '') + '"><i class="' + value + '"></i></span>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bindevent: function () {
|
||||||
|
$(document).on('click', "input[name='row[ismenu]']", function () {
|
||||||
|
var name = $("input[name='row[name]']");
|
||||||
|
var ismenu = $(this).val() == 1;
|
||||||
|
name.prop("placeholder", ismenu ? name.data("placeholder-menu") : name.data("placeholder-node"));
|
||||||
|
$('div[data-type="menu"]').toggleClass("hidden", !ismenu);
|
||||||
|
});
|
||||||
|
$("input[name='row[ismenu]']:checked").trigger("click");
|
||||||
|
|
||||||
|
var iconlist = [];
|
||||||
|
var iconfunc = function () {
|
||||||
|
Layer.open({
|
||||||
|
type: 1,
|
||||||
|
area: ['99%', '98%'], //宽高
|
||||||
|
content: Template('chooseicontpl', {iconlist: iconlist})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Form.api.bindevent($("form[role=form]"), function (data) {
|
||||||
|
Fast.api.refreshmenu();
|
||||||
|
});
|
||||||
|
$(document).on('change keyup', "#icon", function () {
|
||||||
|
$(this).prev().find("i").prop("class", $(this).val());
|
||||||
|
});
|
||||||
|
$(document).on('click', ".btn-search-icon", function () {
|
||||||
|
if (iconlist.length == 0) {
|
||||||
|
$.get(Config.site.cdnurl + "/assets/libs/font-awesome/less/variables.less", function (ret) {
|
||||||
|
var exp = /fa-var-(.*):/ig;
|
||||||
|
var result;
|
||||||
|
while ((result = exp.exec(ret)) != null) {
|
||||||
|
iconlist.push(result[1]);
|
||||||
|
}
|
||||||
|
iconfunc();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
iconfunc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(document).on('click', '#chooseicon ul li', function () {
|
||||||
|
$("input[name='row[icon]']").val('fa fa-' + $(this).data("font")).trigger("change");
|
||||||
|
Layer.closeAll();
|
||||||
|
});
|
||||||
|
$(document).on('keyup', 'input.js-icon-search', function () {
|
||||||
|
$("#chooseicon ul li").show();
|
||||||
|
if ($(this).val() != '') {
|
||||||
|
$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user