mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
114 lines
3.3 KiB
Plaintext
114 lines
3.3 KiB
Plaintext
@*
|
||
选择多个模块ID,以ids的形式返回
|
||
*@
|
||
|
||
@{
|
||
ViewBag.Title = "title";
|
||
Layout = null;
|
||
}
|
||
<div class="bjui-pageContent">
|
||
<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>
|
||
<a href="javascript:;" id="btnSelected" data-toggle="lookupback"
|
||
data-args=""
|
||
class="btn btn-blue" title="选择本项" data-icon="check">选择</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
|
||
$(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?bAll=true', 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
|
||
}
|
||
};
|
||
$.getJSON('ModuleManager/LoadForTree?bAll=true', function (json) {
|
||
var zTreeObj = $.fn.zTree.init($('#selected'), setting, json);
|
||
zTreeObj.expandAll(true);
|
||
});
|
||
}
|
||
|
||
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);
|
||
}
|
||
|
||
$("#btnSelected").attr("data-args", "{ ids: '" + 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> |