OpenAuth.Net/OpenAuth.Mvc/Views/ModuleManager/Index.cshtml

178 lines
5.0 KiB
Plaintext
Raw Normal View History

@{
Layout = "~/Views/Shared/_BjuiLayout.cshtml";
}
@{ Html.RenderAction("MenuHeader", "Home");}
<div class="bjui-pageContent tableContent" style="position:relative">
2015-11-21 23:56:39 +08:00
<div class="clearfix">
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
<ul id="maintree" class="ztree"></ul>
2015-11-21 23:56:39 +08:00
</div>
<div id="detail" style="margin-left: 225px;">
2015-11-21 23:56:39 +08:00
</div>
</div>
</div>
<script type="text/javascript">
var selectedId = 0;
$(document).ready(function () {
initZtree();
loadDataGrid();
});
//加载数据到datagrid
function loadDataGrid() {
//b-jui的datagrid需要重新处理HTML
$('#detail').empty()
.append('<table id="maingrid" class="table table-hover table-striped table-top"></table>');
2015-11-21 23:56:39 +08:00
$('#maingrid').datagrid({
showToolbar: false,
2015-11-21 23:56:39 +08:00
filterThead: false,
target: $(this),
2015-11-21 23:56:39 +08:00
columns: [
{
name: 'Id',
2015-11-22 00:35:20 +08:00
label: '功能模块流水号',
hide: true
2015-11-21 23:56:39 +08:00
},
{
name: 'CascadeId',
2015-11-22 00:35:20 +08:00
label: '节点语义ID',
width: 80
2015-11-21 23:56:39 +08:00
},
{
name: 'Name',
2015-11-22 00:35:20 +08:00
label: '功能模块名称',
width: 80
2015-11-21 23:56:39 +08:00
},
{
name: 'Url',
2015-11-22 00:35:20 +08:00
label: '主页面URL',
width: 80
2015-11-21 23:56:39 +08:00
},
2015-11-22 00:35:20 +08:00
2015-11-21 23:56:39 +08:00
{
name: 'ParentId',
2015-11-22 00:35:20 +08:00
label: '父节点流水号',
hide:true
2015-11-21 23:56:39 +08:00
},
2015-11-22 00:35:20 +08:00
2015-11-21 23:56:39 +08:00
{
name: 'IconName',
2015-11-22 00:35:20 +08:00
width: 80,
2015-11-21 23:56:39 +08:00
label: '节点图标文件名称'
},
{
name: 'Status',
2015-11-22 00:35:20 +08:00
width: 80,
2015-11-21 23:56:39 +08:00
label: '当前状态'
},
{
name: 'ParentName',
2015-11-22 00:35:20 +08:00
width: 80,
2015-11-21 23:56:39 +08:00
label: '父节点名称'
},
{
name: 'Vector',
2015-11-22 00:35:20 +08:00
width: 80,
2015-11-21 23:56:39 +08:00
label: '矢量图标'
},
{
name: 'SortNo',
2015-11-22 00:35:20 +08:00
width: 80,
2015-11-21 23:56:39 +08:00
label: '排序号'
},
],
dataUrl: '/ModuleManager/Load?orgId=' + selectedId,
2015-11-21 23:56:39 +08:00
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: true,
filterMult: false,
2016-01-17 11:29:46 +08:00
showTfoot: false,
height: '100%'
2015-11-21 23:56:39 +08:00
});
}
function zTreeOnClick(event, treeId, treeNode) {
selectedId = treeNode.Id;
loadDataGrid();
}
function initZtree() {
var setting = {
view: {selectedMulti: false},
data: {
key: {
name: 'Name',
title: 'Name'
},
simpleData: {
enable: true,
idKey: 'Id',
pIdKey: 'ParentId',
rootPId: 'null'
}
},
callback: {onClick: zTreeOnClick}
};
$.getJSON('/ModuleManager/LoadModuleWithRoot', function (json) {
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
2015-11-21 23:56:39 +08:00
zTreeObj.expandAll(true);
});
}
2015-12-05 21:24:01 +08:00
//删除
function delModule() {
var selected = getSelected('#maingrid',2);
2015-12-05 21:24:01 +08:00
if (selected == null) return;
$.getJSON('/ModuleManager/Delete?Id=' + selected, function (data) {
2015-12-05 21:24:01 +08:00
if (data.statusCode == "200")
loadDataGrid();
else {
$(this).alertmsg('warn', data.message);
}
});
}
2015-11-21 23:56:39 +08:00
//自定义的编辑按钮
function editModule() {
var selected = getSelected('#maingrid',2);
2015-11-21 23:56:39 +08:00
if (selected == null) return;
$(this).dialog({
id: 'editDialog',
url: '/ModuleManager/Add?id=' + selected,
title: '编辑',
onClose:function() {
refreshModuleGrid();
2015-11-21 23:56:39 +08:00
}
});
}
2015-12-02 16:28:01 +08:00
//为模块分配按钮
function assignButton() {
var selected = getSelected('#maingrid',2);
2015-12-02 16:28:01 +08:00
if (selected == null) return;
$(this).dialog({
id: 'editDialog',
width: 1000,
height: 500,
mask:true,
2015-12-02 16:28:01 +08:00
url: '/ModuleElementManager/Index?id=' + selected,
title: '为模块分配按钮'
});
}
function refreshModuleGrid() {
$('#maingrid').datagrid('refresh');
2015-11-21 23:56:39 +08:00
// loadDataGrid();
}
</script>