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>
|
||||
// <summary>分配组织</summary>
|
||||
// ***********************************************************************
|
||||
layui.use(['layer', 'form'], function () {
|
||||
var form = layui.form();
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||
var ids = ztree.getSelected();
|
||||
if (ids == null) return;
|
||||
|
||||
$.post('/RelevanceManager/Assign', {
|
||||
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();
|
||||
});
|
||||
});
|
||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||
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();
|
||||
});
|
||||
form.on('checkbox', function (data) {
|
||||
if (data.elem.checked)
|
||||
{
|
||||
$.post('/RelevanceManager/Assign', {
|
||||
type: $("#moduleType").val(),
|
||||
firstId: $('#firstId').val(),
|
||||
secIds: data.value
|
||||
}, function (json) {
|
||||
json = $.parseJSON(json);
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$.post('/RelevanceManager/UnAssign', {
|
||||
type: $("#moduleType").val(),
|
||||
firstId: $('#firstId').val(),
|
||||
secIds: data.value
|
||||
}, function (json) {
|
||||
json = $.parseJSON(json);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ function openUserModuleAccess(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
skin: 'layui-layer-rim', //加上边框
|
||||
area: ['600px', '500px'], //宽高
|
||||
area: ['410px', '390px'], //宽高
|
||||
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);
|
||||
}
|
||||
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())
|
||||
{
|
||||
sb.Append("<div class=\"layui-form-item\">\r\n");
|
||||
sb.Append("<label class=\"layui-form-label\">" + moduleView.Item.Name + "</label>\r\n");
|
||||
sb.Append("<div class=\"layui-input-block\">\r\n");
|
||||
sb.Append("<fieldset class=\"layui-elem-field\">\r\n");
|
||||
sb.Append("<legend>");
|
||||
BuildCheckbox(sb, moduleView);
|
||||
sb.Append("</legend>\r\n");
|
||||
sb.Append("<div class=\"layui-field-box\">\r\n");
|
||||
sb.Append(BuilderModules(moduleView.Children));
|
||||
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
|
||||
{
|
||||
sb.Append("<input type=\"checkbox\" name=\"like[dai]\" title=\"" + moduleView.Item.Name + "\"");
|
||||
if (moduleView.Item.Checked)
|
||||
{
|
||||
sb.Append(" checked");
|
||||
}
|
||||
sb.Append(">\r\n");
|
||||
BuildCheckbox(sb, moduleView);
|
||||
}
|
||||
}
|
||||
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>
|
||||
|
@ -373,6 +373,7 @@
|
||||
<Content Include="Content\layui\lay\modules\tree.js" />
|
||||
<Content Include="Content\layui\lay\modules\upload.js" />
|
||||
<Content Include="Content\layui\lay\modules\util.js" />
|
||||
<Content Include="Content\mylayer.css" />
|
||||
<Content Include="Content\myace.css" />
|
||||
<Content Include="Content\plugins\bootstrap\css\bootstrap.css" />
|
||||
<Content Include="Content\plugins\bootstrap\css\bootstrap.min.css" />
|
||||
|
@ -2,7 +2,9 @@
|
||||
Layout = null;
|
||||
}
|
||||
<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/plugins/jQuery/jQuery-2.1.4.min.js"></script>
|
||||
|
||||
<script src="~/Content/layui/lay/modules/form.js"></script>
|
||||
<form class="layui-form " action="">
|
||||
@ -11,12 +13,7 @@
|
||||
@Html.Raw(ViewBag.Modules)
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer', 'form'], function () {
|
||||
var form = layui.form();
|
||||
|
||||
});
|
||||
</script>
|
||||
<script src="~/BllScripts/assignModule.js"></script>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user