141 lines
5.4 KiB
Plaintext
141 lines
5.4 KiB
Plaintext
@using Mini.Web.WebHelper
|
|
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Areas/Admin/Views/Shared/_EasyUI_Layout.cshtml";
|
|
}
|
|
|
|
<div data-options="region:'north',border:false" style="height:30px;">
|
|
<div class="mvctool">
|
|
@*@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)*@
|
|
@await Component.InvokeAsync("ToolBar", new { ToolBar = 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: "RightGroup/GetRightTreeList"
|
|
});
|
|
});
|
|
function RightLoad_Click() {
|
|
SyncRightAndToolBar();
|
|
}
|
|
function SyncRightAndToolBar() {
|
|
$.r_post("RoleRightResource/SyncRightAndToolBar", function (data) {
|
|
$.messageBox5s('提示', data.message);
|
|
$("#ulGroup").tree('reload');
|
|
}, "json");
|
|
|
|
}
|
|
function frameReturnByReload(fid) {
|
|
$("#ulGroup").tree('reload');
|
|
}
|
|
</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("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("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 = "RightGroup/Edit";
|
|
if (typeof row.id === "string") {
|
|
editUrl = "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 = "RightGroup/Details";
|
|
var id = "";
|
|
if (typeof row.id === "string") {
|
|
detailsUrl = "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 = "RightGroup/Delete";
|
|
if (typeof row.id === "string") {
|
|
deleteUrl = "Right/Delete?rightid=" + row.id;
|
|
}
|
|
else {
|
|
deleteUrl = "RightGroup/Delete?pkid=" + parseFloat(row.id);
|
|
}
|
|
$.r_post(deleteUrl, 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>
|
|
|
|
|