调整数据库菜单表结构,可以动态加载按钮,注意更新数据库结构并重新初始化数据库

This commit is contained in:
yubaolee
2015-12-05 16:07:53 +08:00
parent 135723f563
commit af5e04d62f
16 changed files with 805 additions and 1090 deletions

View File

@@ -1,15 +1,37 @@
@{
@using System.Text
@{
string _prefix = "user";
var _treeId = _prefix + "Tree";
var _gridId = _prefix + "Grid";
var _treeDetail = _prefix + "Detail";
}
<div class="bjui-pageContent">
<div class="clearfix">
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
<ul id="@_treeId" class="ztree"></ul>
</div>
<div class="bjui-pageHeader" style="margin-left: 225px">
<div class="bjui-searchBar">
<div class="bjui-searchBar">
@{
var sb = new StringBuilder();
foreach (var element in ViewBag.Module.Elements)
{
sb.Append("<" + element.Type
+" data-icon='" + element.Icon+"' "
+" class='" + element.Class+"' "
+" onclick='" + element.Script+"' " + element.Attr
+ ">"+element.Name +"</" + element.Type +">");
}
@Html.Raw(sb.ToString())
}
</div>
</div>
</div>
<div id="@_treeDetail" style="margin-left: 225px;">
</div>
</div>
@@ -29,25 +51,15 @@
$('#@_treeDetail').empty()
.append('<table id="@_gridId" class="table table-bordered"></table>');
@{
string strBtns = string.Empty;
foreach (var element in ViewBag.Module.Elements)
{
strBtns +="<button type=\"button\" class =\"btn btn-green\">"+element.Name +"</button>";
}
}
grid = $(gridid).datagrid({
gridTitle: '用户列表',
showToolbar: true,
showToolbar: false,
filterThead: false,
toolbarItem: 'refresh, |, del',
toolbarCustom: '<a href="/UserManager/Add" class="btn btn-green" data-icon ="plus" ' +
'data-toggle="dialog" data-id="dialog-mask" data-mask="true" data-on-close="refreshGrid">添加</a>' +
'<button class=" btn-green" onclick="editOrg()" data-icon="pencil" type="button">编辑</button>' +
'<button type="button" class="btn btn-green" onclick="openModuleAccess(this)">为用户分配模块</button>' +
'<button type="button" class ="btn btn-green" onclick="openRoleAccess(this)">为用户分配角色</button>' + '@strBtns',
'<button type="button" class ="btn btn-green" onclick="openRoleAccess(this)">为用户分配角色</button>',
columns: [
{
name: 'Id',