asp.mvc + easyui 动态列
废话不多说,直接上代码:
@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 动态列的更多相关文章
- easyui 动态列
$.post('${createLink(action:"build Columns url ")}', params, function(data){ var columns = ...
- MVC+EasyUI 菜单导航的实现
一个简单的使用mvc+easyUi 动态菜单显示 直接上代码 前端 function initMenu() { $.get("/Admin/Home/GetNav", functi ...
- Easy DataGrid 实现动态列、行
Easy DataGrid 实现动态列.行 前端代码: <title>展示销售的实时数据</title> <script type="text/javascri ...
- ASP.NET MVC+EasyUI+Entity FrameWork 整合开发
本文详细讲解怎么用ASP.NET MVC+EasyUI+Entity FrameWork 来开发一个项目 对于ASP.NET MVC的Jscript库,主要引用 <script type=.mi ...
- ASP.NET MVC +EasyUI 权限设计(二)环境搭建
请注明转载地址:http://www.cnblogs.com/arhat 今天突然发现博客园出问题了,老魏使用了PC,手机,平板都访问博客园了,都是不能正常的访问,原因是不能加载CSS,也就是不能访问 ...
- ASP.NET MVC +EasyUI 权限设计(一)开篇
在前一段时间中,老魏的确非常的忙碌,Blog基本上没有更新了,非常的抱歉,那么在后面的时间中,老魏会尽量的抽时间来写的,可能时间上就不太富裕了.今天开始呢,老魏会和大家分享一下关于权限设计的有关文章, ...
- [ASP.NET MVC] 利用动态注入HTML的方式来设计复杂页面
原文:[ASP.NET MVC] 利用动态注入HTML的方式来设计复杂页面 随着最终用户对用户体验需求的不断提高,实际上我们很多情况下已经在按照桌面应用的标准来设计Web应用,甚至很多Web页面本身就 ...
- 对Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架的个人认识
对Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架的个人认识 初次接触Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架,查阅了相 ...
- Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架
Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架 初次接触Spring.Net+NHibenate+Asp.Net Mvc+Easyui框架,查阅了相关资料,了解了框 ...
随机推荐
- JavaScript权威指南 - 函数
函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...
- HTML骨架结构
前面的话 一个完整的HTML文档必须包含3个部分:文档声明.文档头部和文档主体.而正是它们构成了HTML的骨架结构.前面已经分别介绍过文档声明和文档头部,本文将详细介绍构成HTML骨架结构的基础元 ...
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(64)-补充WebApi与Unity注入-配置文件
系列目录 上一篇演示了WebApi利用Unity注入 很多人问我如何用配置文件来配置注入,本节演示如何利用配置文件来注入,道理是一样的,跳转到上一节下载源码一起来动手! 1.打开源码定位到文件Depe ...
- 设置tomcat远程debug
查看端口占用情况命令: netstat -tunlp |grep 8000 tomcat 启动远程debug: startup.sh 中的最后一行 exec "$PRGDIR"/& ...
- JS继承类相关试题
题目一: //有关于原型继承的代码如下:function Person(name) { this.name = name;}Person.prototype = { getName : f ...
- Div Vertical Menu ver5
这个小功能,如果是算此次,已经是第5次修改了.可以从这里看到前4次:V1, http://www.cnblogs.com/insus/archive/2011/10/17/2215637.html V ...
- linux系统oracle-ora12505问题解决方案一
说明:(1)Linux版本 Linux version 2.6.32.12-0.7-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-bran ...
- Oracle 11g必须开启的服务及服务详细介绍
转自:http://www.educity.cn/shujuku/404120.html 成功安装Oracle 11g数据库后,你会发现自己电脑运行速度会变慢,配置较低的电脑甚至出现非常卡的状况,通 ...
- 用SecureCRT连接虚拟机中的Linux系统(Ubuntu)
今天突然练习linux命令行的时候,想在window中联系linux命令行.经过一番dudu找到了一个不错的的工具(SecureCRT--意思安全)就是用SSH链接linux主机.推荐大家使用.毕竟w ...
- 了解 ARDUINO 101* 平台
原文链接 简介 作为一名物联网 (IoT) 开发人员,您需要根据项目的不同需求,选择最适合的平台来构建应用. 了解不同平台的功能至关重要. 本文第一部分比较了 Arduino 101 平台和 Ardu ...