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

169 lines
4.9 KiB
Plaintext
Raw Normal View History

@{
Layout = "~/Views/Shared/_BjuiLayout.cshtml";
}
@{ Html.RenderAction("MenuHeader", "Home");}
<div class="bjui-pageContent tableContent" style="position:relative">
<div class="clearfix">
<div style="float: left; width: 220px; overflow: auto;" class="table table-bordered">
<ul id="maintree" class="ztree"></ul>
</div>
<div id="detail" style="margin-left: 225px;">
</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-bordered table-hover table-striped table-top"></table>');
$('#maingrid').datagrid({
showToolbar: false,
filterThead: false,
target: $(this),
columns: [
{
name: 'Id',
label: '资源表ID',
width: 100
, hide: true
},
{
name: 'CascadeId',
label: '节点语义ID',
width: 100
},
{
name: 'Key',
label: '',
width: 100
},
{
name: 'Name',
label: '名称',
width: 100
},
{
name: 'ParentId',
label: '父节点流水号',
width: 100
,type: 'select',
align: 'center',
items: [{ '0': '默认' }, { '1': '状态1' }],
},
{
name: 'Status',
label: '当前状态',
width: 100
,type: 'select',
align: 'center',
items: [{ '0': '默认' }, { '1': '状态1' }],
},
{
name: 'SortNo',
label: '排序号',
width: 100
,type: 'select',
align: 'center',
items: [{ '0': '默认' }, { '1': '状态1' }],
},
{
name: 'CategoryId',
label: '资源分类标识',
width: 100
,type: 'select',
align: 'center',
items: [{ '0': '默认' }, { '1': '状态1' }],
},
{
name: 'Description',
label: '描述',
width: 100
},
],
dataUrl: '/ResourceManager/Load?categoryId=' + selectedId,
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: true,
filterMult: false,
2016-01-17 11:29:46 +08:00
showTfoot: false,
height: '100%'
});
}
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('/CategoryManager/LoadForTree', function (json) {
var zTreeObj = $.fn.zTree.init($('#maintree'), setting, json);
zTreeObj.expandAll(true);
});
}
//删除
function delResource() {
var selected = getSelected('#maingrid',2);
if (selected == null) return;
$.getJSON('/ResourceManager/Delete?Id=' + selected, function (data) {
if (data.statusCode == "200")
loadDataGrid();
else {
$(this).alertmsg('warn', data.message);
}
});
}
//自定义的编辑按钮
function editResource() {
var selected = getSelected('#maingrid',2);
if (selected == null) return;
$(this).dialog({
id: 'editDialog',
url: '/ResourceManager/Add?id=' + selected,
title: '编辑',
onClose:function() {
2016-01-05 10:03:35 +08:00
refreshResourceGrid();
}
});
}
function refreshResourceGrid() {
$('#maingrid').datagrid('refresh');
// loadDataGrid();
}
//@@ sourceURL=ResourceManagerIndex.js
</script>