废话不多说,直接上代码:

@model Huacisoft.Model.Crm_Sys_Role
@{
Layout = null; } <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色管理</title>
<!--前后台公用样式开始-->
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Themes/Default/Common.css")" />
<!--前后台公用样式结束--> <!--后台样式开始-->
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Themes/Default/Admin.css")" />
<!--后台样式结束--> <!--EasyUI引用开始-->
<link rel="stylesheet" type="text/css" href="@Url.Content("~/js/jquery-easyui-1.3.5/themes/default/easyui.css")" />
<link rel="stylesheet" type="text/css" href="@Url.Content("~/js/jquery-easyui-1.3.5/themes/icon.css")" />
<script type="text/javascript" src="@Url.Content("~/js/jquery-1.8.0.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/js/jquery-easyui-1.3.5/jquery.easyui.min.js")"></script>
<script type="text/javascript" src='@Url.Content("~/Js/jquery-easyui-1.3.5/locale/easyui-lang-" + ViewBag.Language + ".js")'></script>
<!--EasyUI引用结束--> <!--前后台公用脚本封装开始-->
<script type="text/javascript" src="@Url.Content("~/js/common.js")"></script>
<script type="text/javascript" src="@Url.Content("~/js/dialog.js")"></script>
<!--前后台公用脚本封装结束--> <style type="text/css">
.ItemTitle{background-image:url(../images/rolesBg.png);height:26px; padding-left:10px; line-height:26px; vertical-align:middle; font-weight:bold;}
.ItemTitle input{ position: absolute; margin-top: 6px;*margin-top: -3px;}
.ItemList{margin-top:10px; margin-bottom:15px;}
.ItemList input{ margin-left:10px;}
.theName{float:left; margin-top:-1px;*margin-top: 3px; padding-left:3px; padding-bottom:8px; } </style> <script type="text/javascript">
function FormatData(value) {//value, row, index
//-1:不显示checkbox 0:没有该方法 1:没有该方法权限 2:有该方法权限 style='margin-left: 30%;'
var newData = "";
// if (data == -1) {
// newData = ' '
// }
if (value.split(',')[0] == "-1") {
newData = "<div >" + '<input title="该模块暂无此方法,请去模块管理页面核对!" id="' +value.split(',')[1] + '" type="checkbox" disabled="disabled" />' + "</div>"
}
if (value.split(',')[0] == "0") {
newData = "<div >" + '<input id="' + value.split(',')[1] + '" type="checkbox" />' + "</div>"
}
if (value.split(',')[0] =="1") {
newData = "<div >" + '<input id="' + value.split(',')[1] + '" type="checkbox" checked="checked" />' + "</div>"
} return newData;
}
$(function () {
var cols = new Array(); var col1 = {};
col1["field"] = "Module_Id";
col1["title"] = "模块";
col1["width"] = 130;
col1["hidden"] = true;
cols.push(col1); var col2 = {};
col2["field"] = "Module_Name";
col2["title"] = "模块";
col2["width"] = 60;
col2["align"] = "left";
cols.push(col2); $.ajax({
url: '@Url.Action("LoadFunctionTitle", "System")',
async: false,
type: "POST",
dataType: 'json',
success: function (json) {
var rows = json.rows;
for (var i = 0; i < rows.length; i++) {
var col = {};
col["field"] = rows[i].Function_EnglishName;
col["title"] = rows[i].Funtion_Name;
col["width"] = 30;
col["align"] = "center";
col["formatter"] = function (value,row) {return FormatData(value);};
cols.push(col);
//"{ field: '" + rows.Function_EnglishName + "', title: '" + rows[i].Funtion_Name + "', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) {return FormatData(value);}}";
}
},
error: function (a, b, c) {
$.messager.alert("@ViewBag.SystemInfo", "@ViewBag.Fail", 'warning');
}
}); $('#DomainTable').treegrid({
url: '@Url.Action("LoadModuleForRole", "System")' + "?roleId=@ViewBag.RoleId",
iconCls: 'icon-ok',
width: "90%",
height: 650,
rownumbers: false,
nowrap: false,
animate: true,
fitColumns: true,
idField: 'Module_Id',
treeField: 'Module_Name',
pagination: true,
rowStyler: function (row) {
if (row.persons > 1) {
return 'background:#AAD684;color:#fff';
}
},
singleSelect: true,
//frozenColumns: [[{ field: 'ck', checkbox: true}]],
// frozenColumns: [[{ field: 'ck', width: 40, formatter: function (value, row, index) {
// return '<input type="radio" name="rd_action" />';
// }
// }]],
//queryParams: getQueryParams("search_go"),
columns: [cols],
// columns: [[
// { field: 'Module_Id', title: 'Module_Id', width: 60, sortable: true, hidden: true },
// { field: 'Module_Name', title: '@ViewBag.ModuleName', width: 60, sortable: true },
// { field: 'Search', title: '@ViewBag.Search', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Create', title: '@ViewBag.Add', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) {
// //alert(FormatData(data));
// return FormatData(value);
// }
// },
// { field: 'Edit', title: '@ViewBag.Edit', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Delete', title: '@ViewBag.Delete', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Import', title: '@ViewBag.Import', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Export', title: '@ViewBag.Export', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Sync', title: '@ViewBag.Sync', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) { // return FormatData(value);
// }
// },
// { field: 'Print', title: '@ViewBag.Print', width: 30, align: 'center', editor: 'text', sortable: true, formatter: function (value, row, index) {
// return FormatData(value);
// }
// }
// ]],
onBeforeLoad: function (row, param) {
//移除头部批量勾选框
$(".datagrid-header-check input").css("visibility", "hidden");
//隐藏分页
$(".datagrid-pager").css("display", "none");
//$(".datagrid-pager").removeClass("datagrid-pager");
return true;
},
onBeforeExpand: function (row) {
if (row != null) {
//动态设置展开查询的url
var url = '@Url.Action("LoadRole", "Role")' + "?roleId=" + row.Role_Id;
$("#DomainTable").treegrid("options").url = url;
}
return true;
},
onLoadSuccess: function (row, data) {
if (data.rows.length == 0) {
$(".datagrid-view2 .datagrid-body").html("<div class='divNodataHeigth'>@ViewBag.NoData</div>");
}
}, onClickRow: function (row) {
$("input[name=rd_action]", $("div.datagrid-view1 tr.datagrid-row-selected")).attr("checked", "checked");
} }); });
</script>
<script type="text/javascript">
$(function () {
$("#Cancel").click(function(){
window.location.href='@Url.Content("Index")';
});
$("#Save").click(function () {
var itemList = new Array();
$("#configDiv > div").find("input[type='checkbox']").each(function () {
if ($(this).attr("checked")) {
itemList.push($(this).attr("id"));
}
}) var itemAll = itemList.join(",");
// alert(itemAll);
$.ajax({
url: '@Url.Content("~/Role/Save")',
async: false,
type: "POST",
dataType: 'text',
data: { roleId: "@ViewBag.RoleId", funList: itemAll },
success: function (msg) {
if (msg == "True") {
$.messager.alert("@ViewBag.SystemInfo", "@ViewBag.Success", 'warning');
window.location.href="@Url.Content("~/Role/Index")";
}
else {
$.messager.alert("@ViewBag.SystemInfo", "@ViewBag.Fail", 'warning');
}
},
error: function (msg) {
$.messager.alert("@ViewBag.SystemInfo", "@ViewBag.Fail", 'warning');
}
});
});
})
</script> </head>
<body> <div class=""> <!--wrap class="header" div end --> <h3 class="h3Box"><span></span>权限配置</h3>
@Html.TextBoxFor(m => m.Role_Id, new { style = "display:none" })
<div class="">
<div id="data" style="margin-top:10px;">
<div id="configDiv">
<table id="DomainTable">
</table> </div>
<div>@ViewBag.CustomFieldTip</div>
</div> <div class="ct" style=" text-align:center">
<div class="btnCenterBoxes">
<div class="classdetail_btn_box0101" id="divSubmit">
<span class="classdetail_btn_box0102" id="Save">@ViewBag.Save</span>
</div>
</div>
<div class="btnCenterBoxes">
<div class="classdetail_btn_box0101" id="divCancel">
<span class="classdetail_btn_box0102" id="Cancel">@ViewBag.Back</span>
</div>
</div>
@*<span id="Save" class="btnSpan btnBlue01 colorTextBlue btnText2">@ViewBag.Save</span> <a class="btnSpan btnBlue01 colorTextBlue btnText2" href="@Url.Content("Index")"><span id="Cancel" >@ViewBag.Back</span></a>*@ </div> </div>
</div>
<div id="divProcess" style=" display:none">
<div class="" style="position:absolute;width:100%;height:2040px;background:#b8b8b8;top:0;bottom:0;right:0;left:0; opacity: 0.5;filter:alpha(opacity=50)" >
</div>
<div class="iconMsg" style="position:absolute;top:1000px;left:44%;z-index:9999;line-height:30px;">
<p>@ViewBag.Submit...</p>
</div>
</div>
</body> </html>

