mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 18:22:11 +08:00
修正因合并多对多映射造成的BUG
This commit is contained in:
@@ -8,9 +8,7 @@
|
||||
<form action="/ModuleManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><h3>* 添加</h3></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m => m.Id)
|
||||
|
@@ -1,123 +1,123 @@
|
||||
@*
|
||||
选择多个模块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/AccessModule', { 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
|
||||
@*
|
||||
选择多个模块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>
|
@@ -1,5 +1,4 @@
|
||||
|
||||
@{
|
||||
@{
|
||||
ViewBag.Title = "title";
|
||||
Layout = null;
|
||||
}
|
||||
@@ -8,26 +7,21 @@
|
||||
<form action="/OrgManager/AddOrg" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><h3>* 添加</h3></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label x90">机构名称:</label>
|
||||
<input type="text" name="Name" id="Name" value=""
|
||||
data-rule="required" size="20">
|
||||
data-rule="required" size="20">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input id="ParentId" name="ParentId" type="hidden">
|
||||
<input id="ParentId" name="ParentId" type="hidden">
|
||||
<label for="ParentName" class="control-label x90">上级机构:</label>
|
||||
<input type="text" name="ParentName" id="ParentName" data-toggle="selectztree" size="20" data-tree="#j_select_tree1">
|
||||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -37,7 +31,6 @@
|
||||
<option value="0">正常</option>
|
||||
<option value="1">禁用</option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -51,7 +44,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
Init();
|
||||
@@ -112,4 +104,4 @@
|
||||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
event.preventDefault();
|
||||
}
|
||||
</script>
|
||||
</script>
|
@@ -8,9 +8,7 @@
|
||||
<form action="/RoleManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><h3>* 添加</h3></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m => m.Id)
|
||||
|
@@ -36,7 +36,8 @@
|
||||
toolbarItem: 'refresh, |, del',
|
||||
toolbarCustom: '<a href="/RoleManager/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="editRole()" data-icon="pencil" type="button">编辑</button>',
|
||||
'<button class=" btn-green" onclick="editRole()" data-icon="pencil" type="button">编辑</button>'+
|
||||
'<button type="button" class="btn btn-green" onclick="openModuleAccess(this)">角色模块</button>',
|
||||
columns: [
|
||||
{
|
||||
name: 'Id',
|
||||
@@ -174,5 +175,22 @@
|
||||
$('#@_gridId').datagrid('refresh');
|
||||
// loadDataGrid();
|
||||
}
|
||||
|
||||
//用户模块授权按钮
|
||||
function openModuleAccess(obj) {
|
||||
|
||||
var selected = getSelected(2);
|
||||
if (selected == null) return;
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessRoleModule',
|
||||
url: '/ModuleManager/LookupMultiForRole',
|
||||
title: '为角色分配模块',
|
||||
data: {
|
||||
roleid: selected
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//@@ sourceURL=RoleManagerIndex.js
|
||||
</script>
|
||||
|
@@ -8,9 +8,7 @@
|
||||
<form action="/UserManager/Add" class="pageForm" data-toggle="validate">
|
||||
<table class="table table-condensed table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><h3>* 添加</h3></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@Html.HiddenFor(m =>m.CreateTime)
|
||||
|
@@ -185,7 +185,7 @@
|
||||
|
||||
$(obj).dialog({
|
||||
id: 'accessUserModule',
|
||||
url: '/ModuleManager/LookupMulti',
|
||||
url: '/ModuleManager/LookupMultiForUser',
|
||||
title: '为用户分配模块',
|
||||
data: {
|
||||
userId: selected
|
||||
|
Reference in New Issue
Block a user