mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-21 02:57:54 +08:00
全面完成前端模块化!
This commit is contained in:
34
OpenAuth.Mvc/Views/ModuleManager/Assign.cshtml
Normal file
34
OpenAuth.Mvc/Views/ModuleManager/Assign.cshtml
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="bjui-pageHeader">
|
||||
<div class="bjui-searchBar">
|
||||
<input style="display: none" id="firstId" value="@ViewBag.FirstId" />
|
||||
<input style="display: none" id="moduleType" , value="@ViewBag.ModuleType" />
|
||||
<div class="pull-right">
|
||||
<div class="alert alert-info search-inline">
|
||||
<i class="fa fa-info-circle"></i>用户可访问的模块=其角色的模块+本身可访问的模块
|
||||
</div>
|
||||
<button type="button" class="btn btn-green" data-num="1" data-icon="plus" id="btnAccess">
|
||||
授权选中
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" data-num="1" data-icon="trash" id="btnDelAccess">
|
||||
取消授权
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bjui-pageContent">
|
||||
<fieldset style="height: auto; float: left; width: 280px;">
|
||||
<legend>系统的模块</legend>
|
||||
<ul id="tree" class="ztree"></ul>
|
||||
</fieldset>
|
||||
|
||||
<!--已经选中的列表-->
|
||||
<fieldset style="height: auto;margin-left: 310px; width: 280px">
|
||||
<legend>已分配的模块</legend>
|
||||
<ul id="selected" class="ztree"></ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<script src="~/BllScripts/grid.js"></script>
|
||||
<script src="~/BllScripts/assignModule.js"></script>
|
||||
|
@@ -1,123 +0,0 @@
|
||||
@*
|
||||
选择多个模块ID,以ids的形式返回
|
||||
*@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "title";
|
||||
Layout = null;
|
||||
}
|
||||
<div class="bjui-pageContent">
|
||||
<input style="display: none" id="roleId" value="@ViewBag.RoleId"/>
|
||||
<div style="float: left; width: 220px; height: 240px; overflow: auto;" class="table table-bordered">
|
||||
<ul id="lookupTree" class="ztree"></ul>
|
||||
</div>
|
||||
<!--已经选中的列表-->
|
||||
<div style="margin-left: 225px">
|
||||
<ul id="selected" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
|
||||
<li><button type="button" onclick="save()" class="btn btn-blue" data-icon="check">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var moduleIds;
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
InitSelected();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/ModuleManager/LoadForTree', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#lookupTree'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function InitSelected() {
|
||||
var setting = {
|
||||
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.post('/ModuleManager/LoadForRole', { roleId: $('#roleId').val() },
|
||||
function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#selected'), setting, eval(json));
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
$.post('/ModuleManager/AssignModuleForRole', { roleId: $('#roleId').val(), moduleIds: moduleIds },
|
||||
function (json) {
|
||||
var rel = $.parseJSON(json);
|
||||
if (rel.statusCode == "200") {
|
||||
$(this).alertmsg('ok', rel.message);
|
||||
} else {
|
||||
$(this).alertmsg('error', rel.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
}
|
||||
|
||||
moduleIds = ids;
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
//@@ sourceURL=lookupMulti.js
|
||||
</script>
|
@@ -1,123 +0,0 @@
|
||||
@*
|
||||
选择多个模块ID,以ids的形式返回
|
||||
*@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "title";
|
||||
Layout = null;
|
||||
}
|
||||
<div class="bjui-pageContent">
|
||||
<input style="display: none" id="userId" value="@ViewBag.UserId"/>
|
||||
<div style="float: left; width: 220px; height: 240px; overflow: auto;" class="table table-bordered">
|
||||
<ul id="lookupTree" class="ztree"></ul>
|
||||
</div>
|
||||
<!--已经选中的列表-->
|
||||
<div style="margin-left: 225px">
|
||||
<ul id="selected" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bjui-pageFooter">
|
||||
<ul>
|
||||
<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
|
||||
<li><button type="button" onclick="save()" class="btn btn-blue" data-icon="check">保存</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var moduleIds;
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
InitSelected();
|
||||
});
|
||||
function Init() {
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox"
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.getJSON('/ModuleManager/LoadForTree', function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#lookupTree'), setting, json);
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function InitSelected() {
|
||||
var setting = {
|
||||
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: zTreeOnClick,
|
||||
onCheck: zTreeCheck
|
||||
}
|
||||
};
|
||||
$.post('/ModuleManager/LoadForUser', { userId: $('#userId').val() },
|
||||
function (json) {
|
||||
var zTreeObj = $.fn.zTree.init($('#selected'), setting, eval(json));
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
}
|
||||
|
||||
function save() {
|
||||
$.post('/ModuleManager/AssignModuleForUser', { userId: $('#userId').val(), moduleIds: moduleIds },
|
||||
function (json) {
|
||||
var rel = $.parseJSON(json);
|
||||
if (rel.statusCode == "200") {
|
||||
$(this).alertmsg('ok', rel.message);
|
||||
} else {
|
||||
$(this).alertmsg('error', rel.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function zTreeCheck(e, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||||
nodes = zTree.getCheckedNodes(true);
|
||||
var ids = '';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
ids += ',' + nodes[i].Id;
|
||||
}
|
||||
if (ids.length > 0) { //去掉第一个逗号
|
||||
ids = ids.substr(1);
|
||||
}
|
||||
|
||||
moduleIds = ids;
|
||||
}
|
||||
function zTreeOnClick(event, treeId, treeNode) {
|
||||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
//@@ sourceURL=lookupMulti.js
|
||||
</script>
|
Reference in New Issue
Block a user