188 lines
7.4 KiB
Plaintext
188 lines
7.4 KiB
Plaintext
@using WX.CRM.WebHelper
|
|
@{
|
|
ViewBag.Title = "RightGroup";
|
|
Layout = "~/Views/Shared/_EasyUI_Layout.cshtml";
|
|
}
|
|
<style>
|
|
.panel-body {
|
|
border: none;
|
|
}
|
|
</style>
|
|
<div data-options="region:'north',border:false" style="height:55px;">
|
|
<div><span id="rolesDiv"></span></div>
|
|
<div class="mvctool">
|
|
@*@Html.ToolButton("btnQuery", "icon-search", "查询", true)*@
|
|
<button class="layui-btn layui-btn-sm layui-btn-primary" id="ShowRole">
|
|
<span class="csicon2 icon-flag"></span>
|
|
<span class="csicontitle">查看角色</span>
|
|
</button>
|
|
@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)
|
|
</div>
|
|
</div>
|
|
<div data-options="region:'center',split:true" style="width:100%; border-left:none; padding:10px; border-right:none;">
|
|
<ul id="ulGroup"></ul>
|
|
</div>
|
|
<script>
|
|
$(function () {
|
|
$("#ulGroup").tree({
|
|
url: "/Base/RightGroup/GetRightTreeList"
|
|
});
|
|
|
|
$("#ShowRole").click(function () {
|
|
var row = $('#ulGroup').tree('getSelected');
|
|
if (row != null) {
|
|
$.post("/Base/RightGroup/GetHasRoles?rightId=" + row.id, "" , function (rsp) {
|
|
$("#rolesDiv").html(rsp.data);
|
|
});
|
|
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
});
|
|
});
|
|
function RightLoad_Click() {
|
|
SyncRightAndToolBar();
|
|
}
|
|
function SyncRightAndToolBar() {
|
|
$.r_post("/Base/RoleRightResource/SyncRightAndToolBar", function (data) {
|
|
$.messageBox5s('提示', data.message);
|
|
$("#ulGroup").tree('reload');
|
|
}, "json");
|
|
|
|
}
|
|
function frameReturnByReload(fid) {
|
|
$("#ulGroup").tree('reload');
|
|
//$.r_ajax({
|
|
// url: "/Base/RightGroup/GetGroupTree?id=" + fid,
|
|
// type: "Post",
|
|
// dataType: "json",
|
|
// loading: true,
|
|
// cache: false,
|
|
// success: function (data) {
|
|
// //if (!$("#ulGroup").tree("isLeaf", row.target)) {
|
|
// var childs = $("#ulGroup").tree("getChildren", $('#ulGroup').tree('find', fid).target);
|
|
// console.log($('#ulGroup').tree('find', fid));
|
|
// $(childs).each(function (i, n) {
|
|
// $("#ulGroup").tree("remove", n.target)
|
|
// });
|
|
|
|
// $('#ulGroup').tree('append', {
|
|
// parent: $('#ulGroup').tree('find', fid).target,
|
|
// data: data
|
|
// });
|
|
// }
|
|
// });
|
|
//$('#ulGroup').tree('reload', $('#ulGroup').tree('find', fid).target);
|
|
}
|
|
</script>
|
|
@*ToolBar事件处理*@
|
|
<script type="text/javascript">
|
|
|
|
|
|
function GetIframeHtml(src) {
|
|
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
|
|
}
|
|
function CreateGroup_Click() {
|
|
var fid = 0;
|
|
var selected = $("#ulGroup").tree("getSelected");
|
|
if (selected != null) {
|
|
fid = selected.id
|
|
if (selected.attributes == "right")
|
|
fid = $("#ulGroup").tree("getParent", selected.target).id
|
|
}
|
|
$("#modalwindow").html(GetIframeHtml("/Base/RightGroup/Edit?fid=" + fid));
|
|
$("#modalwindow").window({ title: '新增权限组', width: 500, height: 400, iconCls: 'icon-add' }).window('open');
|
|
}
|
|
function CreateRight_Click() {
|
|
var fid = 0;
|
|
var selected = $("#ulGroup").tree("getSelected");
|
|
if (selected != null) {
|
|
fid = selected.id
|
|
if (selected.attributes == "right")
|
|
fid = $("#ulGroup").tree("getParent", selected.target).id
|
|
}
|
|
$("#modalwindow").html(GetIframeHtml("/Base/Right/Add?fid=" + fid));
|
|
$("#modalwindow").window({ title: '新增资源', width: 500, height: 400, iconCls: 'icon-add' }).window('open');
|
|
}
|
|
function ExpandAll_Click() {
|
|
$("#ulGroup").tree("expandAll");
|
|
}
|
|
function CollapseAll_Click() {
|
|
$("#ulGroup").tree("collapseAll");
|
|
}
|
|
function Edit_Click() {
|
|
var row = $('#ulGroup').tree('getSelected');
|
|
if (row != null) {
|
|
var editUrl = "/Base/RightGroup/Edit";
|
|
if (typeof row.id === "string") {
|
|
editUrl = "/Base/Right/Edit?id=" + row.id + "&Ieguid=" + GetGuid();
|
|
}
|
|
else {
|
|
var id = parseFloat(row.id);
|
|
// editUrl = "/Base/Right/Edit?id=" + id + "&Ieguid=" + GetGuid();
|
|
|
|
var notId = "[" + row.id + "]";//不准许选的ID
|
|
if (!$("#tt").tree("isLeaf", row.target)) {
|
|
var childnode = $('#ulGroup').tree('getChildren', row.target);//获取所有的子部门
|
|
$(childnode).each(function (i, node) {
|
|
notId = notId + "[" + node.id + "]";
|
|
});
|
|
}
|
|
editUrl += "?id=" + id + "¬Id=" + notId + "&Ieguid=" + GetGuid();
|
|
}
|
|
|
|
$("#modalwindow").html(GetIframeHtml(editUrl));
|
|
$("#modalwindow").window({ title: '编辑', width: 700, height: 430, iconCls: 'icon-edit' }).window('open');
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
}
|
|
function Details_Click() {
|
|
var row = $('#ulGroup').tree('getSelected');
|
|
if (row != null) {
|
|
var detailsUrl = "/Base/RightGroup/Details";
|
|
var id = "";
|
|
if (typeof row.id === "string") {
|
|
detailsUrl = "/Base/Right/Details";
|
|
id = row.id;
|
|
}
|
|
else {
|
|
id = parseFloat(row.id);
|
|
}
|
|
|
|
$("#modalwindow").html(GetIframeHtml(detailsUrl + "?id=" + id + "&Ieguid=" + GetGuid()));
|
|
$("#modalwindow").window({ title: '详细', width: 500, height: 300, iconCls: 'icon-details' }).window('open');
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
}
|
|
function Delete_Click() {
|
|
var row = $('#ulGroup').tree('getSelected');
|
|
if (row != null) {
|
|
$.messager.confirm('提示', '@Suggestion.YouWantToDeleteTheSelectedRecords', function (r) {
|
|
if (r) {
|
|
var deleteUrl = "/Base/RightGroup/Delete";
|
|
var id;
|
|
if (typeof row.id === "string") {
|
|
deleteUrl = "/Base/Right/Delete";
|
|
id = row.id;
|
|
}
|
|
else {
|
|
id = parseFloat(row.id);
|
|
deleteUrl = "/Base/RightGroup/Delete";
|
|
}
|
|
//var id = parseFloat(row.id);
|
|
//var deleteUrl = "/Base/RightGroup/Delete";
|
|
//if (id < 0) {
|
|
// deleteUrl = "/Base/Right/Delete";
|
|
// id = -id;
|
|
//}
|
|
$.r_post(deleteUrl + "?id=" + id, function (data) {
|
|
if (data.type == 1) {
|
|
frameReturnByReload($("#ulGroup").tree("getParent", row.target).id);
|
|
}
|
|
$.messageBox5s('提示', data.message);
|
|
}, "json");
|
|
}
|
|
});
|
|
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
|
|
}
|
|
function Reload_Click() {
|
|
$("#ulGroup").tree('reload');
|
|
}
|
|
</script>
|