mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
完成用户分配模块
This commit is contained in:
parent
3b99938df1
commit
5d2569dddd
@ -11,43 +11,32 @@
|
|||||||
// </copyright>
|
// </copyright>
|
||||||
// <summary>分配组织</summary>
|
// <summary>分配组织</summary>
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
|
layui.use(['layer', 'form'], function () {
|
||||||
|
var form = layui.form();
|
||||||
|
|
||||||
|
form.on('checkbox', function (data) {
|
||||||
$(document).ready(function () {
|
if (data.elem.checked)
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
{
|
||||||
var ids = ztree.getSelected();
|
$.post('/RelevanceManager/Assign', {
|
||||||
if (ids == null) return;
|
type: $("#moduleType").val(),
|
||||||
|
firstId: $('#firstId').val(),
|
||||||
$.post('/RelevanceManager/Assign', {
|
secIds: data.value
|
||||||
type: $("#moduleType").val(),
|
}, function (json) {
|
||||||
firstId: $('#firstId').val(),
|
json = $.parseJSON(json);
|
||||||
secIds: ids
|
|
||||||
}, function (json) {
|
});
|
||||||
json = $.parseJSON(json);
|
}
|
||||||
if (json.statusCode != "200") {
|
else
|
||||||
$(this).alertmsg('warn', json.message);
|
{
|
||||||
return;
|
$.post('/RelevanceManager/UnAssign', {
|
||||||
}
|
type: $("#moduleType").val(),
|
||||||
selected.reLoad();
|
firstId: $('#firstId').val(),
|
||||||
});
|
secIds: data.value
|
||||||
});
|
}, function (json) {
|
||||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
json = $.parseJSON(json);
|
||||||
var ids = selected.getSelected();
|
|
||||||
if (ids == null) return;
|
});
|
||||||
|
}
|
||||||
$.post('/RelevanceManager/UnAssign', {
|
|
||||||
type: $("#moduleType").val(),
|
|
||||||
firstId: $('#firstId').val(),
|
|
||||||
secIds: ids
|
|
||||||
}, function (json) {
|
|
||||||
json = $.parseJSON(json);
|
|
||||||
if (json.statusCode != "200") {
|
|
||||||
$(this).alertmsg('warn', json.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selected.reLoad();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ function openUserModuleAccess(obj) {
|
|||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
skin: 'layui-layer-rim', //加上边框
|
skin: 'layui-layer-rim', //加上边框
|
||||||
area: ['600px', '500px'], //宽高
|
area: ['410px', '390px'], //宽高
|
||||||
content: '/ModuleManager/Assign?key=UserModule&firstId=' + selected.Id
|
content: '/ModuleManager/Assign?key=UserModule&firstId=' + selected.Id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
3
OpenAuth.Mvc/Content/mylayer.css
Normal file
3
OpenAuth.Mvc/Content/mylayer.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.layui-elem-field {
|
||||||
|
border: 1px solid #5fb878;
|
||||||
|
}
|
@ -51,13 +51,12 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
CheckModule(module.Children, modules);
|
CheckModule(module.Children, modules);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (modules.Select(u => u.Id).Contains(module.Item.Id))
|
||||||
{
|
{
|
||||||
if (modules.Select(u => u.Id).Contains(module.Item.Id))
|
module.Item.Checked = true;
|
||||||
{
|
|
||||||
module.Item.Checked = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,26 +67,40 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
if (moduleView.Children.Any())
|
if (moduleView.Children.Any())
|
||||||
{
|
{
|
||||||
sb.Append("<div class=\"layui-form-item\">\r\n");
|
sb.Append("<fieldset class=\"layui-elem-field\">\r\n");
|
||||||
sb.Append("<label class=\"layui-form-label\">" + moduleView.Item.Name + "</label>\r\n");
|
sb.Append("<legend>");
|
||||||
sb.Append("<div class=\"layui-input-block\">\r\n");
|
BuildCheckbox(sb, moduleView);
|
||||||
|
sb.Append("</legend>\r\n");
|
||||||
|
sb.Append("<div class=\"layui-field-box\">\r\n");
|
||||||
sb.Append(BuilderModules(moduleView.Children));
|
sb.Append(BuilderModules(moduleView.Children));
|
||||||
sb.Append("</div>\r\n");
|
sb.Append("</div>\r\n");
|
||||||
sb.Append("</div>\r\n");
|
sb.Append("</fieldset>\r\n");
|
||||||
|
|
||||||
|
//sb.Append("<div class=\"layui-form-item\">\r\n");
|
||||||
|
//BuildCheckbox(sb, moduleView);
|
||||||
|
//sb.Append("<div class=\"layui-input-block\">\r\n");
|
||||||
|
//sb.Append(BuilderModules(moduleView.Children));
|
||||||
|
//sb.Append("</div>\r\n");
|
||||||
|
//sb.Append("</div>\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.Append("<input type=\"checkbox\" name=\"like[dai]\" title=\"" + moduleView.Item.Name + "\"");
|
BuildCheckbox(sb, moduleView);
|
||||||
if (moduleView.Item.Checked)
|
|
||||||
{
|
|
||||||
sb.Append(" checked");
|
|
||||||
}
|
|
||||||
sb.Append(">\r\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BuildCheckbox(StringBuilder sb, TreeItem<ModuleView> moduleView)
|
||||||
|
{
|
||||||
|
sb.Append("<input type=\"checkbox\" value=\"" + moduleView.Item.Id + "\" title=\"" + moduleView.Item.Name + "\"");
|
||||||
|
if (moduleView.Item.Checked)
|
||||||
|
{
|
||||||
|
sb.Append(" checked");
|
||||||
|
}
|
||||||
|
sb.Append(">\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载模块下面的所有模块
|
/// 加载模块下面的所有模块
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -373,6 +373,7 @@
|
|||||||
<Content Include="Content\layui\lay\modules\tree.js" />
|
<Content Include="Content\layui\lay\modules\tree.js" />
|
||||||
<Content Include="Content\layui\lay\modules\upload.js" />
|
<Content Include="Content\layui\lay\modules\upload.js" />
|
||||||
<Content Include="Content\layui\lay\modules\util.js" />
|
<Content Include="Content\layui\lay\modules\util.js" />
|
||||||
|
<Content Include="Content\mylayer.css" />
|
||||||
<Content Include="Content\myace.css" />
|
<Content Include="Content\myace.css" />
|
||||||
<Content Include="Content\plugins\bootstrap\css\bootstrap.css" />
|
<Content Include="Content\plugins\bootstrap\css\bootstrap.css" />
|
||||||
<Content Include="Content\plugins\bootstrap\css\bootstrap.min.css" />
|
<Content Include="Content\plugins\bootstrap\css\bootstrap.min.css" />
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
Layout = null;
|
Layout = null;
|
||||||
}
|
}
|
||||||
<link href="~/Content/layui/css/layui.css" rel="stylesheet"/>
|
<link href="~/Content/layui/css/layui.css" rel="stylesheet"/>
|
||||||
|
<link href="~/Content/mylayer.css" rel="stylesheet" />
|
||||||
<script src="~/Content/layui/layui.js"></script>
|
<script src="~/Content/layui/layui.js"></script>
|
||||||
|
<script src="~/Content/plugins/jQuery/jQuery-2.1.4.min.js"></script>
|
||||||
|
|
||||||
<script src="~/Content/layui/lay/modules/form.js"></script>
|
<script src="~/Content/layui/lay/modules/form.js"></script>
|
||||||
<form class="layui-form " action="">
|
<form class="layui-form " action="">
|
||||||
@ -11,12 +13,7 @@
|
|||||||
@Html.Raw(ViewBag.Modules)
|
@Html.Raw(ViewBag.Modules)
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script src="~/BllScripts/assignModule.js"></script>
|
||||||
layui.use(['layer', 'form'], function () {
|
|
||||||
var form = layui.form();
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user