init
This commit is contained in:
322
app/admin/view/dept/add.html
Executable file
322
app/admin/view/dept/add.html
Executable file
@@ -0,0 +1,322 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
新增菜单
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/dept/lists');?>"> 菜单列表</a></li>
|
||||
<li class="active"> 菜单</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<form class="form-horizontal" action="<?php echo url('/admin/dept/create');?>" method="post">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#navfirst" data-toggle="tab"><i class="fa fa-edit text-green"></i> 基本信息</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="active tab-pane" id="navfirst">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">菜单名称<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="name" id="name" required>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pid" class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control" name="pid" id="pid">
|
||||
<option value="0" selected="">默认值</option>
|
||||
<?php echo $deptOptions;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(上级菜单)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sort" class="col-sm-2 control-label">菜单排序<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" name="sort" id="sort" value="9999">
|
||||
</div>
|
||||
<div class="col-sm-5 col-sm-offset-3">
|
||||
<span class="help-block">(菜单排序)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="hidden" class="col-sm-2 control-label">是否显示</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="hidden" value="0" checked> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="hidden" value="1"> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(是否显示)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="selModule" class="col-sm-2 control-label">所属模块</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control" name="module" id="selModule" onchange="moduleChanged(this, 'selCtrl', 'selAction')">
|
||||
<option value="" selected="">默认值</option>
|
||||
<option value="admin">admin</option>
|
||||
<option value="index">index</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(所属模块)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">菜单MCA</label>
|
||||
<div class="col-sm-2"><!--onblur="ctrlChanged(this, 'selAction')"-->
|
||||
<select class="form-control" name="ctrl" id="selCtrl" onchange="ctrlChanged(this, 'selAction')">
|
||||
<option value="">默认值</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<select class="form-control" name="action" id="selAction">
|
||||
<option value="">默认值</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button type="button" class="btn btn-danger" onclick="addURL();">添加</button>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单MCA)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="url" class="col-sm-2 control-label">菜单链接</label>
|
||||
<div class="col-sm-5 has-feedback">
|
||||
<input type="text" class="form-control" name="url" id="url" required>
|
||||
<span class="fa fa-globe form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单链接 认证权限使用)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="query" class="col-sm-2 control-label">查询参数</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="query">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(查询参数)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">菜单类型</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="0" checked> 目录
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="1"> 内部链接
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="2"> 外部链接
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="icon" class="col-sm-2 control-label">图标</label>
|
||||
<div class="col-sm-3 has-feedback">
|
||||
<input type="text" class="form-control" id="icon" name="icon" placeholder="图标">
|
||||
<span id="icon_i" class=""></span>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" id="selectIcon" class="btn btn-primary" onclick="showIcon();">
|
||||
<i class="fa fa-hand-pointer-o"> 选择图标</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(图标)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-2 control-label">菜单说明</label>
|
||||
<div class="col-sm-5">
|
||||
<textarea class="form-control" id="description" name="description"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单说明)</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" name="agree"> 确认</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
<div class="nav-footer row">
|
||||
<div class="col-sm-2 col-sm-offset-2">
|
||||
<p><button id="reset-btn" type="button" class="btn btn-warning btn-block">重置</button></p>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<p><button id="submit-btn" type="submit" class="btn btn-danger btn-block">提交</button></p>
|
||||
</div>
|
||||
<!-- /. row -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.nav-tabs-custom -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">快捷入口</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<a href="<?php echo url('/admin/dept/lists');?>" class="btn btn-block btn-primary">菜单列表</a>
|
||||
<a href="<?php echo url('/admin/dept/add');?>" class="btn btn-block btn-primary">添加菜单</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<style>
|
||||
.table thead > tr > td, .table tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<!-- /.content-wrapper -->
|
||||
<script type="text/javascript">
|
||||
function showIcon() {
|
||||
var iconName;
|
||||
if ($("#icon").val())
|
||||
iconName = encodeURIComponent($("#icon").val());
|
||||
$('#modal-icon').remove();
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/icon');?>?iconName=" + iconName,
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
$('body').append('<div id="modal-icon" class="modal fade">' + html + '</div>');
|
||||
$('#modal-icon').modal({show: true, backdrop: 'static'});
|
||||
}
|
||||
});
|
||||
}
|
||||
//类型changed事件
|
||||
function moduleChanged(obj, target, target2) {
|
||||
var module_val = obj.options[obj.selectedIndex].value;
|
||||
if (module_val && target && target2) {
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/getajaxctrl');?>",
|
||||
dataType: 'html',
|
||||
data: {"module": module_val},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
$('#' + target).html('<option value="">加载中...</option>');
|
||||
$('#' + target2).html('<option value="">默认值</option>');
|
||||
},
|
||||
success: function(html) {
|
||||
$('#' + target).html('<option value="">默认值</option>' + html);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("上传失败,请检查网络后重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//控制器changed事件
|
||||
function ctrlChanged(obj, target) {
|
||||
var ctrl_val = obj.options[obj.selectedIndex].value;
|
||||
if (ctrl_val && target) {
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/getajaxaction');?>",
|
||||
dataType: 'html',
|
||||
data: {"controller": ctrl_val, "module": 'admin'},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
$('#' + target).html('<option value="">加载中...</option>');
|
||||
},
|
||||
success: function(html) {
|
||||
$('#' + target).html(html);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("上传失败,请检查网络后重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function addURL() {
|
||||
var module = $('#selModule').val();
|
||||
var ctrl = $('#selCtrl').val();
|
||||
var action = $('#selAction').val();
|
||||
ctrl = ctrl.slice(0, 1).toLowerCase() + ctrl.slice(1).replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
action = action.slice(0, 1).toLowerCase() + action.slice(1).replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
var urlObj = document.getElementById('url');
|
||||
if (module !== '' && ctrl !== '' && action !== '') {
|
||||
urlObj.value = module + '/' + ctrl + '/' + action;
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#reset-btn").click(function(e) {
|
||||
if (confirm('确认重置所有表单项吗?')) {
|
||||
this.form.reset();
|
||||
}
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('名称必须填写');
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
var pidObj = document.getElementById('pid');
|
||||
if (isNaN(pidObj.value)) {
|
||||
alert('所属上级值无效');
|
||||
pidObj.focus();
|
||||
return false;
|
||||
}
|
||||
var sortObj = document.getElementById('sort');
|
||||
if (isNaN(sortObj.value)) {
|
||||
alert('排序值必须是数字');
|
||||
sortObj.focus();
|
||||
return false;
|
||||
}
|
||||
var moduleObj = document.getElementById('selModule');
|
||||
if (isNull(moduleObj.value)) {
|
||||
alert('所属模块值无效');
|
||||
moduleObj.focus();
|
||||
return false;
|
||||
}
|
||||
var urlObj = document.getElementById('url');
|
||||
if (isNull(urlObj.value)) {
|
||||
alert('URL必须填写');
|
||||
urlObj.focus();
|
||||
return false;
|
||||
}
|
||||
// var agree = $("input[name='agree']", this).prop('checked');
|
||||
// if (agree) {
|
||||
// alert("Submitted");
|
||||
// e.preventDefault();
|
||||
// } else {
|
||||
// e.preventDefault();
|
||||
// alert("请勾选确认");
|
||||
// }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
328
app/admin/view/dept/edit.html
Executable file
328
app/admin/view/dept/edit.html
Executable file
@@ -0,0 +1,328 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
新增菜单
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/dept/lists');?>"> 菜单列表</a></li>
|
||||
<li class="active"> 菜单</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<form class="form-horizontal" action="<?php echo url('/admin/dept/update');?>" method="post">
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#navfirst" data-toggle="tab"><i class="fa fa-edit text-green"></i> 基本信息</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="active tab-pane" id="navfirst">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-2 control-label">菜单名称<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="name" id="name" required value="<?php echo $dept['name'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pid" class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="hidden" name="oldpid" value="<?php echo $dept['pid'];?>">
|
||||
<select class="form-control" name="pid" id="pid">
|
||||
<option value="0">默认值</option>
|
||||
<?php echo $deptOptions;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(上级菜单)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sort" class="col-sm-2 control-label">菜单排序<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" name="sort" id="sort" value="<?php echo $dept['sort'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5 col-sm-offset-3">
|
||||
<span class="help-block">(菜单排序)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="hidden" class="col-sm-2 control-label">是否显示</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="hidden" value="0" <?php if(!$dept['hidden']):?>checked=""<?php endif;?>> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="hidden" value="1" <?php if($dept['hidden']):?>checked=""<?php endif;?>> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(是否显示)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="selModule" class="col-sm-2 control-label">所属模块</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control" name="module" id="selModule" onchange="moduleChanged(this, 'selCtrl', 'selAction')">
|
||||
<option value="">默认值</option>
|
||||
<option value="admin" <?php if($dept['module']=='admin'):?>selected<?php endif;?>>admin</option>
|
||||
<option value="index" <?php if($dept['module']=='index'):?>selected<?php endif;?>>index</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(所属模块)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">菜单MCA</label>
|
||||
<div class="col-sm-2"><!--onblur="ctrlChanged(this, 'selAction')"-->
|
||||
<select class="form-control" name="ctrl" id="selCtrl" onchange="ctrlChanged(this, 'selAction')">
|
||||
<option value="">默认值</option>
|
||||
<option value="<?php echo $dept['ctrl'];?>" selected><?php echo $dept['ctrl'];?></option>
|
||||
<?php echo $ctrlOption;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<select class="form-control" name="action" id="selAction">
|
||||
<option value="">默认值</option>
|
||||
<option value="<?php echo $dept['action'];?>" selected><?php echo $dept['action'];?></option>
|
||||
<?php echo $actionOption;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button type="button" class="btn btn-danger" onclick="addURL();">添加</button>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单MCA)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="url" class="col-sm-2 control-label">菜单链接</label>
|
||||
<div class="col-sm-5 has-feedback">
|
||||
<input type="text" class="form-control" name="url" id="url" required value="<?php echo $dept['url'];?>">
|
||||
<span class="fa fa-globe form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单链接 认证权限使用)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="query" class="col-sm-2 control-label">查询参数</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="query" value="<?php echo $dept['query'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(查询参数)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">菜单类型</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="0" <?php if(!$dept['functype']):?>checked=""<?php endif;?>> 目录
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="1" <?php if($dept['functype']==1):?>checked=""<?php endif;?>> 内部链接
|
||||
</label>
|
||||
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="functype" value="2" <?php if($dept['functype']==2):?>checked=""<?php endif;?>> 外部链接
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="icon" class="col-sm-2 control-label">图标</label>
|
||||
<div class="col-sm-3 has-feedback">
|
||||
<input type="text" class="form-control" id="icon" name="icon" value="<?php echo $dept['icon'];?>">
|
||||
<span id="icon_i" class="form-control-feedback <?php echo $dept['icon'];?>"></span>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="button" id="selectIcon" class="btn btn-primary" onclick="showIcon();">
|
||||
<i class="fa fa-hand-pointer-o"> 选择图标</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(图标)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-sm-2 control-label">菜单说明</label>
|
||||
<div class="col-sm-5">
|
||||
<textarea class="form-control" id="description" name="description"><?php echo $dept['description'];?></textarea>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block">(菜单说明)</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" name="agree"> 确认</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
<div class="nav-footer row">
|
||||
<input type="hidden" name="id" value="<?php echo $dept['id'];?>">
|
||||
<div class="col-sm-2 col-sm-offset-2">
|
||||
<p><button id="reset-btn" type="button" class="btn btn-warning btn-block">重置</button></p>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<p><button id="submit-btn" type="submit" class="btn btn-danger btn-block">提交</button></p>
|
||||
</div>
|
||||
<!-- /. row -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.nav-tabs-custom -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">快捷入口</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<a href="<?php echo url('/admin/dept/lists');?>" class="btn btn-block btn-primary">菜单列表</a>
|
||||
<a href="<?php echo url('/admin/dept/add');?>" class="btn btn-block btn-primary">添加菜单</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<style>
|
||||
.table thead > tr > td, .table tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<!-- /.content-wrapper -->
|
||||
<script type="text/javascript">
|
||||
function showIcon() {
|
||||
var iconName;
|
||||
if ($("#icon").val())
|
||||
iconName = encodeURIComponent($("#icon").val());
|
||||
$('#modal-icon').remove();
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/icon');?>?iconName=" + iconName,
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
$('body').append('<div id="modal-icon" class="modal fade">' + html + '</div>');
|
||||
$('#modal-icon').modal({show: true, backdrop: 'static'});
|
||||
}
|
||||
});
|
||||
}
|
||||
//类型changed事件
|
||||
function moduleChanged(obj, target, target2) {
|
||||
var module_val = obj.options[obj.selectedIndex].value;
|
||||
if (module_val && target && target2) {
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/getajaxctrl');?>",
|
||||
dataType: 'html',
|
||||
data: {"module": module_val},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
$('#' + target).html('<option value="">加载中...</option>');
|
||||
$('#' + target2).html('<option value="">默认值</option>');
|
||||
},
|
||||
success: function(html) {
|
||||
$('#' + target).html('<option value="">默认值</option>' + html);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("上传失败,请检查网络后重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//控制器changed事件
|
||||
function ctrlChanged(obj, target) {
|
||||
var ctrl_val = obj.options[obj.selectedIndex].value;
|
||||
if (ctrl_val && target) {
|
||||
$.ajax({
|
||||
url: "<?php echo url('/admin/tool/getajaxaction');?>",
|
||||
dataType: 'html',
|
||||
data: {"controller": ctrl_val, "module": 'admin'},
|
||||
beforeSend: function(XMLHttpRequest) {
|
||||
$('#' + target).html('<option value="">加载中...</option>');
|
||||
},
|
||||
success: function(html) {
|
||||
$('#' + target).html(html);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("上传失败,请检查网络后重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function addURL() {
|
||||
var module = $('#selModule').val();
|
||||
var ctrl = $('#selCtrl').val();
|
||||
var action = $('#selAction').val();
|
||||
var urlObj = document.getElementById('url');
|
||||
ctrl = ctrl.slice(0, 1).toLowerCase() + ctrl.slice(1).replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
action = action.slice(0, 1).toLowerCase() + action.slice(1).replace(/([A-Z])/g, "_$1").toLowerCase();
|
||||
if (module !== '' && ctrl !== '' && action !== '') {
|
||||
urlObj.value = module + '/' + ctrl + '/' + action;
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#reset-btn").click(function(e) {
|
||||
if (confirm('确认重置所有表单项吗?')) {
|
||||
this.form.reset();
|
||||
}
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('名称必须填写');
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
var pidObj = document.getElementById('pid');
|
||||
if (isNaN(pidObj.value)) {
|
||||
alert('所属上级值无效');
|
||||
pidObj.focus();
|
||||
return false;
|
||||
}
|
||||
var sortObj = document.getElementById('sort');
|
||||
if (isNaN(sortObj.value)) {
|
||||
alert('排序值必须是数字');
|
||||
sortObj.focus();
|
||||
return false;
|
||||
}
|
||||
var moduleObj = document.getElementById('selModule');
|
||||
if (isNull(moduleObj.value)) {
|
||||
alert('所属模块值无效');
|
||||
moduleObj.focus();
|
||||
return false;
|
||||
}
|
||||
var urlObj = document.getElementById('url');
|
||||
if (isNull(urlObj.value)) {
|
||||
alert('URL必须填写');
|
||||
urlObj.focus();
|
||||
return false;
|
||||
}
|
||||
// var agree = $("input[name='agree']", this).prop('checked');
|
||||
// if (agree) {
|
||||
// alert("Submitted");
|
||||
// e.preventDefault();
|
||||
// } else {
|
||||
// e.preventDefault();
|
||||
// alert("请勾选确认");
|
||||
// }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
111
app/admin/view/dept/lists.html
Executable file
111
app/admin/view/dept/lists.html
Executable file
@@ -0,0 +1,111 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
菜单管理
|
||||
<small>菜单列表</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
||||
<li><a href="<?php echo url('/admin/dept/lists');?>"> 菜单</a></li>
|
||||
<li class="active"> 菜单列表</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">菜单列表</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="<?php echo $search['skeyword'];?>">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-tools -->
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body no-padding">
|
||||
<?php if(!empty($list)):?>
|
||||
<div class="table-responsive lists-table">
|
||||
<table class="table table-hover table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="35rem"> </th>
|
||||
<th width="70rem" class="text-center">ID</th>
|
||||
<th width="45rem" class="text-center">图标</th>
|
||||
<th>菜单名称</th>
|
||||
<th class="text-center">菜单URL</th>
|
||||
<th class="text-center">查询参数</th>
|
||||
<th width="75rem" class="text-center">菜单排序</th>
|
||||
<th width="75rem" class="text-center">是否显示</th>
|
||||
<th width="170rem">操作</th>
|
||||
</tr>
|
||||
<?php foreach($list as $k=>$dept):?>
|
||||
<tr>
|
||||
<td class="text-center"><input type="checkbox" name="ids[]" value="<?php echo $dept['id'];?>"></td>
|
||||
<td class="text-center"><?php echo $dept['id'];?></td>
|
||||
<td class="text-center"><span class="<?php echo empty($dept['icon'])?'fa fa-ban':$dept['icon'];?>"></sapn></td>
|
||||
<td>
|
||||
<?php if ($dept['level']) echo str_repeat('|---', $dept['level']); ?><a href="<?php echo url('/admin/dept/edit',['id'=>$dept['id']]);?>"><?php echo $dept['name'];?></a>
|
||||
</td>
|
||||
<td class="text-center"><?php echo $dept['url'];?></td>
|
||||
<td class="text-center"><?php echo $dept['query'];?></td>
|
||||
<td class="text-center"><input size="3" maxlength="7" value="<?php echo $dept['sort'];?>" type="text" data-id="<?php echo $dept['id'];?>" data-url="<?php echo url('/admin/dept/updatesort');?>" data-cod="sort"></td>
|
||||
<td class="text-center">
|
||||
<span class="fa <?php if(!$dept['hidden']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $dept['id'];?>" data-url="<?php echo url('/admin/dept/toggleisshow');?>" data-cod="state"></span>
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/dept/add',['pid'=>$dept['id']]);?>">添加子菜单</a>
|
||||
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/dept/edit',['id'=>$dept['id']]);?>">编辑</a>
|
||||
<a class="btn btn-xs btn-info" data-id="<?php echo $dept['id'];?>" data-url="<?php echo url('/admin/dept/delete');?>" data-cod="dowarn">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /.table -->
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<!-- /.lists-table -->
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer no-padding">
|
||||
<div class="mailbox-controls">
|
||||
<!-- Check all button -->
|
||||
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
|
||||
</div>
|
||||
<!-- /.btn-group -->
|
||||
<a href="<?php echo url('/admin/dept/add');?>" class="btn btn-default btn-sm">添加</a>
|
||||
<div class="pull-right">
|
||||
<?php if(0):?>
|
||||
<?php echo $page;?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<style>
|
||||
.table thead > tr > td, .table tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<!-- Page Script -->
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user