2015-11-22 00:35:20 +08:00
|
|
|
|
@{
|
2015-11-21 23:56:39 +08:00
|
|
|
|
string _prefix = "Module";
|
|
|
|
|
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 id="@_treeDetail" style="margin-left: 225px;">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var gridid = '#@_gridId';
|
|
|
|
|
var selectedId = 0;
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
initZtree();
|
|
|
|
|
loadDataGrid();
|
|
|
|
|
});
|
|
|
|
|
//加载数据到datagrid
|
|
|
|
|
function loadDataGrid() {
|
|
|
|
|
//b-jui的datagrid需要重新处理HTML
|
|
|
|
|
$('#@_treeDetail').empty()
|
|
|
|
|
.append('<table id="@_gridId" class="table table-bordered"></table>');
|
|
|
|
|
|
|
|
|
|
$(gridid).datagrid({
|
|
|
|
|
gridTitle: '列表',
|
|
|
|
|
showToolbar: true,
|
|
|
|
|
filterThead: false,
|
|
|
|
|
toolbarItem: 'refresh, |, del',
|
|
|
|
|
toolbarCustom: '<a href="/ModuleManager/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="editModule()" data-icon="pencil" type="button">编辑</button>',
|
|
|
|
|
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,
|
|
|
|
|
delUrl: 'Module/Delete',
|
|
|
|
|
delPK: "Id",
|
|
|
|
|
fullGrid: true,
|
|
|
|
|
showLinenumber: true,
|
|
|
|
|
showCheckboxcol: true,
|
|
|
|
|
paging: true,
|
|
|
|
|
filterMult: false,
|
|
|
|
|
showTfoot: true,
|
|
|
|
|
height: '700',
|
|
|
|
|
delCallback: function (delResult) {
|
|
|
|
|
if (delResult.statusCode == "200")
|
|
|
|
|
loadDataGrid();
|
|
|
|
|
else {
|
|
|
|
|
$(this).alertmsg('warn', delResult.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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('OrgManager/LoadOrg', function (json) {
|
|
|
|
|
var zTreeObj = $.fn.zTree.init($('#@_treeId'), setting, json);
|
|
|
|
|
zTreeObj.expandAll(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取勾选的值
|
|
|
|
|
//column:为从0开始的列标识
|
|
|
|
|
function getSelected(column) {
|
|
|
|
|
var selected = $(gridid).data('selectedTrs');
|
|
|
|
|
if (selected == null || selected.length == 0) {
|
|
|
|
|
$(this).alertmsg('warn', '至少选择一个对象', {
|
|
|
|
|
displayMode: 'slide',
|
|
|
|
|
title: '重要提示'
|
|
|
|
|
});
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//todo:下面这段只能chrome有效
|
|
|
|
|
var records = new Array();
|
|
|
|
|
selected.each(function () {
|
|
|
|
|
records[records.length] = this.children[column].innerText;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return records[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//自定义的编辑按钮
|
|
|
|
|
function editModule() {
|
|
|
|
|
var selected = getSelected(2);
|
|
|
|
|
if (selected == null) return;
|
|
|
|
|
|
|
|
|
|
$(this).dialog({
|
|
|
|
|
id: 'editDialog',
|
|
|
|
|
url: '/ModuleManager/Add?id=' + selected,
|
|
|
|
|
title: '编辑',
|
|
|
|
|
onClose:function() {
|
|
|
|
|
refreshGrid();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshGrid() {
|
|
|
|
|
$('#@_gridId').datagrid('refresh');
|
|
|
|
|
// loadDataGrid();
|
|
|
|
|
}
|
|
|
|
|
//@@ sourceURL=ModuleManagerIndex.js
|
|
|
|
|
</script>
|