TG.WXCRM.V4/WEB/Views/Base/Role/Index.cshtml

105 lines
4.4 KiB
Plaintext

@using WX.CRM.WebHelper;
@{
ViewBag.Title = "Role";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<div class="mvctool">
@*@Html.ToolButton("btnQuery", "icon-search", "查询", true)*@
@Html.Action("ToolBar", "Control", ViewBag.ToolBar as ToolBar)
</div>
<div class="bas_datagrid">
@Html.Raw(ViewBag.gridTable)
</div>
<script>
$(function () {
$('#tablist').tablegrid({
url: '/Base/Role/GetHtmlList',
height: $(window).height() - 110,
loadNow: true
});
});
function frameReturnByClose() {
$("#modalwindow").window('close');
}
function frameReturnByReload(flag) {
$("#tablist").tablegrid("Load");
}
function frameReturnByMes(mes) {
$.messageBox5s('提示', mes);
}
</script>
@*ToolBar事件处理*@
<script type="text/javascript">
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function UpdateSort_Click() {
$.messager.confirm('提示', '你确定要更新顺序吗?', function (r) {
if (r) {
var roleIds = "";
var sortIds = "";
$("[roleId]").each(function () {
if ($(this).attr("oldvalue") != $(this).val()) {//只获取以改变的数据
roleIds += $(this).attr("roleId") + ",";
sortIds += $(this).val() + ",";
}
});
if (roleIds.length > 0)
roleIds = roleIds.substr(0, roleIds.length - 1)
if (sortIds.length > 0)
sortIds = sortIds.substr(0, sortIds.length - 1)
$.r_post("/Base/Role/Sort?roleIds=" + roleIds + "&sortIds=" + sortIds, function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message);
}, "json");
}
});
}
function Create_Click() {
$("#modalwindow").html(GetIframeHtml("/Base/Role/Edit"));
$("#modalwindow").window({ title: '新增', width: 700, height: 400, iconCls: 'icon-add' }).window('open');
}
function Edit_Click() {
var row = $('#tablist').tablegrid('getSelected');
if (row != null) {
$("#modalwindow").html(GetIframeHtml("/Base/Role/Edit?id=" + row.ROLEID + "&Ieguid=" + GetGuid()));
$("#modalwindow").window({ title: '编辑', width: 700, height: 430, iconCls: 'icon-edit' }).window('open');
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
}
function Details_Click() {
var row = $('#tablist').tablegrid('getSelected');
if (row != null) {
$("#modalwindow").html(GetIframeHtml("/Base/Role/Details?id=" + row.ROLEID + "&Ieguid=" + GetGuid()));
$("#modalwindow").window({ title: '详细', width: 500, height: 300, iconCls: 'icon-details' }).window('open');
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
}
function Delete_Click() {
var row = $('#tablist').tablegrid('getSelected');
if (row != null) {
$.messager.confirm('提示', '@Suggestion.YouWantToDeleteTheSelectedRecords', function (r) {
if (r) {
$.r_post("/Base/Role/Delete?id=" + row.ROLEID, function (data) {
if (data.type == 1) {
$("#tablist").tablegrid('Load');
}
$.messageBox5s('提示', data.message);
}, "json");
}
});
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
}
///设置角色权限等级
function SetDengji_Click() {
var row = $('#tablist').tablegrid('getSelected');
if (row != null) {
$("#modalwindow").html(GetIframeHtml("/Base/Role/RoleLevel?rolecode=" + row.CODE + "&Ieguid=" + GetGuid()));
var width = $(window).width()*0.8;
var height = $(window).height()*0.8;
$("#modalwindow").window({ title: row.RNAME + '--权限等级', width: width, height: height, iconCls: 'icon-edit' }).window('open');
} else { $.messageBox5s('提示', '@Suggestion.PlaseChooseToOperatingRecords'); }
}
</script>