75 lines
2.8 KiB
Plaintext
75 lines
2.8 KiB
Plaintext
@using Mini.Web.WebHelper;
|
|
@{
|
|
ViewBag.Title = "SettingInnerUserRole";
|
|
Layout = "~/Areas/Admin/Views/Shared/_Index_LayoutEdit.cshtml";
|
|
}
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
$("#btnSave").click(function () {
|
|
$.messager.confirm('提示', '您确定要保存修改吗?', function (r) {
|
|
var checkeds = $('#ulRole').tree("getChecked");
|
|
var roleIds = "";//角色ID
|
|
$(checkeds).each(function (i, n) {
|
|
roleIds += "" + n.id + ",";
|
|
});
|
|
if (roleIds.length > 0)
|
|
roleIds = roleIds.substr(0, roleIds.length - 1);
|
|
var pkids = window.parent.GetUserId();//员工ID
|
|
$.r_ajax({
|
|
url: "Save",
|
|
type: "Post",
|
|
data: { roleIds: roleIds, pkids: pkids },
|
|
dataType: "json",
|
|
loading: true,
|
|
success: function (data) {
|
|
if (data.type == 1) {
|
|
window.parent.frameReturnByMes(data.message);
|
|
window.parent.frameReturnByReload(true);
|
|
window.parent.frameReturnByClose()
|
|
}
|
|
else {
|
|
window.parent.frameReturnByMes(data.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
var isAdmin = '@(ViewBag.isAdmin)';
|
|
|
|
$('#ulRole').tree({
|
|
checkbox: true,
|
|
onlyLeafCheck: true,
|
|
url: "../Role/GetRoleTree",
|
|
onLoadSuccess: function () {
|
|
var selects = window.parent.GetUserRoleId();
|
|
if (selects != null && selects != "") {
|
|
var roleIds = selects.split(',');
|
|
for (var i = 0; i < roleIds.length; i++) {
|
|
$('#ulRole').tree("check", $('#ulRole').tree("find", roleIds[i]).target);
|
|
|
|
}
|
|
}
|
|
var allnode = $('#ulRole').tree("getRoots");
|
|
$(allnode).each(function (i,n) {
|
|
var roleName = n.text;
|
|
if (isAdmin == "0") {
|
|
if (roleName == "总监" || roleName == "总监助理" || roleName == "管理员") {
|
|
$(n.target).find(".tree-checkbox").unbind().click(function () {
|
|
return false;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
});
|
|
</script>
|
|
<div class="mvctool bgb">
|
|
@Html.ToolButtonPlain("btnSave", "icon-save", "分配", false, "")
|
|
</div>
|
|
<div style="width:100%; height:90%;overflow-y:auto;">
|
|
<ul id="ulRole"></ul>
|
|
</div>
|