mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-05-07 14:18:07 +08:00
132 lines
4.0 KiB
Plaintext
132 lines
4.0 KiB
Plaintext
@{
|
|
string _prefix = "assignForRole";
|
|
var _treeId = _prefix + "Tree";
|
|
var _gridId = _prefix + "Grid";
|
|
var _treeDetail = _prefix + "Detail";
|
|
}
|
|
<div class="bjui-pageHeader">
|
|
<div class="bjui-searchBar">
|
|
<input style="display: none" id="roleId" value="@ViewBag.RoleId" />
|
|
<div class="pull-right">
|
|
<div class="alert alert-info search-inline">
|
|
<i class="fa fa-info-circle"></i> 可多选统一授权
|
|
</div>
|
|
<button type="button" class="btn-green" data-num="1" data-icon="plus" data-toggle="assign">
|
|
授权选中
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bjui-pageContent tableContent">
|
|
<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-hover table-striped table-top"></table>');
|
|
|
|
$(gridid).datagrid({
|
|
showToolbar: false,
|
|
filterThead: false,
|
|
columns: [
|
|
{
|
|
name: 'Id',
|
|
label: '元素名称',
|
|
hide: true
|
|
},
|
|
{
|
|
name: 'Name',
|
|
label: '元素名称',
|
|
width: 80
|
|
},
|
|
{
|
|
name: 'ModuleName',
|
|
label: '所属模块',
|
|
width: 80
|
|
},
|
|
{
|
|
name: 'Accessed',
|
|
label: '是否已经授权',
|
|
type: 'select',
|
|
align: 'center',
|
|
items: [{ 'false': '未授权', 'true': '已授权' }],
|
|
width: 80
|
|
}
|
|
],
|
|
dataUrl: 'ModuleElementManager/Load?orgId=' + selectedId +'&roleId='+$('#roleId').val(),
|
|
fullGrid: true,
|
|
showLinenumber: true,
|
|
showCheckboxcol: true,
|
|
paging: true,
|
|
filterMult: false,
|
|
showTfoot: true
|
|
});
|
|
}
|
|
|
|
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/LoadForTree', function (json) {
|
|
var zTreeObj = $.fn.zTree.init($('#@_treeId'), setting, json);
|
|
zTreeObj.expandAll(true);
|
|
});
|
|
}
|
|
|
|
//授权选中的
|
|
function assign() {
|
|
var selected = getSelected(gridid, 2);
|
|
if (selected == null) return;
|
|
|
|
$(this).dialog({
|
|
id: 'assign',
|
|
url: '/ModuleManager/Add?id=' + selected,
|
|
title: '编辑',
|
|
onClose: function () {
|
|
refreshGrid();
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function refreshGrid() {
|
|
$('#@_gridId').datagrid('refresh');
|
|
// loadDataGrid();
|
|
}
|
|
//@@ sourceURL=ModuleManagerIndex.js
|
|
</script> |