asp.mvc + easyui 动态列的更多相关文章

  1. easyui 动态列

    $.post('${createLink(action:"build Columns url ")}', params, function(data){ var columns = ...

  2. MVC+EasyUI 菜单导航的实现

    一个简单的使用mvc+easyUi 动态菜单显示 直接上代码 前端 function initMenu() { $.get("/Admin/Home/GetNav", functi ...

  3. Easy DataGrid 实现动态列、行

    Easy DataGrid 实现动态列.行 前端代码: <title>展示销售的实时数据</title> <script type="text/javascri ...

  4. ASP.NET MVC+EasyUI+Entity FrameWork 整合开发

    本文详细讲解怎么用ASP.NET MVC+EasyUI+Entity FrameWork 来开发一个项目 对于ASP.NET MVC的Jscript库,主要引用 <script type=.mi ...

  5. ASP.NET MVC +EasyUI 权限设计(二)环境搭建

    请注明转载地址:http://www.cnblogs.com/arhat 今天突然发现博客园出问题了,老魏使用了PC,手机,平板都访问博客园了,都是不能正常的访问,原因是不能加载CSS,也就是不能访问 ...

  6. ASP.NET MVC +EasyUI 权限设计(一)开篇

    在前一段时间中,老魏的确非常的忙碌,Blog基本上没有更新了,非常的抱歉,那么在后面的时间中,老魏会尽量的抽时间来写的,可能时间上就不太富裕了.今天开始呢,老魏会和大家分享一下关于权限设计的有关文章, ...

  7. [ASP.NET MVC] 利用动态注入HTML的方式来设计复杂页面

    原文:[ASP.NET MVC] 利用动态注入HTML的方式来设计复杂页面 随着最终用户对用户体验需求的不断提高,实际上我们很多情况下已经在按照桌面应用的标准来设计Web应用,甚至很多Web页面本身就 ...

  8. 对Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架的个人认识

    对Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架的个人认识   初次接触Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架,查阅了相 ...

  9. Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架

    Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架 初次接触Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架,查阅了相关资料,了解了框 ...

随机推荐

  1. 常用 Gulp 插件汇总 —— 基于 Gulp 的前端集成解决方案(三)

    前两篇文章讨论了 Gulp 的安装部署及基本概念,借助于 Gulp 强大的 插件生态 可以完成很多常见的和不常见的任务.本文主要汇总常用的 Gulp 插件及其基本使用,需要读者对 Gulp 有一个基本 ...

  2. FFmpeg学习6:视音频同步

    在上一篇文章中,视频和音频是各自独立播放的,并不同步.本文主要描述了如何以音频的播放时长为基准,将视频同步到音频上以实现视音频的同步播放的.主要有以下几个方面的内容 视音频同步的简单介绍 DTS 和 ...

  3. setAttribute()

    ●节点分为不同的类型:元素节点.属性节点和文本节点等.   ●getElementById()方法将返回一个对象,该对象对应着文档里的一个特定的元素节点.   ●getElementsByTagNam ...

  4. HTML 获取屏幕、浏览器、页面的高度宽度

    本篇主要介绍Web环境中屏幕.浏览器及页面的高度.宽度信息. 目录 1. 介绍:介绍页面的容器(屏幕.浏览器及页面).物理尺寸与分辨率.展示等内容. 2. 屏幕信息:介绍屏幕尺寸信息:如:屏幕.软件可 ...

  5. warensoft unity3d 更新说明

    warensoft unity3d 组件的Alpha版本已经发布了将近一年,很多网友发送了改进的Email,感谢大家的支持. Warensoft Unity3D组件将继续更新,将改进的功能如下: 1. ...

  6. IE8/9 本地预览上传图片

    本地预览的意思是,在选择图片之后先不上传到服务器,而是由一个<img>标签来预览本地的图片,非 IE8/9 浏览器可以从<input type="file"/&g ...

  7. Kooboo CMS技术文档之三:切换数据存储方式

    切换数据存储方式包括以下几种: 将文本内容存储在SqlServer.MySQL.MongoDB等数据库中 将站点配置信息存储在数据库中 将后台用户信息存储在数据库中 将会员信息存储在数据库中 将图片. ...

  8. ASP.NET MVC一次删除多笔记录

    批量删除数据记录,如下面的截屏: 先选中想删除的记录,然后点一下删除铵钮,系统将把选中的记录一次性删除.在此,Insus.NET不想每删除一笔记录连接一次数据库. 因此需要把选择的记录一次上传至服务器 ...

  9. 分页插件--根据Bootstrap Paginator改写的js插件

    刚刚出来实习,之前实习的公司有一个分页插件,和后端的数据字典约定好了的,基本上是看不到内部是怎么实现的,新公司是做WPF的,好像对于ASP.NET的东西不多,导师扔了一个小系统给我和另一个同事,指了两 ...

  10. 在 Windows7 上按照 MySQL5.7

    在 Windows7 上按照 MySQL5.7 1.从官网下载最新版本的 MySQL,这里下载的是 mysql-5.7.17-win32: 2.将下载的 mysql-5.7.17-win32.zip ...